From 34694eb54af0cd89487a0ec2f308181d47dc29f6 Mon Sep 17 00:00:00 2001 From: Andrea Campanella Date: Wed, 27 Feb 2019 16:10:08 +0100 Subject: [PATCH] Minor fix for tapi helper and for TAPI Rpc error message Change-Id: Ieef1c0937f797efc26a00d9e9e67850cb92f6919 --- .../resources/openconfig-device-link.json | 18 ++++++++++----- .../internal/DcsBasedTapiConnectivityRpc.java | 2 +- tools/test/scenarios/bin/tapiHelper.py | 22 ++++++++++++++----- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/apps/odtn/api/src/test/resources/openconfig-device-link.json b/apps/odtn/api/src/test/resources/openconfig-device-link.json index 9cbc0e375a..23bbf678d8 100644 --- a/apps/odtn/api/src/test/resources/openconfig-device-link.json +++ b/apps/odtn/api/src/test/resources/openconfig-device-link.json @@ -4,42 +4,48 @@ "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } }, "netconf:127.0.0.1:11002/202-netconf:127.0.0.1:11003/202": { "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } }, "netconf:127.0.0.1:11002/203-netconf:127.0.0.1:11003/203": { "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } }, "netconf:127.0.0.1:11002/204-netconf:127.0.0.1:11003/204": { "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } }, "netconf:127.0.0.1:11002/205-netconf:127.0.0.1:11003/205": { "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } }, "netconf:127.0.0.1:11002/206-netconf:127.0.0.1:11003/206": { "basic": { "type": "OPTICAL", "metric": 1, - "durable": true + "durable": true, + "bidirectional": true } } } 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 d5f2962d4c..b68696edf9 100755 --- 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 @@ -82,7 +82,7 @@ public class DcsBasedTapiConnectivityRpc implements TapiConnectivityService { // check SIP validation if (!disjoint(getUsedSips(), input.getSips())) { - log.error("check SIP validation : NG"); + log.error("SIPS {} are already used, please use a different pair", input.getSips()); return new RpcOutput(RpcOutput.Status.RPC_FAILURE, null); } log.debug("check SIP validation : OK"); diff --git a/tools/test/scenarios/bin/tapiHelper.py b/tools/test/scenarios/bin/tapiHelper.py index 9fe3fcc9de..f5bfcc852f 100755 --- a/tools/test/scenarios/bin/tapiHelper.py +++ b/tools/test/scenarios/bin/tapiHelper.py @@ -141,6 +141,8 @@ def create_client_connection(url_context, url_connectivity): assert topo["uuid"] == nep_pair[1]["topology-uuid"] (src_onep, dst_onep) = (find_client_onep(nep_pair[0], topo["node"]), find_client_onep(nep_pair[1], topo["node"])) + print "client side neps", (src_onep, dst_onep) + src_sip_uuid, dst_sip_uuid = \ (src_onep["mapped-service-interface-point"][0]["service-interface-point-uuid"], dst_onep["mapped-service-interface-point"][0]["service-interface-point-uuid"]) @@ -157,6 +159,14 @@ def create_client_connection(url_context, url_connectivity): raise Exception('POST {}'.format(resp.status_code)) return resp +# +# Parse array structure "name" under structure "owned node edge point" +# +def parse_value(arr): + rtn = {} + for item in arr: + rtn[item["value-name"]] = item["value"] + return rtn # # Find node edge point of node structure in topology with client-side port, by using nep with line-side port. @@ -168,16 +178,18 @@ def find_client_onep(line_nep_in_link, nodes): conn_id = None for onep in node["owned-node-edge-point"]: if onep["uuid"] == line_nep_in_link["node-edge-point-uuid"]: - assert onep["name"][1]["value-name"] == "odtn-connection-id" - assert onep["name"][0]["value"] == "line" - conn_id = onep["name"][1]["value"] - break + name = parse_value(onep["name"]) + if name["odtn-port-type"] == "line": + conn_id = name["odtn-connection-id"] + break if conn_id is None: raise AssertionError("Cannot find owned node edge point with node id %s and nep id %s." % (line_nep_in_link["node-uuid"], line_nep_in_link["node-edge-point-uuid"], )) for onep in node["owned-node-edge-point"]: - if onep["name"][1]["value"] == conn_id and onep["name"][0]["value"] == "client": + name = parse_value(onep["name"]) + if name["odtn-port-type"] == "client" and name["odtn-connection-id"] == conn_id: return onep + return None