upgrade portmapping YANG to introduce OTN
[transportpce.git] / networkmodel / src / main / java / org / opendaylight / transportpce / networkmodel / util / ClliNetwork.java
index 09a797d1769416368e81d04097a7db8b6e927501..248fb4581959f7c4ea2816fed1cbf5df3749465d 100644 (file)
@@ -11,11 +11,11 @@ package org.opendaylight.transportpce.networkmodel.util;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.NetworkUtils;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200113.network.nodes.NodeInfo;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev181130.NetworkTypes1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev181130.NetworkTypes1Builder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev181130.Node1;
@@ -56,7 +56,7 @@ public final class ClliNetwork {
                 new NetworkKey(new NetworkId(NetworkUtils.CLLI_NETWORK_ID)));
             WriteTransaction wrtx = controllerdb.newWriteOnlyTransaction();
             wrtx.put(LogicalDatastoreType.CONFIGURATION, nwIID.build(), clliNetwork);
-            wrtx.submit().get(1, TimeUnit.SECONDS);
+            wrtx.commit().get(1, TimeUnit.SECONDS);
             LOG.info("CLLI-Network created successfully.");
         } catch (ExecutionException | TimeoutException | InterruptedException e) {
             LOG.warn("Failed to create CLLI-Network", e);
@@ -66,25 +66,13 @@ public final class ClliNetwork {
     /**
      * Create single node entry for CLLI topology.
      *
-     * @param deviceTransactionManager device transation manager
      * @param deviceId device ID
+     * @param nodeInfo Some important and general data from device
      *
      * @return node builder status
      */
-    public static Node createNode(DeviceTransactionManager deviceTransactionManager, String deviceId,
-                                  String openRoadmVersion) {
-        //Read clli from the device
-        InfoSubtree infoSubtree = new InfoSubtree(openRoadmVersion);
-        String clli;
-
-        if (infoSubtree.getDeviceInfo(deviceId,deviceTransactionManager)) {
-
-            clli = infoSubtree.getClli();
-        } else {
-            LOG.info("Unable for get Info subtree from the device");
-            return null;
-        }
-
+    public static Node createNode(String deviceId, NodeInfo nodeInfo) {
+        String clli = nodeInfo.getNodeClli();
         /*
          * Create node in the CLLI layer of the network model
          * with nodeId equal to the clli attribute in the device