Revert "Use single-argument form of firstKeyOf()" 07/27007/1
authorAnil Vishnoi <vishnoianil@gmail.com>
Tue, 15 Sep 2015 22:58:34 +0000 (22:58 +0000)
committerAnil Vishnoi <vishnoianil@gmail.com>
Tue, 15 Sep 2015 22:58:34 +0000 (22:58 +0000)
This reverts commit e19e4e3f10f65054aba16a94c082180f24b9beb6.

This is breaking the net-virt code. Bridges are not getting created when OVSDB server connects to the controller. Probably happening because of single argument firstKeyOf() method.

Change-Id: I76ab5f86f7329f741e30fd21eaed436391f793b8
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/arp/ArpSender.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/MdsalHelper.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeOperationalState.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java

index 0ca89b042fca2ac984727b8f087ae409a44a9cb3..bf9ac1a8ed418f0ea2c965e8f3e2849cdb2291f0 100644 (file)
@@ -82,10 +82,11 @@ public class SouthboundMapper {
     }
 
     public static InstanceIdentifier<Node> createInstanceIdentifier(NodeId nodeId) {
-        return InstanceIdentifier
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
                 .create(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
                 .child(Node.class,new NodeKey(nodeId));
+        return nodePath;
     }
 
     public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key,OvsdbBridgeName bridgeName) {
@@ -127,7 +128,8 @@ public class SouthboundMapper {
         String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
                 + new String(ip.getValue()) + ":" + port.getValue();
         Uri uri = new Uri(uriString);
-        return new NodeId(uri);
+        NodeId nodeId = new NodeId(uri);
+        return nodeId;
     }
 
     public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
@@ -152,7 +154,7 @@ public class SouthboundMapper {
     }
 
     public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
-        String datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class);
+        String datapathtype = new String(SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class));
 
         if (mdsalbridge.getDatapathType() != null) {
             if (SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()) != null) {
index dcf94d0a0aec35ba1ef81c01d873b60421b3c5ac..8f72018b3822f8ff6668e5aed85f2e250852789d 100644 (file)
@@ -67,13 +67,14 @@ public class ArpSender {
         checkNotNull(nodeIid);
         // node connector representing all physical ports on node
         NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(createNodeConnectorId(OFPP_ALL,
-                nodeIid.firstKeyOf(Node.class).getId()));
+                nodeIid.firstKeyOf(Node.class, NodeKey.class).getId()));
         InstanceIdentifier<NodeConnector> egressNc = nodeIid.child(NodeConnector.class, nodeConnectorKey);
         return sendArp(senderAddress, tpa, egressNc);
     }
 
     private NodeConnectorId createNodeConnectorId(String connectorId, NodeId nodeId) {
-        return new NodeConnectorId(nodeId.getValue() + ":" + connectorId);
+        StringBuilder stringId = new StringBuilder(nodeId.getValue()).append(":").append(connectorId);
+        return new NodeConnectorId(stringId.toString());
     }
 
     /**
index e2962a116c99b08af8faaa8d1e2fe6235b0d1f54..38b1d5335eaa74ee5be55fd0c8ca326eeac52541 100644 (file)
@@ -96,21 +96,23 @@ public class MdsalHelper {
 
 
     public static NodeId createManagedNodeId(InstanceIdentifier<Node> iid) {
-        NodeKey nodeKey = iid.firstKeyOf(Node.class);
+        NodeKey nodeKey = iid.firstKeyOf(Node.class, NodeKey.class);
         return nodeKey.getNodeId();
     }
 
     public static InstanceIdentifier<Topology> createInstanceIdentifier() {
-        return InstanceIdentifier
+        InstanceIdentifier<Topology> path = InstanceIdentifier
                 .create(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID));
+        return path;
     }
 
     public static InstanceIdentifier<Node> createInstanceIdentifier(NodeId nodeId) {
-        return InstanceIdentifier
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
                 .create(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID))
                 .child(Node.class,new NodeKey(nodeId));
+        return nodePath;
     }
 
     public static InstanceIdentifier<Node> createInstanceIdentifier(NodeKey ovsdbNodeKey, String bridgeName) {
index f24d7087ca84d90d608d891eacf1faebaf8968a9..547ad2642c06230b60491193d71e22fcbcacef5a 100644 (file)
@@ -220,7 +220,7 @@ public class OvsdbConnectionInstance implements OvsdbClient {
     }
 
     public NodeKey getNodeKey() {
-        return getInstanceIdentifier().firstKeyOf(Node.class);
+        return getInstanceIdentifier().firstKeyOf(Node.class, NodeKey.class);
     }
 
     public NodeId getNodeId() {
index 8480b5e1c81fca2bfba0b31f94d91523ea36d3ea..b5252892b9351beb7fbdeeda9b5e6a945162d3c5 100644 (file)
@@ -61,7 +61,7 @@ public class SouthboundMapper {
     private static final Logger LOG = LoggerFactory.getLogger(SouthboundMapper.class);
 
     private static NodeId createNodeId(OvsdbConnectionInstance client) {
-        NodeKey key = client.getInstanceIdentifier().firstKeyOf(Node.class);
+        NodeKey key = client.getInstanceIdentifier().firstKeyOf(Node.class, NodeKey.class);
         return key.getNodeId();
 
     }
@@ -137,7 +137,7 @@ public class SouthboundMapper {
     }
 
     public static NodeId createManagedNodeId(InstanceIdentifier<Node> iid) {
-        NodeKey nodeKey = iid.firstKeyOf(Node.class);
+        NodeKey nodeKey = iid.firstKeyOf(Node.class, NodeKey.class);
         return nodeKey.getNodeId();
     }
 
@@ -210,7 +210,7 @@ public class SouthboundMapper {
     }
 
     public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
-        Set<String> protocols = new HashSet<>();
+        Set<String> protocols = new HashSet<String>();
         if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
             for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
                 if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
@@ -335,7 +335,7 @@ public class SouthboundMapper {
 
     public static Map<UUID, Controller> createOvsdbController(OvsdbBridgeAugmentation omn,DatabaseSchema dbSchema) {
         List<ControllerEntry> controllerEntries = omn.getControllerEntry();
-        Map<UUID,Controller> controllerMap = new HashMap<>();
+        Map<UUID,Controller> controllerMap = new HashMap<UUID,Controller>();
         if (controllerEntries != null && !controllerEntries.isEmpty()) {
             for (ControllerEntry controllerEntry : controllerEntries) {
                 String controllerNamedUUID = "Controller_" + getRandomUUID();
index 8348c99c527ce0bdb780b1a03a8a63667fa19a6f..86e60e9cad4553107af0d4378e57ca3532968879 100644 (file)
@@ -78,7 +78,7 @@ public class BridgeOperationalState {
         if (iid != null) {
             Optional<Node> nodeOptional = getBridgeNode(iid);
             if (nodeOptional.isPresent() && nodeOptional.get().getTerminationPoint() != null) {
-                TerminationPointKey key = iid.firstKeyOf(TerminationPoint.class);
+                TerminationPointKey key = iid.firstKeyOf(TerminationPoint.class, TerminationPointKey.class);
                 if (key != null) {
                     for (TerminationPoint tp:nodeOptional.get().getTerminationPoint()) {
                         if (tp.getKey().equals(key)) {
@@ -103,7 +103,7 @@ public class BridgeOperationalState {
         if (iid != null) {
             Optional<OvsdbBridgeAugmentation> ovsdbBridgeOptional = getOvsdbBridgeAugmentation(iid);
             if (ovsdbBridgeOptional.isPresent() && ovsdbBridgeOptional.get().getControllerEntry() != null) {
-                ControllerEntryKey key = iid.firstKeyOf(ControllerEntry.class);
+                ControllerEntryKey key = iid.firstKeyOf(ControllerEntry.class, ControllerEntryKey.class);
                 if (key != null) {
                     for (ControllerEntry entry: ovsdbBridgeOptional.get().getControllerEntry()) {
                         if (entry.getKey().equals(key)) {
@@ -120,7 +120,7 @@ public class BridgeOperationalState {
         if (iid != null) {
             Optional<OvsdbBridgeAugmentation> ovsdbBridgeOptional = getOvsdbBridgeAugmentation(iid);
             if (ovsdbBridgeOptional.isPresent() && ovsdbBridgeOptional.get().getProtocolEntry() != null) {
-                ProtocolEntryKey key = iid.firstKeyOf(ProtocolEntry.class);
+                ProtocolEntryKey key = iid.firstKeyOf(ProtocolEntry.class, ProtocolEntryKey.class);
                 if (key != null) {
                     for (ProtocolEntry entry: ovsdbBridgeOptional.get().getProtocolEntry()) {
                         if (entry.getKey().equals(key)) {
index 2e132d60d036f135648718cc6f6f3f22248cae7b..dc8bd53c94b9b40627c08cabfcfe6a5a26bed0c6 100644 (file)
@@ -269,7 +269,7 @@ public class OpenVSwitchUpdateCommand extends AbstractTransactionCommand {
     }
 
     private NodeId getNodeId(OpenVSwitch ovs) {
-        NodeKey nodeKey = getInstanceIdentifier(ovs).firstKeyOf(Node.class);
+        NodeKey nodeKey = getInstanceIdentifier(ovs).firstKeyOf(Node.class, NodeKey.class);
         return nodeKey.getNodeId();
     }
 }
index 528152aecdb74d5938f04b8a6b3161a52650a92e..80a6ed69cc67db72cc8df6ba30b3036af490b2ec 100644 (file)
@@ -118,7 +118,8 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
             InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
         Preconditions.checkNotNull(bridgeIid);
         Preconditions.checkNotNull(bridge);
-        List<InstanceIdentifier<BridgeOtherConfigs>> result = new ArrayList<>();
+        List<InstanceIdentifier<BridgeOtherConfigs>> result =
+                new ArrayList<InstanceIdentifier<BridgeOtherConfigs>>();
 
         Bridge oldBridge = oldBridgeRows.get(bridge.getUuid());
 
@@ -142,7 +143,8 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
             InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
         Preconditions.checkNotNull(bridgeIid);
         Preconditions.checkNotNull(bridge);
-        List<InstanceIdentifier<BridgeExternalIds>> result = new ArrayList<>();
+        List<InstanceIdentifier<BridgeExternalIds>> result =
+                new ArrayList<InstanceIdentifier<BridgeExternalIds>>();
 
         Bridge oldBridge = oldBridgeRows.get(bridge.getUuid());
 
@@ -166,7 +168,8 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
             InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
         Preconditions.checkNotNull(bridgeIid);
         Preconditions.checkNotNull(bridge);
-        List<InstanceIdentifier<ProtocolEntry>> result = new ArrayList<>();
+        List<InstanceIdentifier<ProtocolEntry>> result =
+                new ArrayList<InstanceIdentifier<ProtocolEntry>>();
         Bridge oldBridge = oldBridgeRows.get(bridge.getUuid());
 
         try {
@@ -197,7 +200,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
         connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId());
 
         OvsdbNodeAugmentationBuilder ovsdbConnectionAugmentationBuilder = new OvsdbNodeAugmentationBuilder();
-        List<ManagedNodeEntry> managedBridges = new ArrayList<>();
+        List<ManagedNodeEntry> managedBridges = new ArrayList<ManagedNodeEntry>();
         InstanceIdentifier<Node> bridgeIid = SouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(),
                 bridge);
         ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder().setBridgeRef(
@@ -263,7 +266,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
                 .getOtherConfigColumn().getData();
         if (otherConfigs != null && !otherConfigs.isEmpty()) {
             Set<String> otherConfigKeys = otherConfigs.keySet();
-            List<BridgeOtherConfigs> otherConfigList = new ArrayList<>();
+            List<BridgeOtherConfigs> otherConfigList = new ArrayList<BridgeOtherConfigs>();
             String otherConfigValue;
             for (String otherConfigKey : otherConfigKeys) {
                 otherConfigValue = otherConfigs.get(otherConfigKey);
@@ -284,7 +287,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
                 .getData();
         if (externalIds != null && !externalIds.isEmpty()) {
             Set<String> externalIdKeys = externalIds.keySet();
-            List<BridgeExternalIds> externalIdsList = new ArrayList<>();
+            List<BridgeExternalIds> externalIdsList = new ArrayList<BridgeExternalIds>();
             String externalIdValue;
             for (String externalIdKey : externalIdKeys) {
                 externalIdValue = externalIds.get(externalIdKey);
@@ -365,7 +368,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
     }
 
     private NodeId getNodeId(Bridge bridge) {
-        NodeKey nodeKey = getInstanceIdentifier(bridge).firstKeyOf(Node.class);
+        NodeKey nodeKey = getInstanceIdentifier(bridge).firstKeyOf(Node.class, NodeKey.class);
         return nodeKey.getNodeId();
     }
 }