Fixed mininet driver stopNet to validate current prompt
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b7dc847..2ba4b6d 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -97,11 +97,6 @@
main.cleanup()
main.exit()
-<<<<<<< HEAD
-
- def startNet( self, topoFile = '', args = '', timeout = 120 ):
-=======
->>>>>>> 42efbd8869b8e52ac17c3f0966cdf12979e41e0f
def startNet( self, topoFile = '', args = '', timeout = 120 ):
"""
@@ -1245,12 +1240,8 @@
def disconnect( self ):
"""
-<<<<<<< HEAD
- Called at the end of the test to disconnect the handle.
-=======
Called at the end of the test to stop the mininet and
disconnect the handle.
->>>>>>> 42efbd8869b8e52ac17c3f0966cdf12979e41e0f
"""
self.handle.sendline('')
i = 1
@@ -1264,29 +1255,31 @@
self.handle.expect( "exit" )
self.handle.expect( "(.*)" )
main.log.info( "Mininet CLI is successfully disconnected" )
-<<<<<<< HEAD
- response = self.handle.before
-=======
response = main.TRUE
->>>>>>> 42efbd8869b8e52ac17c3f0966cdf12979e41e0f
else:
main.log.error( "Connection failed to the host" )
response = main.FALSE
return response
- def stopNet( self ):
-<<<<<<< HEAD
-=======
+ def stopNet( self , timeout = 5):
"""
Stops mininet. returns true if the mininet succesfully stops.
"""
->>>>>>> 42efbd8869b8e52ac17c3f0966cdf12979e41e0f
main.log.info( self.name + ": Disconnecting mininet..." )
response = ''
if self.handle:
try:
+
+ i = self.handle.expect( [ 'mininet>',
+ '\$',
+ pexpect.EOF,
+ pexpect.TIMEOUT ],
+ timeout )
+ if i == 0:
+ main.log.info( "Exiting mininet..." )
+
response = self.execute(
cmd="exit",
prompt="(.*)",
@@ -1294,6 +1287,16 @@
main.log.info( self.name + ": Disconnected")
self.handle.sendline( "sudo mn -c" )
response = main.TRUE
+
+ if i == 1:
+ main.log.info( " Mininet trying to exit while not " +
+ "in the mininet prompt" )
+ elif i == 2:
+ main.log.error( "Something went wrong exiting mininet" )
+ elif i == 3: # timeout
+ main.log.error( "Something went wrong exiting mininet " +
+ "TIMEOUT" )
+
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
index aecaab6..8d0d10b 100644
--- a/TestON/tests/PingallExample/PingallExample.params
+++ b/TestON/tests/PingallExample/PingallExample.params
@@ -1,12 +1,12 @@
<PARAMS>
<testcases>1,2,3</testcases>
<ENV>
- <cellName>HA</cellName>
+ <cellName>kelvin</cellName>
</ENV>
<Git>True</Git>
<CTRL>
- <ip1>10.128.30.11</ip1>
+ <ip1>10.128.10.21</ip1>
<port1>6633</port1>
</CTRL>
</PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.topo b/TestON/tests/PingallExample/PingallExample.topo
index 1712756..dba7a5d 100644
--- a/TestON/tests/PingallExample/PingallExample.topo
+++ b/TestON/tests/PingallExample/PingallExample.topo
@@ -2,7 +2,7 @@
<COMPONENT>
<ONOSbench>
- <host>10.128.30.10</host>
+ <host>10.128.10.20</host>
<user>admin</user>
<password></password>
<type>OnosDriver</type>
@@ -11,7 +11,7 @@
</ONOSbench>
<ONOScli1>
- <host>10.128.30.10</host>
+ <host>10.128.10.20</host>
<user>admin</user>
<password></password>
<type>OnosCliDriver</type>
@@ -20,16 +20,16 @@
</ONOScli1>
<ONOS1>
- <host>10.128.30.11</host>
- <user>sdn</user>
- <password>rocks</password>
+ <host>10.128.10.21</host>
+ <user>admin</user>
+ <password></password>
<type>OnosDriver</type>
<connect_order>3</connect_order>
<COMPONENTS> </COMPONENTS>
</ONOS1>
<Mininet1>
- <host>10.128.30.9</host>
+ <host>10.128.10.20</host>
<user>admin</user>
<password></password>
<type>MininetCliDriver</type>