summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-03-05 10:28:03 +0100
committerMarco Platania <platania@research.att.com>2020-03-05 15:26:40 +0000
commit3d3d3c28d88d1f7bad2b9a274fe9ad4cfaf01554 (patch)
tree2f33b3f16289d8555173f011737d611515e7541b /test
parent5d8a1df2dbfd99fa87e792c584ac220187c9928e (diff)
Fix indentation and whitespace issues in Python scripts
Reported by pylint. Change-Id: I9d5ee152f3587bb2d7e8abee919e4ffe47d8ae85 Issue-ID: INT-1427 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test')
-rw-r--r--test/hpa_automation/heat/insert_policy_models_heat.py10
-rwxr-xr-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py21
-rw-r--r--test/mocks/pnfsimulator/netconfsimulator/netconf/__init__.py4
-rwxr-xr-xtest/mocks/pnfsimulator/netconfsimulator/netconf/set-up-xmls.py8
-rw-r--r--test/mocks/pnfsimulator/netconfsimulator/netconf/test_yang_loader_server.py4
-rw-r--r--test/mocks/pnfsimulator/netconfsimulator/netconf/yang_loader_server.py4
-rwxr-xr-xtest/s3p/collector/get_resource_stats.py6
-rw-r--r--test/s3p/generator/locustfile.py4
-rwxr-xr-xtest/security/check_for_ingress_and_nodeports.py4
-rwxr-xr-xtest/vcpe/preload.py10
-rwxr-xr-xtest/vcpe/soutils.py4
-rw-r--r--test/vcpe/tests/test_imports.py2
-rwxr-xr-xtest/vcpe/vcpe.py10
-rwxr-xr-xtest/vcpe/vcpecommon.py14
14 files changed, 51 insertions, 54 deletions
diff --git a/test/hpa_automation/heat/insert_policy_models_heat.py b/test/hpa_automation/heat/insert_policy_models_heat.py
index 68a1d23bf..549763897 100644
--- a/test/hpa_automation/heat/insert_policy_models_heat.py
+++ b/test/hpa_automation/heat/insert_policy_models_heat.py
@@ -1,13 +1,13 @@
import mysql.connector
import sys
-
+
mydb = mysql.connector.connect(
host= sys.argv[1],
user= sys.argv[2],
passwd= sys.argv[3],
database="onap_sdk",
)
-
+
mycursor = mydb.cursor()
sql = "INSERT INTO microservicemodels (modelname, description, dependency, imported_by, attributes, ref_attributes, sub_attributes, version, annotation, enumValues, dataOrderInfo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
@@ -22,9 +22,9 @@ val = [
('pciPolicy', 'Pci policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,resources=MANY-true,pciProperties=pciProperties_properties:MANY-true:description-null', '{"pciProperties_properties":{"pciOptimizationTimeConstraint":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptimizationNwConstraint":"string:defaultValue-null:required-false:MANY-false:description-null","algoCategory":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptmizationAlgoName":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptimizationPriority":"string:defaultValue-null:required-false:MANY-false:description-null"}}', 'test1', 'olicyScope=matching-true, policyType=matching-true ', ' POLICYTYPE=[pciPolicy,]', '""'),
('subscriberPolicy', 'Subscriber Policy Model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,properties=properties_properties:MANY-false:description-type of a policy', '{"properties_properties":{"provStatus":"PROVSTATUS:defaultValue-null:required-true:MANY-false:description-null","subscriberName":"SUBSCRIBERNAME:defaultValue-null:required-true:MANY-false:description-null","subscriberRole":"SUBSCRIBERROLE:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true, properties=matching-true ', ' SUBSCRIBERNAME=[], SUBSCRIBERROLE=[], POLICYTYPE=[subscriberPolicy,], PROVSTATUS=[]', '""')
]
-
+
mycursor.executemany(sql, val)
-
+
mydb.commit()
-
+
print(mycursor.rowcount, "was inserted.")
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index 353631d56..98b66f28d 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -76,9 +76,9 @@ if args.bootstrap and args.ipstart and args.urlves:
start_port=2000
ftps_pasv_port_start=8000
ftps_pasv_port_num_of_ports=10
-
+
ftps_pasv_port_end=ftps_pasv_port_start + ftps_pasv_port_num_of_ports
-
+
for i in range(int(args.bootstrap)):
print("PNF simulator instance: " + str(i) + ".")
@@ -97,13 +97,13 @@ if args.bootstrap and args.ipstart and args.urlves:
IpFileServer = args.ipfileserver
TypeFileServer = args.typefileserver
-
+
PortSftp=start_port +1
- PortFtps=start_port +2
+ PortFtps=start_port +2
start_port +=2
UrlFtps = str(ipaddress.ip_address(args.ipstart) + int(3 + (i * 16)))
print("\tUrl Ftps: " + str(UrlFtps))
-
+
UrlSftp = str(ipaddress.ip_address(args.ipstart) + int(4 + (i * 16)))
print("\tUrl Sftp: " + str(UrlSftp))
@@ -138,7 +138,7 @@ if args.bootstrap and args.ipstart and args.urlves:
composercmd,
shell=True)
print('Cloning:', completed.stdout)
-
+
ftps_pasv_port_start += ftps_pasv_port_num_of_ports + 1
ftps_pasv_port_end += ftps_pasv_port_num_of_ports +1
@@ -202,23 +202,20 @@ if args.trigger:
"; ./simulator.sh trigger-simulator",
shell=True)
print('Status:', completed.stdout)
-
+
if args.triggerstart and args.triggerend:
print("Triggering VES sending by a range of simulators:")
-
+
for i in range(int(args.triggerstart), int(args.triggerend)+1):
foldername = "pnf-sim-lw-" + str(i)
print("Instance being processed:" + str(i))
-
+
completed = subprocess.run(
'cd ' +
foldername +
"; ./simulator.sh trigger-simulator",
shell=True)
print('Status:', completed.stdout)
-
-
-
else:
print("No instruction was defined")
sys.exit()
diff --git a/test/mocks/pnfsimulator/netconfsimulator/netconf/__init__.py b/test/mocks/pnfsimulator/netconfsimulator/netconf/__init__.py
index 0f144c21e..aa8b4f995 100644
--- a/test/mocks/pnfsimulator/netconfsimulator/netconf/__init__.py
+++ b/test/mocks/pnfsimulator/netconfsimulator/netconf/__init__.py
@@ -7,9 +7,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/test/mocks/pnfsimulator/netconfsimulator/netconf/set-up-xmls.py b/test/mocks/pnfsimulator/netconfsimulator/netconf/set-up-xmls.py
index cdc4e4f3d..2ec1cf2b9 100755
--- a/test/mocks/pnfsimulator/netconfsimulator/netconf/set-up-xmls.py
+++ b/test/mocks/pnfsimulator/netconfsimulator/netconf/set-up-xmls.py
@@ -9,9 +9,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,8 +29,8 @@ logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
-# Placeholders definition - this needs to match placeholders in
-# load_server_certs_xml_file and tls_listen_xml_file
+# Placeholders definition - this needs to match placeholders in
+# load_server_certs_xml_file and tls_listen_xml_file
SERVER_KEY_NAME = "SERVER_KEY_NAME"
SERVER_CERT_NAME = "SERVER_CERT_NAME"
SERVER_CERTIFICATE_HERE = "SERVER_CERTIFICATE_HERE"
diff --git a/test/mocks/pnfsimulator/netconfsimulator/netconf/test_yang_loader_server.py b/test/mocks/pnfsimulator/netconfsimulator/netconf/test_yang_loader_server.py
index c5bd08dd4..a22208711 100644
--- a/test/mocks/pnfsimulator/netconfsimulator/netconf/test_yang_loader_server.py
+++ b/test/mocks/pnfsimulator/netconfsimulator/netconf/test_yang_loader_server.py
@@ -7,9 +7,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/test/mocks/pnfsimulator/netconfsimulator/netconf/yang_loader_server.py b/test/mocks/pnfsimulator/netconfsimulator/netconf/yang_loader_server.py
index f414467d0..27d46cea5 100644
--- a/test/mocks/pnfsimulator/netconfsimulator/netconf/yang_loader_server.py
+++ b/test/mocks/pnfsimulator/netconfsimulator/netconf/yang_loader_server.py
@@ -7,9 +7,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/test/s3p/collector/get_resource_stats.py b/test/s3p/collector/get_resource_stats.py
index 8ad22c575..aca2514c8 100755
--- a/test/s3p/collector/get_resource_stats.py
+++ b/test/s3p/collector/get_resource_stats.py
@@ -20,7 +20,7 @@ AAI2_IP = "10.0.1.2"
SO_IP = "10.0.5.1"
SDNC_IP = "10.0.7.1"
-def aai1():
+def aai1():
containers = docker_util.get_container_list(AAI1_IP)
run(AAI1_NAME, AAI1_IP, containers)
@@ -39,7 +39,7 @@ def sdnc():
def run(component, ip, containers):
cmd = ["ssh", "-i", "onap_dev"]
cmd.append("ubuntu@" + ip)
- cmd.append("sudo docker stats --no-stream")
+ cmd.append("sudo docker stats --no-stream")
for c in containers:
cmd.append(c)
ssh = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -80,7 +80,7 @@ def get_memory_number(s):
return f
file = open("resource.log", "w+")
-while True:
+while True:
so()
sdnc()
aai1()
diff --git a/test/s3p/generator/locustfile.py b/test/s3p/generator/locustfile.py
index 63031cd78..ca926b3c2 100644
--- a/test/s3p/generator/locustfile.py
+++ b/test/s3p/generator/locustfile.py
@@ -26,7 +26,7 @@ class UserBehavior(TaskSet):
self.init()
def init(self):
- pass
+ pass
def myconverter(self, o):
if isinstance(o, datetime.datetime):
@@ -36,7 +36,7 @@ class UserBehavior(TaskSet):
def create_service(self):
# Post a E2E service instantiation request to SO
method = "POST"
- url = self.base
+ url = self.base
service_instance_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
data = self.service_creation_body % service_instance_name
diff --git a/test/security/check_for_ingress_and_nodeports.py b/test/security/check_for_ingress_and_nodeports.py
index 8b3e84a6d..27066bf00 100755
--- a/test/security/check_for_ingress_and_nodeports.py
+++ b/test/security/check_for_ingress_and_nodeports.py
@@ -79,7 +79,7 @@ def find_ingress_ports(v1):
https_port = 0
for item in svc.items:
if item.metadata.name == K8S_INGRESS_NS:
- for pinfo in item.spec.ports:
+ for pinfo in item.spec.ports:
if pinfo and pinfo.name == 'http':
http_port = pinfo.node_port
elif pinfo and pinfo.name == 'https':
@@ -263,4 +263,4 @@ if __name__ == "__main__":
v1c = client.Configuration()
if args.scan_nodeport: check_onap_ports()
elif args.scan_ingress: check_onap_ingress()
- else: onap_list_all() \ No newline at end of file
+ else: onap_list_all()
diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py
index 08b34ecf5..6517fe5d8 100755
--- a/test/vcpe/preload.py
+++ b/test/vcpe/preload.py
@@ -102,9 +102,9 @@ class Preload:
self.logger.info('Preloading network ' + network_role)
self.logger.info('template_file:' + template_file)
if 'networkgra' in template_file:
- return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_gra_url)
+ return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_gra_url)
else:
- return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_url)
+ return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_url)
def preload(self, template_file, replace_dict, url):
self.logger.debug('tempalte_file:'+ template_file)
@@ -165,10 +165,10 @@ class Preload:
'${suffix}': name_suffix}
replace_dict.update(common_dict)
self.logger.info('Preloading VF Module ' + vfmodule_name)
- if gra_api_flag:
- return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_gra_url)
+ if gra_api_flag:
+ return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_gra_url)
else:
- return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url)
+ return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url)
def preload_all_networks(self, template_file, name_suffix):
common_dict = {'${' + k + '}': v for k, v in self.vcpecommon.common_preload_config.items()}
diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py
index 8d2e56d12..63100128e 100755
--- a/test/vcpe/soutils.py
+++ b/test/vcpe/soutils.py
@@ -121,7 +121,7 @@ class SoUtils:
def generate_vnf_or_network_request(self, req_type, instance_name, vnf_or_network_model, service_instance_id,
service_model):
if self.vcpecommon.gra_api_flag:
- self.testApi = 'GR_API'
+ self.testApi = 'GR_API'
req_details = {
'modelInfo': vnf_or_network_model,
'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name,
@@ -139,7 +139,7 @@ class SoUtils:
def generate_vfmodule_request(self, instance_name, vfmodule_model, service_instance_id,
service_model, vnf_instance_id, vnf_model):
if self.vcpecommon.gra_api_flag:
- self.testApi = 'GR_API'
+ self.testApi = 'GR_API'
req_details = {
'modelInfo': vfmodule_model,
'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name,
diff --git a/test/vcpe/tests/test_imports.py b/test/vcpe/tests/test_imports.py
index 4587495d4..728c29375 100644
--- a/test/vcpe/tests/test_imports.py
+++ b/test/vcpe/tests/test_imports.py
@@ -15,4 +15,4 @@ import vcpecommon
# are included in setuptools configuration
def test_imports():
- pass
+ pass
diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py
index 9ecda81d2..aa924bca6 100755
--- a/test/vcpe/vcpe.py
+++ b/test/vcpe/vcpe.py
@@ -137,11 +137,11 @@ def deploy_infra():
vnf_template_file = vcpecommon.find_file(keyword_vnf, 'json', 'preload_templates')
gra_template_file = vcpecommon.find_file(keyword_gra, 'json', 'preload_templates')
if vcpecommon.gra_api_flag:
- svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, gra_template_file, preload_dict,
- name_suffix, heatbridge)
+ svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, gra_template_file, preload_dict,
+ name_suffix, heatbridge)
else:
- svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict,
- name_suffix, heatbridge)
+ svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict,
+ name_suffix, heatbridge)
if not svc_instance_uuid[keyword]:
sys.exit(1)
@@ -310,7 +310,7 @@ if __name__ == '__main__':
init_so_sdnc()
elif args.mode == 'infra':
#if 'y' == raw_input('Ready to deploy infrastructure? y/n: ').lower():
- deploy_infra()
+ deploy_infra()
elif args.mode == 'customer':
if 'y' == raw_input('Ready to deploy customer service? y/n: ').lower():
deploy_custom_service()
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 932766f30..8eeb68e9a 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -207,13 +207,13 @@ class VcpeCommon:
# to conform to openstack cli client
self.cloud = {}
for k in os_cloud:
- if isinstance(os_cloud[k],dict):
- for sub_k in os_cloud[k]:
- os_setting_name = '--os-' + sub_k.replace('_','-')
- self.cloud[os_setting_name] = os_cloud[k][sub_k]
- else:
- os_setting_name = '--os-' + k.replace('_','-')
- self.cloud[os_setting_name] = os_cloud[k]
+ if isinstance(os_cloud[k],dict):
+ for sub_k in os_cloud[k]:
+ os_setting_name = '--os-' + sub_k.replace('_','-')
+ self.cloud[os_setting_name] = os_cloud[k][sub_k]
+ else:
+ os_setting_name = '--os-' + k.replace('_','-')
+ self.cloud[os_setting_name] = os_cloud[k]
def heatbridge(self, openstack_stack_name, svc_instance_uuid):
"""