update to drivers
diff --git a/TestON/drivers/common/cli/cassandraclidriver.py b/TestON/drivers/common/cli/cassandraclidriver.py
index 0b43d32..d307f93 100644
--- a/TestON/drivers/common/cli/cassandraclidriver.py
+++ b/TestON/drivers/common/cli/cassandraclidriver.py
@@ -37,7 +37,7 @@
class CassandraCliDriver(CLI):
'''
- CassandraCliDriver is the basic driver which will handle the Cassandra's functions
+ CassandraCliDriver is the basic driver which will handle the Cassandra's functions
'''
def __init__(self):
super(CLI, self).__init__()
@@ -64,7 +64,9 @@
def start(self):
- ''' This Function will start the Cassandra'''
+ '''
+ This Function will start the Cassandra
+ '''
main.log.info( "Starting Cassandra" )
self.handle.sendline("")
self.handle.expect("\$")
@@ -81,7 +83,9 @@
return main.FALSE
def status(self):
- '''This Function will return the Status of the Cassandra '''
+ '''
+ This Function will return the Status of the Cassandra
+ '''
time.sleep(5)
self.execute(cmd="\r",prompt="\$",timeout=10)
response = self.execute(cmd="~/ONOS/start-cassandra.sh status ",prompt="\d+\sinstance\sof\scassandra\srunning(.*)",timeout=10)
@@ -98,7 +102,9 @@
return main.TRUE
def stop(self):
- '''This Function will stop the Cassandra if it is Running'''
+ '''
+ This Function will stop the Cassandra if it is Running
+ '''
self.execute(cmd="\r",prompt="\$",timeout=10)
time.sleep(5)
response = self.execute(cmd="~/ONOS/start-cassandra.sh stop ",prompt="Killed\sexisting\sprosess(.*)",timeout=10)
@@ -111,7 +117,9 @@
return main.FALSE
def disconnect(self):
-
+ '''
+ Called at the end of the test to disconnect the ssh handle.
+ '''
response = ''
if self.handle:
self.handle.sendline("exit")
@@ -122,6 +130,11 @@
return response
def isup(self):
+ '''
+ A more complete status check of cassandra.
+ Tries 5 times to call start-cassandra.sh status
+ returns TRUE if it sees four occurances of both Up, and Normal
+ '''
tries = 5
main.log.info("trying %i times" % tries )
for i in range(tries):
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index aa02ed1..4e60f46 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -124,6 +124,27 @@
else :
main.log.error("Connection failed to the host")
return main.FALSE
+
+ def fpingHost(self,**pingParams):
+ '''
+ Uses the fping package for faster pinging...
+ *requires fping to be installed on machine running mininet
+ '''
+ args = utilities.parse_args(["SRC","TARGET"],**pingParams)
+ command = args["SRC"] + " fping -i 100 -t 10 -C 1 -q "+args["TARGET"]
+ self.handle.sendline(command)
+ self.handle.expect(args["TARGET"])
+ self.handle.expect("mininet")
+ response = self.handle.before
+ if re.search(":\s-" ,response):
+ main.log.info("Ping fail")
+ return main.FALSE
+ elif re.search(":\s\d\.\d\d", response):
+ main.log.info("Ping good!")
+ return main.TRUE
+ main.log.info("Install fping on mininet machine... ")
+ main.log.info("\n---\n"+response)
+ return main.FALSE
def pingHost(self,**pingParams):
@@ -255,6 +276,32 @@
return main.TRUE
+ def yank(self, **yangargs):
+ '''
+ yank out a mininet switch interfacet to host
+ '''
+ main.log.info('Yang out the switch interface attached to a host')
+ args = utilities.parse_args(["SW","INTF"])
+ sw = args["SW"] if args["SW"] !=None else ""
+ intf = args["INTF"] if args["INTF"] != None else ""
+ command = "py "+ str(sw) + '.detach("' + str(intf) + '")'
+ response = self.execute(cmd=command,prompt="mininet>",timeout=10)
+ return main.TRUE
+
+ def plug(self, **plugargs):
+ '''
+ plug the yanked mininet switch interface to a switch
+ '''
+ main.log.info('Plug the switch interface attached to a switch')
+ args = utilities.parse_args(["SW","INTF"])
+ sw = args["SW"] if args["SW"] !=None else ""
+ intf = args["INTF"] if args["INTF"] != None else ""
+ command = "py "+ str(sw) + '.attach("' + str(intf) + '")'
+ response = self.execute(cmd=command,prompt="mininet>",timeout=10)
+ return main.TRUE
+
+
+
def dpctl(self,**dpctlargs):
'''
Run dpctl command on all switches.
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index b55a371..5452dbe 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -37,7 +37,9 @@
class RemoteMininetDriver(Emulator):
'''
- MininetCliDriver is the basic driver which will handle the Mininet functions
+ RemoteMininetCliDriver is the basic driver which will handle the Mininet functions
+ The main different between this and the MininetCliDriver is that this one does not build the mininet.
+ It assumes that there is already a mininet running on the target.
'''
def __init__(self):
super(Emulator, self).__init__()
@@ -66,6 +68,9 @@
return main.FALSE
def pingLong(self,**pingParams):
+ '''
+ Starts a continuous ping on the mininet host outputing to a file in the /tmp dir.
+ '''
args = utilities.parse_args(["SRC","TARGET"],**pingParams)
command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .1 -D -W 1 > /tmp/ping." + args["SRC"] + " &"
main.log.info( command )
@@ -73,15 +78,9 @@
return main.TRUE
def pingstatus(self,**pingParams):
- #self.handle.sendline("pgrep ping")
- #self.handle.expect("pgrep")
- #self.handle.expect("\$")
- #result = self.handle.before + self.handle.after
- #if re.search('\d\d+', result ):
- # return main.TRUE
- #else:
- # return main.FALSE
-
+ '''
+ Tails the respective ping output file and check that there is a moving "64 bytes"
+ '''
args = utilities.parse_args(["SRC"],**pingParams)
self.handle.sendline("tail /tmp/ping." + args["SRC"])
self.handle.expect("tail")
@@ -98,20 +97,17 @@
return main.FALSE
def pingKill(self):
+ '''
+ Kills all continuous ping processes.
+ Then copies all the ping files to the TestStation.
+ '''
+ import time
command = "sudo pkill ping"
main.log.info( command )
self.execute(cmd=command,prompt="(.*)",timeout=10)
- #command = "sudo pgrep ping"
- #result1 = self.execute(cmd="\r",prompt="\$",timout=10)
- #result = self.execute(cmd=command,prompt=self.user_name,timout=10)
- #if utilities.assert_matches(expect='[^\s]+',actual=result,onpass="match",onfail="no match"):
- # main.log.info( "pings running as process" )
- # main.log.info( result )
- # return main.FALSE
main.log.info( "Removing old ping data" )
command = "rm /tmp/ping.*"
os.popen(command)
- import time
time.sleep(2)
main.log.info( "Transferring ping files to TestStation" )
command = "scp /tmp/ping.* admin@10.128.7.7:/tmp/"
@@ -119,7 +115,9 @@
return main.TRUE
def pingHost(self,**pingParams):
-
+ '''
+ Pings between two hosts on remote mininet
+ '''
args = utilities.parse_args(["SRC","TARGET"],**pingParams)
command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -c 4 -W 1 -i .2"
main.log.info ( command )
@@ -136,7 +134,7 @@
def checknum(self,num):
'''
- Verifies the correct number of switches are running
+ Verifies the correct number of switches are running
'''
if self.handle :
self.handle.sendline("")
@@ -161,12 +159,21 @@
main.log.error("Connection failed to the host")
def ctrl_none(self):
+ '''
+ Sets all the switches to no controllers.
+ '''
self.execute(cmd="~/ONOS/scripts/test-ctrl-none.sh", prompt="\$",timeout=10)
def ctrl_one(self, ip):
+ '''
+ Sets all the switches to point to the supplied IP
+ '''
self.execute(cmd="~/ONOS/scripts/test-ctrl-one.sh "+ip, prompt="\$",timeout=10)
def ctrl_local(self):
+ '''
+ Sets all the switches to point to the Controller on the same machine that they are running on.
+ '''
self.execute(cmd="~/ONOS/scripts/test-ctrl-local.sh ", prompt="\$",timeout=10)
# def verifySSH(self,**connectargs):
@@ -293,7 +300,9 @@
# return version
def disconnect(self):
-
+ '''
+ Called at the end of the test to disconnect the handle.
+ '''
response = ''
#print "Disconnecting Mininet"
if self.handle:
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 670a492..41505f2 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -62,14 +62,16 @@
self.handle.sendline("cd ~/ONOS")
self.handle.expect("ONOS\$")
self.handle.sendline("./start-onos.sh start")
+ self.handle.expect("onos.sh start")
i=self.handle.expect(["Starting\sONOS\scontroller","Cassandra\sis\snot\srunning"])
if i==0:
- if self.handle.expect("ONOS\$", 60):
+ try:
+ self.handle.expect("ONOS\$", timeout=60)
main.log.info("ONOS Started ")
- return main.TRUE
- else:
+ except:
main.log.info("ONOS NOT Started, stuck while waiting for it to start ")
return main.FALSE
+ return main.TRUE
elif i==1:
main.log.error("ONOS didn't start because cassandra wasn't running.")
return main.FALSE
@@ -192,8 +194,9 @@
self.handle.expect("ONOS\$")
self.handle.sendline("./start-onos.sh stop")
self.handle.expect("stop", 2)
+ result = self.handle.before
self.handle.expect("ONOS\$", 60)
- if re.search("Killed",response):
+ if re.search("Killed", result):
main.log.info("ONOS Killed Successfully")
return main.TRUE
else :
@@ -215,18 +218,17 @@
def disconnect(self):
'''
- Called when Test is complete to dissconnect the ONOS handle.
+ Called when Test is complete to disconnect the ONOS handle.
'''
- if self.handle:
+ response = ''
+ try:
self.handle.sendline("exit")
- self.handle.expect("closed")
- if self.handle.isalive():
- response = main.TRUE
- else :
+ self.handle.expect("closed")
+ except:
main.log.error("Connection failed to the host")
response = main.FALSE
- return response
-
+ return response
+
def get_version(self):
'''
Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
diff --git a/TestON/drivers/common/cli/zookeeperclidriver.py b/TestON/drivers/common/cli/zookeeperclidriver.py
index 60ac65e..2a575ae 100644
--- a/TestON/drivers/common/cli/zookeeperclidriver.py
+++ b/TestON/drivers/common/cli/zookeeperclidriver.py
@@ -37,7 +37,7 @@
class ZookeeperCliDriver(CLI):
'''
- ZookeeperCliDriver is the basic driver which will handle the Zookeeper's functions
+ ZookeeperCliDriver is the basic driver which will handle the Zookeeper's functions
'''
def __init__(self):
super(CLI, self).__init__()
@@ -64,7 +64,9 @@
def start(self):
- ''' This Function will start the Zookeeper'''
+ '''
+ This Function will start the Zookeeper
+ '''
main.log.info( "Starting Zookeeper" )
self.handle.sendline("")
self.handle.expect("\$")
@@ -82,7 +84,9 @@
return main.FALSE
def status(self):
- '''This Function will return the Status of the Zookeeper '''
+ '''
+ This Function will return the Status of the Zookeeper
+ '''
time.sleep(5)
self.execute(cmd="\r",prompt="\$",timeout=10)
response = self.execute(cmd="~/zookeeper-3.4.5/bin/zkServer.sh status ",prompt="JMX",timeout=10)
@@ -91,7 +95,9 @@
return response
def stop(self):
- '''This Function will stop the Zookeeper if it is Running'''
+ '''
+ This Function will stop the Zookeeper if it is Running
+ '''
self.execute(cmd="\r",prompt="\$",timeout=10)
time.sleep(5)
response = self.execute(cmd="~/zookeeper-3.4.5/bin/zkServer.sh stop ",prompt="STOPPED",timeout=10)
@@ -104,7 +110,9 @@
return main.FALSE
def disconnect(self):
-
+ '''
+ Called at the end of the test to disconnect the ZK handle
+ '''
response = ''
if self.handle:
self.handle.sendline("exit")
@@ -115,6 +123,9 @@
return response
def isup(self):
+ '''
+ Calls the zookeeper status and returns TRUE if it has an assigned Mode to it.
+ '''
self.execute(cmd="\n",prompt="\$",timeout=10)
response = self.execute(cmd="~/zookeeper-3.4.5/bin/zkServer.sh status ",prompt="Mode",timeout=10)
pattern = '(.*)Mode(.*)'