Loading services/helper/helper_service/services/interconnection/core/ccfinstancedetails.py +6 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,13 @@ class CcfInstanceOperations(Resource): services_col = self.db.get_col_by_name(self.db.services_col) shareable_apis = services_col.find({ "shareable_info.is_shareable": True, "shareable_info.capif_prov_doms": peer_dom, "apf_id": {"$ne": peer_ccf_id}, "pub_api_path.ccf_ids": {"$ne": peer_ccf_id} "pub_api_path.ccf_ids": {"$ne": peer_ccf_id}, "$or": [ {"shareable_info.capif_prov_doms": peer_dom}, {"shareable_info.capif_prov_doms": {"$exists": False}}, {"shareable_info.capif_prov_doms": None} ] }) url = "https://{}/published-apis/v1/{}/service-apis".format(peer_dom, local_ccf_id) Loading services/remove_users.sh +1 −1 Original line number Diff line number Diff line Loading @@ -119,4 +119,4 @@ docker run $DOCKER_ROBOT_TTY_OPTIONS --rm --network="host" \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ --variable USERNAME_PREFIX:$USERNAME_PREFIX \ --include remove-users --include remove-users-by-prefix tests/features/Helper/Interconnection API/interconnection.robot +30 −10 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A ## Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... is_shareable=True ... is_shareable=${True} ## Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Loading @@ -83,11 +83,15 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A # Interconnection Request between CCF-A and CCF-B ${DESTINATION_PROVIDER_DOMAIN}= Set Variable capifcore-b:1443 ${INTERCONNECTION_CCF_HOSTNAME}= Set Variable capifcore-b:1443 ${INTERCONNECTION_CCF_REGISTER_HOSTNAME}= Set Variable register-b:8184 Set Global Variable ${CAPIF_HTTPS_URL_B} https://${INTERCONNECTION_CCF_HOSTNAME}/ Set Global Variable ${CAPIF_HTTPS_REGISTER_URL_B} https://${INTERCONNECTION_CCF_REGISTER_HOSTNAME}/ ${ccf_id_a}= Get Capif Ccf Id ${body}= Create Interconnection Request Body ${DESTINATION_PROVIDER_DOMAIN} ${body}= Create Interconnection Request Body ${INTERCONNECTION_CCF_HOSTNAME} ${resp}= Post Request Capif ... /helper/interconnection/request ... server=${CAPIF_HTTPS_URL} Loading @@ -97,17 +101,33 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A Should Be Equal As Integers ${resp.status_code} 201 Log Dictionary ${resp.json()} ${ccf_id_b}= Set Variable ${resp.json()['ccfId']} # Delete interconnection ${resp}= Delete Request Capif ... /helper/interconnection/request/${ccf_id_b} ... server=${CAPIF_HTTPS_URL} Call Method ${CAPIF_USERS} update_ccf_interconnected ${CAPIF_HTTPS_URL} ${ccf_id_b} ${SUPERADMIN_USERNAME} ## Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding ... invoker_username=${INVOKER_USERNAME}_B ... register_server=${CAPIF_HTTPS_REGISTER_URL_B} ... capif_server=${CAPIF_HTTPS_URL_B} ## Test ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL_B} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} ... username=${INVOKER_USERNAME}_B Should Be Equal As Integers ${resp.status_code} 204 Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs # # Delete interconnection # ${resp}= Delete Request Capif # ... /helper/interconnection/request/${ccf_id_b} # ... server=${CAPIF_HTTPS_URL} # ... verify=ca.crt # ... username=${SUPERADMIN_USERNAME} # Should Be Equal As Integers ${resp.status_code} 204 Interconnection establish between CCF-A and CCF-B [Tags] interconnection-10 Loading tests/libraries/environment.py +33 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ class CapifUserManager(): def __init__(self): self.capif_users = {} self.register_users = {} self.interconnected_ccfs = {} def update_register_users(self, uuid, username, server): self.register_users[uuid] = { Loading @@ -18,6 +19,22 @@ class CapifUserManager(): "server": server } def update_ccf_interconnected(self, ccf_hostname, ccf_id, username): ccf_input = self.interconnected_ccfs.get(ccf_hostname) if ccf_input is None: ccf_interconnected = { "hostname": ccf_hostname, "ccf_ids_interconnected": [ccf_id], "username": username } else: ccf_interconnected = ccf_input ccf_interconnected["ccf_ids_interconnected"].append(ccf_id) self.interconnected_ccfs[ccf_hostname] = ccf_interconnected def remove_capif_users_entry(self, key): self.capif_users.pop(key) Loading @@ -28,6 +45,19 @@ class CapifUserManager(): uuid, server = self.get_user_uuid(username) self.register_users.pop(uuid) def remove_ccf_interconnected_entry(self, ccf_hostname): self.interconnected_ccfs.pop(ccf_hostname) def remove_ccf_interconnected_entry_by_id(self, ccf_hostname, ccf_id): ccf_input = self.interconnected_ccfs.get(ccf_hostname) if ccf_input is not None: ccf_interconnected = ccf_input if ccf_id in ccf_interconnected["ccf_ids_interconnected"]: ccf_interconnected["ccf_ids_interconnected"].remove(ccf_id) self.interconnected_ccfs[ccf_hostname] = ccf_interconnected if len(ccf_interconnected["ccf_ids_interconnected"]) == 0: self.interconnected_ccfs.pop(ccf_hostname) def get_capif_users_dict(self): return self.capif_users Loading @@ -40,4 +70,7 @@ class CapifUserManager(): return uuid, stored_user_info["server"] return None, None def get_ccf_interconnected_dict(self): return self.interconnected_ccfs CAPIF_USERS = CapifUserManager() No newline at end of file tests/resources/common.resource +6 −2 Original line number Diff line number Diff line Loading @@ -55,12 +55,16 @@ Reset Testing Environment Check Location Header [Documentation] This keyword will check location header at response according to regular expression provided as argument [Arguments] ${resp} ${regular_expression} [Arguments] ${resp} ${regular_expression} ${hostname}=${CAPIF_HTTPS_URL} ${event_url}= Parse Url ${resp.headers['Location']} Should Match Regexp ${event_url.path} ${regular_expression} Should Match Regexp ${event_url.netloc} ^${CAPIF_HOSTNAME}(:[0-9]+)?$ ${hostname_url}= Parse Url ${hostname} Should Match Regexp ${event_url.netloc} ^${hostname_url.hostname}(:[0-9]+)?$ RETURN ${event_url} Check Event Location Header Loading Loading
services/helper/helper_service/services/interconnection/core/ccfinstancedetails.py +6 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,13 @@ class CcfInstanceOperations(Resource): services_col = self.db.get_col_by_name(self.db.services_col) shareable_apis = services_col.find({ "shareable_info.is_shareable": True, "shareable_info.capif_prov_doms": peer_dom, "apf_id": {"$ne": peer_ccf_id}, "pub_api_path.ccf_ids": {"$ne": peer_ccf_id} "pub_api_path.ccf_ids": {"$ne": peer_ccf_id}, "$or": [ {"shareable_info.capif_prov_doms": peer_dom}, {"shareable_info.capif_prov_doms": {"$exists": False}}, {"shareable_info.capif_prov_doms": None} ] }) url = "https://{}/published-apis/v1/{}/service-apis".format(peer_dom, local_ccf_id) Loading
services/remove_users.sh +1 −1 Original line number Diff line number Diff line Loading @@ -119,4 +119,4 @@ docker run $DOCKER_ROBOT_TTY_OPTIONS --rm --network="host" \ --variable NOTIFICATION_DESTINATION_URL:$NOTIFICATION_DESTINATION_URL \ --variable MOCK_SERVER_URL:$MOCK_SERVER_URL \ --variable USERNAME_PREFIX:$USERNAME_PREFIX \ --include remove-users --include remove-users-by-prefix
tests/features/Helper/Interconnection API/interconnection.robot +30 −10 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A ## Publish one api ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api ... ${register_user_info} ... is_shareable=True ... is_shareable=${True} ## Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding Loading @@ -83,11 +83,15 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A # Interconnection Request between CCF-A and CCF-B ${DESTINATION_PROVIDER_DOMAIN}= Set Variable capifcore-b:1443 ${INTERCONNECTION_CCF_HOSTNAME}= Set Variable capifcore-b:1443 ${INTERCONNECTION_CCF_REGISTER_HOSTNAME}= Set Variable register-b:8184 Set Global Variable ${CAPIF_HTTPS_URL_B} https://${INTERCONNECTION_CCF_HOSTNAME}/ Set Global Variable ${CAPIF_HTTPS_REGISTER_URL_B} https://${INTERCONNECTION_CCF_REGISTER_HOSTNAME}/ ${ccf_id_a}= Get Capif Ccf Id ${body}= Create Interconnection Request Body ${DESTINATION_PROVIDER_DOMAIN} ${body}= Create Interconnection Request Body ${INTERCONNECTION_CCF_HOSTNAME} ${resp}= Post Request Capif ... /helper/interconnection/request ... server=${CAPIF_HTTPS_URL} Loading @@ -97,17 +101,33 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A Should Be Equal As Integers ${resp.status_code} 201 Log Dictionary ${resp.json()} ${ccf_id_b}= Set Variable ${resp.json()['ccfId']} # Delete interconnection ${resp}= Delete Request Capif ... /helper/interconnection/request/${ccf_id_b} ... server=${CAPIF_HTTPS_URL} Call Method ${CAPIF_USERS} update_ccf_interconnected ${CAPIF_HTTPS_URL} ${ccf_id_b} ${SUPERADMIN_USERNAME} ## Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding ... invoker_username=${INVOKER_USERNAME}_B ... register_server=${CAPIF_HTTPS_REGISTER_URL_B} ... capif_server=${CAPIF_HTTPS_URL_B} ## Test ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL_B} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} ... username=${INVOKER_USERNAME}_B Should Be Equal As Integers ${resp.status_code} 204 Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs # # Delete interconnection # ${resp}= Delete Request Capif # ... /helper/interconnection/request/${ccf_id_b} # ... server=${CAPIF_HTTPS_URL} # ... verify=ca.crt # ... username=${SUPERADMIN_USERNAME} # Should Be Equal As Integers ${resp.status_code} 204 Interconnection establish between CCF-A and CCF-B [Tags] interconnection-10 Loading
tests/libraries/environment.py +33 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ class CapifUserManager(): def __init__(self): self.capif_users = {} self.register_users = {} self.interconnected_ccfs = {} def update_register_users(self, uuid, username, server): self.register_users[uuid] = { Loading @@ -18,6 +19,22 @@ class CapifUserManager(): "server": server } def update_ccf_interconnected(self, ccf_hostname, ccf_id, username): ccf_input = self.interconnected_ccfs.get(ccf_hostname) if ccf_input is None: ccf_interconnected = { "hostname": ccf_hostname, "ccf_ids_interconnected": [ccf_id], "username": username } else: ccf_interconnected = ccf_input ccf_interconnected["ccf_ids_interconnected"].append(ccf_id) self.interconnected_ccfs[ccf_hostname] = ccf_interconnected def remove_capif_users_entry(self, key): self.capif_users.pop(key) Loading @@ -28,6 +45,19 @@ class CapifUserManager(): uuid, server = self.get_user_uuid(username) self.register_users.pop(uuid) def remove_ccf_interconnected_entry(self, ccf_hostname): self.interconnected_ccfs.pop(ccf_hostname) def remove_ccf_interconnected_entry_by_id(self, ccf_hostname, ccf_id): ccf_input = self.interconnected_ccfs.get(ccf_hostname) if ccf_input is not None: ccf_interconnected = ccf_input if ccf_id in ccf_interconnected["ccf_ids_interconnected"]: ccf_interconnected["ccf_ids_interconnected"].remove(ccf_id) self.interconnected_ccfs[ccf_hostname] = ccf_interconnected if len(ccf_interconnected["ccf_ids_interconnected"]) == 0: self.interconnected_ccfs.pop(ccf_hostname) def get_capif_users_dict(self): return self.capif_users Loading @@ -40,4 +70,7 @@ class CapifUserManager(): return uuid, stored_user_info["server"] return None, None def get_ccf_interconnected_dict(self): return self.interconnected_ccfs CAPIF_USERS = CapifUserManager() No newline at end of file
tests/resources/common.resource +6 −2 Original line number Diff line number Diff line Loading @@ -55,12 +55,16 @@ Reset Testing Environment Check Location Header [Documentation] This keyword will check location header at response according to regular expression provided as argument [Arguments] ${resp} ${regular_expression} [Arguments] ${resp} ${regular_expression} ${hostname}=${CAPIF_HTTPS_URL} ${event_url}= Parse Url ${resp.headers['Location']} Should Match Regexp ${event_url.path} ${regular_expression} Should Match Regexp ${event_url.netloc} ^${CAPIF_HOSTNAME}(:[0-9]+)?$ ${hostname_url}= Parse Url ${hostname} Should Match Regexp ${event_url.netloc} ^${hostname_url.hostname}(:[0-9]+)?$ RETURN ${event_url} Check Event Location Header Loading