update to drivers
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: