Adding dependency between driver topology handlers and impl common handler to resolve...
[unimgr.git] / impl / src / main / java / org / opendaylight / unimgr / mef / nrp / common / NrpDao.java
index 588af697e788623b464ff593c8a6e4eb08c50536..d1fbcc20e2f4253ea4c5134f532730eda8cec6cf 100644 (file)
@@ -68,13 +68,7 @@ public class NrpDao  {
         this.tx =  null;
     }
 
-    public Node createSystemNode(String nodeId, List<OwnedNodeEdgePoint> neps) {
-
-        return createSystemNode(nodeId, ETH.class, neps);
-    }
-
-
-    public Node createSystemNode(String nodeId, Class<? extends LayerProtocolName> name, List<OwnedNodeEdgePoint> neps) {
+    public Node createNode(String topologyId, String nodeId, Class<? extends LayerProtocolName> name, List<OwnedNodeEdgePoint> neps) {
         verifyTx();
         Uuid uuid = new Uuid(nodeId);
 
@@ -160,22 +154,35 @@ public class NrpDao  {
         return topology.orNull();
     }
 
+    public Node getNode(String uuidTopo, String uuidNode) throws ReadFailedException {
+        Optional<Node> topology = rtx.read(LogicalDatastoreType.OPERATIONAL, node(new Uuid(uuidTopo), new Uuid(uuidNode))).checkedGet();
+        return topology.orNull();
+    }
+
     public static InstanceIdentifier<Context> ctx() {
         return InstanceIdentifier.create(Context.class);
     }
 
     public static InstanceIdentifier<Topology> topo(String topoId) {
+        return topo(new Uuid(topoId));
+    }
+
+    public static InstanceIdentifier<Topology> topo(Uuid topoId) {
         return ctx()
                 .augmentation(Context1.class)
-                .child(Topology.class, new TopologyKey(new Uuid(topoId)));
+                .child(Topology.class, new TopologyKey(topoId));
     }
 
     public static InstanceIdentifier<Node> node(String nodeId) {
         return node(new Uuid(nodeId));
     }
 
+    public static InstanceIdentifier<Node> node(Uuid topologyId, Uuid nodeId) {
+        return topo(topologyId).child(Node.class, new NodeKey(nodeId));
+    }
+
     public static InstanceIdentifier<Node> node(Uuid nodeId) {
-        return topo(TapiConstants.PRESTO_SYSTEM_TOPO).child(Node.class, new NodeKey(nodeId));
+        return node(new Uuid(TapiConstants.PRESTO_SYSTEM_TOPO), nodeId);
     }
 
     public static InstanceIdentifier<Node> abstractNode() {