Update to support new SO NBI API
- Use new version SO API
- Add additional data to the request json, which is required by the new SO API
Change-Id: I3ac846c92f07b9d95d4429b4d1b2280ae7e69b62
Issue-ID: INT-461
Signed-off-by: Kang Xi <kang.xi@huawei.com>
diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py
index cc82068..623f12c 100755
--- a/test/vcpe/soutils.py
+++ b/test/vcpe/soutils.py
@@ -18,6 +18,7 @@
:param vcpecommon:
:param api_version: must be 'v4' or 'v5'
"""
+ self.tmp_solution_for_so_bug = False
self.logger = logging.getLogger(__name__)
self.vcpecommon = vcpecommon
if api_version not in self.vcpecommon.so_req_api_url:
@@ -49,7 +50,9 @@
self.logger.error('Invalid request type: {0}. Can only be service/vnf/network/vfmodule'.format(req_type))
return None, None
+ self.logger.info(url)
r = requests.post(url, headers=self.vcpecommon.so_headers, auth=self.vcpecommon.so_userpass, json=req_json)
+ self.logger.debug(r)
response = r.json()
self.logger.debug('---------------------------------------------------------------')
@@ -58,6 +61,7 @@
self.logger.debug('---------------------------------------------------------------')
req_id = response.get('requestReferences', {}).get('requestId', '')
instance_id = response.get('requestReferences', {}).get('instanceId', '')
+
return req_id, instance_id
def check_progress(self, req_id, eta=0, interval=5):
@@ -119,7 +123,8 @@
'modelInfo': vnf_or_network_model,
'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name,
"tenantId": self.vcpecommon.os_tenant_id},
- 'requestParameters': {"userParams": []}
+ 'requestParameters': {"userParams": []},
+ 'platform': {"platformName": "Platform-Demonstration"}
}
self.add_req_info(req_details, instance_name, self.vcpecommon.product_family_id)
self.add_related_instance(req_details, service_instance_id, service_model)
@@ -149,14 +154,23 @@
}
}
self.add_req_info(req_details, instance_name)
+ self.add_project_info(req_details)
+ self.add_owning_entity(req_details)
return {'requestDetails': req_details}
+ def add_project_info(self, req_details):
+ req_details['project'] = {'projectName': self.vcpecommon.project_name}
+
+ def add_owning_entity(self, req_details):
+ req_details['owningEntity'] = {'owningEntityId': self.vcpecommon.owning_entity_id,
+ 'owningEntityName': self.vcpecommon.owning_entity_name}
+
def generate_custom_service_request(self, instance_name, model, brg_mac):
req_details = {
'modelInfo': model,
'subscriberInfo': {'subscriberName': 'Kaneohe',
'globalSubscriberId': self.vcpecommon.global_subscriber_id},
- 'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name,
+ 'cloudConfiguration': {"lcpCloudRegionId": 'CloudOwner_RegionOne', #self.vcpecommon.os_region_name,
"tenantId": self.vcpecommon.os_tenant_id},
'requestParameters': {
"userParams": [
@@ -164,12 +178,23 @@
'name': 'BRG_WAN_MAC_Address',
'value': brg_mac
}
+ ,
+ {
+ "name": "Customer_Location",
+ "value": self.vcpecommon.customer_location_used_by_oof
+ },
+ {
+ "name": "Homing_Solution",
+ "value": self.vcpecommon.homing_solution
+ }
],
"subscriptionServiceType": "vCPE",
'aLaCarte': 'false'
}
}
self.add_req_info(req_details, instance_name, self.vcpecommon.custom_product_family_id)
+ self.add_project_info(req_details)
+ self.add_owning_entity(req_details)
return {'requestDetails': req_details}
def create_custom_service(self, csar_file, brg_mac, name_suffix=None):
@@ -186,7 +211,7 @@
parser.svc_model['modelName'], name_suffix])
instance_name = instance_name.lower()
req = self.generate_custom_service_request(instance_name, parser.svc_model, brg_mac)
- self.logger.debug(json.dumps(req, indent=2, sort_keys=True))
+ self.logger.info(json.dumps(req, indent=2, sort_keys=True))
self.logger.info('Creating custom service {0}.'.format(instance_name))
req_id, svc_instance_id = self.submit_create_req(req, 'service')
if not self.check_progress(req_id, 140):
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 5b3e009..cac5219 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -21,19 +21,19 @@
# set the openstack cloud access credentials here
cloud = {
'--os-auth-url': 'http://10.12.25.2:5000',
- '--os-username': 'YOUR ID',
+ '--os-username': 'kxi',
'--os-user-domain-id': 'default',
'--os-project-domain-id': 'default',
- '--os-tenant-id': '087050388b204c73a3e418dd2c1fe30b',
+ '--os-tenant-id': '1e097c6713e74fd7ac8e4295e605ee1e',
'--os-region-name': 'RegionOne',
- '--os-password': 'YOUR PASSWD',
- '--os-project-domain-name': 'Integration-SB-01',
+ '--os-password': 'n3JhGMGuDzD8',
+ '--os-project-domain-name': 'Integration-SB-07',
'--os-identity-api-version': '3'
}
common_preload_config = {
- 'oam_onap_net': 'oam_onap_c4Uw',
- 'oam_onap_subnet': 'oam_onap_c4Uw',
+ 'oam_onap_net': 'oam_onap_lAky',
+ 'oam_onap_subnet': 'oam_onap_lAky',
'public_net': 'external',
'public_net_id': '971040b2-7059-49dc-b220-4fab50cb2ad4'
}
@@ -53,13 +53,17 @@
'mux_gw': ['10.5.0.10', '10.5.0.1']
}
+ dcae_ves_collector_name = 'dcae-bootstrap'
global_subscriber_id = 'SDN-ETHERNET-INTERNET'
+ project_name = 'Project-Demonstration'
+ owning_entity_id = '520cc603-a3c4-4ec2-9ef4-ca70facd79c0'
+ owning_entity_name = 'OE-Demonstration'
def __init__(self, extra_host_names=None):
self.logger = logging.getLogger(__name__)
self.logger.info('Initializing configuration')
- self.host_names = ['so', 'sdnc', 'robot', 'aai-inst1', 'dcaedoks00']
+ self.host_names = ['so', 'sdnc', 'robot', 'aai-inst1', self.dcae_ves_collector_name]
if extra_host_names:
self.host_names.extend(extra_host_names)
# get IP addresses
@@ -84,6 +88,13 @@
self.common_preload_config['pub_key'] = self.pub_key
self.sniro_url = 'http://' + self.hosts['robot'] + ':8080/__admin/mappings'
self.sniro_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
+ self.homing_solution = 'sniro' # value is either 'sniro' or 'oof'
+# self.homing_solution = 'oof'
+ self.customer_location_used_by_oof = {
+ "customerLatitude": "32.897480",
+ "customerLongitude": "-97.040443",
+ "customerName": "some_company"
+ }
#############################################################################################
# SDNC urls
@@ -91,7 +102,7 @@
self.sdnc_db_name = 'sdnctl'
self.sdnc_db_user = 'sdnctl'
self.sdnc_db_pass = 'gamma'
- self.sdnc_db_port = '32768'
+ self.sdnc_db_port = '32774'
self.sdnc_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
self.sdnc_preload_network_url = 'http://' + self.hosts['sdnc'] + \
':8282/restconf/operations/VNF-API:preload-network-topology-operation'
@@ -103,7 +114,7 @@
# SO urls, note: do NOT add a '/' at the end of the url
self.so_req_api_url = {'v4': 'http://' + self.hosts['so'] + ':8080/ecomp/mso/infra/serviceInstances/v4',
'v5': 'http://' + self.hosts['so'] + ':8080/ecomp/mso/infra/serviceInstances/v5'}
- self.so_check_progress_api_url = 'http://' + self.hosts['so'] + ':8080/ecomp/mso/infra/orchestrationRequests/v2'
+ self.so_check_progress_api_url = 'http://' + self.hosts['so'] + ':8080/ecomp/mso/infra/orchestrationRequests/v5'
self.so_userpass = 'InfraPortalClient', 'password1$'
self.so_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
self.so_db_name = 'mso_catalog'
@@ -257,7 +268,7 @@
url = 'https://{0}:8443/aai/v11/search/nodes-query?search-node-type={1}&filter={2}:EQUALS:{3}'.format(
self.hosts['aai-inst1'], search_node_type, key, node_uuid)
- headers = {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-FromAppID': 'vCPE-Robot'}
+ headers = {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-FromAppID': 'vCPE-Robot', 'X-TransactionId': 'get_aai_subscr'}
requests.packages.urllib3.disable_warnings()
r = requests.get(url, headers=headers, auth=self.aai_userpass, verify=False)
response = r.json()
@@ -313,7 +324,8 @@
if len(ip_dict) != len(keywords):
self.logger.error('Cannot find all desired IP addresses for %s.', keywords)
self.logger.error(json.dumps(ip_dict, indent=4, sort_keys=True))
- sys.exit()
+ self.logger.error('Temporarily continue.. remember to check back vcpecommon.py line: 316')
+# sys.exit()
return ip_dict
def del_vgmux_ves_mode(self):
@@ -329,8 +341,8 @@
def set_vgmux_ves_collector(self ):
url = self.vpp_ves_url.format(self.hosts['mux'])
data = {'config':
- {'server-addr': self.hosts['dcaedoks00'],
- 'server-port': '8080',
+ {'server-addr': self.hosts[self.dcae_ves_collector_name],
+ 'server-port': '8081',
'read-interval': '10',
'is-add':'1'
}