[ONOS-7883] extend execute-tapi-post-call.py, verify its get-sip-list and create-sip function
Change-Id: I4ba37f1b80c737c4c0983e5aabfac0aafdd27440
diff --git a/tools/test/scenarios/bin/execute-tapi-post-call.py b/tools/test/scenarios/bin/execute-tapi-post-call.py
index 031e276..3536791 100755
--- a/tools/test/scenarios/bin/execute-tapi-post-call.py
+++ b/tools/test/scenarios/bin/execute-tapi-post-call.py
@@ -7,7 +7,8 @@
from requests.auth import HTTPBasicAuth
if len(sys.argv) < 4:
- print "usage: execute-tapi-post-call onos-node context empty uuid. Uuid is optional and defaults to empty"
+ print "usage: execute-tapi-post-call <onos-node> <context> <empty> [uuid]."
+ print "\t- If <empty> is \"empty\", it measn that it shoudl be no devices, links or ports\n\t- Uuid is optional and defaults to empty"
sys.exit(1)
node = sys.argv[1]
@@ -27,10 +28,23 @@
if not tapi_connection_json["tapi-connectivity:output"] and empty != "empty":
print "No connection was established"
sys.exit(1)
- #TODO verify empty connection if uuid is empty
- #TODO verify correct connection if uuid is not empty
+ if uuid == "":
+ # verify empty connection
+ print tapi_connection_json
+ elif uuid != "":
+ # verify correct connection
+ servs = tapi_connection_json["tapi-connectivity:output"]["service"]
+ for s in range(len(servs)):
+ if servs[s]['uuid'] == uuid:
+ print "Find service with uuid %s" % uuid
+ print servs[s]
+ sys.exit(0)
+ else:
+ print "Invalid input for 3rd and 4th parameters."
+ sys.exit(1)
sys.exit(0)
+# test succeeds by using cmd: python execute-tapi-post-call.py 127.0.0.1 tapi-connectivity:create-connectivity-service empty
if "create-connectivity-service" in context:
context_request = 'http://' + node + ':8181/onos/restconf/data/tapi-common:context'
connectivity_request = 'http://' + node + ':8181/onos/restconf/operations/' + context
diff --git a/tools/test/scenarios/bin/tapiHelper.py b/tools/test/scenarios/bin/tapiHelper.py
index 74714d0..77c3cd4 100755
--- a/tools/test/scenarios/bin/tapiHelper.py
+++ b/tools/test/scenarios/bin/tapiHelper.py
@@ -96,12 +96,8 @@
# Obtains existing connectivity services
#
def get_connection(url_connectivity, uuid):
- if(uuid == ""):
- json = '{}'
- else:
- #TODO use uuid to retrieve given topo
- print "Not Yet implemented"
- json = '{}'
+ # uuid is useless for this method
+ json = '{}'
headers = {'Content-type': 'application/json'}
resp = requests.post(url_connectivity, data=json, headers=headers, auth=('onos', 'rocks'))
if resp.status_code != 200: