Reported by pylint.
Change-Id: I9d5ee152f3587bb2d7e8abee919e4ffe47d8ae85
Issue-ID: INT-1427
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
import random
import string
from locust import HttpLocust, TaskSet, task
-
+
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
self.init()
-
+
def init(self):
pass
-
+
@task(1)
def DCI(self):
method = "POST"
print(data)
response = self.client.request(method, url, headers=headers, data=data)
print(response.json())
-
+
class WebsiteUser(HttpLocust):
task_set = UserBehavior
host = "http://10.0.5.1:8080"
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)"
('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.")
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) + ".")
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))
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
"; ./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()
# 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.
# 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.
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"
# 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.
# 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.
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)
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)
return f
file = open("resource.log", "w+")
-while True:
+while True:
so()
sdnc()
aai1()
self.init()
def init(self):
- pass
+ pass
def myconverter(self, o):
if isinstance(o, datetime.datetime):
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
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':
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()
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)
'${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()}
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,
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,
# are included in setuptools configuration
def test_imports():
- pass
+ pass
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)
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()
# 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):
"""