Merge "Inline return values"
authorSam Hague <shague@redhat.com>
Mon, 30 Nov 2015 16:29:50 +0000 (16:29 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 30 Nov 2015 16:29:50 +0000 (16:29 +0000)
1  2 
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java

index 7aff3e4a437429c945d2343da0fada1d2a72c54c,31f2aa2847e2b301208e850822df2d95951b8bd2..a5a819c3d30001adde739a94b5f052dd1c5f4587
@@@ -160,37 -146,9 +155,35 @@@ public class HwvtepSouthboundMapper 
          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;
 +    }
 +
  }