Update TAPI YANG files to v2.1(v20181016)
* Replaced TAPI yang files with latest master(v2.1)
* Updated ModelRegistrator
* Updated library path for auto generated library
* Updated ODTN Phase1.0 impl
* Added TAPI XML conversion test for ODTN Phase1.0
* Added sample JSON for ODTN Phase1.0
Change-Id: I11eeab2423a1468df3ee515d40f31b82ed96aa3c
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnDcsModelCheckCommand.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnDcsModelCheckCommand.java
index e1636c7..b7d08e2 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnDcsModelCheckCommand.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnDcsModelCheckCommand.java
@@ -26,7 +26,7 @@
import static org.onosproject.odtn.utils.YangToolUtil.toCompositeData;
import static org.onosproject.odtn.utils.YangToolUtil.toResourceData;
import static org.onosproject.odtn.utils.YangToolUtil.toXmlCompositeStream;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.DefaultContext;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.DefaultContext;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.DefaultModelObjectData;
import org.onosproject.yang.model.InnerModelObject;
@@ -75,4 +75,4 @@
CharSequence strNode = toCharSequence(toXmlCompositeStream(toCompositeData(toResourceData(empty, all))));
printlog("XML:\n{}", XmlString.prettifyXml(strNode));
}
-}
\ No newline at end of file
+}
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnTapiHandlersTestCommand.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnTapiHandlersTestCommand.java
new file mode 100644
index 0000000..6131360
--- /dev/null
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnTapiHandlersTestCommand.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+package org.onosproject.odtn.cli.impl;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onlab.util.XmlString;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.config.DynamicConfigService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.odtn.utils.tapi.TapiCepHandler;
+import org.onosproject.odtn.utils.tapi.TapiCepRefHandler;
+import org.onosproject.odtn.utils.tapi.TapiConnectionHandler;
+import org.onosproject.odtn.utils.tapi.TapiConnectivityContextHandler;
+import org.onosproject.odtn.utils.tapi.TapiConnectivityServiceHandler;
+import org.onosproject.odtn.utils.tapi.TapiContextHandler;
+import org.onosproject.odtn.utils.tapi.TapiNepHandler;
+import org.onosproject.odtn.utils.tapi.TapiNodeHandler;
+import org.onosproject.odtn.utils.tapi.TapiSepHandler;
+import org.onosproject.odtn.utils.tapi.TapiSipHandler;
+import org.onosproject.odtn.utils.tapi.TapiTopologyContextHandler;
+import org.onosproject.odtn.utils.tapi.TapiTopologyHandler;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.DefaultContext;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.Uuid;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.tapicontext.DefaultServiceInterfacePoint;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.connectivitycontext.DefaultConnection;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.connectivitycontext.DefaultConnectivityService;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.connectivityservice.DefaultEndPoint;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.context.augmentedtapicommoncontext.DefaultConnectivityContext;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.context.augmentedtapicommoncontext.DefaultTopologyContext;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.node.DefaultOwnedNodeEdgePoint;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topology.DefaultNode;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topologycontext.DefaultTopology;
+import org.onosproject.yang.model.Augmentable;
+import org.onosproject.yang.model.DataNode;
+import org.onosproject.yang.model.ModelConverter;
+import org.onosproject.yang.model.ResourceId;
+import org.slf4j.Logger;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.regex.Pattern;
+
+import static org.onosproject.odtn.utils.YangToolUtil.*;
+import static org.slf4j.LoggerFactory.getLogger;
+
+@Command(scope = "onos", name = "odtn-tapi-handlers-test")
+public class OdtnTapiHandlersTestCommand extends AbstractShellCommand {
+
+ private static final Logger log = getLogger(OdtnDcsModelCheckCommand.class);
+ private DynamicConfigService dcs;
+ private ModelConverter modelConverter;
+ private TapiContextHandler contextHandler;
+
+ @Override
+ public void execute() {
+ dcs = get(DynamicConfigService.class);
+ modelConverter = get(ModelConverter.class);
+
+ setupTapiContext();
+ DataNode data = contextHandler.getDataNode();
+
+ ResourceId empty = ResourceId.builder().build();
+ CharSequence strNode = toCharSequence(toXmlCompositeStream(toCompositeData(toResourceData(empty, data))));
+ StringBuilder exp = loadXml("/test-tapi-context.xml");
+
+ if (XmlString.prettifyXml(strNode).toString().contentEquals(exp)) {
+ log.info("result: ok");
+ } else {
+ log.info("result: failed");
+ }
+ }
+
+ private void printlog(String format, Object... objs) {
+ print(format.replaceAll(Pattern.quote("{}"), "%s"), objs);
+ log.info(format, objs);
+ }
+
+ private static StringBuilder loadXml(final String fileName) {
+
+ InputStream inputStream = OdtnTapiHandlersTestCommand.class.getResourceAsStream(fileName);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ StringBuilder result = new StringBuilder();
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ result.append(line).append("\n");
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private void setupTapiContext() {
+
+ DeviceId did1 = DeviceId.deviceId("netconf:127.0.0.1:11001");
+ DeviceId did2 = DeviceId.deviceId("netconf:127.0.0.1:11002");
+
+ ConnectPoint cp11 = new ConnectPoint(did1, PortNumber.portNumber(1, "TRANSCEIVER"));
+ ConnectPoint cp12 = new ConnectPoint(did1, PortNumber.portNumber(2, "TRANSCEIVER"));
+ ConnectPoint cp21 = new ConnectPoint(did2, PortNumber.portNumber(1, "TRANSCEIVER"));
+ ConnectPoint cp22 = new ConnectPoint(did2, PortNumber.portNumber(2, "TRANSCEIVER"));
+
+ // context
+ contextHandler = TapiContextHandler.create();
+ DefaultContext context = contextHandler.getModelObject();
+
+ // context augmentation
+ Augmentable augmentableContext = context;
+
+ // context augmentation with topologyContext
+ org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.context
+ .DefaultAugmentedTapiCommonContext augmentedTopologyContext
+ = new org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology
+ .context.DefaultAugmentedTapiCommonContext();
+ augmentableContext.addAugmentation(augmentedTopologyContext);
+
+ // context augmentation with connectivityServiceContext
+ org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.context
+ .DefaultAugmentedTapiCommonContext augmentedConnectivityContext
+ = new org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity
+ .context.DefaultAugmentedTapiCommonContext();
+ augmentableContext.addAugmentation(augmentedConnectivityContext);
+
+ // topology context
+ DefaultTopologyContext topologyContext = TapiTopologyContextHandler.create().getModelObject();
+ augmentedTopologyContext.topologyContext(topologyContext);
+
+ // topology
+ TapiTopologyHandler topologyHandler = TapiTopologyHandler.create();
+ topologyHandler.setId(Uuid.of("00000000-0000-0000-0000-000000000001"));
+ DefaultTopology topology = topologyHandler.getModelObject();
+ topologyContext.addToTopology(topology);
+
+ // nodes
+ TapiNodeHandler nodeHandler1 = TapiNodeHandler.create();
+ nodeHandler1.setId(Uuid.of("00000000-0000-0000-0001-000000000001"));
+ DefaultNode node1 = nodeHandler1.setTopologyUuid(topology.uuid())
+ .setDeviceId(did1)
+ .getModelObject();
+ topology.addToNode(node1);
+
+ TapiNodeHandler nodeHandler2 = TapiNodeHandler.create();
+ nodeHandler2.setId(Uuid.of("00000000-0000-0000-0001-000000000002"));
+ DefaultNode node2 = nodeHandler2.setTopologyUuid(topology.uuid())
+ .setDeviceId(did2)
+ .getModelObject();
+ topology.addToNode(node2);
+
+ // sips
+ TapiSipHandler sipHandler1 = TapiSipHandler.create();
+ sipHandler1.setId(Uuid.of("00000000-0000-0000-0002-000000000001"));
+ DefaultServiceInterfacePoint sip1 = sipHandler1.setConnectPoint(cp11)
+ .getModelObject();
+ context.addToServiceInterfacePoint(sip1);
+
+ TapiSipHandler sipHandler2 = TapiSipHandler.create();
+ sipHandler2.setId(Uuid.of("00000000-0000-0000-0002-000000000002"));
+ DefaultServiceInterfacePoint sip2 = sipHandler2.setConnectPoint(cp21)
+ .getModelObject();
+ context.addToServiceInterfacePoint(sip2);
+
+ // neps
+ TapiNepHandler nepHandler11 = TapiNepHandler.create();
+ nepHandler11.setId(Uuid.of("00000000-0000-0000-0003-000000000011"));
+ DefaultOwnedNodeEdgePoint nep11 = nepHandler11
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node1.uuid())
+ .setConnectPoint(cp11)
+ .addSip(sip1.uuid())
+ .getModelObject();
+ nodeHandler1.addNep(nep11);
+
+ TapiNepHandler nepHandler12 = TapiNepHandler.create();
+ nepHandler12.setId(Uuid.of("00000000-0000-0000-0003-000000000012"));
+ DefaultOwnedNodeEdgePoint nep12 = nepHandler12
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node1.uuid())
+ .setConnectPoint(cp12)
+ .getModelObject();
+ nodeHandler1.addNep(nep12);
+
+ TapiNepHandler nepHandler21 = TapiNepHandler.create();
+ nepHandler21.setId(Uuid.of("00000000-0000-0000-0003-000000000021"));
+ DefaultOwnedNodeEdgePoint nep21 = nepHandler21
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node2.uuid())
+ .setConnectPoint(cp21)
+ .addSip(sip2.uuid())
+ .getModelObject();
+ nodeHandler2.addNep(nep21);
+
+ TapiNepHandler nepHandler22 = TapiNepHandler.create();
+ nepHandler22.setId(Uuid.of("00000000-0000-0000-0003-000000000022"));
+ DefaultOwnedNodeEdgePoint nep22 = nepHandler22
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node2.uuid())
+ .setConnectPoint(cp22)
+ .getModelObject();
+ nodeHandler2.addNep(nep22);
+
+ // connectivity context
+ DefaultConnectivityContext connectivityContext = TapiConnectivityContextHandler.create().getModelObject();
+ augmentedConnectivityContext.connectivityContext(connectivityContext);
+
+ // connectivityService
+ TapiConnectivityServiceHandler connectivityServiceHandler = TapiConnectivityServiceHandler.create();
+ connectivityServiceHandler.setId(Uuid.of("00000000-0000-0000-0004-000000000001"));
+ DefaultConnectivityService connectivityService = connectivityServiceHandler.getModelObject();
+ connectivityContext.addToConnectivityService(connectivityService);
+
+ // connection
+ TapiConnectionHandler connectionHandler = TapiConnectionHandler.create();
+ connectionHandler.setId(Uuid.of("00000000-0000-0000-0005-000000000001"));
+ DefaultConnection connection1 = connectionHandler.getModelObject();
+ connectivityServiceHandler.addConnection(connection1.uuid());
+ connectivityContext.addToConnection(connection1);
+
+
+ // seps
+ TapiSepHandler sepHandler1 = TapiSepHandler.create();
+ sepHandler1.setId(Uuid.of("00000000-0000-0000-0006-000000000001"));
+ DefaultEndPoint sep1 = sepHandler1.getModelObject();
+ connectivityServiceHandler.addSep(sep1);
+
+ TapiSepHandler sepHandler2 = TapiSepHandler.create();
+ sepHandler2.setId(Uuid.of("00000000-0000-0000-0006-000000000002"));
+ DefaultEndPoint sep2 = sepHandler2.getModelObject();
+ connectivityServiceHandler.addSep(sep2);
+
+ // ceps
+ TapiCepHandler cepHandler11 = TapiCepHandler.create();
+ cepHandler11.setId(Uuid.of("00000000-0000-0000-0007-000000000011"));
+ org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity
+ .ceplist.DefaultConnectionEndPoint
+ cep11 = cepHandler11
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node1.uuid())
+ .setNepUuid(nep11.uuid())
+ .setParentNep()
+ .getModelObject();
+ nepHandler11.addCep(cep11);
+ org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity
+ .connection.DefaultConnectionEndPoint
+ cepRef11 = TapiCepRefHandler.create()
+ .setCep(cep11)
+ .getModelObject();
+ connectionHandler.addCep(cepRef11);
+
+ TapiCepHandler cepHandler21 = TapiCepHandler.create();
+ cepHandler21.setId(Uuid.of("00000000-0000-0000-0007-000000000021"));
+ org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity
+ .ceplist.DefaultConnectionEndPoint
+ cep21 = cepHandler21
+ .setTopologyUuid(topology.uuid())
+ .setNodeUuid(node1.uuid())
+ .setNepUuid(nep21.uuid())
+ .setParentNep()
+ .getModelObject();
+ nepHandler21.addCep(cep21);
+ org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity
+ .connection.DefaultConnectionEndPoint
+ cepRef21 = TapiCepRefHandler.create()
+ .setCep(cep21)
+ .getModelObject();
+ connectionHandler.addCep(cepRef21);
+
+ }
+}
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiCommonRpc.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiCommonRpc.java
index 315e10c..0d42ca0 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiCommonRpc.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiCommonRpc.java
@@ -19,8 +19,8 @@
import org.onosproject.config.DynamicConfigService;
import org.onosproject.odtn.TapiResolver;
import org.onosproject.odtn.utils.tapi.TapiGetSipListOutputHandler;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.TapiCommonService;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.Uuid;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.TapiCommonService;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.Uuid;
import org.onosproject.yang.model.ModelConverter;
import org.onosproject.yang.model.RpcInput;
import org.onosproject.yang.model.RpcOutput;
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiConnectivityRpc.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiConnectivityRpc.java
index 2598781..a55c16b 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiConnectivityRpc.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiConnectivityRpc.java
@@ -27,16 +27,15 @@
import org.onosproject.odtn.utils.tapi.TapiCreateConnectivityInputHandler;
import org.onosproject.odtn.utils.tapi.TapiCreateConnectivityOutputHandler;
import org.onosproject.odtn.utils.tapi.TapiDeleteConnectivityInputHandler;
-import org.onosproject.odtn.utils.tapi.TapiDeleteConnectivityOutputHandler;
import org.onosproject.odtn.utils.tapi.TapiGetConnectivityDetailsInputHandler;
import org.onosproject.odtn.utils.tapi.TapiGetConnectivityDetailsOutputHandler;
import org.onosproject.odtn.utils.tapi.TapiGetConnectivityListOutputHandler;
import org.onosproject.odtn.utils.tapi.TapiNepRef;
import org.onosproject.odtn.utils.tapi.TapiObjectHandler;
import org.onosproject.odtn.utils.tapi.TapiSepHandler;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.Uuid;
-import org.onosproject.yang.gen.v1.tapiconnectivity.rev20180307.TapiConnectivityService;
-import org.onosproject.yang.gen.v1.tapiconnectivity.rev20180307.tapiconnectivity.connectivitycontext.DefaultConnectivityService;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.Uuid;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.TapiConnectivityService;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.connectivitycontext.DefaultConnectivityService;
import org.onosproject.yang.model.ModelConverter;
import org.onosproject.yang.model.RpcInput;
import org.onosproject.yang.model.RpcOutput;
@@ -139,17 +138,14 @@
service.connection().stream().forEach(connection -> {
TapiConnectionHandler connectionHandler = TapiConnectionHandler.create();
- connectionHandler.setId(Uuid.fromString(connection.connectionId().toString()));
+ connectionHandler.setId(Uuid.fromString(connection.connectionUuid().toString()));
DcsBasedTapiConnectionManager manager = DcsBasedTapiConnectionManager.create();
manager.deleteConnection(connectionHandler);
manager.apply();
});
serviceHandler.remove();
- TapiDeleteConnectivityOutputHandler output = TapiDeleteConnectivityOutputHandler.create()
- .addService(serviceHandler.getModelObject());
-
- return new RpcOutput(RpcOutput.Status.RPC_SUCCESS, output.getDataNode());
+ return new RpcOutput(RpcOutput.Status.RPC_SUCCESS, null);
} catch (Throwable e) {
log.error("Error:", e);
return new RpcOutput(RpcOutput.Status.RPC_FAILURE, null);
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducer.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducer.java
index 4adc3d2..40e606a 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducer.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducer.java
@@ -30,11 +30,11 @@
import org.onosproject.odtn.utils.tapi.DcsBasedTapiObjectRefFactory;
import org.onosproject.odtn.utils.tapi.TapiNepRef;
import org.onosproject.odtn.utils.tapi.TapiNodeRef;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.DefaultContext;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.globalclass.Name;
-import org.onosproject.yang.gen.v1.tapiconnectivity.rev20180307.tapiconnectivity.context.topology.node.ownednodeedgepoint.DefaultAugmentedTapiTopologyOwnedNodeEdgePoint;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.context.DefaultAugmentedTapiCommonContext;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topologycontext.Topology;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.DefaultContext;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.globalclass.Name;
+import org.onosproject.yang.gen.v1.tapiconnectivity.rev20181016.tapiconnectivity.context.topologycontext.topology.node.ownednodeedgepoint.DefaultAugmentedTapiTopologyOwnedNodeEdgePoint;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.context.DefaultAugmentedTapiCommonContext;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topologycontext.Topology;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.DefaultModelObjectData;
import org.onosproject.yang.model.DefaultResourceData;
@@ -114,7 +114,7 @@
private List<TapiNodeRef> getNodes(DefaultContext context) {
DefaultAugmentedTapiCommonContext topologyContext
= context.augmentation(DefaultAugmentedTapiCommonContext.class);
- Topology topology = topologyContext.topology().get(0);
+ Topology topology = topologyContext.topologyContext().topology().get(0);
if (topology.node() == null) {
return Collections.emptyList();
@@ -142,7 +142,7 @@
private List<TapiNepRef> getNeps(DefaultContext context) {
DefaultAugmentedTapiCommonContext topologyContext
= context.augmentation(DefaultAugmentedTapiCommonContext.class);
- Topology topology = topologyContext.topology().get(0);
+ Topology topology = topologyContext.topologyContext().topology().get(0);
if (topology.node() == null) {
return Collections.emptyList();
@@ -169,15 +169,15 @@
if (nep.mappedServiceInterfacePoint() != null) {
nep.mappedServiceInterfacePoint().stream()
.forEach(sip -> {
- nepRef.setSipId(sip.serviceInterfacePointId().toString());
+ nepRef.setSipId(sip.serviceInterfacePointUuid().toString());
});
}
DefaultAugmentedTapiTopologyOwnedNodeEdgePoint augmentNep =
nep.augmentation(DefaultAugmentedTapiTopologyOwnedNodeEdgePoint.class);
try {
- if (augmentNep.connectionEndPoint() != null) {
- List<String> cepIds = augmentNep.connectionEndPoint().stream()
+ if (augmentNep.cepList().connectionEndPoint() != null) {
+ List<String> cepIds = augmentNep.cepList().connectionEndPoint().stream()
.map(cep -> cep.uuid().toString()).collect(Collectors.toList());
nepRef.setCepIds(cepIds);
}
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiTopologyManager.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiTopologyManager.java
index 659e984..b528f23 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiTopologyManager.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/DcsBasedTapiTopologyManager.java
@@ -32,6 +32,7 @@
import org.onosproject.odtn.TapiResolver;
import org.onosproject.odtn.TapiTopologyManager;
+import org.onosproject.odtn.utils.tapi.TapiConnectivityContextHandler;
import org.onosproject.odtn.utils.tapi.TapiLinkHandler;
import org.onosproject.odtn.utils.tapi.TapiCepHandler;
import org.onosproject.odtn.utils.tapi.TapiNepRef;
@@ -40,10 +41,11 @@
import org.onosproject.odtn.utils.tapi.TapiNepHandler;
import org.onosproject.odtn.utils.tapi.TapiNodeHandler;
import org.onosproject.odtn.utils.tapi.TapiSipHandler;
+import org.onosproject.odtn.utils.tapi.TapiTopologyContextHandler;
import org.onosproject.odtn.utils.tapi.TapiTopologyHandler;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.DefaultContext;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.Uuid;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topologycontext.DefaultTopology;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.DefaultContext;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.Uuid;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topologycontext.DefaultTopology;
import org.onosproject.yang.model.ModelConverter;
import org.slf4j.Logger;
@@ -74,6 +76,7 @@
public void activate() {
initDcsTapiContext();
initDcsTapiTopology();
+ initDcsTapiConnectivityContext();
log.info("Started");
}
@@ -171,13 +174,26 @@
}
/**
- * Add Tapi Topology to Dcs store.
+ * Add Tapi TopologyContext and Topology to Dcs store.
*
* Assumed there is only one topology for ODTN Phase 1.0
*/
private void initDcsTapiTopology() {
+ TapiTopologyContextHandler topologyContextHandler = TapiTopologyContextHandler.create();
+ topologyContextHandler.add();
TapiTopologyHandler topologyHandler = TapiTopologyHandler.create();
- topology = topologyHandler.getModelObject();
topologyHandler.add();
+ topology = topologyHandler.getModelObject();
}
+
+ /**
+ * Add Tapi ConnectivityContext to Dcs store.
+ *
+ * Assumed there is only one topology for ODTN Phase 1.0
+ */
+ private void initDcsTapiConnectivityContext() {
+ TapiConnectivityContextHandler connectivityContextHandler = TapiConnectivityContextHandler.create();
+ connectivityContextHandler.add();
+ }
+
}
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/package-info.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/package-info.java
index b75ad48..9dc4dad 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/package-info.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/internal/package-info.java
@@ -17,4 +17,4 @@
/**
* Package to place ODTN internal implementations.
*/
-package org.onosproject.odtn.internal;
\ No newline at end of file
+package org.onosproject.odtn.internal;
diff --git a/apps/odtn/service/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/odtn/service/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index a2c2c6e..953a71e 100644
--- a/apps/odtn/service/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/apps/odtn/service/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -34,6 +34,10 @@
<action class="org.onosproject.odtn.cli.impl.OdtnDcsModelCheckCommand"/>
</command>
+ <command>
+ <action class="org.onosproject.odtn.cli.impl.OdtnTapiHandlersTestCommand"/>
+ </command>
+
</command-bundle>
<bean id="deviceIdCompleter" class="org.onosproject.cli.net.DeviceIdCompleter"/>
diff --git a/apps/odtn/service/src/main/resources/test-tapi-context.xml b/apps/odtn/service/src/main/resources/test-tapi-context.xml
new file mode 100644
index 0000000..b56f488
--- /dev/null
+++ b/apps/odtn/service/src/main/resources/test-tapi-context.xml
@@ -0,0 +1,120 @@
+<context xmlns="urn:onf:otcc:yang:tapi-common">
+ <topology-context xmlns="urn:onf:otcc:yang:tapi-topology">
+ <topology>
+ <uuid>00000000-0000-0000-0000-000000000001</uuid>
+ <node>
+ <uuid>00000000-0000-0000-0001-000000000001</uuid>
+ <owned-node-edge-point>
+ <uuid>00000000-0000-0000-0003-000000000011</uuid>
+ <cep-list xmlns="urn:onf:otcc:yang:tapi-connectivity">
+ <connection-end-point>
+ <uuid>00000000-0000-0000-0007-000000000011</uuid>
+ <parent-node-edge-point>
+ <node-edge-point-uuid>00000000-0000-0000-0003-000000000011</node-edge-point-uuid>
+ <node-uuid>00000000-0000-0000-0001-000000000001</node-uuid>
+ <topology-uuid>00000000-0000-0000-0000-000000000001</topology-uuid>
+ </parent-node-edge-point>
+ </connection-end-point>
+ </cep-list>
+ <mapped-service-interface-point>
+ <service-interface-point-uuid>00000000-0000-0000-0002-000000000001</service-interface-point-uuid>
+ </mapped-service-interface-point>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11001/[TRANSCEIVER](1)</value>
+ </name>
+ </owned-node-edge-point>
+ <owned-node-edge-point>
+ <uuid>00000000-0000-0000-0003-000000000012</uuid>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11001/[TRANSCEIVER](2)</value>
+ </name>
+ </owned-node-edge-point>
+ <name>
+ <value-name>device-id</value-name>
+ <value>netconf:127.0.0.1:11001</value>
+ </name>
+ </node>
+ <node>
+ <uuid>00000000-0000-0000-0001-000000000002</uuid>
+ <owned-node-edge-point>
+ <uuid>00000000-0000-0000-0003-000000000021</uuid>
+ <cep-list xmlns="urn:onf:otcc:yang:tapi-connectivity">
+ <connection-end-point>
+ <uuid>00000000-0000-0000-0007-000000000021</uuid>
+ <parent-node-edge-point>
+ <node-edge-point-uuid>00000000-0000-0000-0003-000000000021</node-edge-point-uuid>
+ <node-uuid>00000000-0000-0000-0001-000000000001</node-uuid>
+ <topology-uuid>00000000-0000-0000-0000-000000000001</topology-uuid>
+ </parent-node-edge-point>
+ </connection-end-point>
+ </cep-list>
+ <mapped-service-interface-point>
+ <service-interface-point-uuid>00000000-0000-0000-0002-000000000002</service-interface-point-uuid>
+ </mapped-service-interface-point>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11002/[TRANSCEIVER](1)</value>
+ </name>
+ </owned-node-edge-point>
+ <owned-node-edge-point>
+ <uuid>00000000-0000-0000-0003-000000000022</uuid>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11002/[TRANSCEIVER](2)</value>
+ </name>
+ </owned-node-edge-point>
+ <name>
+ <value-name>device-id</value-name>
+ <value>netconf:127.0.0.1:11002</value>
+ </name>
+ </node>
+ </topology>
+ </topology-context>
+ <connectivity-context xmlns="urn:onf:otcc:yang:tapi-connectivity">
+ <connectivity-service>
+ <uuid>00000000-0000-0000-0004-000000000001</uuid>
+ <end-point>
+ <local-id>00000000-0000-0000-0006-000000000001</local-id>
+ </end-point>
+ <end-point>
+ <local-id>00000000-0000-0000-0006-000000000002</local-id>
+ </end-point>
+ <connection>
+ <connection-uuid>00000000-0000-0000-0005-000000000001</connection-uuid>
+ </connection>
+ </connectivity-service>
+ <connection>
+ <uuid>00000000-0000-0000-0005-000000000001</uuid>
+ <connection-end-point>
+ <connection-end-point-uuid>00000000-0000-0000-0007-000000000011</connection-end-point-uuid>
+ <node-edge-point-uuid>00000000-0000-0000-0003-000000000011</node-edge-point-uuid>
+ <node-uuid>00000000-0000-0000-0001-000000000001</node-uuid>
+ <topology-uuid>00000000-0000-0000-0000-000000000001</topology-uuid>
+ </connection-end-point>
+ <connection-end-point>
+ <connection-end-point-uuid>00000000-0000-0000-0007-000000000021</connection-end-point-uuid>
+ <node-edge-point-uuid>00000000-0000-0000-0003-000000000021</node-edge-point-uuid>
+ <node-uuid>00000000-0000-0000-0001-000000000001</node-uuid>
+ <topology-uuid>00000000-0000-0000-0000-000000000001</topology-uuid>
+ </connection-end-point>
+ </connection>
+ </connectivity-context>
+ <service-interface-point>
+ <layer-protocol-name>DSR</layer-protocol-name>
+ <uuid>00000000-0000-0000-0002-000000000001</uuid>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11001/[TRANSCEIVER](1)</value>
+ </name>
+ </service-interface-point>
+ <service-interface-point>
+ <layer-protocol-name>DSR</layer-protocol-name>
+ <uuid>00000000-0000-0000-0002-000000000002</uuid>
+ <name>
+ <value-name>onos-cp</value-name>
+ <value>netconf:127.0.0.1:11002/[TRANSCEIVER](1)</value>
+ </name>
+ </service-interface-point>
+</context>
\ No newline at end of file
diff --git a/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducerTest.java b/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducerTest.java
index bfc45c7..64278fe 100644
--- a/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducerTest.java
+++ b/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DcsBasedTapiDataProducerTest.java
@@ -31,13 +31,15 @@
import org.onosproject.odtn.utils.tapi.TapiNodeHandler;
import org.onosproject.odtn.utils.tapi.TapiNodeRef;
import org.onosproject.odtn.utils.tapi.TapiSipHandler;
+import org.onosproject.odtn.utils.tapi.TapiTopologyContextHandler;
import org.onosproject.odtn.utils.tapi.TapiTopologyHandler;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.DefaultContext;
-import org.onosproject.yang.gen.v1.tapicommon.rev20180307.tapicommon.tapicontext.DefaultServiceInterfacePoint;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.context.DefaultAugmentedTapiCommonContext;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.node.DefaultOwnedNodeEdgePoint;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topology.DefaultNode;
-import org.onosproject.yang.gen.v1.tapitopology.rev20180307.tapitopology.topologycontext.DefaultTopology;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.DefaultContext;
+import org.onosproject.yang.gen.v1.tapicommon.rev20181016.tapicommon.tapicontext.DefaultServiceInterfacePoint;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.context.DefaultAugmentedTapiCommonContext;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.context.augmentedtapicommoncontext.DefaultTopologyContext;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.node.DefaultOwnedNodeEdgePoint;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topology.DefaultNode;
+import org.onosproject.yang.gen.v1.tapitopology.rev20181016.tapitopology.topologycontext.DefaultTopology;
import org.onosproject.yang.model.Augmentable;
import static org.easymock.EasyMock.expectLastCall;
@@ -73,10 +75,14 @@
context = new DefaultContext();
topology = TapiTopologyHandler.create().getModelObject();
- DefaultAugmentedTapiCommonContext topologyContext = new DefaultAugmentedTapiCommonContext();
- topologyContext.addToTopology(topology);
+ DefaultTopologyContext topologyContext = TapiTopologyContextHandler.create().getModelObject();
+
+ DefaultAugmentedTapiCommonContext augmentedTopologyContext = new DefaultAugmentedTapiCommonContext();
Augmentable augmentableContext = context;
- augmentableContext.addAugmentation(topologyContext);
+ augmentableContext.addAugmentation(augmentedTopologyContext);
+
+ augmentedTopologyContext.topologyContext(topologyContext);
+ topologyContext.addToTopology(topology);
node1 = TapiNodeHandler.create()
.setTopologyUuid(topology.uuid())
@@ -236,4 +242,4 @@
verify(mockResolver);
}
-}
\ No newline at end of file
+}
diff --git a/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DefaultTapiResolverTest.java b/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DefaultTapiResolverTest.java
index 5fcad14..6e4dd3a 100644
--- a/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DefaultTapiResolverTest.java
+++ b/apps/odtn/service/src/test/java/org/onosproject/odtn/internal/DefaultTapiResolverTest.java
@@ -192,4 +192,4 @@
assertThat(tapiResolver.getNepRefs(filter), is(exp));
}
-}
\ No newline at end of file
+}
diff --git a/apps/odtn/service/src/test/resources/create-connectivity.json b/apps/odtn/service/src/test/resources/create-connectivity.json
index 283de56..35798f4 100644
--- a/apps/odtn/service/src/test/resources/create-connectivity.json
+++ b/apps/odtn/service/src/test/resources/create-connectivity.json
@@ -5,79 +5,30 @@
{
"layer-protocol-name" : "DSR",
"service-interface-point": {
- "service-interface-point-id" : "00000000-0000-4200-0001-110000000000"
+ "service-interface-point-uuid" : "00000001-0000-0000-0000-000000000001"
},
"capacity" : {
},
"direction" : "BIDIRECTIONAL",
"role" : "UNKNOWN",
- "protection-role" : "WORK",
- "local-id": "00000000-0000-4100-0001-110000000000",
- "name" : [
- {
- "value-name" : "port",
- "value" : "1"
- },
- {
- "value-name" : "transponder",
- "value" : "TRNP_A"
- },
- {
- "value-name" : "onos-index",
- "value" : "1"
- },
- {
- "value-name" : "test-driver",
- "value" : "driver"
- }
- ],
- "administrative-state" : "UNLOCKED",
- "operational-state" : "ENABLED",
- "lifecycle-state" : "INSTALLED"
+ "protection-role" : "WORK"
}
,
{
"layer-protocol-name" : "DSR",
"service-interface-point": {
- "service-interface-point-id" : "00000000-0000-4200-0001-210000000000"
+ "service-interface-point-uuid" : "00000001-0000-0000-0000-000000000002"
},
"capacity" : {
},
"direction" : "BIDIRECTIONAL",
"role" : "UNKNOWN",
- "protection-role" : "WORK",
- "local-id": "00000000-0000-4100-0001-210000000000",
- "name" : [
- {
- "value-name" : "port",
- "value" : "1"
- },
- {
- "value-name" : "transponder",
- "value" : "TRNP_B"
- },
- {
- "value-name" : "onos-index",
- "value" : "1"
- },
- {
- "value-name" : "test-driver",
- "value" : "driver"
- }
- ],
- "administrative-state" : "UNLOCKED",
- "operational-state" : "ENABLED",
- "lifecycle-state" : "INSTALLED"
+ "protection-role" : "WORK"
}
],
-
"conn-constraint" : {},
-
"topo-constraint" : {},
-
- "resilience-constraint" : [ ],
-
- "state" : "operational-state"
+ "resilience-constraint" : [ ]
}
}
diff --git a/apps/odtn/service/src/test/resources/delete-connectivity.json b/apps/odtn/service/src/test/resources/delete-connectivity.json
new file mode 100644
index 0000000..850c18f
--- /dev/null
+++ b/apps/odtn/service/src/test/resources/delete-connectivity.json
@@ -0,0 +1,6 @@
+{
+ "tapi-connectivity:input":
+ {
+ "service-id-or-name" : "00000002-0000-0000-0000-000000000001"
+ }
+}
\ No newline at end of file
diff --git a/apps/odtn/service/src/test/resources/nbi-tapi-sample.json b/apps/odtn/service/src/test/resources/nbi-tapi-sample.json
deleted file mode 100644
index 4578336..0000000
--- a/apps/odtn/service/src/test/resources/nbi-tapi-sample.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "tapi-common:context": {
- "service-interface-point": [
- {
- "uuid": "9F759964-2410-44AF-8522-4FCE2C3ED464",
- "layer-protocol-name": ["DSR"],
- "name": [
- {
- "value-name": "port",
- "value": "1"
- },
- {
- "value-name": "transponder",
- "value": "TRPN_A"
- }
- ]
- },
- {
- "uuid": "FBDDC006-8913-4509-BA71-485CFAC89567",
- "layer-protocol-name": ["DSR"],
- "name": [
- {
- "value-name": "port",
- "value": "1"
- },
- {
- "value-name": "transponder",
- "value": "TRPN_B"
- }
- ]
- }
- ],
-
- "tapi-connectivity:connectivity-service": [
- {
- "uuid" : "D0BF25C8-B20C-49C3-9030-1C5AEC993E44",
- "end-point": [
- {
- "local-id" : "TRPN_A-1",
- "layer-protocol-name": "DSR",
- "service-interface-point": {
- "service-interface-point-id" : "9F759964-2410-44AF-8522-4FCE2C3ED464"
- }
- },
- {
- "local-id" : "TRPN_B-1",
- "layer-protocol-name": "DSR",
- "service-interface-point": {
- "service-interface-point-id" : "FBDDC006-8913-4509-BA71-485CFAC89567"
- }
- }
- ]
- }
- ]
- }
-}
diff --git a/apps/odtn/service/src/test/resources/post-nbi-tapi-rpc b/apps/odtn/service/src/test/resources/post-nbi-tapi-rpc
deleted file mode 100644
index 45bdb17..0000000
--- a/apps/odtn/service/src/test/resources/post-nbi-tapi-rpc
+++ /dev/null
@@ -1 +0,0 @@
-curl -X POST http://localhost:8181/onos/restconf/operations/tapi-connectivity:create-connectivity-service -H 'cache-control: no-cache' -H 'content-type: application/json' -d @create-connectivity.json
diff --git a/apps/odtn/service/src/test/resources/post-nbi-tapi-sample b/apps/odtn/service/src/test/resources/post-nbi-tapi-sample
deleted file mode 100644
index ffdd3d9..0000000
--- a/apps/odtn/service/src/test/resources/post-nbi-tapi-sample
+++ /dev/null
@@ -1,2 +0,0 @@
-curl -X POST http://localhost:8181/onos/restconf/data -H 'cache-control: no-cache' -H 'content-type: application/json' -d @nbi-tapi-sample.json
-
diff --git a/apps/odtn/service/src/test/resources/post-tapi-rpc-create-connectivity-service b/apps/odtn/service/src/test/resources/post-tapi-rpc-create-connectivity-service
new file mode 100644
index 0000000..8f3409d
--- /dev/null
+++ b/apps/odtn/service/src/test/resources/post-tapi-rpc-create-connectivity-service
@@ -0,0 +1 @@
+curl -X POST http://localhost:8181/onos/restconf/operations/tapi-connectivity:create-connectivity-service -H 'cache-control: no-cache' -H 'content-type: application/json' -H 'Basic a2FyYWY6a2FyYWY=' -d @create-connectivity.json
diff --git a/apps/odtn/service/src/test/resources/post-tapi-rpc-delete-connectivity-service b/apps/odtn/service/src/test/resources/post-tapi-rpc-delete-connectivity-service
new file mode 100644
index 0000000..b45296e
--- /dev/null
+++ b/apps/odtn/service/src/test/resources/post-tapi-rpc-delete-connectivity-service
@@ -0,0 +1 @@
+curl -X POST http://localhost:8181/onos/restconf/operations/tapi-connectivity:delete-connectivity-service -H 'cache-control: no-cache' -H 'content-type: application/json' -H 'Basic a2FyYWY6a2FyYWY=' -d @delete-connectivity.json