use of org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo in project genius by opendaylight.
the class IfmUtil method getVlanInterfaceInfo.
public static VlanInterfaceInfo getVlanInterfaceInfo(Interface iface, BigInteger dpId) {
short vlanId = 0;
String portName = null;
IfL2vlan vlanIface = iface.getAugmentation(IfL2vlan.class);
ParentRefs parentRefs = iface.getAugmentation(ParentRefs.class);
if (parentRefs != null && parentRefs.getParentInterface() != null) {
portName = parentRefs.getParentInterface();
} else {
LOG.warn("Portname set to null since parentRef is Null");
}
VlanInterfaceInfo vlanInterfaceInfo = new VlanInterfaceInfo(dpId, portName, vlanId);
if (vlanIface != null) {
vlanId = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
L2vlanMode l2VlanMode = vlanIface.getL2vlanMode();
if (l2VlanMode == L2vlanMode.Transparent) {
vlanInterfaceInfo.setVlanTransparent(true);
}
if (l2VlanMode == L2vlanMode.NativeUntagged) {
vlanInterfaceInfo.setUntaggedVlan(true);
}
vlanInterfaceInfo.setVlanId(vlanId);
}
return vlanInterfaceInfo;
}
Aggregations