added devices driver function
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 89362da..1d45f8a 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -211,6 +211,33 @@
main.cleanup()
main.exit()
+ def remove_node(self, node_id):
+ '''
+ Removes a cluster by ID
+ Issues command: 'remove-node [<node-id>]'
+ Required:
+ * node_id
+ '''
+ try:
+ self.handle.sendline("")
+ self.handle.expect("onos>")
+
+ self.handle.sendline("remove-node "+str(node_id))
+ self.handle.expect("onos>")
+
+ return main.TRUE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
def onos_topology(self):
'''
@@ -294,4 +321,44 @@
main.cleanup()
main.exit()
+ def devices(self, grep_str=""):
+ '''
+ Lists all infrastructure devices
+ Optional argument:
+ * grep_str - pass in a string to grep
+ '''
+ try:
+ self.handle.sendline("")
+ self.handle.expect("onos>")
+
+ if not grep_str:
+ self.handle.sendline("devices")
+ self.handle.expect("onos>")
+ else:
+ self.handle.sendline("devices | grep '"+
+ str(grep_str)+"'")
+ self.handle.expect("onos>")
+
+ handle = self.handle.before
+ handle += self.handle.after
+
+ self.handle.sendline("")
+ self.handle.expect("onos>")
+
+ handle += self.handle.before
+ handle += self.handle.after
+
+ return handle
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.py b/TestON/tests/ONOSNextTest/ONOSNextTest.py
index dd91efb..fcdc28e 100755
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.py
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.py
@@ -148,6 +148,8 @@
'''
Test the ONOS-cli functionality
'''
+ import time
+
cell_name = main.params['ENV']['cellName']
ONOS1_ip = main.params['CTRL']['ip1']
@@ -157,8 +159,31 @@
main.ONOScli.set_cell(cell_name)
main.step("Start ONOS-cli")
- main.ONOScli.start_onos_cli()
+ main.ONOScli.start_onos_cli(ONOS1_ip)
main.step("issue command: onos:topology")
- main.ONOScli.onos_topology()
+ topology_obj = main.ONOScli.onos_topology()
+
+ main.step("issue various feature:install <str> commands")
+ main.ONOScli.feature_install("onos-app-fwd")
+ main.ONOScli.feature_install("onos-rest")
+
+ main.step("Add a bad node")
+ node_result = main.ONOScli.add_node("111", "10.128.20.")
+ if node_result == main.TRUE:
+ main.log.info("Node successfully added")
+
+ main.step("Add a correct node")
+ node_result = main.ONOScli.add_node("111", "10.128.20.12")
+
+ main.step("List devices")
+ for i in range(1,8):
+ main.Mininet2.handle.sendline("sudo ovs-vsctl set-controller s"+str(i)+
+ " tcp:10.128.20.11")
+ main.Mininet2.handle.expect("\$")
+ #Need to sleep to allow switch add processing
+ time.sleep(10)
+ list_result = main.ONOScli.devices()
+ main.log.info(list_result)
+
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.topo b/TestON/tests/ONOSNextTest/ONOSNextTest.topo
index de31bc9..1e319d8 100755
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.topo
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.topo
@@ -43,5 +43,19 @@
</COMPONENTS>
</Mininet1>
+ <Mininet2>
+ <host>10.128.10.90</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ <arg1> --custom topo-intentTPtest.py </arg1>
+ <arg2> --arp --mac</arg2>
+ <arg3> --topo mytopo</arg3>
+ <controller> remote </controller>
+ </COMPONENTS>
+ </Mininet2>
+
</COMPONENT>
</TOPOLOGY>