Streamlined UnimgrMapper, cleaned up the code 55/29355/3
authorGabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
Thu, 5 Nov 2015 23:35:10 +0000 (18:35 -0500)
committerGabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
Fri, 6 Nov 2015 20:17:13 +0000 (15:17 -0500)
Change-Id: I5267fb1e9179f9fcaa1a41b384ea7a2a0f2fef4c
Signed-off-by: Gabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
impl/src/main/java/org/opendaylight/unimgr/command/EvcCreateCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/UniCreateCommand.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrDataChangeListener.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrMapper.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrUtils.java

index 8346220f23aedbc349254863d801af7a853f1e48..295f338f1ad29e3fb07288374a64cf4544ef4df4 100644 (file)
@@ -30,7 +30,7 @@ public class EvcCreateCommand extends AbstractCreateCommand {
     private static final Logger LOG = LoggerFactory.getLogger(EvcCreateCommand.class);
 
     public EvcCreateCommand(DataBroker dataBroker,
-            Map<InstanceIdentifier<?>, DataObject> changes) {
+                            Map<InstanceIdentifier<?>, DataObject> changes) {
         super.dataBroker = dataBroker;
         super.changes = changes;
     }
@@ -58,10 +58,10 @@ public class EvcCreateCommand extends AbstractCreateCommand {
                 if (evc.getUniSource().iterator().next().getUni() != null) {
                     sourceUniIid = (InstanceIdentifier<Node>) evc.getUniSource().iterator().next().getUni();
                 } else {
-                    sourceUniIid = UnimgrMapper.createUniIid(dataBroker, evc.getUniSource().iterator().next().getIpAddress());
+                    sourceUniIid = UnimgrMapper.getUniIid(dataBroker, evc.getUniSource().iterator().next().getIpAddress());
                 }
                 if (evc.getUniDest().iterator().next().getUni() != null) {
-                    destinationUniIid = UnimgrMapper.createUniIid(dataBroker, evc.getUniDest().iterator().next().getIpAddress());;
+                    destinationUniIid = UnimgrMapper.getUniIid(dataBroker, evc.getUniDest().iterator().next().getIpAddress());;
                 } else {
                     destinationUniIid = (InstanceIdentifier<Node>) evc.getUniDest().iterator().next().getUni();
                 }
@@ -85,13 +85,13 @@ public class EvcCreateCommand extends AbstractCreateCommand {
                 }
                 // Set source and destination
                 InstanceIdentifier<Node> sourceBridgeIid =
-                        UnimgrMapper.getOvsdbBridgeNodeIID(uniSource.getNodeId(),
+                        UnimgrMapper.getOvsdbBridgeNodeIid(uniSource.getNodeId(),
                                                            UnimgrConstants.DEFAULT_BRIDGE_NAME);
                 Optional<Node> optionalSourceBr = UnimgrUtils.readNode(dataBroker,
                                                                        LogicalDatastoreType.CONFIGURATION,
                                                                        sourceBridgeIid);
                 InstanceIdentifier<Node> destinationBridgeIid =
-                        UnimgrMapper.getOvsdbBridgeNodeIID(uniSource.getNodeId(),
+                        UnimgrMapper.getOvsdbBridgeNodeIid(uniSource.getNodeId(),
                                                            UnimgrConstants.DEFAULT_BRIDGE_NAME);
                 Optional<Node> optionalDestinationBr = UnimgrUtils.readNode(dataBroker,
                                                                             LogicalDatastoreType.CONFIGURATION,
index 2dd4a544e7d1dd141c945ddfa2260ab80f64f752..b41975c78df68ade59b53e2a9cf51c618d15c3ff 100644 (file)
@@ -81,7 +81,7 @@ public class UniCreateCommand extends AbstractCreateCommand {
                             ovsdbNode = UnimgrUtils.createOvsdbNode(dataBroker,
                                                                     uni);
                             LOG.info("Could not retrieve the OVSDB node,"
-                                   + "created a new one: {}", ovsdbNode.getNodeId());
+                                   + " created a new one: {}", ovsdbNode.getNodeId());
                             UnimgrUtils.updateUniNode(LogicalDatastoreType.CONFIGURATION,
                                                       uniKey,
                                                       uni,
@@ -144,8 +144,9 @@ public class UniCreateCommand extends AbstractCreateCommand {
                                                                                             ovsdbIid);
                                     if (optionalOvsdbNode.isPresent()) {
                                         InstanceIdentifier<Node> uniIid =
-                                                                    UnimgrMapper.createUniIid(dataBroker,
-                                                                                              uniAugmentation.getIpAddress());
+                                                                    UnimgrMapper.getUniIid(dataBroker,
+                                                                                           uniAugmentation.getIpAddress(),
+                                                                                           LogicalDatastoreType.CONFIGURATION);
                                         UnimgrUtils.createBridgeNode(dataBroker,
                                                                      ovsdbIid,
                                                                      uniAugmentation,
@@ -161,8 +162,9 @@ public class UniCreateCommand extends AbstractCreateCommand {
                                           .getConnectionInfo()
                                           .getRemoteIp()
                                           .equals(uniAugmentation.getIpAddress())) {
-                                InstanceIdentifier<Node> uniIid = UnimgrMapper.createUniIid(dataBroker,
-                                                                                            uniAugmentation.getIpAddress());
+                                InstanceIdentifier<Node> uniIid = UnimgrMapper.getUniIid(dataBroker,
+                                                                                         uniAugmentation.getIpAddress(),
+                                                                                         LogicalDatastoreType.CONFIGURATION);
                                 UnimgrUtils.createBridgeNode(dataBroker,
                                                              ovsdbIid,
                                                              uniAugmentation,
index 2bdc6afdfe656a8dee8fc3b7f1ce054c4c5d4337..9441ed8f72c30f517b7d0bd1037bcfcf6ead17b2 100644 (file)
@@ -45,15 +45,15 @@ public class UnimgrDataChangeListener  implements IUnimgrDataChangeListener {
         this.invoker = invoker;
         listeners = new HashSet<ListenerRegistration<DataChangeListener>>();
         listeners.add(dataBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
-                                                            UnimgrMapper.createUniIid(),
+                                                            UnimgrMapper.getUniTopologyIid(),
                                                             this,
                                                             DataChangeScope.SUBTREE));
         listeners.add(dataBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
-                                                            UnimgrMapper.createEvcIid(),
+                                                            UnimgrMapper.getEvcTopologyIid(),
                                                             this,
                                                             DataChangeScope.SUBTREE));
         listeners.add(dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
-                                                            UnimgrMapper.getOvsdbTopologyIdentifier(),
+                                                            UnimgrMapper.getOvsdbTopologyIid(),
                                                             this,
                                                             DataChangeScope.SUBTREE));
     }
index 5eeda0fff9d5f40902c4638b58280fb722638254..5223f1ab28efd0fbad83f0b6108f76c85db9be79 100755 (executable)
@@ -10,6 +10,7 @@ package org.opendaylight.unimgr.impl;
 import java.util.List;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.UniAugmentation;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId;
@@ -25,26 +26,42 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UnimgrMapper {
 
-    private static final Logger LOG = LoggerFactory.getLogger(UnimgrMapper.class);
+    public static InstanceIdentifier<Link> getEvcLinkIID(LinkId id) {
+        InstanceIdentifier<Link> linkPath = InstanceIdentifier
+                                                .create(NetworkTopology.class)
+                                                .child(Topology.class,
+                                                        new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
+                                                .child(Link.class,
+                                                        new LinkKey(id));
+        return linkPath;
+    }
+
+    public static InstanceIdentifier<Topology> getEvcTopologyIid() {
+        InstanceIdentifier<Topology> topoPath = InstanceIdentifier
+                                                    .create(NetworkTopology.class)
+                                                    .child(Topology.class,
+                                                            new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID));
+        return topoPath;
+    }
 
-    public static InstanceIdentifier<Node> getOvsdbNodeIID(NodeId nodeId) {
+    public static InstanceIdentifier<Node> getEvcTopologyNodeIid() {
         InstanceIdentifier<Node> nodePath = InstanceIdentifier
                                                 .create(NetworkTopology.class)
                                                 .child(Topology.class,
-                                                        new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID))
-                                                .child(Node.class,
-                                                        new NodeKey(nodeId));
+                                                        new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
+                                                .child(Node.class);
         return nodePath;
     }
 
-    public static InstanceIdentifier<Node> getOvsdbBridgeNodeIID(NodeId ovsdbNode,
+    public static InstanceIdentifier<Node> getOvsdbBridgeNodeIid(NodeId ovsdbNode,
                                                                  String bridgeName) {
-        NodeId bridgeNodeId = new NodeId(ovsdbNode + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX + bridgeName);
+        String ovsdbNodeId = ovsdbNode.getValue();
+        NodeId bridgeNodeId = new NodeId(ovsdbNodeId
+                                       + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX
+                                       + bridgeName);
         InstanceIdentifier<Node> nodePath = InstanceIdentifier
                                                 .create(NetworkTopology.class)
                                                 .child(Topology.class,
@@ -54,11 +71,11 @@ public class UnimgrMapper {
         return nodePath;
     }
 
-    public static InstanceIdentifier<Node> getOvsdbNodeIID(IpAddress ipAddress) {
+    public static InstanceIdentifier<Node> getOvsdbNodeIid(IpAddress ipAddress) {
         String nodeId = UnimgrConstants.OVSDB_PREFIX
-                + ipAddress.getIpv4Address().getValue().toString()
-                + ":"
-                + UnimgrConstants.OVSDB_PORT;
+                            + ipAddress.getIpv4Address().getValue().toString()
+                            + ":"
+                            + UnimgrConstants.OVSDB_PORT;
         InstanceIdentifier<Node> nodePath = InstanceIdentifier
                                                 .create(NetworkTopology.class)
                                                 .child(Topology.class,
@@ -68,16 +85,25 @@ public class UnimgrMapper {
         return nodePath;
     }
 
-    public static InstanceIdentifier<Node> getOvsdbTopologyIdentifier() {
-        InstanceIdentifier<Node> path = InstanceIdentifier
-                                            .create(NetworkTopology.class)
-                                            .child(Topology.class,
-                                                    new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID))
-                                            .child(Node.class);
-        return path;
+    public static InstanceIdentifier<Node> getOvsdbNodeIid(NodeId nodeId) {
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
+                                                .create(NetworkTopology.class)
+                                                .child(Topology.class,
+                                                        new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID))
+                                                .child(Node.class,
+                                                        new NodeKey(nodeId));
+        return nodePath;
+    }
+
+    public static InstanceIdentifier<Topology> getOvsdbTopologyIid() {
+        InstanceIdentifier<Topology> topoPath = InstanceIdentifier
+                                                    .create(NetworkTopology.class)
+                                                    .child(Topology.class,
+                                                            new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID));
+        return topoPath;
     }
 
-    public static InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(
+    public static InstanceIdentifier<TerminationPoint> getTerminationPointIid(
                                                            Node bridgeNode,
                                                            String portName) {
         InstanceIdentifier<TerminationPoint> terminationPointPath =
@@ -85,25 +111,17 @@ public class UnimgrMapper {
                                                      .create(NetworkTopology.class)
                                                      .child(Topology.class,
                                                              new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID))
-                                                     .child(Node.class,bridgeNode.getKey())
+                                                     .child(Node.class, bridgeNode.getKey())
                                                      .child(TerminationPoint.class,
                                                              new TerminationPointKey(new TpId(portName)));
-
-        LOG.debug("Termination point InstanceIdentifier generated : {}",terminationPointPath);
         return terminationPointPath;
     }
 
-    public static InstanceIdentifier<Node> createUniIid() {
-        InstanceIdentifier<Node> iid = InstanceIdentifier.create(NetworkTopology.class)
-                .child(Topology.class, new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID))
-                .child(Node.class);
-        return iid;
-    }
-
-    public static InstanceIdentifier<Node> createUniIid(DataBroker dataBroker,
-                                                        IpAddress ip) {
-        List<Node> uniNodes = UnimgrUtils.getUniNodes(dataBroker);
-        for (Node node: uniNodes) {
+    public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker,
+                                                     IpAddress ip) {
+        List<Node> uniNodes = UnimgrUtils.getUniNodes(dataBroker,
+                                                      LogicalDatastoreType.OPERATIONAL);
+        for (Node node : uniNodes) {
             UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
             if (uniAugmentation.getIpAddress().equals(ip)) {
                 InstanceIdentifier<Node> uniNode = InstanceIdentifier
@@ -118,29 +136,41 @@ public class UnimgrMapper {
         return null;
     }
 
-    public static InstanceIdentifier<Node> createEvcIid() {
-        InstanceIdentifier<Node> iid = InstanceIdentifier
-                                           .create(NetworkTopology.class)
-                                           .child(Topology.class,
-                                                   new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
-                                           .child(Node.class);
-        return iid;
+    public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker,
+                                                     IpAddress ip,
+                                                     LogicalDatastoreType store) {
+        List<Node> uniNodes = UnimgrUtils.getUniNodes(dataBroker,
+                                                      store);
+        for (Node node : uniNodes) {
+            UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
+            if (uniAugmentation.getIpAddress().equals(ip)) {
+                InstanceIdentifier<Node> uniNode = InstanceIdentifier
+                                                       .create(NetworkTopology.class)
+                                                       .child(Topology.class,
+                                                               new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID))
+                                                       .child(Node.class,
+                                                               new NodeKey(node.getKey()));
+                return uniNode;
+            }
+        }
+        return null;
     }
 
-    public static InstanceIdentifier<Topology> createTopologyIid() {
-        InstanceIdentifier<Topology> iid = InstanceIdentifier
-                                               .create(NetworkTopology.class)
-                                               .child(Topology.class,
-                                                       new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID));
-        return iid;
+    public static InstanceIdentifier<Topology> getUniTopologyIid() {
+        InstanceIdentifier<Topology> topoPath = InstanceIdentifier
+                                                   .create(NetworkTopology.class)
+                                                   .child(Topology.class,
+                                                           new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID));
+        return topoPath;
     }
 
-    public static InstanceIdentifier<Link> getEvcLinkIID(LinkId id) {
-        InstanceIdentifier<Link> linkPath = InstanceIdentifier
+    public static InstanceIdentifier<Node> getUniTopologyNodeIid() {
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
                                                 .create(NetworkTopology.class)
                                                 .child(Topology.class,
-                                                        new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
-                                                .child(Link.class,new LinkKey(id));
-        return linkPath;
+                                                        new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID))
+                                                .child(Node.class);
+        return nodePath;
     }
+
 }
index c4b775f2bdbd4b9abd7deaf7e7bd577d08c8685c..78f3efbbea6715a9ed874c564564b6f7b648944f 100644 (file)
@@ -48,7 +48,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey;
@@ -85,12 +84,12 @@ public class UnimgrUtils {
                                         String bridgeName) {
         LOG.info("Creating a bridge on node {}", ovsdbNodeId);
         InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper
-                                                    .getOvsdbNodeIID(uni.getIpAddress());
+                                                    .getOvsdbNodeIid(uni.getIpAddress());
         ConnectionInfo connectionInfo = UnimgrUtils.getConnectionInfo(dataBroker, ovsdbNodeId);
         if (connectionInfo != null) {
             NodeBuilder bridgeNodeBuilder = new NodeBuilder();
             InstanceIdentifier<Node> bridgeIid = UnimgrMapper
-                                                    .getOvsdbBridgeNodeIID(ovsdbNodeId, bridgeName);
+                                                    .getOvsdbBridgeNodeIid(ovsdbNodeId, bridgeName);
             NodeId bridgeNodeId = new NodeId(ovsdbNodeId
                                              + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX
                                              + bridgeName);
@@ -122,7 +121,7 @@ public class UnimgrUtils {
         InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) uni.getOvsdbNodeRef().getValue();
         if (ovsdbNodeIid != null) {
             NodeBuilder bridgeNodeBuilder = new NodeBuilder();
-            InstanceIdentifier<Node> bridgeIid = UnimgrMapper.getOvsdbBridgeNodeIID(ovsdbNode.getNodeId(),
+            InstanceIdentifier<Node> bridgeIid = UnimgrMapper.getOvsdbBridgeNodeIid(ovsdbNode.getNodeId(),
                                                                                     bridgeName);
             NodeId bridgeNodeId = new NodeId(ovsdbNode.getNodeId()
                                            + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX
@@ -154,9 +153,9 @@ public class UnimgrUtils {
                                                                     ovsdbNodeIid);
             if (optionalOvsdbNode.isPresent()) {
                 Node ovsdbNode = optionalOvsdbNode.get();
-                InstanceIdentifier<Node> bridgeIid = UnimgrMapper.getOvsdbBridgeNodeIID(ovsdbNode.getNodeId(),
+                InstanceIdentifier<Node> bridgeIid = UnimgrMapper.getOvsdbBridgeNodeIid(ovsdbNode.getNodeId(),
                                                                                         bridgeName);
-                NodeId bridgeNodeId = new NodeId(ovsdbNode.getNodeId()
+                NodeId bridgeNodeId = new NodeId(ovsdbNode.getNodeId().getValue()
                                                + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX
                                                + bridgeName);
                 bridgeNodeBuilder.setNodeId(bridgeNodeId);
@@ -193,8 +192,8 @@ public class UnimgrUtils {
                                        String bridgeName,
                                        String portName) {
         InstanceIdentifier<TerminationPoint> tpIid =
-                                                 UnimgrMapper.createTerminationPointInstanceIdentifier(bridgeNode,
-                                                                                                       portName);
+                                                 UnimgrMapper.getTerminationPointIid(bridgeNode,
+                                                                                     portName);
         OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder =
                                                      new OvsdbTerminationPointAugmentationBuilder();
         tpAugmentationBuilder.setName(portName);
@@ -246,7 +245,7 @@ public class UnimgrUtils {
     public static void createOvsdbNode(DataBroker dataBroker,
                                        NodeId ovsdbNodeId,
                                        Uni uni) {
-        InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIID(uni.getIpAddress());
+        InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIid(uni.getIpAddress());
         try {
             NodeKey ovsdbNodeKey = new NodeKey(ovsdbNodeId);
             Node nodeData = new NodeBuilder()
@@ -269,7 +268,7 @@ public class UnimgrUtils {
                                        UniAugmentation uni) {
         NodeId ovsdbNodeId = new NodeId(createOvsdbNodeId(uni.getIpAddress()));
         try {
-            InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIID(ovsdbNodeId);
+            InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIid(ovsdbNodeId);
             NodeKey ovsdbNodeKey = new NodeKey(ovsdbNodeId);
             Node nodeData = new NodeBuilder()
                                     .setNodeId(ovsdbNodeId)
@@ -325,8 +324,8 @@ public class UnimgrUtils {
                                                   String portName,
                                                   String type) {
         InstanceIdentifier<TerminationPoint> tpIid = UnimgrMapper
-                                                        .createTerminationPointInstanceIdentifier(bridgeNode,
-                                                                                                  portName);
+                                                        .getTerminationPointIid(bridgeNode,
+                                                                                portName);
         OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
         tpAugmentationBuilder.setName(portName);
         if (type != null) {
@@ -421,7 +420,7 @@ public class UnimgrUtils {
 
     public static ConnectionInfo getConnectionInfo(DataBroker dataBroker,
                                                    NodeId ovsdbNodeId) {
-        InstanceIdentifier<Node> nodeIid = UnimgrMapper.getOvsdbNodeIID(ovsdbNodeId);
+        InstanceIdentifier<Node> nodeIid = UnimgrMapper.getOvsdbNodeIid(ovsdbNodeId);
         Optional<Node> node = readNode(dataBroker,
                                        LogicalDatastoreType.OPERATIONAL,
                                        nodeIid);
@@ -439,11 +438,11 @@ public class UnimgrUtils {
     public static List<Link> getEvcLinks(DataBroker dataBroker,
                                          IpAddress ipAddress) {
         List<Link> evcLinks = new ArrayList<>();
-        InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.createTopologyIid();
+        InstanceIdentifier<Topology> evcTopology = UnimgrMapper.getEvcTopologyIid();
         Topology topology = UnimgrUtils.read(dataBroker,
                                              LogicalDatastoreType.OPERATIONAL,
-                                             topologyInstanceIdentifier);
-        if (topology != null && topology.getNode() != null) {
+                                             evcTopology);
+        if (topology != null && topology.getLink() != null) {
             for (Link link : topology.getLink()) {
                 EvcAugmentation evcAugmentation = link.getAugmentation(EvcAugmentation.class);
                 if (evcAugmentation != null) {
@@ -469,10 +468,10 @@ public class UnimgrUtils {
 
     public static List<Node> getOvsdbNodes(DataBroker dataBroker) {
         List<Node> ovsdbNodes = new ArrayList<>();
-        InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.createTopologyIid();
+        InstanceIdentifier<Topology> ovsdbTopoIdentifier = UnimgrMapper.getOvsdbTopologyIid();
         Topology topology = UnimgrUtils.read(dataBroker,
                                              LogicalDatastoreType.OPERATIONAL,
-                                             topologyInstanceIdentifier);
+                                             ovsdbTopoIdentifier);
         if (topology != null && topology.getNode() != null) {
             for (Node node : topology.getNode()) {
                 OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
@@ -486,7 +485,7 @@ public class UnimgrUtils {
 
     public static List<Node> getUniNodes(DataBroker dataBroker) {
         List<Node> uniNodes = new ArrayList<>();
-        InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.createTopologyIid();
+        InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
         Topology topology = read(dataBroker,
                                  LogicalDatastoreType.CONFIGURATION,
                                  topologyInstanceIdentifier);
@@ -501,6 +500,24 @@ public class UnimgrUtils {
         return uniNodes;
     }
 
+    public static List<Node> getUniNodes(DataBroker dataBroker,
+                                         LogicalDatastoreType store) {
+        List<Node> uniNodes = new ArrayList<>();
+        InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
+        Topology topology = read(dataBroker,
+                                 store,
+                                 topologyInstanceIdentifier);
+        if (topology != null && topology.getNode() != null) {
+            for (Node node : topology.getNode()) {
+                UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
+                if (uniAugmentation != null) {
+                    uniNodes.add(node);
+                }
+            }
+        }
+        return uniNodes;
+    }
+
     public static <D extends org.opendaylight.yangtools.yang.binding.DataObject> D read(
             DataBroker dataBroker,
             final LogicalDatastoreType store,
@@ -560,13 +577,15 @@ public class UnimgrUtils {
                                      UniAugmentation uni,
                                      Node ovsdbNode,
                                      DataBroker dataBroker) {
-        InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIID(ovsdbNode.getNodeId());
+        InstanceIdentifier<Node> ovsdbNodeIid = UnimgrMapper.getOvsdbNodeIid(ovsdbNode.getNodeId());
         OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(ovsdbNodeIid);
         UniAugmentationBuilder updatedUniBuilder = new UniAugmentationBuilder(uni);
         if (ovsdbNodeRef != null) {
             updatedUniBuilder.setOvsdbNodeRef(ovsdbNodeRef);
         }
-        Optional<Node> optionalNode = readNode(dataBroker, LogicalDatastoreType.CONFIGURATION, uniKey);
+        Optional<Node> optionalNode = readNode(dataBroker,
+                                               LogicalDatastoreType.CONFIGURATION,
+                                               uniKey);
         if (optionalNode.isPresent()) {
             Node node = optionalNode.get();
             WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
@@ -589,7 +608,9 @@ public class UnimgrUtils {
         if (ovsdbNodeRef != null) {
             updatedUniBuilder.setOvsdbNodeRef(ovsdbNodeRef);
         }
-        Optional<Node> optionalNode = readNode(dataBroker, LogicalDatastoreType.CONFIGURATION, uniKey);
+        Optional<Node> optionalNode = readNode(dataBroker,
+                                               LogicalDatastoreType.CONFIGURATION,
+                                               uniKey);
         if (optionalNode.isPresent()) {
             Node node = optionalNode.get();
             WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();