Search in sources :

Example 6 with InterfaceType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType in project genius by opendaylight.

the class InterfaceManagerTestUtil method removeFlowCapableNodeConnectorState.

static void removeFlowCapableNodeConnectorState(DataBroker dataBroker, Class<? extends InterfaceType> ifType) throws TransactionCommitFailedException {
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    BigInteger dpnId = Tunnel.class.equals(ifType) ? DPN_ID_2 : DPN_ID_1;
    long portNo = Tunnel.class.equals(ifType) ? PORT_NO_1 : PORT_NO_1;
    tx.delete(OPERATIONAL, buildNodeConnectorInstanceIdentifier(dpnId, portNo));
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel) BigInteger(java.math.BigInteger)

Example 7 with InterfaceType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType in project genius by opendaylight.

the class InterfaceManagerTestUtil method putInterfaceConfig.

static void putInterfaceConfig(DataBroker dataBroker, String ifaceName, ParentRefs parentRefs, Class<? extends InterfaceType> ifType) throws TransactionCommitFailedException {
    Interface interfaceInfo;
    if (!Tunnel.class.equals(ifType)) {
        interfaceInfo = InterfaceManagerTestUtil.buildInterface(ifaceName, ifaceName, true, ifType, parentRefs.getParentInterface(), IfL2vlan.L2vlanMode.Trunk);
    } else {
        interfaceInfo = buildTunnelInterface(parentRefs.getDatapathNodeIdentifier(), ifaceName, ifaceName, true, TunnelTypeVxlan.class, "1.1.1.1", "2.2.2.2");
    }
    InstanceIdentifier<Interface> interfaceInstanceIdentifier = IfmUtil.buildId(ifaceName);
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(CONFIGURATION, interfaceInstanceIdentifier, interfaceInfo, true);
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 8 with InterfaceType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType in project genius by opendaylight.

the class InterfaceManagerTestUtil method buildInterface.

static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
    InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
    ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
    builder.addAugmentation(ParentRefs.class, parentRefs);
    if (ifType.equals(L2vlan.class)) {
        IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
        if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
            ifL2vlanBuilder.setVlanId(new VlanId(100));
        } else {
            ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
        }
        builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
    } else if (ifType.equals(IfTunnel.class)) {
        IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
        builder.addAugmentation(IfTunnel.class, tunnel);
    }
    return builder.build();
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) IfTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder) IfL2vlanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) ParentRefsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder)

Example 9 with InterfaceType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType in project genius by opendaylight.

the class InterfaceManagerCommonUtils method createOrUpdateDpnToInterface.

public void createOrUpdateDpnToInterface(BigInteger dpId, String infName, Class<? extends InterfaceType> interfaceType) {
    DpnToInterfaceKey dpnToInterfaceKey = new DpnToInterfaceKey(dpId);
    InterfaceNameEntryKey interfaceNameEntryKey = new InterfaceNameEntryKey(infName);
    InstanceIdentifier<InterfaceNameEntry> intfid = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).child(InterfaceNameEntry.class, interfaceNameEntryKey).build();
    InterfaceNameEntryBuilder entryBuilder = new InterfaceNameEntryBuilder().setKey(interfaceNameEntryKey).setInterfaceName(infName);
    if (interfaceType != null) {
        entryBuilder.setInterfaceType(interfaceType);
    }
    batchingUtils.write(intfid, entryBuilder.build(), BatchingUtils.EntityType.DEFAULT_OPERATIONAL);
}
Also used : InterfaceNameEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntry) InterfaceNameEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey) InterfaceNameEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryBuilder) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) DpnToInterfaceList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.DpnToInterfaceList)

Example 10 with InterfaceType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType in project netvirt by opendaylight.

the class EtreeInterfaceAdd method doExecute.

@Override
protected Object doExecute() {
    EtreeInterfaceType inputType = null;
    for (EtreeInterfaceType type : EtreeInterfaceType.values()) {
        if (interfaceType.equals(type.getName())) {
            inputType = type;
            break;
        }
    }
    if (inputType == null) {
        session.getConsole().println("interfaceType must be one of: leaf/root, but was: " + interfaceType);
        return null;
    }
    ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
    if (elanInstance == null) {
        session.getConsole().println("Etree instance " + elanName + " does not exist.");
        return null;
    } else {
        if (elanInstance.getAugmentation(EtreeInstance.class) == null) {
            session.getConsole().println("Etree instance " + elanName + " exists but isn't configured as Etree.");
            return null;
        }
    }
    LOG.debug("Executing create EtreeInterface command elanName:{}, interfaceName:{}, interfaceType:{}," + "staticMacAddresses:{}, elanInterfaceDescr:{}", elanName, interfaceName, interfaceType, staticMacAddresses, elanInterfaceDescr);
    elanProvider.addEtreeInterface(elanName, interfaceName, inputType, staticMacAddresses, elanInterfaceDescr);
    session.getConsole().println("Created etree interface successfully");
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EtreeInterfaceType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface.EtreeInterfaceType) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)

Aggregations

BigInteger (java.math.BigInteger)8 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)6 Tunnel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel)5 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)5 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)5 ArrayList (java.util.ArrayList)4 Collections (java.util.Collections)4 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)4 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)4 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)4 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)3 DpnToInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey)3 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)3 InterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder)2 AdminStatus (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus)2 OperStatus (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus)2 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)2 DpnToInterfaceList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.DpnToInterfaceList)2 InterfaceNameEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntry)2 InterfaceNameEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryBuilder)2