Network model add enable wavelength unit test 58/94558/7
authormanuedelf <emmanuelle.delfour@orange.com>
Fri, 11 Dec 2020 15:21:45 +0000 (16:21 +0100)
committermanuedelf <emmanuelle.delfour@orange.com>
Sat, 9 Jan 2021 14:41:35 +0000 (15:41 +0100)
- Enable and fix NetworkModelWavelengthServiceTest.
- Remove no more used PathDescriptionUtils test class
- Add a stub yang model for path-description in test-common to define
path description as a container and use it to parse
path_description.json test file. Using a json file avoid to have big
test classes to instantiate yang object.

JIRA: TRNSPRTPCE-230
Signed-off-by: manuedelf <emmanuelle.delfour@orange.com>
Change-Id: If843edb8116cb7ac60cffa3cd25544e9a251c88a

networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelWavelengthServiceTest.java
networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/PathDescriptionUtils.java [deleted file]
networkmodel/src/test/resources/path_description.json
test-common/src/main/yang/path-description-stub@2020-12-11.yang [new file with mode: 0644]

index c861e9384fc03f28a2bed2e52d879c7d6613b921..6b836ed7b883fa75eecf1bc5cebed13888fd0987 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.transportpce.networkmodel.service;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import java.io.FileNotFoundException;
@@ -15,44 +17,147 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
+import java.util.BitSet;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.InstanceIdentifiers;
+import org.opendaylight.transportpce.common.NetworkUtils;
+import org.opendaylight.transportpce.common.Timeouts;
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.transportpce.networkmodel.util.OpenRoadmTopology;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.transportpce.test.converter.DataObjectConverter;
 import org.opendaylight.transportpce.test.converter.JSONDataObjectConverter;
 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.Node1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.TerminationPoint1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.available.freq.map.AvailFreqMapsKey;
+import org.opendaylight.yang.gen.v1.pathdescription.stub.rev201211.PathDescription;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Ignore
-//FIXME: disabled because some updates are needed on test-common
 public class NetworkModelWavelengthServiceTest extends AbstractTest {
     private static final Logger LOG = LoggerFactory.getLogger(NetworkModelWavelengthServiceTest.class);
     private static final String OPENROADM_TOPOLOGY_FILE = "src/test/resources/openroadm-topology.xml";
     private static final String PATH_DESCRIPTION_FILE = "src/test/resources/path_description.json";
-    private static DataObjectConverter dataObjectConverter;
+    private static PathDescription pathDescription;
+    private final AvailFreqMapsKey availFreqMapKey = new AvailFreqMapsKey(GridConstant.C_BAND);
+    private final BitSet usedBits = new BitSet(8);
+    private static BitSet availableBits = new BitSet(8);
 
     @BeforeClass
     public static void setUp() throws InterruptedException, ExecutionException, FileNotFoundException {
+        availableBits.set(0, 8, true);
         TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(), OPENROADM_TOPOLOGY_FILE,
                 InstanceIdentifiers.OVERLAY_NETWORK_II);
-        dataObjectConverter = JSONDataObjectConverter.createWithDataStoreUtil(getDataStoreContextUtil());
-    }
-
-    @Test
-    public void allocateFrequenciesTest() throws IOException {
+        DataObjectConverter dataObjectConverter = JSONDataObjectConverter
+                .createWithDataStoreUtil(getDataStoreContextUtil());
         try (Reader reader = new FileReader(PATH_DESCRIPTION_FILE, StandardCharsets.UTF_8)) {
-            PathDescription pathDescription = (PathDescription) dataObjectConverter.transformIntoNormalizedNode(reader)
-                    .get().getValue();
-            NetworkModelWavelengthService service = new NetworkModelWavelengthServiceImpl(getDataBroker());
-            service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
+            NormalizedNode<? extends PathArgument, ?> normalizedNode = dataObjectConverter
+                    .transformIntoNormalizedNode(reader).get();
+            pathDescription = (PathDescription) getDataStoreContextUtil()
+                    .getBindingDOMCodecServices().fromNormalizedNode(YangInstanceIdentifier
+                            .of(PathDescription.QNAME), normalizedNode).getValue();
         } catch (IOException e) {
             LOG.error("Cannot load path description ", e);
             fail("Cannot load path description ");
         }
     }
+
+    @Test
+    public void allocateFrequenciesTest() throws IOException {
+        NetworkModelWavelengthService service = new NetworkModelWavelengthServiceImpl(getDataBroker());
+        service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
+        TerminationPoint1 terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-DEG2", "DEG2-CTP-TXRX");
+        assertEquals("Lambda 1 should not be available for ctp-attributes",
+                BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),usedBits);
+        assertNull("cp-attributes should be null", terminationPoint.getCpAttributes());
+        terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-SRG1", "SRG1-PP1-TXRX");
+        assertEquals("Lambda 1 should not be available for pp-attributes",
+                BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),usedBits);
+        Node1 node = getNetworkNodeFromDatastore("ROADM-A1-SRG1");
+        assertEquals("Lambda 1 should not be available for srg-attributes",
+                BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),usedBits);
+    }
+
+    @Test
+    public void releaseFrequenciesTest() throws IOException {
+        NetworkModelWavelengthService service = new NetworkModelWavelengthServiceImpl(getDataBroker());
+        service.allocateFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
+        service.releaseFrequencies(pathDescription.getAToZDirection(), pathDescription.getZToADirection());
+        TerminationPoint1 terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-DEG2", "DEG2-CTP-TXRX");
+        assertEquals("Lambda 1 should be available for ctp-attributes",
+                BitSet.valueOf(terminationPoint.getCtpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),availableBits);
+        terminationPoint = getNetworkTerminationPointFromDatastore("ROADM-A1-SRG1", "SRG1-PP1-TXRX");
+        assertEquals("Lambda 1 should be available for pp-attributes",
+                BitSet.valueOf(terminationPoint.getPpAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),availableBits);
+        Node1 node = getNetworkNodeFromDatastore("ROADM-A1-SRG1");
+        assertEquals("Lambda 1 should be available for srg-attributes",
+                BitSet.valueOf(node.getSrgAttributes().getAvailFreqMaps().get(availFreqMapKey)
+                .getFreqMap()).get(760, 768),availableBits);
+    }
+
+    private TerminationPoint1 getNetworkTerminationPointFromDatastore(String nodeId, String tpId) {
+        InstanceIdentifier<TerminationPoint1> tpIID = OpenRoadmTopology
+                .createNetworkTerminationPointIIDBuilder(nodeId, tpId).build();
+        try (ReadTransaction readTx = getDataBroker().newReadOnlyTransaction()) {
+            Optional<TerminationPoint1> optionalTerminationPoint = readTx
+                    .read(LogicalDatastoreType.CONFIGURATION, tpIID)
+                    .get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS);
+            if (optionalTerminationPoint.isPresent()) {
+                return optionalTerminationPoint.get();
+            } else {
+                return null;
+            }
+        } catch (ExecutionException | TimeoutException e) {
+            LOG.warn("Exception while getting termination {} for node id {} point from {} topology", tpId, nodeId,
+                    NetworkUtils.OVERLAY_NETWORK_ID, e);
+            return null;
+        } catch (InterruptedException e) {
+            LOG.warn("Getting termination {} for node id {} point from {} topology was interrupted", tpId, nodeId,
+                    NetworkUtils.OVERLAY_NETWORK_ID, e);
+            Thread.currentThread().interrupt();
+            return null;
+        }
+    }
+
+    private Node1 getNetworkNodeFromDatastore(String nodeId) {
+        InstanceIdentifier<Node1> nodeIID = OpenRoadmTopology.createNetworkNodeIID(nodeId);
+        try (ReadTransaction nodeReadTx = getDataBroker().newReadOnlyTransaction()) {
+            Optional<Node1> optionalNode = nodeReadTx.read(LogicalDatastoreType.CONFIGURATION, nodeIID)
+                    .get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS);
+            if (optionalNode.isPresent()) {
+                return optionalNode.get();
+            } else {
+                LOG.error("Unable to get network node for node id {}from topology {}", nodeId,
+                        NetworkUtils.OVERLAY_NETWORK_ID);
+                return null;
+            }
+        } catch (ExecutionException | TimeoutException e) {
+            LOG.warn("Exception while getting network node for node id {} from {} topology", nodeId,
+                    NetworkUtils.OVERLAY_NETWORK_ID, e);
+            return null;
+        } catch (InterruptedException e) {
+            LOG.warn("Getting network node for node id {} from {} topology was interrupted", nodeId,
+                    NetworkUtils.OVERLAY_NETWORK_ID, e);
+            Thread.currentThread().interrupt();
+            return null;
+        }
+    }
+
 }
diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/PathDescriptionUtils.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/PathDescriptionUtils.java
deleted file mode 100644 (file)
index 615fe2e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.transportpce.networkmodel.util.test;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.AToZDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.AToZDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ZToADirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ZToADirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.atoz.direction.AToZ;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.atoz.direction.AToZBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.atoz.direction.AToZKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ztoa.direction.ZToA;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ztoa.direction.ZToABuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ztoa.direction.ZToAKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.pce.resource.ResourceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.pce.resource.resource.resource.TerminationPoint;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.pce.resource.resource.resource.TerminationPointBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.path.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.path.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.path.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.path.ServiceZEndBuilder;
-import org.opendaylight.yangtools.yang.common.Uint32;
-
-public final class PathDescriptionUtils {
-
-    private PathDescriptionUtils() {
-
-    }
-
-    public static PathDescription createTransactionPathDescription(String tpId) {
-        Map<AToZKey,AToZ> atoZMap = new HashMap<>();
-        TerminationPointBuilder terminationPointBuilder = new TerminationPointBuilder();
-        TerminationPoint terminationPoint = terminationPointBuilder.setTpNodeId("node2" + tpId)
-                        .setTpId(tpId).build();
-        TerminationPoint terminationPoint2 = terminationPointBuilder.setTpNodeId("node1" + tpId)
-                        .setTpId(tpId).build();
-        AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-                .setResource(terminationPoint).build()).build();
-        AToZ atoZ2 = new AToZBuilder().setId("2").withKey(new AToZKey("2")).setResource(new ResourceBuilder()
-                .setResource(terminationPoint2).build()).build();
-        atoZMap.put(atoZ.key(),atoZ);
-        atoZMap.put(atoZ2.key(),atoZ2);
-        AToZDirection atozDirection = new AToZDirectionBuilder()
-                .setRate(Uint32.valueOf(20))
-                .setAToZWavelengthNumber(Uint32.valueOf(20))
-                .setAToZ(atoZMap)
-                .setModulationFormat("OC")
-                .build();
-        Map<ZToAKey,ZToA> ztoAMap = new HashMap<>();
-        ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-                .setResource(terminationPoint).build()).build();
-        ZToA ztoA2 = new ZToABuilder().setId("2").withKey(new ZToAKey("2")).setResource(new ResourceBuilder()
-                .setResource(terminationPoint).build()).build();
-        ztoAMap.put(ztoA.key(),ztoA);
-        ztoAMap.put(ztoA2.key(),ztoA2);
-        ZToADirection ztoaDirection = new ZToADirectionBuilder()
-                .setRate(Uint32.valueOf(20))
-                .setZToAWavelengthNumber(Uint32.valueOf(20))
-                .setZToA(ztoAMap)
-                .setModulationFormat("OC")
-                .build();
-        PathDescriptionBuilder pathDescriptionBuilder = new PathDescriptionBuilder();
-        pathDescriptionBuilder.setAToZDirection(atozDirection);
-        pathDescriptionBuilder.setZToADirection(ztoaDirection);
-        return pathDescriptionBuilder.build();
-    }
-
-    public static ServiceAEndBuilder getServiceAEndBuild() {
-        return new ServiceAEndBuilder()
-            .setClli("clli").setServiceFormat(ServiceFormat.OC)
-            .setServiceRate(Uint32.valueOf(1)).setNodeId("XPONDER-1-2")
-            .setTxDirection(
-                new TxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build())
-            .setRxDirection(
-                new RxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build());
-    }
-
-    public static ServiceZEndBuilder getServiceZEndBuild() {
-        return new ServiceZEndBuilder()
-            .setClli("clli").setServiceFormat(ServiceFormat.OC)
-            .setServiceRate(Uint32.valueOf(1)).setNodeId("XPONDER-2-3")
-            .setTxDirection(
-                new TxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build())
-            .setRxDirection(
-                new RxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build());
-    }
-}
index 816f6fa58fa4a1db58a27d3266aa9000b727020a..5b9ff1ba24e9d42089a30a84f4f6772de297034d 100644 (file)
  {
-            "transportpce-pathDescription:path-description": {
-                "zToA-direction": {
-                    "rate": 100,
-                    "zToA": [
-                        {
-                            "id": "0",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-SRG1",
-                                "tp-id": "SRG1-PP1-TXRX"
-                            }
-                        },
-                        {
-                            "id": "1",
-                            "resource": {
-                                "node-id": "ROADM-C1-SRG1"
-                            }
-                        },
-                        {
-                            "id": "2",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-SRG1",
-                                "tp-id": "SRG1-CP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "3",
-                            "resource": {
-                                "link-id": "ROADM-C1-SRG1-SRG1-CP-TXRXtoROADM-C1-DEG1-DEG1-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "4",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-DEG1",
-                                "tp-id": "DEG1-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "5",
-                            "resource": {
-                                "node-id": "ROADM-C1-DEG1"
-                            }
-                        },
-                        {
-                            "id": "6",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-DEG1",
-                                "tp-id": "DEG1-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "7",
-                            "resource": {
-                                "link-id": "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "8",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-DEG2",
-                                "tp-id": "DEG2-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "9",
-                            "resource": {
-                                "node-id": "ROADM-A1-DEG2"
-                            }
-                        },
-                        {
-                            "id": "10",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-DEG2",
-                                "tp-id": "DEG2-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "11",
-                            "resource": {
-                                "link-id": "ROADM-A1-DEG2-DEG2-CTP-TXRXtoROADM-A1-SRG1-SRG1-CP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "12",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-SRG1",
-                                "tp-id": "SRG1-CP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "13",
-                            "resource": {
-                                "node-id": "ROADM-A1-SRG1"
-                            }
-                        },
-                        {
-                            "id": "14",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-SRG1",
-                                "tp-id": "SRG1-PP1-TXRX"
-                            }
-                        }
-                    ],
-                    "zToA-wavelength-number": 3,
-                    "zToA-min-frequency": 195.975,
-                    "zToA-max-frequency": 196.02499999999998,
-                    "modulation-format": "dp-qpsk"
+    "pathdescription-stub:path-description": {
+        "zToA-direction": {
+            "rate": 100,
+            "zToA": [
+                {
+                    "id": "0",
+                    "resource": {
+                            "tp-node-id": "ROADM-C1-SRG1",
+                            "tp-id": "SRG1-PP1-TXRX"
+                    }
                 },
-                "aToZ-direction": {
-                    "aToZ": [
-                        {
-                            "id": "0",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-SRG1",
-                                "tp-id": "SRG1-PP1-RX"
-                            }
-                        },
-                        {
-                            "id": "1",
-                            "resource": {
-                                "node-id": "ROADM-A1-SRG1"
-                            }
-                        },
-                        {
-                            "id": "2",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-SRG1",
-                                "tp-id": "SRG1-CP-TX"
-                            }
-                        },
-                        {
-                            "id": "14",
-                            "resource": {
-                                "tp-node-id": "OpenROADM-2-2-SRG1",
-                                "tp-id": "SRG1-PP1-TX"
-                            }
-                        },
-                        {
-                            "id": "10",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-DEG1",
-                                "tp-id": "DEG1-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "11",
-                            "resource": {
-                                "link-id": "ROADM-C1-DEG1-DEG1-CTP-TXRXtoROADM-C1-SRG1-SRG1-CP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "12",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-SRG1",
-                                "tp-id": "SRG1-CP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "13",
-                            "resource": {
-                                "node-id": "ROADM-C1-SRG1"
-                            }
-                        },
-                        {
-                            "id": "14",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-SRG1",
-                                "tp-id": "SRG1-PP1-TXRX"
-                            }
-                        },
-                        {
-                            "id": "3",
-                            "resource": {
-                                "link-id": "ROADM-A1-SRG1-SRG1-CP-TXRXtoROADM-A1-DEG2-DEG2-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "4",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-DEG2",
-                                "tp-id": "DEG2-CTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "5",
-                            "resource": {
-                                "node-id": "ROADM-A1-DEG2"
-                            }
-                        },
-                        {
-                            "id": "6",
-                            "resource": {
-                                "tp-node-id": "ROADM-A1-DEG2",
-                                "tp-id": "DEG2-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "7",
-                            "resource": {
-                                "link-id": "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "8",
-                            "resource": {
-                                "tp-node-id": "ROADM-C1-DEG1",
-                                "tp-id": "DEG1-TTP-TXRX"
-                            }
-                        },
-                        {
-                            "id": "9",
-                            "resource": {
-                                "node-id": "ROADM-C1-DEG1"
-                            }
-                        }
-                    ],
-                    "aToZ-min-frequency": 195.075,
-                    "aToZ-max-frequency": 196.125,
-                    "rate": 100,
-                    "aToZ-wavelength-number": 1,
-                    "modulation-format": "dp-qpsk"
+                {
+                    "id": "1",
+                    "resource": {
+                            "node-id": "ROADM-C1-SRG1"
+                    }
+                },
+                {
+                    "id": "2",
+                    "resource": {
+                            "tp-node-id": "ROADM-C1-SRG1",
+                            "tp-id": "SRG1-CP-TXRX"
+                    }
+                },
+                {
+                    "id": "3",
+                    "resource": {
+                            "link-id": "ROADM-C1-SRG1-SRG1-CP-TXRXtoROADM-C1-DEG1-DEG1-CTP-TXRX"
+                    }
+                },
+                {
+                    "id": "4",
+                    "resource": {
+                            "tp-node-id": "ROADM-C1-DEG1",
+                            "tp-id": "DEG1-CTP-TXRX"
+                    }
+                },
+                {
+                    "id": "5",
+                    "resource": {
+                            "node-id": "ROADM-C1-DEG1"
+                    }
+                },
+                {
+                    "id": "6",
+                    "resource": {
+                            "tp-node-id": "ROADM-C1-DEG1",
+                            "tp-id": "DEG1-TTP-TXRX"
+                    }
+                },
+                {
+                    "id": "7",
+                    "resource": {
+                            "link-id": "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX"
+                    }
+                },
+                {
+                    "id": "8",
+                    "resource": {
+                            "tp-node-id": "ROADM-A1-DEG2",
+                            "tp-id": "DEG2-TTP-TXRX"
+                    }
+                },
+                {
+                    "id": "9",
+                    "resource": {
+                            "node-id": "ROADM-A1-DEG2"
+                    }
+                },
+                {
+                    "id": "10",
+                    "resource": {
+                            "tp-node-id": "ROADM-A1-DEG2",
+                            "tp-id": "DEG2-CTP-TXRX"
+                    }
+                },
+                {
+                    "id": "11",
+                    "resource": {
+                            "link-id": "ROADM-A1-DEG2-DEG2-CTP-TXRXtoROADM-A1-SRG1-SRG1-CP-TXRX"
+                    }
+                },
+                {
+                    "id": "12",
+                    "resource": {
+                            "tp-node-id": "ROADM-A1-SRG1",
+                            "tp-id": "SRG1-CP-TXRX"
+                    }
+                },
+                {
+                    "id": "13",
+                    "resource": {
+                            "node-id": "ROADM-A1-SRG1"
+                    }
+                },
+                {
+                    "id": "14",
+                    "resource": {
+                            "tp-node-id": "ROADM-A1-SRG1",
+                            "tp-id": "SRG1-PP1-TXRX"
+                        }
                 }
+            ],
+            "zToA-wavelength-number": 1,
+            "zToA-min-frequency": 196.075,
+            "zToA-max-frequency": 196.125,
+            "modulation-format": "dp-qpsk"
+        },
+            "aToZ-direction": {
+                "aToZ": [
+                    {
+                        "id": "0",
+                        "resource": {
+                            "tp-node-id": "ROADM-A1-SRG1",
+                            "tp-id": "SRG1-PP1-TXRX"
+                        }
+                    },
+                    {
+                        "id": "1",
+                        "resource": {
+                            "node-id": "ROADM-A1-SRG1"
+                        }
+                    },
+                    {
+                        "id": "2",
+                        "resource": {
+                            "tp-node-id": "ROADM-A1-SRG1",
+                            "tp-id": "SRG1-CP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "14",
+                        "resource": {
+                            "tp-node-id": "OpenROADM-2-2-SRG1",
+                            "tp-id": "SRG1-PP1-TX"
+                        }
+                    },
+                    {
+                        "id": "10",
+                        "resource": {
+                            "tp-node-id": "ROADM-C1-DEG1",
+                            "tp-id": "DEG1-CTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "11",
+                        "resource": {
+                            "link-id": "ROADM-C1-DEG1-DEG1-CTP-TXRXtoROADM-C1-SRG1-SRG1-CP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "12",
+                        "resource": {
+                            "tp-node-id": "ROADM-C1-SRG1",
+                            "tp-id": "SRG1-CP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "13",
+                        "resource": {
+                            "node-id": "ROADM-C1-SRG1"
+                        }
+                    },
+                    {
+                        "id": "14",
+                        "resource": {
+                            "tp-node-id": "ROADM-C1-SRG1",
+                            "tp-id": "SRG1-PP1-TXRX"
+                        }
+                    },
+                    {
+                        "id": "3",
+                        "resource": {
+                            "link-id": "ROADM-A1-SRG1-SRG1-CP-TXRXtoROADM-A1-DEG2-DEG2-CTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "4",
+                        "resource": {
+                            "tp-node-id": "ROADM-A1-DEG2",
+                            "tp-id": "DEG2-CTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "5",
+                        "resource": {
+                            "node-id": "ROADM-A1-DEG2"
+                        }
+                    },
+                    {
+                        "id": "6",
+                        "resource": {
+                            "tp-node-id": "ROADM-A1-DEG2",
+                            "tp-id": "DEG2-TTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "7",
+                        "resource": {
+                            "link-id": "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "8",
+                        "resource": {
+                            "tp-node-id": "ROADM-C1-DEG1",
+                            "tp-id": "DEG1-TTP-TXRX"
+                        }
+                    },
+                    {
+                        "id": "9",
+                        "resource": {
+                            "node-id": "ROADM-C1-DEG1"
+                        }
+                    }
+                ],
+                "aToZ-min-frequency": 196.075,
+                "aToZ-max-frequency": 196.125,
+                "rate": 100,
+                "aToZ-wavelength-number": 1,
+                "modulation-format": "dp-qpsk"
             }
-    }
+        }
+}
\ No newline at end of file
diff --git a/test-common/src/main/yang/path-description-stub@2020-12-11.yang b/test-common/src/main/yang/path-description-stub@2020-12-11.yang
new file mode 100644 (file)
index 0000000..60cad83
--- /dev/null
@@ -0,0 +1,24 @@
+module pathdescription-stub {
+  yang-version 1;
+  namespace "pathdescription-stub";
+  prefix pathdescription-stub;
+
+  import transportpce-pathDescription {
+    prefix transportpce-pathDescription;
+       revision-date 2020-11-26;
+  }
+
+  description
+    "YANG model for providing path-description through data container for testing purpose";
+
+  revision 2020-12-11 {
+    description
+      "first version";
+    reference
+      "YANG model for providing path-description through data container for testing purpose";
+  }
+
+  container path-description {
+    uses transportpce-pathDescription:path-description;
+  }
+}