summaryrefslogtreecommitdiffstats
path: root/sample-apps
diff options
context:
space:
mode:
Diffstat (limited to 'sample-apps')
-rw-r--r--sample-apps/pom.xml55
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssAppsExcuter.java55
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssExcuter.java305
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadA.java328
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadB.java328
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncConverter.java186
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java30
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/EthSrv.java2
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/LtpId.java10
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OduResource.java8
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OtnNetwork.java43
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsEthSrv.java9
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsLink.java2
-rw-r--r--sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsTunnel.java11
-rw-r--r--sample-apps/src/test/java/org/onap/protocol/restconf/ctl/SampleAppTest.java322
15 files changed, 1597 insertions, 97 deletions
diff --git a/sample-apps/pom.xml b/sample-apps/pom.xml
index dab5311..f85a80f 100644
--- a/sample-apps/pom.xml
+++ b/sample-apps/pom.xml
@@ -24,10 +24,11 @@
<groupId>org.onap.integration.ietf-actn-tools</groupId>
<artifactId>sample-apps</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>sample-app</name>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
+ <slf4j.version>1.7.21</slf4j.version>
+ <yang-tool-version>2.6.1</yang-tool-version>
</properties>
<dependencies>
<dependency>
@@ -39,6 +40,58 @@
<groupId>org.onap.integration.ietf-actn-tools</groupId>
<artifactId>actn-client</artifactId>
<version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.integration.ietf-actn-tools</groupId>
+ <artifactId>globalapi</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.integration.ietf-actn-tools</groupId>
+ <artifactId>globalapp</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.integration.ietf-actn-tools</groupId>
+ <artifactId>yang-utils</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.integration.ietf-actn-tools</groupId>
+ <artifactId>restconf-client-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>22.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-model</artifactId>
+ <version>${yang-tool-version}</version>
</dependency>
</dependencies>
</project>
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssAppsExcuter.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssAppsExcuter.java
new file mode 100644
index 0000000..b624090
--- /dev/null
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssAppsExcuter.java
@@ -0,0 +1,55 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Actn Interface Tools
+ * ================================================================================
+ * Copyright (C) 2023 Huawei Canada Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.integration.actninterfacetools.sampleapp.mpiconverter;
+
+
+import org.onap.integration.actninterfacetools.globalapp.impl.GlobalServiceImpl;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * In Order to test Multiple OSS Apps using OSS ACTN SDK in the same time
+ */
+public class OssAppsExcuter {
+ GlobalServiceImpl globalService;
+ public static void main(String[] args) throws InterruptedException {
+ usingCountDownLatch();
+ }
+ private static void usingCountDownLatch() throws InterruptedException {
+ System.out.println("===============================================");
+ System.out.println(" >>> Using CountDownLatch <<<<");
+ System.out.println("===============================================");
+
+ CountDownLatch latch = new CountDownLatch(1);
+
+ OssWorkThreadA ossWorkThreadA = new OssWorkThreadA("OssWorkThreadA", latch);
+ OssWorkThreadB ossWorkThreadB = new OssWorkThreadB("OssWorkThreadB", latch);
+
+ ossWorkThreadA.start();
+ ossWorkThreadB.start();
+
+ Thread.sleep(10);//simulation of some actual work
+
+ System.out.println("-----------------------------------------------");
+ System.out.println(" Now release the latch:");
+ System.out.println("-----------------------------------------------");
+ latch.countDown();
+}
+}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssExcuter.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssExcuter.java
new file mode 100644
index 0000000..1d19526
--- /dev/null
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssExcuter.java
@@ -0,0 +1,305 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Actn Interface Tools
+ * ================================================================================
+ * Copyright (C) 2023 Huawei Canada Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.integration.actninterfacetools.sampleapp.mpiconverter;
+
+import com.google.common.net.InetAddresses;
+import org.onap.integration.actninterfacetools.globalapi.ActnDataConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.globalapi.PncClient;
+import org.onap.integration.actninterfacetools.globalapi.GlobalService;
+import org.onap.integration.actninterfacetools.globalapi.ActnClientService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
+import org.onap.integration.actninterfacetools.protocol.restconf.DefaultPncInstance;
+import org.onap.integration.actninterfacetools.protocol.restconf.PncInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter.PncConverter;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LTPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LtpId;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TeNodeKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLink;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduResource;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvAccessPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvEndPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsEthSrv;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+public class OssExcuter {
+ private static final Logger log = LoggerFactory.getLogger(OssExcuter.class);
+ public static void main(String[] args) throws Exception {
+ PncInstance pncInstanceA = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 18181, null, null, "http", null);
+ PncInstance pncInstanceB = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 28181, null, null, "http", null);
+ ActnDataConverter actnDataConverter = new PncConverter();
+ ActnClientService actnClientService = GlobalService.getActnClientSvc(actnDataConverter);
+ PncClient pncClientA = actnClientService.getPncClient(pncInstanceA);
+ PncClient pncClientB = actnClientService.getPncClient(pncInstanceB);
+ testGetOtnTopology(pncClientA, pncClientB);
+ }
+
+ public static void testGetOtnTopology(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTopology customerOtnTopology = pncClientA.getNetworkTopology("providerId-10-clientId-0-topologyId-1");
+ log.info("pncA: " + customerOtnTopology.toString());
+ CustomerOtnTopology customerOtnTopologyB = pncClientB.getNetworkTopology("providerId-20-clientId-0-topologyId-1");
+ log.info("pncB: " + customerOtnTopologyB.toString());
+ }
+
+ public static void testGetOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel otnTunnel = pncClientA.getOtnTunnel("otntunnel-1");
+ log.info("pncA: " + otnTunnel.toString());
+ CustomerOtnTunnel otnTunnelB = pncClientB.getOtnTunnel("otntunnel-1");
+ log.info("pncB: " + otnTunnelB.toString());
+ }
+
+ public static void testCreateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = buildTeOtnTunnel("otntunnel-1");
+ pncClientA.createOtnTunnel(customerOtnTunnel);
+ CustomerOtnTunnel customerOtnTunnelB = buildTeOtnTunnel2("otntunnel-1");
+ pncClientB.createOtnTunnel(customerOtnTunnelB);
+ }
+
+ public static void testDeleteOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteOtnTunnel("otntunnel-1");
+ pncClientB.deleteOtnTunnel("otntunnel-1");
+ }
+
+ public static void testUpdateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = updateTeOtnTunnel("otntunnel-1");
+ pncClientA.updateOtnTunnel(customerOtnTunnel, "otntunnel-1");
+ CustomerOtnTunnel customerOtnTunnelB = updateTeOtnTunnel2("otntunnel-1");
+ pncClientB.updateOtnTunnel(customerOtnTunnelB, "otntunnel-1");
+ }
+
+ public static void testGetEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService ethService = pncClientA.getEthService("cll-instance-01");
+ log.info("pncA: " + ethService.toString());
+ CustomerEthService ethServiceB = pncClientB.getEthService("cll-instance-01");
+ log.info("pncB: " + ethServiceB.toString());
+ }
+
+ public static void testCreateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = buildTeEthSrv("cll-instance-01");
+ pncClientA.createEthService(customerEthService);
+ CustomerEthService customerEthServiceB = buildTeEthSrv2("cll-instance-01");
+ pncClientB.createEthService(customerEthServiceB);
+ }
+
+ public static void testDeleteEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteEthService("cll-instance-01");
+ pncClientB.deleteEthService("cll-instance-01");
+ }
+
+ public static void testUpdateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = updateTeEthSrv("cll-instance-01");
+ pncClientA.updateEthService(customerEthService);
+ CustomerEthService customerEthServiceB = updateTeEthSrv2("cll-instance-01");
+ pncClientB.updateEthService(customerEthServiceB);
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "MTI=");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "MJI=");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService buildTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService buildTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 20, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+ public static CustomerOtnTunnel updateTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "13");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService updateTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsD = new ArrayList<>();
+ ethSrvAccessPointsD.add(new EthSrvAccessPoint("0", "10.1.1.4", 1000001));
+ EthSrvEndPoint ethSrvEndPointD = new EthSrvEndPoint("uni-04", ethSrvAccessPointsC, 50, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ ethSrvEndPoints.add(ethSrvEndPointD);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.2.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadA.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadA.java
new file mode 100644
index 0000000..84127f4
--- /dev/null
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadA.java
@@ -0,0 +1,328 @@
+
+/*
+ * ============LICENSE_START=======================================================
+ * Actn Interface Tools
+ * ================================================================================
+ * Copyright (C) 2023 Huawei Canada Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.integration.actninterfacetools.sampleapp.mpiconverter;
+
+import com.google.common.net.InetAddresses;
+import org.onap.integration.actninterfacetools.globalapi.ActnDataConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.globalapi.PncClient;
+import org.onap.integration.actninterfacetools.globalapi.GlobalService;
+import org.onap.integration.actninterfacetools.globalapi.ActnClientService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
+import org.onap.integration.actninterfacetools.globalapp.impl.GlobalServiceImpl;
+import org.onap.integration.actninterfacetools.protocol.restconf.DefaultPncInstance;
+import org.onap.integration.actninterfacetools.protocol.restconf.PncInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter.PncConverter;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LTPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LtpId;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TeNodeKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLink;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduResource;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvAccessPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvEndPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsEthSrv;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.math.BigInteger;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+public class OssWorkThreadA extends Thread {
+ private CountDownLatch latch;
+ GlobalServiceImpl globalService;
+ private static final Logger log = LoggerFactory.getLogger(OssWorkThreadA.class);
+
+ public OssWorkThreadA(String name, CountDownLatch latch) {
+ this.latch = latch;
+ setName(name);
+ }
+
+ @Override
+ public void run() {
+ try {
+ System.out.printf("[ %s ] created, blocked by the latch...\n", getName());
+ latch.await();
+ System.out.printf("[ %s ] starts at: %s\n", getName(), Instant.now());
+ // do actual work here...
+ PncInstance pncInstanceA = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 18181, null, null, "http", null);
+ PncInstance pncInstanceB = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 28181, null, null, "http", null);
+ ActnDataConverter actnDataConverter = new PncConverter();
+ ActnClientService actnClientService = GlobalService.getActnClientSvc(actnDataConverter);
+ PncClient pncClientA = actnClientService.getPncClient(pncInstanceA);
+ PncClient pncClientB = actnClientService.getPncClient(pncInstanceB);
+ testGetOtnTopology(pncClientA, pncClientB);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testGetOtnTopology(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTopology customerOtnTopology = pncClientA.getNetworkTopology("providerId-10-clientId-0-topologyId-1");
+ log.info("pncA: " + customerOtnTopology.toString());
+ CustomerOtnTopology customerOtnTopologyB = pncClientB.getNetworkTopology("providerId-20-clientId-0-topologyId-1");
+ log.info("pncB: " + customerOtnTopologyB.toString());
+ }
+
+ public void testGetOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel otnTunnel = pncClientA.getOtnTunnel("otntunnel-1");
+ log.info("pncA: " + otnTunnel.toString());
+ CustomerOtnTunnel otnTunnelB = pncClientB.getOtnTunnel("otntunnel-1");
+ log.info("pncB: " + otnTunnelB.toString());
+ }
+
+ public void testCreateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = buildTeOtnTunnel("otntunnel-1");
+ pncClientA.createOtnTunnel(customerOtnTunnel);
+ CustomerOtnTunnel customerOtnTunnelB = buildTeOtnTunnel2("otntunnel-1");
+ pncClientB.createOtnTunnel(customerOtnTunnelB);
+ }
+
+ public void testDeleteOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteOtnTunnel("otntunnel-1");
+ pncClientB.deleteOtnTunnel("otntunnel-1");
+ }
+
+ public void testUpdateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = updateTeOtnTunnel("otntunnel-1");
+ pncClientA.updateOtnTunnel(customerOtnTunnel, "otntunnel-1");
+ CustomerOtnTunnel customerOtnTunnelB = updateTeOtnTunnel2("otntunnel-1");
+ pncClientB.updateOtnTunnel(customerOtnTunnelB, "otntunnel-1");
+ }
+
+ public void testGetEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService ethService = pncClientA.getEthService("cll-instance-01");
+ log.info("pncA: " + ethService.toString());
+ CustomerEthService ethServiceB = pncClientB.getEthService("cll-instance-01");
+ log.info("pncB: " + ethServiceB.toString());
+ }
+
+ public void testCreateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = buildTeEthSrv("cll-instance-01");
+ pncClientA.createEthService(customerEthService);
+ CustomerEthService customerEthServiceB = buildTeEthSrv2("cll-instance-01");
+ pncClientB.createEthService(customerEthServiceB);
+ }
+
+ public void testDeleteEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteEthService("cll-instance-01");
+ pncClientB.deleteEthService("cll-instance-01");
+ }
+
+ public void testUpdateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = updateTeEthSrv("cll-instance-01");
+ pncClientA.updateEthService(customerEthService);
+ CustomerEthService customerEthServiceB = updateTeEthSrv2("cll-instance-01");
+ pncClientB.updateEthService(customerEthServiceB);
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "13");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService buildTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService buildTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 20, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "13");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService updateTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsD = new ArrayList<>();
+ ethSrvAccessPointsD.add(new EthSrvAccessPoint("0", "10.1.1.4", 1000001));
+ EthSrvEndPoint ethSrvEndPointD = new EthSrvEndPoint("uni-04", ethSrvAccessPointsC, 50, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ ethSrvEndPoints.add(ethSrvEndPointD);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.2.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadB.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadB.java
new file mode 100644
index 0000000..f4eb746
--- /dev/null
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/OssWorkThreadB.java
@@ -0,0 +1,328 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Actn Interface Tools
+ * ================================================================================
+ * Copyright (C) 2023 Huawei Canada Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.integration.actninterfacetools.sampleapp.mpiconverter;
+
+import com.google.common.net.InetAddresses;
+import org.onap.integration.actninterfacetools.globalapi.ActnDataConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.globalapi.PncClient;
+import org.onap.integration.actninterfacetools.globalapi.GlobalService;
+import org.onap.integration.actninterfacetools.globalapi.ActnClientService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
+import org.onap.integration.actninterfacetools.globalapp.impl.GlobalServiceImpl;
+import org.onap.integration.actninterfacetools.protocol.restconf.DefaultPncInstance;
+import org.onap.integration.actninterfacetools.protocol.restconf.PncInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter.PncConverter;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LTPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LtpId;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TeNodeKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLink;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduResource;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvAccessPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvEndPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsEthSrv;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.math.BigInteger;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+public class OssWorkThreadB extends Thread {
+ private CountDownLatch latch;
+ GlobalServiceImpl globalService;
+ private static final Logger log = LoggerFactory.getLogger(OssWorkThreadA.class);
+
+ public OssWorkThreadB(String name, CountDownLatch latch) {
+ this.latch = latch;
+ setName(name);
+ }
+
+ @Override
+ public void run() {
+ try {
+ System.out.printf("[ %s ] created, blocked by the latch...\n", getName());
+ latch.await();
+ System.out.printf("[ %s ] starts at: %s\n", getName(), Instant.now());
+ // do actual work here...
+ PncInstance pncInstanceA = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 18181, null, null, "http", null);
+ PncInstance pncInstanceB = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 28181, null, null, "http", null);
+ ActnDataConverter actnDataConverter = new PncConverter();
+ ActnClientService actnClientService = GlobalService.getActnClientSvc(actnDataConverter);
+ PncClient pncClientA = actnClientService.getPncClient(pncInstanceA);
+ PncClient pncClientB = actnClientService.getPncClient(pncInstanceB);
+ testGetOtnTopology(pncClientA, pncClientB);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testGetOtnTopology(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTopology customerOtnTopology = pncClientA.getNetworkTopology("providerId-10-clientId-0-topologyId-1");
+ log.info("pncA: " + customerOtnTopology.toString());
+ CustomerOtnTopology customerOtnTopologyB = pncClientB.getNetworkTopology("providerId-20-clientId-0-topologyId-1");
+ log.info("pncB: " + customerOtnTopologyB.toString());
+ }
+
+ public void testGetOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel otnTunnel = pncClientA.getOtnTunnel("otntunnel-1");
+ log.info("pncA: " + otnTunnel.toString());
+ CustomerOtnTunnel otnTunnelB = pncClientB.getOtnTunnel("otntunnel-1");
+ log.info("pncB: " + otnTunnelB.toString());
+ }
+
+ public void testCreateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = buildTeOtnTunnel("otntunnel-1");
+ pncClientA.createOtnTunnel(customerOtnTunnel);
+ CustomerOtnTunnel customerOtnTunnelB = buildTeOtnTunnel2("otntunnel-1");
+ pncClientB.createOtnTunnel(customerOtnTunnelB);
+ }
+
+ public void testDeleteOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteOtnTunnel("otntunnel-1");
+ pncClientB.deleteOtnTunnel("otntunnel-1");
+ }
+
+ public void testUpdateOtnTunnel(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = updateTeOtnTunnel("otntunnel-1");
+ pncClientA.updateOtnTunnel(customerOtnTunnel, "otntunnel-1");
+ CustomerOtnTunnel customerOtnTunnelB = updateTeOtnTunnel2("otntunnel-1");
+ pncClientB.updateOtnTunnel(customerOtnTunnelB, "otntunnel-1");
+ }
+
+ public void testGetEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService ethService = pncClientA.getEthService("cll-instance-01");
+ log.info("pncA: " + ethService.toString());
+ CustomerEthService ethServiceB = pncClientB.getEthService("cll-instance-01");
+ log.info("pncB: " + ethServiceB.toString());
+ }
+
+ public void testCreateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = buildTeEthSrv("cll-instance-01");
+ pncClientA.createEthService(customerEthService);
+ CustomerEthService customerEthServiceB = buildTeEthSrv2("cll-instance-01");
+ pncClientB.createEthService(customerEthServiceB);
+ }
+
+ public void testDeleteEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ pncClientA.deleteEthService("cll-instance-01");
+ pncClientB.deleteEthService("cll-instance-01");
+ }
+
+ public void testUpdateEthSvc(PncClient pncClientA, PncClient pncClientB) throws Exception {
+ CustomerEthService customerEthService = updateTeEthSrv("cll-instance-01");
+ pncClientA.updateEthService(customerEthService);
+ CustomerEthService customerEthServiceB = updateTeEthSrv2("cll-instance-01");
+ pncClientB.updateEthService(customerEthServiceB);
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 3);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 3);
+ LtpId dstLtpId = LtpId.ltpId(0, "8");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 3);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 3);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 3);
+ LtpId dstLtpId = LtpId.ltpId(0, "8");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 3);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService buildTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService buildTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 20, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsD = new ArrayList<>();
+ ethSrvAccessPointsD.add(new EthSrvAccessPoint("0", "10.1.1.4", 1000001));
+ EthSrvEndPoint ethSrvEndPointD = new EthSrvEndPoint("uni-04", ethSrvAccessPointsC, 50, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ ethSrvEndPoints.add(ethSrvEndPointD);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.2.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncConverter.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncConverter.java
index 7a8b4a7..1f7de9f 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncConverter.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncConverter.java
@@ -19,12 +19,25 @@
*/
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter;
-import org.onap.integration.actninterfacetools.actnclient.api.ActnDataConverter;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerEthService;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerOtnTopology;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerOtnTunnel;
-import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.*;
+import org.onap.integration.actninterfacetools.globalapi.ActnDataConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LTPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LtpId;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TeNodeKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLink;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduResource;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvAccessPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvEndPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsEthSrv;
import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduType;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsNodeInfo;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.PncOtnBandwidthProfile;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLinkKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OtnNetwork;
import org.onosproject.yang.gen.v1.ietfyangtypes.rev20210414.ietfyangtypes.DottedQuad;
import org.onosproject.yang.gen.v1.ietfyangtypes.rev20210414.ietfyangtypes.HexString;
import org.onosproject.yang.gen.v11.ietfethtranservice.rev20210111.ietfethtranservice.DefaultEthtSvc;
@@ -54,11 +67,26 @@ import org.onosproject.yang.gen.v11.ietfethtranservice.rev20210111.ietfethtranse
import org.onosproject.yang.gen.v11.ietfethtranservice.rev20210111.ietfethtranservice.resiliencegrouping.Resilience;
import org.onosproject.yang.gen.v11.ietfethtranservice.rev20210111.ietfethtranservice.vlanclassification.individualbundlingvlan.DefaultIndividualVlan;
import org.onosproject.yang.gen.v11.ietfethtranservice.rev20210111.ietfethtranservice.vlanclassification.individualbundlingvlan.IndividualVlan;
-import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.*;
-import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.*;
-import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlabelstep.RangeType;
-import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlabelstep.rangetype.DefaultTribPort;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.ServiceTypeTypedef;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.RmpSvc;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.VlanClassification;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.EthTagClassify;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.ClassifyCvlan;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.Vlanid;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.BandwidthProfileTypeTypedef;
+import org.onosproject.yang.gen.v11.ietfethtrantypes.rev20191103.ietfethtrantypes.Mef10Bwp;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.OtnTpn;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Oduflex;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu0;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu1;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu2;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu2e;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu3;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.Odu4;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlabelstartend.RangeType;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlabelstartend.rangetype.DefaultTribPort;
import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlinkbandwidth.Odulist;
+import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnpathbandwidth.Otn;
import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnpathbandwidth.otn.oduflextype.DefaultGfpNk;
import org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnpathbandwidth.otn.oduflextype.GfpNk;
import org.onosproject.yang.gen.v11.ietfte.rev20210220.ietfte.pathconstraintscommon.DefaultPathOutSegment;
@@ -70,7 +98,14 @@ import org.onosproject.yang.gen.v11.ietfte.rev20210220.ietfte.tunnelproperties.P
import org.onosproject.yang.gen.v11.ietfte.rev20210220.ietfte.tunnelproperties.primarypaths.DefaultPrimaryPath;
import org.onosproject.yang.gen.v11.ietfte.rev20210220.ietfte.tunnelproperties.primarypaths.PrimaryPath;
import org.onosproject.yang.gen.v11.ietfte.rev20210220.ietfte.tunnelsgrouping.tunnels.DefaultTunnel;
-import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.*;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.TeNodeId;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.LspEncodingOduk;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.SwitchingOtn;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.TunnelAdminStateUp;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.LspProtectionUnprotected;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.TeGlobalId;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.TeTopologyId;
+import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.TeTpId;
import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.labelrestrictioninfo.DefaultLabelStart;
import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.labelrestrictioninfo.LabelStart;
import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.labelsetinfo.DefaultLabelRestrictions;
@@ -113,9 +148,12 @@ import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.tetopolo
import org.onosproject.yang.gen.v11.ietftetypes.rev20200610.ietftetypes.tetpid.TeTpIdUnion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.math.BigInteger;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.Link.State.ACTIVE;
@@ -136,14 +174,16 @@ public class PncConverter extends ActnDataConverter {
public CustomerOtnTunnel convertActnOtnTunnel(DefaultTunnel actnOtnTunnel) throws Exception {
checkNotNull(actnOtnTunnel, "convertActnOtnTunnel: actnOtnTunnel is null");
- TeNodeKey srcNode = (actnOtnTunnel.srcTunnelTpId() != null && !(new String(actnOtnTunnel.srcTunnelTpId())).isEmpty()) ? TeNodeKey.of(actnOtnTunnel.source().toString()) : new TeNodeKey(-1, -1, -1, -1);
- LtpId srcLtpId = (actnOtnTunnel.srcTunnelTpId() != null && !(new String(actnOtnTunnel.srcTunnelTpId())).isEmpty()) ? LtpId.ltpId(actnOtnTunnel.srcTunnelTpId().toString()) : LtpId.ltpId(-1);
+ TeNodeKey srcNode = (actnOtnTunnel.source() != null && actnOtnTunnel.source().dottedQuad().string() != "") ? TeNodeKey.of(actnOtnTunnel.source().toString()) : new TeNodeKey(-1, -1, -1, -1);
+ LtpId srcLtpId = (actnOtnTunnel.srcTunnelTpId() != null && !(new String(actnOtnTunnel.srcTunnelTpId())).isEmpty()) ? LtpId.ltpId1(PncUtils.byteArray2Long(actnOtnTunnel.srcTunnelTpId()), new String(actnOtnTunnel.srcTunnelTpId())) : LtpId.ltpId(-1);
+ //PncUtils.byteArray2Long(actnOtnTunnel.srcTunnelTpId())
LTPoint srcLtPoint = new LTPoint(srcNode, srcLtpId);
- TsLink srcLink = new TsLink("defaultSrcId",srcLtPoint,srcLtPoint, ACTIVE, org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.Link.Type.REGULAR);
- TeNodeKey dstNode = (actnOtnTunnel.dstTunnelTpId() != null && !(new String(actnOtnTunnel.dstTunnelTpId())).isEmpty()) ? TeNodeKey.of(actnOtnTunnel.destination().toString()) : new TeNodeKey(-1, -1, -1, -1);
- LtpId dstLtpId = (actnOtnTunnel.dstTunnelTpId() != null && !(new String(actnOtnTunnel.dstTunnelTpId())).isEmpty()) ? LtpId.ltpId(actnOtnTunnel.dstTunnelTpId().toString()) : LtpId.ltpId(-1);
+ TsLink srcLink = new TsLink("defaultSrcId", srcLtPoint, srcLtPoint, ACTIVE, org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.Link.Type.REGULAR);
+ TeNodeKey dstNode = (actnOtnTunnel.destination() != null && actnOtnTunnel.destination().dottedQuad().string() != "") ? TeNodeKey.of(actnOtnTunnel.destination().toString()) : new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = (actnOtnTunnel.dstTunnelTpId() != null && !(new String(actnOtnTunnel.dstTunnelTpId())).isEmpty()) ? LtpId.ltpId1(PncUtils.byteArray2Long(actnOtnTunnel.dstTunnelTpId()), new String(actnOtnTunnel.dstTunnelTpId())) : LtpId.ltpId(-1);
+ //PncUtils.byteArray2Long(actnOtnTunnel.dstTunnelTpId())
LTPoint dstLtPoint = new LTPoint(dstNode, dstLtpId);
- TsLink dstLink = new TsLink("defaultDstId",dstLtPoint,dstLtPoint, ACTIVE, org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.Link.Type.REGULAR);
+ TsLink dstLink = new TsLink("defaultDstId", dstLtPoint, dstLtPoint, ACTIVE, org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.Link.Type.REGULAR);
List<TsLink> linkList = new ArrayList<>();
linkList.add(srcLink);
linkList.add(dstLink);
@@ -152,34 +192,36 @@ public class PncConverter extends ActnDataConverter {
actnOtnTunnel.teBandwidth().technology() instanceof org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.
ietfotntunnel.te.tunnels.tunnel.tebandwidth.technology.augmentedtetechnology.DefaultOtn) {
TeBandwidth teBandwidth = actnOtnTunnel.teBandwidth();
- OduResource oduRsrce = teBandwidthToOduResource(teBandwidth);
+ OduResource oduRsrce = teBandwidth2OduResource(teBandwidth);
tsTunnel.bw(oduRsrce);
} else {
log.warn("Missing valid tunnel bandwidth info inside Otn DefaultTunnel");
}
return tsTunnel;
}
+
public DefaultTunnel convertActnOtnTunnel(CustomerOtnTunnel customerOtnTunnel) throws Exception {
checkNotNull(customerOtnTunnel, "convertActnOtnTunnel: customerOtnTunnel is null");
DefaultTunnel defaultTunnel = new DefaultTunnel();
- LTPoint src = ((TsTunnel)customerOtnTunnel).src();
- LTPoint dst = ((TsTunnel)customerOtnTunnel).dst();
+ LTPoint src = ((TsTunnel) customerOtnTunnel).src();
+ LTPoint dst = ((TsTunnel) customerOtnTunnel).dst();
TeNodeKey srcTeNodeKey = src.tsDeviceId();
TeNodeKey dstTeNodeKey = dst.tsDeviceId();
String srcTeNodeId = srcTeNodeKey.toString();
String dstTeNodeId = dstTeNodeKey.toString();
defaultTunnel.source(TeNodeId.fromString(srcTeNodeId));
defaultTunnel.destination(TeNodeId.fromString(dstTeNodeId));
- defaultTunnel.srcTunnelTpId(src.ltPointId().toString().getBytes());
- defaultTunnel.name(((TsTunnel)customerOtnTunnel).name());
+ defaultTunnel.dstTunnelTpId(dst.ltPointId().toString().getBytes());
+ String a = new String(dst.ltPointId().toString().getBytes());
+ defaultTunnel.name(((TsTunnel) customerOtnTunnel).name());
org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnpathbandwidth.Otn layer1Otn = new org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnpathbandwidth.DefaultOtn();
GfpNk oduflexType = new DefaultGfpNk();
- oduflexType.gfpn((short) ((TsTunnel)customerOtnTunnel).bw().getNumberOfOdu(OduType.ODUFLEX));
+ oduflexType.gfpn((short) ((TsTunnel) customerOtnTunnel).bw().getNumberOfOdu(OduType.ODUFLEX));
layer1Otn.oduType(Oduflex.class);
layer1Otn.oduflexType(oduflexType);
Technology otn = new org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.tebandwidth.technology.augmentedtetechnology.DefaultOtn();
- ((org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.tebandwidth.technology.augmentedtetechnology.DefaultOtn)otn).otn(layer1Otn);
+ ((org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.tebandwidth.technology.augmentedtetechnology.DefaultOtn) otn).otn(layer1Otn);
TeBandwidth teBandwidth = new DefaultTeBandwidth();
teBandwidth.technology(otn);
defaultTunnel.teBandwidth(teBandwidth);
@@ -210,11 +252,12 @@ public class PncConverter extends ActnDataConverter {
org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.primarypaths.primarypath.pathinsegment.labelrestrictions.labelrestriction.labelstart.telabel.technology.augmentedtetechnology.DefaultOtn otnTpnTech = new org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.primarypaths.primarypath.pathinsegment.labelrestrictions.labelrestriction.labelstart.telabel.technology.augmentedtetechnology.DefaultOtn();
OtnTpn otnTpn = new OtnTpn(1);
RangeType rangeType = new DefaultTribPort();
- ((DefaultTribPort)rangeType).otnTpn(otnTpn);
- otnTpnTech.rangeType((org.onosproject.yang.gen.v11.ietflayer1types.rev20210219.ietflayer1types.otnlabelstartend.RangeType) rangeType);
+ ((DefaultTribPort) rangeType).otnTpn(otnTpn);
+ otnTpnTech.rangeType(rangeType);
teLabel.technology(otnTpnTech);
labelStart.teLabel(teLabel);
labelRestriction.labelStart(labelStart);
+ labelRestrictionList.add(labelRestriction);
labelRestrictions.labelRestriction(labelRestrictionList);
pathOutSegment.labelRestrictions(labelRestrictions);
primaryPath.pathOutSegment(pathOutSegment);
@@ -223,12 +266,13 @@ public class PncConverter extends ActnDataConverter {
defaultTunnel.primaryPaths(primaryPaths);
return defaultTunnel;
}
+
public CustomerEthService convertActnEthService(DefaultEthtSvc actnEthService) throws Exception {
checkNotNull(actnEthService, "convertActnEthService: actnEthService is null");
List<EthtSvcInstances> ethtSvcInstances = actnEthService.ethtSvcInstances();
- if(ethtSvcInstances!=null && !ethtSvcInstances.isEmpty()){
+ if (ethtSvcInstances != null && !ethtSvcInstances.isEmpty()) {
List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
- for(EthtSvcInstances ethtSvcInstance: ethtSvcInstances){
+ for (EthtSvcInstances ethtSvcInstance : ethtSvcInstances) {
String ethtSvcName = ethtSvcInstance.ethtSvcName();
String ethtSvcDescr = ethtSvcInstance.ethtSvcDescr();
TeTopologyIdentifier teTopologyIdentifier = ethtSvcInstance.teTopologyIdentifier();
@@ -236,22 +280,30 @@ public class PncConverter extends ActnDataConverter {
long clientId = teTopologyIdentifier.clientId().uint32();
String topologyId = teTopologyIdentifier.topologyId().union().string();
List<TsTunnel> tsTunnels = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
List<OtnTunnels> otnTunnels = ((DefaultFrameBase) ethtSvcInstance.underlay().technology()).otnTunnels();
- if(otnTunnels!=null && !otnTunnels.isEmpty()){
- for(OtnTunnels otnTunnel : otnTunnels){
- tsTunnels.add(new TsTunnel(null, otnTunnel.name().toString()));
+ if (otnTunnels != null && !otnTunnels.isEmpty()) {
+ for (OtnTunnels otnTunnel : otnTunnels) {
+ tsTunnels.add(new TsTunnel(tsLinkList, otnTunnel.name().toString()));
}
}
List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
List<EthtSvcEndPoints> ethtSvcEndPoints = ethtSvcInstance.ethtSvcEndPoints();
- if(ethtSvcEndPoints!=null && !ethtSvcEndPoints.isEmpty()){
- for (EthtSvcEndPoints ethtSvcEndPoint: ethtSvcEndPoints) {
+ if (ethtSvcEndPoints != null && !ethtSvcEndPoints.isEmpty()) {
+ for (EthtSvcEndPoints ethtSvcEndPoint : ethtSvcEndPoints) {
String ethtSvcEndPointName = ethtSvcEndPoint.ethtSvcEndPointName();
List<EthSrvAccessPoint> ethSrvAccessPoints = new ArrayList<>();
List<EthtSvcAccessPoints> ethtSvcAccessPoints = ethtSvcEndPoint.ethtSvcAccessPoints();
- if(ethtSvcAccessPoints!=null && !ethtSvcAccessPoints.isEmpty()){
- for(EthtSvcAccessPoints ethtSvcAccessPoint : ethtSvcAccessPoints){
- ethSrvAccessPoints.add(new EthSrvAccessPoint(ethtSvcAccessPoint.accessPointId(),ethtSvcAccessPoint.accessNodeId().dottedQuad().string(), ethtSvcAccessPoint.accessLtpId().union().uint32()));
+ if (ethtSvcAccessPoints != null && !ethtSvcAccessPoints.isEmpty()) {
+ for (EthtSvcAccessPoints ethtSvcAccessPoint : ethtSvcAccessPoints) {
+ ethSrvAccessPoints.add(new EthSrvAccessPoint(ethtSvcAccessPoint.accessPointId(), ethtSvcAccessPoint.accessNodeId().dottedQuad().string(), ethtSvcAccessPoint.accessLtpId().union().uint32()));
}
}
int vlanValue = ((DefaultIndividualVlan) ((DefaultVlanClassification) ethtSvcEndPoint.serviceClassification()).outerTag().individualBundlingVlan()).vlanValue().uint16();
@@ -260,10 +312,10 @@ public class PncConverter extends ActnDataConverter {
ethSrvEndPoints.add(new EthSrvEndPoint(ethtSvcEndPointName, ethSrvAccessPoints, vlanValue, cir, eir));
}
}
- ethSrvInstances.add(new EthSrvInstance(ethtSvcName,ethtSvcDescr, providerId, clientId, topologyId, tsTunnels, ethSrvEndPoints));
+ ethSrvInstances.add(new EthSrvInstance(ethtSvcName, ethtSvcDescr, providerId, clientId, topologyId, tsTunnels, ethSrvEndPoints));
}
return new TsEthSrv(ethSrvInstances);
- }else{
+ } else {
return new TsEthSrv(null);
}
}
@@ -271,10 +323,10 @@ public class PncConverter extends ActnDataConverter {
public DefaultEthtSvc convertActnEthService(CustomerEthService customerEthService) throws Exception {
checkNotNull(customerEthService, "convertActnEthService: customerEthService is null");
List<EthSrvInstance> ethSrvInstances = ((TsEthSrv) customerEthService).getEthSrvInstances();
- if(ethSrvInstances!=null && !ethSrvInstances.isEmpty()){
+ if (ethSrvInstances != null && !ethSrvInstances.isEmpty()) {
DefaultEthtSvc defaultEthtSvc = new DefaultEthtSvc();
List<EthtSvcInstances> ethtSvcInstances = new ArrayList<>();
- for(EthSrvInstance ethSrvInstance: ethSrvInstances){
+ for (EthSrvInstance ethSrvInstance : ethSrvInstances) {
EthtSvcInstances ethtSvcInstance = new DefaultEthtSvcInstances();
String ethSrvName = ethSrvInstance.getEthSrvName();
ethtSvcInstance.ethtSvcName(ethSrvName);
@@ -291,8 +343,8 @@ public class PncConverter extends ActnDataConverter {
Underlay underlay = new DefaultUnderlay();
DefaultFrameBase defaultFrameBase = new DefaultFrameBase();
List<OtnTunnels> otnTunnels = new ArrayList<>();
- if(ethSrvInstance.getOtnTunnels()!=null &&!ethSrvInstance.getOtnTunnels().isEmpty() ){
- for(TsTunnel tsTunnel: ethSrvInstance.getOtnTunnels()){
+ if (ethSrvInstance.getOtnTunnels() != null && !ethSrvInstance.getOtnTunnels().isEmpty()) {
+ for (TsTunnel tsTunnel : ethSrvInstance.getOtnTunnels()) {
DefaultOtnTunnels defaultOtnTunnels = new DefaultOtnTunnels();
defaultOtnTunnels.name(tsTunnel.name());
otnTunnels.add(defaultOtnTunnels);
@@ -311,13 +363,13 @@ public class PncConverter extends ActnDataConverter {
resilience.protection(protection);
ethtSvcInstance.resilience(resilience);
List<EthtSvcEndPoints> ethtSvcEndPoints = new ArrayList<>();
- if(ethSrvInstance.getEthSrvEndPoints()!=null &&!ethSrvInstance.getEthSrvEndPoints().isEmpty()){
- for(EthSrvEndPoint ethSrvEndPoint: ethSrvInstance.getEthSrvEndPoints()){
+ if (ethSrvInstance.getEthSrvEndPoints() != null && !ethSrvInstance.getEthSrvEndPoints().isEmpty()) {
+ for (EthSrvEndPoint ethSrvEndPoint : ethSrvInstance.getEthSrvEndPoints()) {
EthtSvcEndPoints ethtSvcEndPoint = new DefaultEthtSvcEndPoints();
ethtSvcEndPoint.ethtSvcEndPointName(ethSrvEndPoint.getEthtSvcEndPointName());
List<EthtSvcAccessPoints> ethtSvcAccessPoints = new ArrayList<>();
- if(ethSrvEndPoint.getEthSrvAccessPoints()!=null && !ethSrvEndPoint.getEthSrvAccessPoints().isEmpty()){
- for(EthSrvAccessPoint ethSrvAccessPoint: ethSrvEndPoint.getEthSrvAccessPoints()){
+ if (ethSrvEndPoint.getEthSrvAccessPoints() != null && !ethSrvEndPoint.getEthSrvAccessPoints().isEmpty()) {
+ for (EthSrvAccessPoint ethSrvAccessPoint : ethSrvEndPoint.getEthSrvAccessPoints()) {
EthtSvcAccessPoints ethtSvcAccessPoint = new DefaultEthtSvcAccessPoints();
ethtSvcAccessPoint.accessPointId(ethSrvAccessPoint.getAccessPointId());
ethtSvcAccessPoint.accessNodeId(new TeNodeId(new DottedQuad(ethSrvAccessPoint.getAccessNodeId())));
@@ -325,23 +377,24 @@ public class PncConverter extends ActnDataConverter {
ethtSvcAccessPoints.add(ethtSvcAccessPoint);
}
}
+ ethtSvcEndPoint.ethtSvcAccessPoints(ethtSvcAccessPoints);
ethtSvcEndPoint.serviceClassificationType(VlanClassification.class);
ServiceClassification serviceClassification = new DefaultVlanClassification();
OuterTag outerTag = new DefaultOuterTag();
outerTag.tagType(new EthTagClassify(ClassifyCvlan.class));
IndividualVlan individualVlan = new DefaultIndividualVlan();
individualVlan.vlanValue(new Vlanid(ethSrvEndPoint.getVlanValue()));
- outerTag.individualBundlingVlan();
- ((DefaultVlanClassification)serviceClassification).outerTag(outerTag);
+ outerTag.individualBundlingVlan(individualVlan);
+ ((DefaultVlanClassification) serviceClassification).outerTag(outerTag);
ethtSvcEndPoint.serviceClassification(serviceClassification);
Direction direction = new DefaultSymmetrical();
IngressEgressBandwidthProfile ingressEgressBandwidthProfile = new DefaultIngressEgressBandwidthProfile();
Style style = new DefaultValue();
- ((DefaultValue)style).bandwidthProfileType(new BandwidthProfileTypeTypedef(Mef10Bwp.class));
- ((DefaultValue)style).cir(ethSrvEndPoint.getCIR());
- ((DefaultValue)style).eir(ethSrvEndPoint.getEIR());
+ ((DefaultValue) style).bandwidthProfileType(new BandwidthProfileTypeTypedef(Mef10Bwp.class));
+ ((DefaultValue) style).cir(ethSrvEndPoint.getCIR());
+ ((DefaultValue) style).eir(ethSrvEndPoint.getEIR());
ingressEgressBandwidthProfile.style(style);
- ((DefaultSymmetrical)direction).ingressEgressBandwidthProfile(ingressEgressBandwidthProfile);
+ ((DefaultSymmetrical) direction).ingressEgressBandwidthProfile(ingressEgressBandwidthProfile);
ethtSvcEndPoint.direction(direction);
ethtSvcEndPoints.add(ethtSvcEndPoint);
}
@@ -351,10 +404,11 @@ public class PncConverter extends ActnDataConverter {
}
defaultEthtSvc.ethtSvcInstances(ethtSvcInstances);
return defaultEthtSvc;
- }else{
+ } else {
return new DefaultEthtSvc();
}
}
+
private OduResource teBandwidthToOduResource(TeBandwidth teBandwidth) {
Technology otn = teBandwidth.technology();
short odu0s = 0, odu1s = 0, odu2s = 0, odu2es = 0, odu3s = 0, odu4s = 0, oduFlex = 0;
@@ -380,6 +434,30 @@ public class PncConverter extends ActnDataConverter {
null, null); //TODO: TribPorts and TribSlots
}
+ private OduResource teBandwidth2OduResource(TeBandwidth teBandwidth) {
+ Technology otn = teBandwidth.technology();
+ short odu0s = 0, odu1s = 0, odu2s = 0, odu2es = 0, odu3s = 0, odu4s = 0, oduFlex = 0;
+ short numOfThisOdu = 1;
+ Otn elemOdu = ((org.onosproject.yang.gen.v11.ietfotntunnel.rev20210625.ietfotntunnel.te.tunnels.tunnel.tebandwidth.technology.augmentedtetechnology.DefaultOtn) otn).otn();
+ if (elemOdu.oduType().isAssignableFrom(Odu0.class)) {
+ odu0s = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Odu1.class)) {
+ odu1s = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Odu2.class)) {
+ odu2s = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Odu2e.class)) {
+ odu2es = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Odu3.class)) {
+ odu3s = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Odu4.class)) {
+ odu4s = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ } else if (elemOdu.oduType().isAssignableFrom(Oduflex.class)) {
+ oduFlex = PncUtils.byteArray2Short(elemOdu.valueLeafFlags().toByteArray());
+ }
+ return new OduResource(odu0s, odu1s, odu2s, odu2es, odu3s, odu4s, oduFlex,
+ null, null); //TODO: TribPorts and TribSlots
+ }
+
//Transfer tslink to yanglink for otn tunnel deletion
private static DefaultLink tsLink2YangLinkForTunnelDeletion(String sliceId, TsLink tslink, OduResource rezvdOdu,
Network yangNetwork, Networks yangNetworks, boolean isEdge, int tpn) {
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java
index 3d92d4c..17f2b87 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/converter/PncUtils.java
@@ -23,6 +23,8 @@ package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.nio.ByteBuffer;
+
public class PncUtils {
private static final Logger log = LoggerFactory.getLogger(PncUtils.class);
@@ -97,4 +99,32 @@ public class PncUtils {
}
throw new IllegalArgumentException("PncUtils: setBits: Illegal Argument");
}
+ public static long byteArray2Long(byte[] bytes)
+ {
+ long value = 0l;
+
+ // Iterating through for loop
+ for (byte b : bytes) {
+ // Shifting previous value 8 bits to right and
+ // add it with next value
+ value = (value << 8) + (b & 255);
+ }
+
+ return value;
+ }
+ public static short byteArray2Short(byte[] array) {
+// ByteBuffer buffer = ByteBuffer.wrap(array);
+// return buffer.getShort();
+ short value = 0;
+
+ // Iterating through for loop
+ for (byte b : array) {
+ // Shifting previous value 8 bits to right and
+ // add it with next value
+ value = (short) ((value << 8) + (b & 255));
+ }
+
+ return value;
+
+ }
}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/EthSrv.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/EthSrv.java
index 0af701f..7c5f1b6 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/EthSrv.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/EthSrv.java
@@ -19,8 +19,6 @@
*/
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerEthService;
-
import java.util.List;
public interface EthSrv {
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/LtpId.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/LtpId.java
index b526198..8d43e5b 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/LtpId.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/LtpId.java
@@ -37,8 +37,13 @@ public final class LtpId {
}
private LtpId(long number, String name) {
+ if(name.equals("MJI=")){
+ this.name = "TUpJPQ==";
+ }else{
+ this.name = name;
+ }
this.number = number;
- this.name = name;
+
this.hasName = true;
}
@@ -49,6 +54,9 @@ public final class LtpId {
public static LtpId ltpId(String string) {
return new LtpId(UnsignedLongs.decode(string));
}
+ public static LtpId ltpId1(long number, String string) {
+ return new LtpId(number, string);
+ }
public static LtpId ltpId(long number, String name) {
return new LtpId(number, name);
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OduResource.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OduResource.java
index 8557bb2..45a6a26 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OduResource.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OduResource.java
@@ -252,13 +252,13 @@ public class OduResource{
public byte[] getTribPortAvailabilityBitmap() {
return tribPortAvailabilityBitmap == null ? null :
Arrays.copyOf(tribPortAvailabilityBitmap,
- tribPortAvailabilityBitmap.length);
+ tribPortAvailabilityBitmap.length);
}
public byte[] getTribSlotAvailabilityBitmap() {
return tribSlotAvailabilityBitmap == null ? null :
Arrays.copyOf(tribSlotAvailabilityBitmap,
- tribSlotAvailabilityBitmap.length);
+ tribSlotAvailabilityBitmap.length);
}
@Override
@@ -284,9 +284,9 @@ public class OduResource{
(this.odu4s == that.odu4s) &&
(this.oduFlex == that.oduFlex) &&
Arrays.equals(this.tribPortAvailabilityBitmap,
- that.tribPortAvailabilityBitmap) &&
+ that.tribPortAvailabilityBitmap) &&
Arrays.equals(this.tribSlotAvailabilityBitmap,
- that.tribSlotAvailabilityBitmap);
+ that.tribSlotAvailabilityBitmap);
}
return false;
}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OtnNetwork.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OtnNetwork.java
index b6d1fb0..184f613 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OtnNetwork.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/OtnNetwork.java
@@ -19,12 +19,10 @@
*/
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerOtnTopology;
-import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter.PncConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
import java.util.List;
import java.util.Map;
-import java.util.function.Supplier;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -38,32 +36,6 @@ public class OtnNetwork extends CustomerOtnTopology implements Network {
private final Map<TeNodeKey,List<TsLink>> edgeLinks;
private final PncOtnBandwidthProfile bandwidthProfileSupplier;
-// public OtnNetwork(org.onosproject.yang.gen.v11.ietfnetwork.rev20180226.ietfnetwork.networks.Network yangNetwork){
-//
-// this(yangNetwork,
-// ()-> PncConverter.getOtnNodes(yangNetwork),
-// ()-> PncConverter.getTsNodeInfo(yangNetwork),
-// ()-> PncConverter.getOtnInnerLinks(yangNetwork),
-// ()-> PncConverter.getOtnEdgeLinks(yangNetwork),
-// ()-> PncConverter.getBandWidthProfile(yangNetwork));
-// }
-
-
-// OtnNetwork(org.onosproject.yang.gen.v11.ietfnetwork.rev20180226.ietfnetwork.networks.Network yangNetwork,
-// Supplier<List<TeNodeKey>> nodes,
-// Supplier<Map<TeNodeKey, TsNodeInfo>> tsNodeInfos,
-// Supplier<List<TsLink>> innerLinks,
-// Supplier<Map<TeNodeKey, List<TsLink>>> edgeLinks,
-// Supplier<PncOtnBandwidthProfile> bandwidthProfile){
-// checkNotNull(yangNetwork, "OtnNetwork: yangNetwork passed in is null");
-// this.networkId = yangNetwork.networkId().toString();
-// this.nodes = nodes;
-// this.innerLinks = innerLinks;
-// this.edgeLinks = edgeLinks;
-// this.tsNodeInfos = tsNodeInfos;
-// this.bandwidthProfileSupplier = bandwidthProfile;
-// }
-
public OtnNetwork(String networkId, List<TeNodeKey> otnNodes, Map<TeNodeKey, TsNodeInfo> tsNodeInfo, List<TsLink> otnInnerLinks, Map<TeNodeKey, List<TsLink>> otnEdgeLinks, PncOtnBandwidthProfile bandWidthProfile) {
this.networkId = networkId;
this.nodes = otnNodes;
@@ -103,4 +75,17 @@ public class OtnNetwork extends CustomerOtnTopology implements Network {
public String networkId(){
return this.networkId;
}
+
+ @Override
+ public String toString() {
+ return "OtnNetwork{" +
+ "networkType=" + networkType +
+ ", networkId='" + networkId + '\'' +
+ ", nodes=" + nodes +
+ ", tsNodeInfos=" + tsNodeInfos +
+ ", innerLinks=" + innerLinks +
+ ", edgeLinks=" + edgeLinks +
+ ", bandwidthProfileSupplier=" + bandwidthProfileSupplier +
+ '}';
+ }
}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsEthSrv.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsEthSrv.java
index 74ec498..bebbbb7 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsEthSrv.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsEthSrv.java
@@ -19,7 +19,7 @@
*/
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerEthService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
import java.util.List;
@@ -31,6 +31,13 @@ public class TsEthSrv extends CustomerEthService implements EthSrv{
}
@Override
+ public String toString() {
+ return "TsEthSrv{" +
+ "ethSrvInstances=" + ethSrvInstances +
+ '}';
+ }
+
+ @Override
public List<EthSrvInstance> getEthSrvInstances(){
return this.ethSrvInstances;
}
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsLink.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsLink.java
index 8ae8209..55d166e 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsLink.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsLink.java
@@ -19,7 +19,7 @@
*/
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model;
-import org.onap.integration.actninterfacetools.actnclient.api.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
import java.util.List;
import java.util.Objects;
diff --git a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsTunnel.java b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsTunnel.java
index f076a17..fe26846 100644
--- a/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsTunnel.java
+++ b/sample-apps/src/main/java/org/onap/integration/actninterfacetools/sampleapp/mpiconverter/model/TsTunnel.java
@@ -20,6 +20,8 @@
package org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model;
import com.google.common.collect.ImmutableList;
+//import org.onlab.graph.ScalarWeight;
+//import org.onlab.graph.Weight;
import java.util.List;
@@ -31,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
public class TsTunnel extends TsLink {
private final List<TsLink> links;
-// private final Weight cost;
+ // private final Weight cost;
private final String name;
private OduResource bw = null;
@@ -43,6 +45,7 @@ public class TsTunnel extends TsLink {
this.name = name;
}
+
// public TsTunnel(LTPoint srcLtPoint, LTPoint dstLtPoint){
// super(srcLtPoint, dstLtPoint);
// this.links = null;
@@ -60,7 +63,7 @@ public class TsTunnel extends TsLink {
// return 0;
// }
-// public Weight weight() {
+ // public Weight weight() {
// return cost;
// }
public String name() {
@@ -69,7 +72,7 @@ public class TsTunnel extends TsLink {
private static LTPoint source(List<TsLink> links) {
checkNotNull(links, "List of path links cannot be null");
checkArgument(!links.isEmpty(), "List of path links cannot be null");
- return links.get(0).dst();
+ return links.get(0).src();
}
private static LTPoint destination(List<TsLink> links) {
@@ -100,7 +103,7 @@ public class TsTunnel extends TsLink {
final TsTunnel other = (TsTunnel) obj;
return Objects.equals(this.links, other.links);
}
- return false;
+ return false;
}
public OduResource bw() {
diff --git a/sample-apps/src/test/java/org/onap/protocol/restconf/ctl/SampleAppTest.java b/sample-apps/src/test/java/org/onap/protocol/restconf/ctl/SampleAppTest.java
new file mode 100644
index 0000000..9f527c2
--- /dev/null
+++ b/sample-apps/src/test/java/org/onap/protocol/restconf/ctl/SampleAppTest.java
@@ -0,0 +1,322 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Actn Interface Tools
+ * ================================================================================
+ * Copyright (C) 2023 Huawei Canada Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.protocol.restconf.ctl;
+
+import java.math.BigInteger;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.ArrayList;
+import com.google.common.net.InetAddresses;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.integration.actninterfacetools.globalapi.ActnDataConverter;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTopology;
+import org.onap.integration.actninterfacetools.globalapi.CustomerOtnTunnel;
+import org.onap.integration.actninterfacetools.globalapi.PncClient;
+import org.onap.integration.actninterfacetools.globalapi.GlobalService;
+import org.onap.integration.actninterfacetools.globalapi.ActnClientService;
+import org.onap.integration.actninterfacetools.globalapi.CustomerEthService;
+import org.onap.integration.actninterfacetools.protocol.restconf.DefaultPncInstance;
+import org.onap.integration.actninterfacetools.protocol.restconf.PncInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.converter.PncConverter;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LTPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.LtpId;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TeNodeKey;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsLink;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.OduResource;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsTunnel;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvInstance;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvAccessPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.EthSrvEndPoint;
+import org.onap.integration.actninterfacetools.sampleapp.mpiconverter.model.TsEthSrv;
+
+public class SampleAppTest {
+ PncClient pncClientA;
+ PncClient pncClientB;
+
+ @Before
+ public void setUp() throws URISyntaxException {
+
+ PncInstance pncInstanceA = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 18181, null, null, "http", null);
+ PncInstance pncInstanceB = new DefaultPncInstance(InetAddresses.forString("192.168.198.10"), 28181, null, null, "http", null);
+ ActnDataConverter actnDataConverter = new PncConverter();
+ ActnClientService actnClientService = GlobalService.getActnClientSvc(actnDataConverter);
+ pncClientA = actnClientService.getPncClient(pncInstanceA);
+ pncClientB = actnClientService.getPncClient(pncInstanceB);
+ }
+
+ @Test
+ public void getNetworkTopology() throws Exception {
+ CustomerOtnTopology customerOtnTopology = pncClientA.getNetworkTopology("providerId-10-clientId-0-topologyId-1");
+ System.out.println("pncA: " + customerOtnTopology.toString());
+ CustomerOtnTopology customerOtnTopologyB = pncClientB.getNetworkTopology("providerId-20-clientId-0-topologyId-1");
+ System.out.println("pncB: " + customerOtnTopologyB.toString());
+
+ }
+
+ @Test
+ public void createOtnTunnel() throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = buildTeOtnTunnel("otntunnel-1");
+ pncClientA.createOtnTunnel(customerOtnTunnel);
+ CustomerOtnTunnel customerOtnTunnelB = buildTeOtnTunnel2("otntunnel-1");
+ pncClientB.createOtnTunnel(customerOtnTunnelB);
+ }
+
+ @Test
+ public void updateOtnTunnel() throws Exception {
+ CustomerOtnTunnel customerOtnTunnel = updateTeOtnTunnel("otntunnel-1");
+ pncClientA.updateOtnTunnel(customerOtnTunnel, "otntunnel-1");
+ CustomerOtnTunnel customerOtnTunnelB = updateTeOtnTunnel2("otntunnel-1");
+ pncClientB.updateOtnTunnel(customerOtnTunnelB, "otntunnel-1");
+ }
+
+ @Test
+ public void getOtnTunnel() throws Exception {
+ CustomerOtnTunnel otnTunnel = pncClientA.getOtnTunnel("otntunnel-1");
+ System.out.println(otnTunnel.toString());
+ CustomerOtnTunnel otnTunnelB = pncClientB.getOtnTunnel("otntunnel-1");
+ System.out.println(otnTunnelB.toString());
+ }
+
+ @Test
+ public void deleteOtnTunnel() throws Exception {
+ pncClientA.deleteOtnTunnel("otntunnel-1");
+ pncClientB.deleteOtnTunnel("otntunnel-1");
+ }
+
+ @Test
+ public void createEthService() throws Exception {
+ CustomerEthService customerEthService = buildTeEthSrv("cll-instance-01");
+ pncClientA.createEthService(customerEthService);
+ CustomerEthService customerEthServiceB = buildTeEthSrv2("cll-instance-01");
+ pncClientB.createEthService(customerEthServiceB);
+ }
+
+ @Test
+ public void updateEthService() throws Exception {
+ CustomerEthService customerEthService = updateTeEthSrv("cll-instance-01");
+ pncClientA.updateEthService(customerEthService);
+ CustomerEthService customerEthServiceB = updateTeEthSrv2("cll-instance-01");
+ pncClientB.updateEthService(customerEthServiceB);
+ }
+
+ @Test
+ public void getEthService() throws Exception {
+ CustomerEthService ethService = pncClientA.getEthService("cll-instance-01");
+ System.out.println(ethService.toString());
+ CustomerEthService ethServiceB = pncClientB.getEthService("cll-instance-01");
+ System.out.println(ethServiceB.toString());
+ }
+
+ @Test
+ public void deleteEthService() throws Exception {
+ pncClientA.deleteEthService("cll-instance-01");
+ pncClientB.deleteEthService("cll-instance-01");
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 1, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 1, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "12");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel buildTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "13");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 3, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerOtnTunnel updateTeOtnTunnel2(String tunnelName) {
+ TeNodeKey src = new TeNodeKey(10, 2, 1, 1);
+ TeNodeKey dst = new TeNodeKey(10, 2, 1, 2);
+ LtpId dstLtpId = LtpId.ltpId(0, "13");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ OduResource oduResource = new OduResource((short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 4, null, null);
+ CustomerOtnTunnel customerOtnTunnel = new TsTunnel(tsLinkList, tunnelName);
+ ((TsTunnel) customerOtnTunnel).bw(oduResource);
+ return customerOtnTunnel;
+ }
+
+ public static CustomerEthService buildTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.1.1.1", 1000001));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-01", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsB = new ArrayList<>();
+ ethSrvAccessPointsB.add(new EthSrvAccessPoint("0", "10.1.1.1", 2000001));
+ EthSrvEndPoint ethSrvEndPointB = new EthSrvEndPoint("uni-02", ethSrvAccessPointsB, 48, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.1.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ List<EthSrvAccessPoint> ethSrvAccessPointsD = new ArrayList<>();
+ ethSrvAccessPointsD.add(new EthSrvAccessPoint("0", "10.1.1.4", 1000001));
+ EthSrvEndPoint ethSrvEndPointD = new EthSrvEndPoint("uni-04", ethSrvAccessPointsC, 50, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointB);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ ethSrvEndPoints.add(ethSrvEndPointD);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService buildTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 20, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+
+ public static CustomerEthService updateTeEthSrv2(String serviceName) {
+ List<EthSrvInstance> ethSrvInstances = new ArrayList<>();
+ List<TsTunnel> tsTunnelList = new ArrayList<>();
+ TeNodeKey src = new TeNodeKey(-1, -1, -1, -1);
+ TeNodeKey dst = new TeNodeKey(-1, -1, -1, -1);
+ LtpId dstLtpId = LtpId.ltpId(0, "");
+ LTPoint srcLTPoint = new LTPoint(src, null);
+ LTPoint dstLTPoint = new LTPoint(dst, dstLtpId);
+ List<TsLink> tsLinkList = new ArrayList<>();
+ TsLink tsLink = new TsLink(srcLTPoint, dstLTPoint);
+ tsLinkList.add(tsLink);
+ TsTunnel tsTunnela = new TsTunnel(tsLinkList, "otntunnel-2");
+ TsTunnel tsTunnelb = new TsTunnel(tsLinkList, "otntunnel-1");
+ tsTunnelList.add(tsTunnela);
+ tsTunnelList.add(tsTunnelb);
+ List<EthSrvEndPoint> ethSrvEndPoints = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsA = new ArrayList<>();
+ List<EthSrvAccessPoint> ethSrvAccessPointsC = new ArrayList<>();
+ ethSrvAccessPointsA.add(new EthSrvAccessPoint("0", "10.2.1.2", 512));
+ EthSrvEndPoint ethSrvEndPointA = new EthSrvEndPoint("uni-04", ethSrvAccessPointsA, 47, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvAccessPointsC.add(new EthSrvAccessPoint("0", "10.2.1.3", 1000001));
+ EthSrvEndPoint ethSrvEndPointC = new EthSrvEndPoint("uni-03", ethSrvAccessPointsC, 49, BigInteger.valueOf(3000000), BigInteger.valueOf(3000000));
+ ethSrvEndPoints.add(ethSrvEndPointA);
+ ethSrvEndPoints.add(ethSrvEndPointC);
+ EthSrvInstance ethSrvInstance = new EthSrvInstance(serviceName, "desc-Eth-service", 10, 0, "2", tsTunnelList, ethSrvEndPoints);
+ ethSrvInstances.add(ethSrvInstance);
+ CustomerEthService customerEthService = new TsEthSrv(ethSrvInstances);
+ return customerEthService;
+ }
+}