Search in sources :

Example 1 with VlanInterfaceInfo

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;
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) VlanInterfaceInfo(org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo) L2vlanMode(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan.L2vlanMode) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Aggregations

VlanInterfaceInfo (org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo)1 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)1 L2vlanMode (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan.L2vlanMode)1 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)1