use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIds in project netvirt by opendaylight.
the class CoeUtils method getAttachedInterfaceAndMac.
public static Pair<String, String> getAttachedInterfaceAndMac(OvsdbTerminationPointAugmentation ovsdbTp) {
String interfaceName = null;
String macAddress = null;
if (ovsdbTp != null) {
List<InterfaceExternalIds> ifaceExtIds = ovsdbTp.getInterfaceExternalIds();
if (ifaceExtIds != null) {
Iterator var2 = ifaceExtIds.iterator();
while (var2.hasNext()) {
if (interfaceName != null && macAddress != null) {
break;
}
InterfaceExternalIds entry = (InterfaceExternalIds) var2.next();
if (entry.getExternalIdKey().equals("iface-id")) {
interfaceName = entry.getExternalIdValue();
continue;
}
if (entry.getExternalIdKey().equals("attached-mac")) {
macAddress = entry.getExternalIdValue();
continue;
}
}
}
}
return Pair.of(interfaceName, macAddress);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIds in project genius by opendaylight.
the class OvsdbSouthboundTestUtil method createTerminationPoint.
public static void createTerminationPoint(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceTypeBase> type, String externalId) throws TransactionCommitFailedException {
final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
InstanceIdentifier<TerminationPoint> tpId = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), interfaceName);
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setKey(InstanceIdentifier.keyOf(tpId));
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
tpAugmentationBuilder.setName(interfaceName);
if (type != null) {
tpAugmentationBuilder.setInterfaceType(type);
}
if (externalId != null) {
List<InterfaceExternalIds> interfaceExternalIds = new ArrayList<>();
InterfaceExternalIds interfaceExternalIds1 = new InterfaceExternalIdsBuilder().setExternalIdKey("iface-id").setExternalIdValue(externalId).build();
interfaceExternalIds.add(interfaceExternalIds1);
tpAugmentationBuilder.setInterfaceExternalIds(interfaceExternalIds);
}
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.put(OPERATIONAL, tpId, tpBuilder.build(), true);
tx.submit().checkedGet();
}
Aggregations