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();
}
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();
}
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();
}
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);
}
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;
}
Aggregations