[ONOS-7883] extend execute-tapi-context-get-call.py to complete topology checking
Change-Id: Ie2996862139c5dd5038a2921e84d4d19febfbcdd
diff --git a/tools/test/scenarios/bin/execute-tapi-context-get-call.py b/tools/test/scenarios/bin/execute-tapi-context-get-call.py
index 95cff90..22b1f27 100755
--- a/tools/test/scenarios/bin/execute-tapi-context-get-call.py
+++ b/tools/test/scenarios/bin/execute-tapi-context-get-call.py
@@ -29,11 +29,19 @@
sys.exit(0)
if state == "full":
- devices = sys.argv[3]
- links = sys.argv[4]
- ports = sys.argv[5]
- #TODO parse reply for number of devices, links and ports
- print "Parsing for given topology not yet implemented"
+ devices = int(sys.argv[3])
+ links = int(sys.argv[4])
+ ports = int(sys.argv[5])
+ dev_num = len(tapiContext['tapi-common:context']['tapi-topology:topology-context']['topology'][0]['node'])
+ directed_link_num = len(tapiContext['tapi-common:context']['tapi-topology:topology-context']['topology'][0]['link'])
+ port_num = 0
+ for x in range(dev_num):
+ port_num=port_num+len(tapiContext['tapi-common:context']['tapi-topology:topology-context']['topology'][0]['node'][x]['owned-node-edge-point'])
+ print "device\tlink\tport\n%i\t%i\t%i" % (dev_num, directed_link_num/2, port_num)
+ assert devices == dev_num
+ assert links == directed_link_num/2
+ assert ports == port_num
+ print "Topology infomation checking passed."
sys.exit(0)
sys.exit(1)