Fix up huge numbers of pylint warnings

Change-Id: I9112ab123943a81e60d2c6bf096bc125e8e042b7
diff --git a/drivers/CiscoCatalyst.py b/drivers/CiscoCatalyst.py
index 5563ef8..5303e2e 100644
--- a/drivers/CiscoCatalyst.py
+++ b/drivers/CiscoCatalyst.py
@@ -20,9 +20,8 @@
 import logging
 import pexpect
 import sys
-import time
 import re
-from common import SwitchDriver, SwitchErrors
+from drivers.common import SwitchDriver, SwitchErrors
 
 if __name__ == '__main__':
     import os
@@ -30,7 +29,7 @@
     sys.path.insert(0, vlandpath)
     sys.path.insert(0, "%s/.." % vlandpath)
 
-from errors import CriticalError, InputError, PExpectError
+from errors import InputError, PExpectError
 
 class CiscoCatalyst(SwitchDriver):
 
@@ -52,6 +51,8 @@
     logfile = None
 
     def __init__(self, switch_hostname, switch_telnetport=23, debug = False):
+        SwitchDriver.__init__(self)
+        self._systemdata = []
         if debug:
             self.logfile = sys.stderr
         self.exec_string = "/usr/bin/telnet %s %d" % (switch_hostname, switch_telnetport)
@@ -71,7 +72,7 @@
     # Log out of the switch and drop the connection and all state
     def switch_disconnect(self):
         self._logout()
-        logging.debug("Closing connection: %s" % self.connection)
+        logging.debug("Closing connection: %s", self.connection)
         self.connection.close(True)
         self._ports = []
         self._prompt_name = ''
@@ -120,7 +121,7 @@
 
     # Create a VLAN with the specified tag
     def vlan_create(self, tag):
-        logging.debug("Creating VLAN %d" % tag)
+        logging.debug("Creating VLAN %d", tag)
         try:
             self._configure()
             self._cli("vlan %d" % tag)
@@ -140,7 +141,7 @@
 
     # Destroy a VLAN with the specified tag
     def vlan_destroy(self, tag):
-        logging.debug("Destroying VLAN %d" % tag)
+        logging.debug("Destroying VLAN %d", tag)
 
         try:
             self._configure()
@@ -160,7 +161,7 @@
 
     # Set the name of a VLAN
     def vlan_set_name(self, tag, name):
-        logging.debug("Setting name of VLAN %d to %s" % (tag, name))
+        logging.debug("Setting name of VLAN %d to %s", tag, name)
 
         try:
             self._configure()
@@ -203,11 +204,11 @@
     def vlan_get_name(self, tag):
 
         try:
-            logging.debug("Grabbing the name of VLAN %d" % tag)
+            logging.debug("Grabbing the name of VLAN %d", tag)
             name = None
             regex = re.compile('^ *\d+\s+(\S+).*(active)')
             self._cli("show vlan id %d" % tag)
-            for line in self._read_long_output():
+            for line in self._read_long_output("show vlan id"):
                 match = regex.match(line)
                 if match:
                     name = match.group(1)
@@ -225,7 +226,7 @@
 
     # Set the mode of a port: access or trunk
     def port_set_mode(self, port, mode):
-        logging.debug("Setting port %s to %s" % (port, mode))
+        logging.debug("Setting port %s to %s", port, mode)
         if not self._is_port_mode_valid(mode):
             raise InputError("Port mode %s is not allowed" % mode)
         if not self._is_port_name_valid(port):
@@ -252,7 +253,7 @@
 
     # Get the mode of a port: access or trunk
     def port_get_mode(self, port):
-        logging.debug("Getting mode of port %s" % port)
+        logging.debug("Getting mode of port %s", port)
         mode = ''
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
@@ -277,7 +278,7 @@
 
     # Set an access port to be in a specified VLAN (tag)
     def port_set_access_vlan(self, port, tag):
-        logging.debug("Setting access port %s to VLAN %d" % (port, tag))
+        logging.debug("Setting access port %s to VLAN %d", port, tag)
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
         if not (self.port_get_mode(port) == "access"):
@@ -303,7 +304,7 @@
 
     # Add a trunk port to a specified VLAN (tag)
     def port_add_trunk_to_vlan(self, port, tag):
-        logging.debug("Adding trunk port %s to VLAN %d" % (port, tag))
+        logging.debug("Adding trunk port %s to VLAN %d", port, tag)
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
         if not (self.port_get_mode(port) == "trunk"):
@@ -329,7 +330,7 @@
 
     # Remove a trunk port from a specified VLAN (tag)
     def port_remove_trunk_from_vlan(self, port, tag):
-        logging.debug("Removing trunk port %s from VLAN %d" % (port, tag))
+        logging.debug("Removing trunk port %s from VLAN %d", port, tag)
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
         if not (self.port_get_mode(port) == "trunk"):
@@ -354,7 +355,7 @@
 
     # Get the configured VLAN tag for an access port (tag)
     def port_get_access_vlan(self, port):
-        logging.debug("Getting VLAN for access port %s" % port)
+        logging.debug("Getting VLAN for access port %s", port)
         vlan = 1
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
@@ -377,7 +378,7 @@
 
     # Get the list of configured VLAN tags for a trunk port
     def port_get_trunk_vlan_list(self, port):
-        logging.debug("Getting VLANs for trunk port %s" % port)
+        logging.debug("Getting VLANs for trunk port %s", port)
         vlans = [ ]
         if not self._is_port_name_valid(port):
             raise InputError("Port name %s not recognised" % port)
@@ -398,10 +399,8 @@
                     match = regex_continue.match(line)
                     if match:
                         vlan_text += match.group(1)
-                        next
                     else:
                         in_match = False
-                        next
                 else:
                     match = regex_start.match(line)
                     if match:
@@ -427,7 +426,7 @@
             self.connection.close(True)
             self.connection = None
 
-        logging.debug("Connecting to Switch with: %s" % self.exec_string)
+        logging.debug("Connecting to Switch with: %s", self.exec_string)
         self.connection = pexpect.spawn(self.exec_string, logfile = self.logfile)
 
         self._login()
@@ -452,8 +451,8 @@
             if match:
                 self.serial_number = match.group(1)
 
-        logging.debug("serial number is %s" % self.serial_number)
-        logging.debug("system description is %s" % descr)
+        logging.debug("serial number is %s", self.serial_number)
+        logging.debug("system description is %s", descr)
 
         if not self._expected_descr_re.match(descr):
             raise IOError("Switch %s not recognised by this driver: abort" % descr)
@@ -464,7 +463,7 @@
             raise IOError("Not enough ports detected - problem!")
 
     def _login(self):
-        logging.debug("attempting login with username %s, password %s" % (self._username, self._password))
+        logging.debug("attempting login with username %s, password %s", self._username, self._password)
         self.connection.expect('User Access Verification')
         if self._username is not None:
             self.connection.expect("User Name:")
@@ -475,8 +474,8 @@
         while True:
             index = self.connection.expect(['User Name:', 'Password:', 'Bad passwords', 'authentication failed', r'(.*)(#|>)'])
             if index != 4: # Any other means: failed to log in!
-                logging.error("Login failure: index %d\n" % index)
-                logging.error("Login failure: %s\n" % self.connection.match.before)
+                logging.error("Login failure: index %d\n", index)
+                logging.error("Login failure: %s\n", self.connection.match.before)
                 raise IOError
 
             # else
@@ -489,7 +488,7 @@
                     self._cli("%s" % self._enable_password, False)
                     index = self.connection.expect(['Password:', 'Bad passwords', 'authentication failed', r'(.*)(#|>)'])
                     if index != 3: # Any other means: failed to log in!
-                        logging.error("Enable password failure: %s\n" % self.connection.match)
+                        logging.error("Enable password failure: %s\n", self.connection.match)
                         raise IOError
                 return 0
 
@@ -513,13 +512,13 @@
             self.errors.log_error_in("")
             raise PExpectError("_read_long_output failed")
         except:
-            logging.error("prompt is \"%s\"" % prompt)
+            logging.error("prompt is \"%s\"", prompt)
             raise
 
-        buf = []
+        longbuf = []
         for line in self.connection.before.split('\r\n'):
-            buf.append(line.strip())
-        return buf
+            longbuf.append(line.strip())
+        return longbuf
 
     def _get_port_names(self):
         logging.debug("Grabbing list of ports")
@@ -648,7 +647,7 @@
 
     print "VLANs are:"
     buf = p.vlan_get_list()
-    p._dump_list(buf)
+    p.dump_list(buf)
 
     buf = p.vlan_get_name(2)
     print "VLAN 2 is named \"%s\"" % buf
@@ -667,14 +666,14 @@
 
     print "VLANs are:"
     buf = p.vlan_get_list()
-    p._dump_list(buf)
+    p.dump_list(buf)
 
     print "Destroy VLAN 3"
     p.vlan_destroy(3)
 
     print "VLANs are:"
     buf = p.vlan_get_list()
-    p._dump_list(buf)
+    p.dump_list(buf)
 
     buf = p.port_get_mode("Gi1/0/10")
     print "Port Gi1/0/10 is in %s mode" % buf
@@ -700,7 +699,7 @@
     p.port_set_mode("Gi1/0/9", "trunk")
     print "Read from switch: which VLANs is Gi1/0/9 on?"
     buf = p.port_get_trunk_vlan_list("Gi1/0/9")
-    p._dump_list(buf)
+    p.dump_list(buf)
     print "Add Gi1/0/9 to VLAN 2"
     p.port_add_trunk_to_vlan("Gi1/0/9", 2)
     print "Add Gi1/0/9 to VLAN 3"
@@ -709,14 +708,14 @@
     p.port_add_trunk_to_vlan("Gi1/0/9", 4)
     print "Read from switch: which VLANs is Gi1/0/9 on?"
     buf = p.port_get_trunk_vlan_list("Gi1/0/9")
-    p._dump_list(buf)
+    p.dump_list(buf)
 
     p.port_remove_trunk_from_vlan("Gi1/0/9", 3)
     p.port_remove_trunk_from_vlan("Gi1/0/9", 3)
     p.port_remove_trunk_from_vlan("Gi1/0/9", 4)
     print "Read from switch: which VLANs is Gi1/0/9 on?"
     buf = p.port_get_trunk_vlan_list("Gi1/0/9")
-    p._dump_list(buf)
+    p.dump_list(buf)
 
 #    print 'Restarting switch, to explicitly reset config'
 #    p.switch_restart()