aboutsummaryrefslogtreecommitdiffstats
path: root/test/vcpe
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-03-05 13:21:59 +0100
committerMarco Platania <platania@research.att.com>2020-03-05 15:27:02 +0000
commit23f22e8e8ca50c862d1cece31a0a87050685cdd7 (patch)
treec2b8c3b79ecc4efeb84e5ccd1a5e86f5addd7fa5 /test/vcpe
parent37fe1c2e88838760a733fbf1129067685ad7a6ea (diff)
Fix Python linting issues in Python scripts
Fixed pylint issues for categories len-as-condition, using-constant-test, undefined-variable and reimported. Change-Id: Idad710958c3ca0ac6da78fb4709da03e5f079b34 Issue-ID: INT-1427 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/vcpe')
-rwxr-xr-xtest/vcpe/config_sdnc_so.py8
-rwxr-xr-xtest/vcpe/csar_parser.py2
-rwxr-xr-xtest/vcpe/preload.py2
-rw-r--r--test/vcpe/tests/test_imports.py1
-rwxr-xr-xtest/vcpe/vcpe.py10
-rwxr-xr-xtest/vcpe/vcpecommon.py4
6 files changed, 13 insertions, 14 deletions
diff --git a/test/vcpe/config_sdnc_so.py b/test/vcpe/config_sdnc_so.py
index eac7c59a5..6e0257720 100755
--- a/test/vcpe/config_sdnc_so.py
+++ b/test/vcpe/config_sdnc_so.py
@@ -22,7 +22,7 @@ def insert_customer_service_to_sdnc(vcpecommon):
parser.parse_csar(csar_file)
cmds = []
- if False:
+ if False: # pylint: disable=W0125
cmds.append("INSERT INTO SERVICE_MODEL (`service_uuid`, `model_yaml`,`invariant_uuid`,`version`,`name`," \
"`description`,`type`,`category`,`ecomp_naming`,`service_instance_name_prefix`,`filename`," \
"`naming_policy`) values ('{0}', null, '{1}',null,'{2}', 'vCPEService', 'Service','Network L1-3'," \
@@ -34,7 +34,7 @@ def insert_customer_service_to_sdnc(vcpecommon):
for model in parser.vnf_models:
if 'tunnel' in model['modelCustomizationName'].lower() or 'brg' in model['modelCustomizationName'].lower():
- if False:
+ if False: # pylint: disable=W0125
cmds.append("INSERT INTO ALLOTTED_RESOURCE_MODEL (`customization_uuid`,`model_yaml`,`invariant_uuid`," \
"`uuid`,`version`,`naming_policy`,`ecomp_generated_naming`,`depending_service`,`role`,`type`," \
"`service_dependency`,`allotted_resource_type`) VALUES ('{0}',NULL,'{1}','{2}','1.0'," \
@@ -44,7 +44,7 @@ def insert_customer_service_to_sdnc(vcpecommon):
cmds.append("UPDATE ALLOTTED_RESOURCE_MODEL SET `ecomp_generated_naming`='Y' " \
"WHERE `customization_uuid`='{0}'".format(model['modelCustomizationId']))
else:
- if False:
+ if False: # pylint: disable=W0125
cmds.append("INSERT INTO VF_MODEL (`customization_uuid`,`model_yaml`,`invariant_uuid`,`uuid`,`version`," \
"`name`,`naming_policy`,`ecomp_generated_naming`,`avail_zone_max_count`,`nf_function`," \
"`nf_code`,`nf_type`,`nf_role`,`vendor`,`vendor_version`) VALUES ('{0}',NULL,'{1}','{2}'," \
@@ -54,7 +54,7 @@ def insert_customer_service_to_sdnc(vcpecommon):
cmds.append("UPDATE VF_MODEL SET `ecomp_generated_naming`='Y' " \
"WHERE `customization_uuid`='{0}'".format(model['modelCustomizationId']))
- if False:
+ if False: # pylint: disable=W0125
model = parser.vfmodule_models[0]
cmds.append("INSERT INTO VF_MODULE_MODEL (`customization_uuid`,`model_yaml`,`invariant_uuid`,`uuid`,`version`," \
"`vf_module_type`,`availability_zone_count`,`ecomp_generated_vm_assignments`) VALUES ('{0}', NULL," \
diff --git a/test/vcpe/csar_parser.py b/test/vcpe/csar_parser.py
index da6fa437a..da1903cd4 100755
--- a/test/vcpe/csar_parser.py
+++ b/test/vcpe/csar_parser.py
@@ -178,7 +178,7 @@ class CsarParser:
},
"""
node_dic = svc_template['topology_template']['groups']
- for node_name, v in node_dic.items():
+ for node_name, v in node_dic.items(): # pylint: disable=W0612
if v['type'].startswith('org.openecomp.groups.VfModule'):
model = {
'modelType': 'vfModule',
diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py
index 117b63ec6..62c036c83 100755
--- a/test/vcpe/preload.py
+++ b/test/vcpe/preload.py
@@ -26,7 +26,7 @@ class Preload:
with open(template_file) as json_input:
json_data = json.load(json_input)
stk = [json_data]
- while len(stk) > 0:
+ while stk:
data = stk.pop()
for k, v in data.items():
if type(v) is dict:
diff --git a/test/vcpe/tests/test_imports.py b/test/vcpe/tests/test_imports.py
index 728c29375..63e551fa3 100644
--- a/test/vcpe/tests/test_imports.py
+++ b/test/vcpe/tests/test_imports.py
@@ -9,7 +9,6 @@ import preload
import sdcutils
import soutils
import vcpe_custom_service
-import vcpecommon
# This will test whether all modules that vcpe scripts leverage
# are included in setuptools configuration
diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py
index f6c85ec53..e6038e719 100755
--- a/test/vcpe/vcpe.py
+++ b/test/vcpe/vcpe.py
@@ -68,7 +68,7 @@ def create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, s
def deploy_brg_only():
- logger = logging.getLogger(__name__)
+ logger = logging.getLogger(__name__) # pylint: disable=W0612
vcpecommon = VcpeCommon(cfg_file=args.config)
preload_dict = vcpecommon.load_preload_data()
@@ -174,7 +174,7 @@ def deploy_custom_service():
# clean up
host_dic = {k: vcpecommon.hosts[k] for k in nodes}
- if False:
+ if False: # pylint: disable=W0125
if not vcpecommon.delete_vxlan_interfaces(host_dic):
sys.exit(1)
custom_service.del_all_vgw_stacks(vcpecommon.vgw_name_keyword)
@@ -215,7 +215,7 @@ def closed_loop(lossrate=0):
def init_so_sdnc():
- logger = logging.getLogger('__name__')
+ logger = logging.getLogger('__name__') # pylint: disable=W0612
vcpecommon = VcpeCommon(cfg_file=args.config)
config_sdnc_so.insert_sdnc_ip_pool(vcpecommon)
config_sdnc_so.insert_customer_service_to_so(vcpecommon)
@@ -234,7 +234,7 @@ def init():
def init_sdc(vcpecommon):
- sdc = sdcutils.SdcUtils(vcpecommon)
+ sdc = sdcutils.SdcUtils(vcpecommon) # pylint: disable=W0612
# default SDC creates BRG - remove this in frankfurt
#sdc.create_allotted_resource_subcategory('BRG')
@@ -245,7 +245,7 @@ def download_vcpe_service_templates(vcpecommon):
def tmp_sniro():
- logger = logging.getLogger(__name__)
+ logger = logging.getLogger(__name__) # pylint: disable=W0612
vcpecommon = VcpeCommon(cfg_file=args.config)
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 8bc5ef147..971082c80 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -520,7 +520,7 @@ class VcpeCommon:
nova = openstackclient.Client(2, self.cloud['--os-username'], self.cloud['--os-password'], self.cloud['--os-tenant-id'], self.cloud['--os-auth-url'])
for i in nova.servers.list():
if i.name == vm:
- for k, v in i.networks.items():
+ for k, v in i.networks.items(): # pylint: disable=W0612
for ip in v:
if IPAddress(ip) in subnet:
return ip
@@ -717,7 +717,7 @@ class VcpeCommon:
url = self.vpp_inf_url.format(ip) + '/interface/' + inf
requests.delete(url, headers=self.vpp_api_headers, auth=self.vpp_api_userpass)
- if len(self.get_vxlan_interfaces(ip)) > 0:
+ if self.get_vxlan_interfaces(ip):
self.logger.error("Error deleting VxLAN from {0}, try to restart the VM, IP is {1}.".format(host, ip))
return False