Search in sources :

Example 6 with L2vlanMode

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan.L2vlanMode in project netvirt by opendaylight.

the class CoeUtils method buildInterface.

static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface buildInterface(String interfaceName) {
    IfL2vlan.L2vlanMode l2VlanMode = IfL2vlan.L2vlanMode.Trunk;
    InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
    IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder();
    ifL2vlanBuilder.setL2vlanMode(l2VlanMode);
    interfaceBuilder.setEnabled(true).setName(interfaceName).setType(L2vlan.class).addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
    return interfaceBuilder.build();
}
Also used : IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan) L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) VpnInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterfaceBuilder) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) IfL2vlanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 7 with L2vlanMode

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan.L2vlanMode in project genius by opendaylight.

the class InterfaceManagerCommonUtils method createInterfaceChildEntryIfNotPresent.

// For trunk interfaces, binding to a parent interface which is already
// bound to another trunk interface should not
// be allowed
public boolean createInterfaceChildEntryIfNotPresent(WriteTransaction tx, String parentInterface, String childInterface, IfL2vlan.L2vlanMode l2vlanMode) {
    InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentInterface);
    InstanceIdentifier<InterfaceParentEntry> interfaceParentEntryIdentifier = InterfaceMetaUtils.getInterfaceParentEntryIdentifier(interfaceParentEntryKey);
    InterfaceParentEntry interfaceParentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceParentEntryIdentifier);
    if (interfaceParentEntry != null) {
        List<InterfaceChildEntry> interfaceChildEntries = interfaceParentEntry.getInterfaceChildEntry();
        if (interfaceChildEntries != null) {
            for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
                String curChildInterface = interfaceChildEntry.getChildInterface();
                if (childInterface.equals(curChildInterface)) {
                    LOG.trace("Child entry for interface {} already exists", childInterface);
                    return false;
                }
                Interface iface = getInterfaceFromConfigDS(curChildInterface);
                if (l2vlanMode == IfL2vlan.L2vlanMode.Trunk && isTrunkInterface(iface)) {
                    LOG.error("Trying to bind child interface {} of type Trunk to parent interface {}," + "but it is already bound to a trunk interface {}", childInterface, parentInterface, curChildInterface);
                    return false;
                }
            }
        }
    }
    LOG.info("Creating child interface {} of type {} bound on parent-interface {}", childInterface, l2vlanMode, parentInterface);
    createInterfaceChildEntry(parentInterface, childInterface, tx);
    return true;
}
Also used : InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) InterfaceParentEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)

Aggregations

InterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder)4 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)4 IfL2vlanBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder)4 L2vlan (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan)3 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)3 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)3 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)2 ParentRefsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder)2 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)2 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 InterfaceAlreadyExistsException (org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException)1 VlanInterfaceInfo (org.opendaylight.genius.interfacemanager.globals.VlanInterfaceInfo)1 VpnInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterfaceBuilder)1 InterfaceParentEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry)1 InterfaceParentEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey)1 InterfaceChildEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry)1 DpnToInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)1 IfExternalBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfExternalBuilder)1 L2vlanMode (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan.L2vlanMode)1