modified get_topology and check_status functions to take topology_result argument instead of ip
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index e924c29..c29ac32 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -584,19 +584,22 @@
self.handle.sendline("onos -w " + ONOS_ip + " " + cmdstr)
self.handle.expect("\$")
- handle_before = str(self.handle.before)
+ handle_before = self.handle.before
+ print "handle_before = ", self.handle.before
handle_after = str(self.handle.after)
- self.handle.sendline("")
- self.handle.expect("\$")
- handle_more = str(self.handle.before)
+ #self.handle.sendline("")
+ #self.handle.expect("\$")
+ #handle_more = str(self.handle.before)
main.log.info("Command sent successfully")
#Obtain return handle that consists of result from
#the onos command. The string may need to be
#configured further.
- return_string = handle_before + handle_after + handle_more
+ #return_string = handle_before + handle_after
+ return_string = handle_before
+ print "return_string = ", return_string
return return_string
except pexpect.EOF:
@@ -875,7 +878,7 @@
main.exit()
- def get_topology(self, ip):
+ def get_topology(self,topology_output):
'''
parses the onos:topology output
Returns: a topology dict populated by the key values found in
@@ -884,32 +887,32 @@
try:
#call the cli to get the topology summary
- cmdstr = "onos:topology"
- cli_result = self.onos_cli(ip, cmdstr)
-
+ #cmdstr = "onos:topology"
+ #cli_result = self.onos_cli(ip, cmdstr)
+ #print "cli_result = ", cli_result
#Parse the output
topology = {}
#for line in cli_result.split("\n"):
- for line in cli_result.splitlines():
+ for line in topology_output.splitlines():
if not line.startswith("time="):
continue
#else
print line
for var in line.split(","):
- print "'"+var+"'"
- print "'"+var.strip()+"'"
+ #print "'"+var+"'"
+ #print "'"+var.strip()+"'"
key, value = var.strip().split("=")
topology[key] = value
- print topology
+ print "topology = ", topology
devices = topology.get('devices', False)
- print devices
+ print "devices = ", devices
links = topology.get('links', False)
- print links
+ print "links = ", links
clusters = topology.get('clusters', False)
- print clusters
+ print "clusters = ", clusters
paths = topology.get('paths', False)
- print paths
+ print "paths = ", paths
return topology
except pexpect.EOF:
@@ -923,8 +926,10 @@
main.log.info(self.name+" ::::::")
main.cleanup()
main.exit()
+
+
- def check_status(self, ip, numoswitch, numolink, log_level="info"):
+ def check_status(self, topology_result, numoswitch, numolink, log_level="info"):
'''
Checks the number of swithes & links that ONOS sees against the
supplied values. By default this will report to main.log, but the
@@ -944,7 +949,7 @@
'''
try:
- topology = self.get_topology(ip)
+ topology = self.get_topology(topology_result)
if topology == {}:
return main.ERROR
output = ""
@@ -986,6 +991,7 @@
main.cleanup()
main.exit()
+
def tshark_grep(self, grep, directory, interface='eth0'):
'''
Required: