Fix typos and code style issues in drivers
diff --git a/TestON/drivers/common/cli/dpclidriver.py b/TestON/drivers/common/cli/dpclidriver.py
index ee26bde..81743d3 100644
--- a/TestON/drivers/common/cli/dpclidriver.py
+++ b/TestON/drivers/common/cli/dpclidriver.py
@@ -18,9 +18,9 @@
self.name = self.options[ 'name' ]
self.handle = super( DPCliDriver, self ).connect( user_name=self.user_name,
- ip_address=self.ip_address,
- port=self.port,
- pwd=self.pwd )
+ ip_address=self.ip_address,
+ port=self.port,
+ pwd=self.pwd )
if self.handle:
return self.handle
@@ -30,11 +30,17 @@
def create_interfaces( self, net, number, start ):
"""
- Creates a number,specified by 'number,' of subinterfaces on eth0. Ip addresses start at 'net'.'start'.1.1 with a 24 bit netmask. Addresses increment sequentially in the third quad,
- therefore all interfaces are in different subnets on the same machine. When the third quad reaches 255, it is reset to 1 and the second quad is incremented.
- Every single ip address is placed in a file in /tmp titled 'ip_table{net}.txt'
- The file is used by 'pingall_interfaces()' as a fping argument
- This method returns true if all interfaces are created without a hitch, and false if a single interface has issues
+ Creates a number,specified by 'number,' of subinterfaces on eth0.
+ Ip addresses start at 'net'.'start'.1.1 with a 24 bit netmask.
+ Addresses increment sequentially in the third quad, therefore all
+ interfaces are in different subnets on the same machine. When the
+ third quad reaches 255, it is reset to 1 and the second quad is
+ incremented. Every single ip address is placed in a file in /tmp
+ titled 'ip_table{net}.txt'. The file is used by 'pingall_interfaces()'
+ as a fping argument
+
+ This method returns true if all interfaces are created without a hitch,
+ and false if a single interface has issues
"""
self.handle.sendline( "" )
self.handle.expect( "\$" )
@@ -60,11 +66,11 @@
intf ) + " " + ip + " netmask 255.255.255.0" )
i = self.handle.expect( [
- "\$",
+ "\$",
"password",
pexpect.TIMEOUT,
pexpect.EOF ],
- timeout=120 )
+ timeout=120 )
if i == 0:
self.handle.sendline(
@@ -80,15 +86,20 @@
def pingall_interfaces( self, netsrc, netstrt, netdst, destlogin, destip ):
"""
- Copies the /tmp/ip_table{ net }.txt file from the machine you wish to ping, then runs fping with a source address of { netsrc }.{ netstrt }.1.1 on the copied file.
- Check every single response for reachable or unreachable. If all are reachable, function returns true. If a SINGLE host is unreachable, then the function stops and returns false
- If fping is not installed, this function will install fping then run the same command
+ Copies the /tmp/ip_table{ net }.txt file from the machine you wish to
+ ping, then runs fping with a source address of
+ { netsrc }.{ netstrt }.1.1 on the copied file.
+ Check every single response for reachable or unreachable. If all are
+ reachable, function returns true. If a SINGLE host is unreachable,
+ then the function stops and returns false. If fping is not installed,
+ this function will install fping then run the same command
"""
self.handle.sendline( "" )
self.handle.expect( "\$" )
self.handle.sendline( "scp " + str( destlogin ) + "@" +
- str( destip ) + ":/tmp/local_ip.txt /tmp/ip_table" +
+ str( destip ) +
+ ":/tmp/local_ip.txt /tmp/ip_table" +
str( netsrc ) + ".txt" )
i = self.handle.expect( [
@@ -145,11 +156,10 @@
elif i == 5:
main.log.info( "fping not installed, installing fping" )
self.handle.sendline( "sudo apt-get install fping" )
- i = self.handle.expect(
- [ "password",
- "\$",
- pexpect.TIMEOUT ],
- timeout=60 )
+ i = self.handle.expect( [ "password",
+ "\$",
+ pexpect.TIMEOUT ],
+ timeout=60 )
if i == 0:
self.handle.sendline( self.pwd )
self.handle.expect( "\$", timeout=30 )
@@ -176,7 +186,7 @@
try:
self.handle.sendline( "exit" )
self.handle.expect( "closed" )
- except Exception:
+ except pexpect.ExceptionPexpect:
main.log.exception( "Connection failed to the host" )
response = main.FALSE
return response