String nodeString = client.getNodeKey().getNodeId().getValue() + "/logicalswitch/" + lSwitch.getName();
NodeId nodeId = new NodeId(new Uri(nodeString));
NodeKey nodeKey = new NodeKey(nodeId);
- iid =InstanceIdentifier.builder(NetworkTopology.class)
+ return InstanceIdentifier.builder(NetworkTopology.class)
.child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID))
.child(Node.class, nodeKey).build();
- return iid;
}
+ public static Class<? extends EncapsulationTypeBase> createEncapsulationType(String type) {
+ Preconditions.checkNotNull(type);
+ if (type.isEmpty()) {
+ return EncapsulationTypeVxlanOverIpv4.class;
+ } else {
+ ImmutableBiMap<String, Class<? extends EncapsulationTypeBase>> mapper =
+ HwvtepSouthboundConstants.ENCAPS_TYPE_MAP.inverse();
+ return mapper.get(type);
+ }
+ }
+
+ public static InstanceIdentifier<TerminationPoint> createInstanceIdentifier(InstanceIdentifier<Node> nodeIid,
+ PhysicalLocator physicalLocator) {
+ return nodeIid.child(TerminationPoint.class, getTerminationPointKey(physicalLocator));
+ }
+
+ public static TerminationPointKey getTerminationPointKey(PhysicalLocator pLoc) {
+ TerminationPointKey tpKey = null;
+ if(pLoc.getEncapsulationTypeColumn().getData() != null &&
+ pLoc.getDstIpColumn().getData() != null) {
+ String tpKeyStr = pLoc.getEncapsulationTypeColumn().getData()+':'+pLoc.getDstIpColumn().getData();
+ tpKey = new TerminationPointKey(new TpId(tpKeyStr));
+ }
+ return tpKey;
+ }
+
}