Fix pep8 violations in switch_manager.py
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 16 Mar 2015 04:29:16 +0000 (00:29 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 16 Mar 2015 04:29:16 +0000 (00:29 -0400)
Change-Id: I80f16dec74e5eb9e904d27c8d4a11184f9c6930e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
test/tools/CSIT_Test/base/modules/switch_manager.py

index d4492f5ae38cedfc36697cc1bd4afe17b711b031..d4bd142bc850e636549339b336a586618e31b033 100644 (file)
@@ -7,7 +7,7 @@ Updated: 2013-11-01
 import sys
 
 sys.path.append('..')
-from restlib import *
+from restlib import *  # noqa
 from testmodule import TestModule
 
 sys.path.remove('..')
@@ -16,7 +16,8 @@ sys.path.remove('..')
 class SwitchManager(TestModule):
     """
     Test for the switch manager, including read switch nodes.
-    Start 2-layer tree topology network. e.g., in Mininet, run  'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
+    Start 2-layer tree topology network. e.g., in Mininet, run
+        'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
     """
 
     def __init__(self, restSubContext='/controller/nb/v2/switchmanager', user=DEFAULT_USER, password=DEFAULT_PWD,
@@ -47,28 +48,28 @@ class SwitchManager(TestModule):
         Add a property to given node.
         """
         suffix = 'node/' + node_type + '/' + node_id + '/property'
-        r = super(self.__class__, self).update(suffix + '/' + property + '/' + str(value))
+        super(self.__class__, self).update(suffix + '/' + property + '/' + str(value))
 
     def remove_property_from_node(self, node_type, node_id, property):
         """
         Remove a property from given node.
         """
         suffix = 'node/' + node_type + '/' + node_id + '/property'
-        r = super(self.__class__, self).delete(suffix + '/' + property)
+        super(self.__class__, self).delete(suffix + '/' + property)
 
     def add_property_to_nodeconnector(self, node_type, node_id, nc_type, nc_id, property, value):
         """
         Add a property to given node.
         """
         suffix = 'nodeconnector/' + node_type + '/' + node_id + '/' + nc_type + '/' + nc_id + '/property'
-        r = super(self.__class__, self).update(suffix + '/' + property + '/' + str(value))
+        super(self.__class__, self).update(suffix + '/' + property + '/' + str(value))
 
     def remove_property_from_nodeconnector(self, node_type, node_id, nc_type, nc_id, property):
         """
         Add a property to given node.
         """
         suffix = 'nodeconnector/' + node_type + '/' + node_id + '/' + nc_type + '/' + nc_id + '/property'
-        r = super(self.__class__, self).delete(suffix + '/' + property)
+        super(self.__class__, self).delete(suffix + '/' + property)
 
     def test_list_nodes(self):
         """
@@ -98,18 +99,18 @@ class SwitchManager(TestModule):
         True
         """
         result = []
-        #current node properties should not include description
+        # current node properties should not include description
         r = self.get_nodes()
         v = [e['properties'].get(property) for e in r['nodeProperties'] if
              e['node'] == {u'type': node_type, u'id': node_id}]
         result.append(v == [{u'value': u'None'}] or v == [None])
-        #After adding, current node properties should include description
+        # After adding, current node properties should include description
         self.add_property_to_node(node_type, node_id, property, value)
         r = self.get_nodes()
         v = [e['properties'].get(property) for e in r['nodeProperties'] if
              e['node'] == {u'type': node_type, u'id': node_id}]
         result.append(v == [{u'value': value}])
-        #After removing, current node properties should not include description
+        # After removing, current node properties should not include description
         self.remove_property_from_node(node_type, node_id, property)
         r = self.get_nodes()
         v = [e['properties'].get(property) for e in r['nodeProperties'] if
@@ -121,24 +122,25 @@ class SwitchManager(TestModule):
         """
         Test the add,remove,show actions on nodeconnector properties.
 
-        >>> SwitchManager().test_nodeconnector_property_operations('OF','00:00:00:00:00:00:00:01','OF','1','bandwidth',1000)
+        >>> SwitchManager().test_nodeconnector_property_operations(
+                'OF','00:00:00:00:00:00:00:01','OF','1','bandwidth',1000)
         True
         """
         result = []
         node_suffix = 'node/' + node_type + '/' + node_id
-        #default bw should be 10000000000L
+        # default bw should be 10000000000L
         r = self.get_node(node_suffix)
         default_value = [e['properties'][property] for e in r['nodeConnectorProperties'] if
                          property in e['properties'] and e['nodeconnector'] == {
                              u'node': {u'type': node_type, u'id': node_id}, u'type': nc_type, u'id': nc_id}]
-        #After setting, the value should be the value
+        # After setting, the value should be the value
         self.add_property_to_nodeconnector(node_type, node_id, nc_type, nc_id, property, value)
         r = self.get_node(node_suffix)
         current_value = [e['properties'][property] for e in r['nodeConnectorProperties'] if
                          property in e['properties'] and e['nodeconnector'] == {
                              u'node': {u'type': node_type, u'id': node_id}, u'type': nc_type, u'id': nc_id}]
         result.append(current_value == [{'value': value}])
-        #After removing, and restoring the default value, the bandwidth property should be default
+        # After removing, and restoring the default value, the bandwidth property should be default
         self.remove_property_from_nodeconnector(node_type, node_id, nc_type, nc_id, property)
         r = self.get_node(node_suffix)
         v = [e['properties'][property] for e in r['nodeConnectorProperties'] if
@@ -151,4 +153,4 @@ class SwitchManager(TestModule):
                          property in e['properties'] and e['nodeconnector'] == {
                              u'node': {u'type': node_type, u'id': node_id}, u'type': nc_type, u'id': nc_id}]
         result.append(current_value == default_value)
-        return result == [True, True, True]
\ No newline at end of file
+        return result == [True, True, True]