use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey in project netvirt by opendaylight.
the class HwvtepHAUtil method convertLocatorRef.
/**
* Trnaform locator reference to nodepath passed .
*
* @param src {@link HwvtepPhysicalLocatorRef} Logical Switch Ref which needs to be transformed
* @param nodePath {@link InstanceIdentifier} src needs to be transformed to this path
* @return physicalLocatorRef {@link HwvtepPhysicalLocatorRef} the transforrmed result
*/
public static HwvtepPhysicalLocatorRef convertLocatorRef(HwvtepPhysicalLocatorRef src, InstanceIdentifier<Node> nodePath) {
InstanceIdentifier<TerminationPoint> srcTepPath = (InstanceIdentifier<TerminationPoint>) src.getValue();
TpId tpId = srcTepPath.firstKeyOf(TerminationPoint.class).getTpId();
InstanceIdentifier<TerminationPoint> tpPath = nodePath.child(TerminationPoint.class, new TerminationPointKey(tpId));
HwvtepPhysicalLocatorRef physicalLocatorRef = new HwvtepPhysicalLocatorRef(tpPath);
return physicalLocatorRef;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey in project netvirt by opendaylight.
the class TestBuilders method buildTerminationPoint.
public static TerminationPoint buildTerminationPoint(InstanceIdentifier<Node> nodeIid, String ip) {
TerminationPointKey tpKey = new TerminationPointKey(new TpId("vxlan_over_ipv4:" + ip));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
if (nodeIid != null && tpKey != null) {
tpBuilder.setKey(tpKey);
tpBuilder.setTpId(tpKey.getTpId());
InstanceIdentifier<TerminationPoint> tpPath = buildTpId(nodeIid, ip);
HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalLocatorAugmentationBuilder();
tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
}
return tpBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey in project netvirt by opendaylight.
the class TestComparators method assertTerminationPoint.
public static void assertTerminationPoint(List<String> terminationPointNames, InstanceIdentifier<Node> d1ps, InstanceIdentifier<Node> haPsa, ReadWriteTransaction readWriteTransaction, Node nodeD, Node nodeHa) throws ReadFailedException {
for (String portName : terminationPointNames) {
InstanceIdentifier<TerminationPoint> tpPathd = d1ps.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
TerminationPoint tpNoded = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathd).checkedGet().get();
HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationD = tpNoded.getAugmentation(HwvtepPhysicalPortAugmentation.class);
InstanceIdentifier<TerminationPoint> tpPathha = haPsa.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
TerminationPoint tpNodeha = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathha).checkedGet().get();
HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationHa = tpNodeha.getAugmentation(HwvtepPhysicalPortAugmentation.class);
assertEquals("Termination point hwvtep-node-name should be same", hwvtepPhysicalPortAugmentationD.getHwvtepNodeName(), hwvtepPhysicalPortAugmentationHa.getHwvtepNodeName());
List<VlanBindings> vlanBindingsesD = hwvtepPhysicalPortAugmentationD.getVlanBindings();
List<VlanBindings> vlanBindingsesHa = hwvtepPhysicalPortAugmentationHa.getVlanBindings();
assertEquals("Size of VlanBindings should be same", vlanBindingsesD.size(), vlanBindingsesHa.size());
List<Integer> vlanKeysD = new ArrayList<>();
List<Integer> vlanKeysHa = new ArrayList<>();
String logicalSwitchRefD = new String();
String logicalSwitchRefHa = new String();
List<String> logicalSwitchNameD = new ArrayList<>();
List<String> logicalSwitchNameHa = new ArrayList<>();
if (vlanBindingsesD.size() == vlanBindingsesHa.size()) {
for (int i = 0; i < vlanBindingsesD.size(); i++) {
vlanKeysD.add(vlanBindingsesD.get(i).getVlanIdKey().getValue());
logicalSwitchRefD = vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
logicalSwitchNameD.add(vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
vlanKeysHa.add(vlanBindingsesHa.get(i).getVlanIdKey().getValue());
logicalSwitchRefHa = vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
logicalSwitchNameHa.add(vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
}
assertTrue(vlanKeysD.containsAll(vlanKeysHa));
assertTrue(logicalSwitchRefD.equals(nodeD.getNodeId().getValue()));
assertTrue(logicalSwitchRefHa.equals(nodeHa.getNodeId().getValue()));
assertTrue(logicalSwitchNameD.containsAll(logicalSwitchNameHa));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method createRemoteMcastMac.
public RemoteMcastMacs createRemoteMcastMac(Node dstDevice, String logicalSwitchName, IpAddress internalTunnelIp) {
Set<LocatorSet> locators = new HashSet<>();
TerminationPointKey terminationPointKey = HwvtepSouthboundUtils.getTerminationPointKey(internalTunnelIp.getIpv4Address().getValue());
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(HwvtepSouthboundUtils.createInstanceIdentifier(dstDevice.getNodeId()).child(TerminationPoint.class, terminationPointKey));
locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(HwvtepSouthboundUtils.createLogicalSwitchesInstanceIdentifier(dstDevice.getNodeId(), new HwvtepNodeName(logicalSwitchName)));
RemoteMcastMacs remoteMcastMacs = new RemoteMcastMacsBuilder().setMacEntryKey(new MacAddress(UNKNOWN_DMAC)).setLogicalSwitchRef(lsRef).build();
InstanceIdentifier<RemoteMcastMacs> iid = HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(dstDevice.getNodeId(), remoteMcastMacs.getKey());
ReadOnlyTransaction transaction = broker.newReadOnlyTransaction();
try {
// TODO do async mdsal read
remoteMcastMacs = transaction.read(LogicalDatastoreType.CONFIGURATION, iid).checkedGet().get();
locators.addAll(remoteMcastMacs.getLocatorSet());
return new RemoteMcastMacsBuilder(remoteMcastMacs).setLocatorSet(new ArrayList<>(locators)).build();
} catch (ReadFailedException e) {
LOG.error("Failed to read the macs {}", iid);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey in project bgpcep by opendaylight.
the class LinkstateTopologyBuilder method buildTp.
private static TerminationPoint buildTp(final TpId id, final TerminationPointType type) {
final TerminationPointBuilder stpb = new TerminationPointBuilder();
stpb.setKey(new TerminationPointKey(id));
stpb.setTpId(id);
if (type != null) {
stpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(type).build()).build());
}
return stpb.build();
}
Aggregations