aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkata Harshavardhan Reddy Allu <venkataharshavardhan_ven@srmuniv.edu.in>2019-03-21 20:02:34 +0530
committerVenkata Harshavardhan Reddy Allu <venkataharshavardhan_ven@srmuniv.edu.in>2019-03-21 20:45:09 +0530
commit77f3df5f118c040a8d9e633181e5105429957dfc (patch)
tree39bbdfb85a250e93d89d98357a0c177e51db9516
parent7e42185599ce6c8ff5bec165fc8950e8cf89dc5b (diff)
Flake8 fixes
Change-Id: Ia0012ebb6af1faa8028b45545cd1f93ea5ed22f0 Signed-off-by: Venkata Harshavardhan Reddy Allu <venkataharshavardhan_ven@srmuniv.edu.in>
-rw-r--r--sfc/lib/cleanup.py4
-rw-r--r--sfc/lib/openstack_utils.py6
-rw-r--r--sfc/lib/test_utils.py16
-rw-r--r--sfc/unit_tests/unit/lib/test_openstack_utils.py6
4 files changed, 17 insertions, 15 deletions
diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py
index 214ff1cb..e97034ad 100644
--- a/sfc/lib/cleanup.py
+++ b/sfc/lib/cleanup.py
@@ -126,7 +126,7 @@ def delete_openstack_objects(testcase_config, creators):
conn = connection.from_config(verify=False)
for creator in creators:
if creator.name == testcase_config.subnet_name:
- subnet_obj = creator
+ subnet_obj = creator
for creator in reversed(creators):
try:
@@ -143,7 +143,7 @@ def delete_openstack_objects(testcase_config, creators):
time.sleep(2)
creators.remove(creator)
except Exception as e:
- logger.error('Unexpected error cleaning - %s', e)
+ logger.error('Unexpected error cleaning - %s', e)
def cleanup(testcase_config, creators, mano, odl_ip=None, odl_port=None):
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index 8bc4543a..59ccdaca 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -70,6 +70,8 @@ class OpenStackSFC:
self.creators.append(image)
logger.info("Image created")
+ self.image_settings = image_settings
+
return image
def create_flavor(self, name, ram, disk, vcpus):
@@ -367,7 +369,7 @@ class OpenStackSFC:
# Avoid race conditions by checking the port pair is already committed
iterations = 5
found_it = False
- for i in range(iterations):
+ for _ in range(iterations):
pp_list = self.neutron_client.list_sfc_port_pairs()['port_pairs']
for pp in pp_list:
if pp['id'] == port_pair_info['port_pair']['id']:
@@ -395,7 +397,7 @@ class OpenStackSFC:
if not port_pair_group_info:
logger.warning("Chain creation failed due to port pair group "
"creation failed for vnf "
- "%(vnf)", vm_instance.name)
+ "{}".format(vm_instance.name))
return None
return port_pair_group_info['port_pair_group']['id']
diff --git a/sfc/lib/test_utils.py b/sfc/lib/test_utils.py
index 36b52755..ed50c390 100644
--- a/sfc/lib/test_utils.py
+++ b/sfc/lib/test_utils.py
@@ -230,11 +230,11 @@ def check_ssh(ips, retries=100):
def fill_installer_dict(installer_type):
- default_string = "defaults.installer.{}.".format(installer_type)
- installer_yaml_fields = {
- "user": default_string+"user",
- "password": default_string+"password",
- "cluster": default_string+"cluster",
- "pkey_file": default_string+"pkey_file"
- }
- return installer_yaml_fields
+ default_string = "defaults.installer.{}.".format(installer_type)
+ installer_yaml_fields = {
+ "user": default_string+"user",
+ "password": default_string+"password",
+ "cluster": default_string+"cluster",
+ "pkey_file": default_string+"pkey_file"
+ }
+ return installer_yaml_fields
diff --git a/sfc/unit_tests/unit/lib/test_openstack_utils.py b/sfc/unit_tests/unit/lib/test_openstack_utils.py
index 8915c45d..aa7ef123 100644
--- a/sfc/unit_tests/unit/lib/test_openstack_utils.py
+++ b/sfc/unit_tests/unit/lib/test_openstack_utils.py
@@ -74,7 +74,7 @@ class SfcOpenStackUtilsTesting(unittest.TestCase):
"""
log_calls = [call("OS_NETWORK_API_VERSION is 1")]
result = self.os_sfc.get_neutron_client_version()
- assert result is '1'
+ assert result == '1'
mock_log.info.assert_has_calls(log_calls)
@patch('sfc.lib.openstack_utils.logger', autospec=True)
@@ -985,8 +985,8 @@ class SfcOpenStackUtilsTesting(unittest.TestCase):
log_calls_info = [call('Creating the port pairs...'),
call('Creating the port pair groups for name')]
log_calls_warn = [call('Chain creation failed due to port pair group '
- 'creation failed for vnf %(vnf)',
- instance_obj.name)]
+ 'creation failed for vnf '
+ '{}'.format(instance_obj.name))]
self.neutron_client.create_sfc_port_pair.return_value = \
{'port_pair': {'id': 'pp_id'}}
self.neutron_client.list_sfc_port_pairs.return_value = \