Commit ef85eb70 authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Added configuration of register and capif hostnames, to allow test interconnection CAPIF

parent 8fc445d5
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ Onboard Network App
    # Check Results
    Check Response Variable Type And Values    ${resp}    201    APIInvokerEnrolmentDetails
    ${url}=    Parse Url    ${resp.headers['Location']}
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${INVOKER_USERNAME}
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${INVOKER_USERNAME}  ${CAPIF_HTTPS_URL}
    Check Location Header    ${resp}    ${LOCATION_INVOKER_RESOURCE_REGEX}

    # Store dummy signed certificate
@@ -184,7 +184,7 @@ Update Onboarded Network App Certificate
    ...    notificationDestination=${new_notification_destination}

    # Update CAPIF_USERS to use the NEW certificate name for cleanup
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${INVOKER_USERNAME_NEW}
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${INVOKER_USERNAME_NEW}  ${CAPIF_HTTPS_URL}

Onboard invoker without supported_features
    [Tags]    capif_api_invoker_management-8
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ Register Api Provider
    Check Response Variable Type And Values    ${resp}    201    APIProviderEnrolmentDetails

    ${url}=    Parse Url    ${resp.headers['Location']}
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${register_user_info['amf_username']}
    Call Method    ${CAPIF_USERS}    update_capif_users_dicts    ${url.path}    ${register_user_info['amf_username']}   ${CAPIF_HTTPS_URL}

    ${resource_url}=    Check Location Header    ${resp}    ${LOCATION_PROVIDER_RESOURCE_REGEX}

+63 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ ${SUBSCRIPTION_ID_NOT_VALID} not-valid


*** Test Cases ***
Interconnection 2 CCF
Interconnection Request between CCF-A and CCF-B
    [Tags]    interconnection-1

    ${DESTINATION_PROVIDER_DOMAIN}=    Set Variable    capifcore-b:1443
@@ -39,6 +39,8 @@ Interconnection 2 CCF

    ${ccf_id_b}=   Set Variable    ${resp.json()['ccfId']}

    Log Dictionary    ${resp.json()}

    # Delete interconnection
    ${resp}=    Delete Request Capif
    ...    /helper/interconnection/request/${ccf_id_b}
@@ -48,9 +50,68 @@ Interconnection 2 CCF

    Should Be Equal As Integers    ${resp.status_code}    204

Interconnection 2 CCF X
Interconnection Request between CCF-A and CCF-B with one API published on CCF-A
    [Tags]    interconnection-2

    # Publish one api on CCF-A
    ## Register APF
    ${register_user_info}=    Provider Default Registration

    ## Publish one api
    ${service_api_description_published}    ${resource_url}    ${request_body}=    Publish Service Api
    ...    ${register_user_info}
    ...    is_shareable=True

    ## Default Invoker Registration and Onboarding
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding

    ## 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}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}

    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs

    # Check Results
    Log  "API discovered by authorised API invoker at CCF-A"
    Dictionary Should Contain Key    ${resp.json()}    serviceAPIDescriptions
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published}


    # Interconnection Request between CCF-A and CCF-B
    ${DESTINATION_PROVIDER_DOMAIN}=    Set Variable    capifcore-b:1443

    ${ccf_id_a}=    Get Capif Ccf Id

    ${body}=    Create Interconnection Request Body    ${DESTINATION_PROVIDER_DOMAIN}
    ${resp}=    Post Request Capif
    ...    /helper/interconnection/request
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${SUPERADMIN_USERNAME}
    ...    json=${body}

    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}
    ...    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

    ${DESTINATION_PROVIDER_DOMAIN}=    Set Variable    capifcore-b:1443

    ${ccf_id_a}=    Get Capif Ccf Id
+24 −11
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ def create_service_api_description(api_name="service_1",
                                   api_status=None,
                                   security_methods="default",
                                   domain_name=None,
                                   interface_descriptions=None):
                                   interface_descriptions=None,
                                   is_shareable=None,
                                   capif_prov_doms=None):
    aef_ids = list()
    if isinstance(aef_id, list):
        aef_ids = aef_id
@@ -47,12 +49,6 @@ def create_service_api_description(api_name="service_1",
        "apiName": api_name,
        "aefProfiles": profiles,
        "description": "ROBOT_TESTING",
        "shareableInfo": {
            "isShareable": True,
            "capifProvDoms": [
                "string"
            ]
        },
        "serviceAPICategory": "string",
        "apiSuppFeats": "fffff",
        "pubApiPath": {
@@ -84,6 +80,16 @@ def create_service_api_description(api_name="service_1",
        body['apiStatus'] = dict()
        body['apiStatus']['aefIds'] = aef_ids_active

    # shareable info
    if is_shareable is not None:
        body['shareableInfo'] = dict()
        body['shareableInfo']['isShareable'] = is_shareable
        if capif_prov_doms is not None:
            if isinstance(capif_prov_doms, list):
                body['shareableInfo']['capifProvDoms'] = capif_prov_doms
            elif isinstance(capif_prov_doms, str):
                body['shareableInfo']['capifProvDoms'] = [capif_prov_doms]

    return body


@@ -171,7 +177,6 @@ def create_aef_profile(aef_id,

def create_service_api_description_patch(aef_id=None,
                                         description=None,
                                         shareable_info=None,
                                         api_status=None,
                                         service_api_category=None,
                                         api_supp_feats=None,
@@ -179,7 +184,9 @@ def create_service_api_description_patch(aef_id=None,
                                         ccf_id=None,
                                         security_methods=None,
                                         domain_name=None,
                                         interface_descriptions=None):
                                         interface_descriptions=None,
                                         is_shareable=None,
                                         capif_prov_doms=None):
    body = dict()

    # aef profiles
@@ -219,8 +226,14 @@ def create_service_api_description_patch(aef_id=None,
        body['description'] = description

    # shareable info
    if shareable_info is not None:
        body['shareableInfo'] = shareable_info
    if is_shareable is not None:
        body['shareableInfo'] = dict()
        body['shareableInfo']['isShareable'] = is_shareable
        if capif_prov_doms is not None:
            if isinstance(capif_prov_doms, list):
                body['shareableInfo']['capifProvDoms'] = capif_prov_doms
            elif isinstance(capif_prov_doms, str):
                body['shareableInfo']['capifProvDoms'] = [capif_prov_doms]

    # service API Category
    if service_api_category is not None:
+21 −12
Original line number Diff line number Diff line
@@ -3,20 +3,29 @@ class CapifUserManager():
        self.capif_users = {}
        self.register_users = {}

    def update_register_users(self, uuid, username):
        self.register_users[uuid] = username

    def update_capif_users_dicts(self, key, value):
        self.capif_users[key] = value
    def update_register_users(self, uuid, username, server):
        self.register_users[uuid] = {
            "username": username,
            "server": server
        }

    def update_capif_users_dicts(self,
                                 resource_url_path,
                                 management_certificate,
                                 server):
        self.capif_users[resource_url_path] = {
            "management_certificate": management_certificate,
            "server": server
        }

    def remove_capif_users_entry(self, key):
        self.capif_users.pop(key)

    def remove_register_users_entry(self, uuid=None, username=None):
        if uuid != None:
        if uuid is not None:
            self.register_users.pop(uuid)
        elif username != None:
            uuid=self.get_user_uuid(username)
        elif username is not None:
            uuid, server = self.get_user_uuid(username)
            self.register_users.pop(uuid)

    def get_capif_users_dict(self):
@@ -26,9 +35,9 @@ class CapifUserManager():
        return self.register_users

    def get_user_uuid(self, username):
        for uuid, stored_user in self.register_users.items():
            if stored_user == username:
                return uuid
        return None
        for uuid, stored_user_info in self.register_users.items():
            if stored_user_info["username"] == username:
                return uuid, stored_user_info["server"]
        return None, None

CAPIF_USERS = CapifUserManager()
 No newline at end of file
Loading