Commit 41a7f653 authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

New interconnection tests and improvements over tests

parent d1223103
Loading
Loading
Loading
Loading
Loading
+257 −32
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ Interconnection Request between CCF-A and CCF-B

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

    Log Dictionary    ${resp.json()}

    # Delete interconnection
    ${resp}=    Delete Request Capif
    ...    /helper/interconnection/request/${ccf_id_b}
@@ -50,7 +48,7 @@ Interconnection Request between CCF-A and CCF-B

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

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

    # Publish one api on CCF-A
@@ -119,47 +117,274 @@ Interconnection Request between CCF-A and CCF-B with one API published on CCF-A
    ...    username=${INVOKER_USERNAME}_B

    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    ${ccf_id_a}

    # # Delete interconnection
    # ${resp}=    Delete Request Capif
    # ...    /helper/interconnection/request/${ccf_id_b}
    # ...    server=${CAPIF_HTTPS_URL}
    # ...    verify=ca.crt
    # ...    username=${SUPERADMIN_USERNAME}
Interconnection Request between CCF-A and CCF-B with one API published on CCF-A capifProvDoms present with CCF-B hostname
    [Tags]    interconnection-3

    # Should Be Equal As Integers    ${resp.status_code}    204
    # Interconnection Request between CCF-A and CCF-B
    ${INTERCONNECTION_CCF_HOSTNAME}=    Set Variable    capifcore-b:1443
    ${INTERCONNECTION_CCF_REGISTER_HOSTNAME}=    Set Variable    register-b:8184

Interconnection establish between CCF-A and CCF-B
    [Tags]    interconnection-10
    Set Global Variable    ${CAPIF_HTTPS_URL_B}    https://${INTERCONNECTION_CCF_HOSTNAME}/
    Set Global Variable    ${CAPIF_HTTPS_REGISTER_URL_B}    https://${INTERCONNECTION_CCF_REGISTER_HOSTNAME}/

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

    # ${hostname_parsed}=    Parse Url    ${INTERCONNECTION_CCF_HOSTNAME}
    # ${ccf_hostname}=    Set Variable    ${hostname_parsed.hostname}

    ${ccf_id_a}=    Get Capif Ccf Id

    ${ccf_crt}=    Read File Utf8    ${CCF_USERNAME}.crt
    ${ccf_key}=    Read File Utf8    ${CCF_USERNAME}.key
    ${ccf_ca}=    Read File Utf8    ${CCF_USERNAME}_ca.crt

    ${body}=    Create Connection Request Body
    ...    ${ccf_ca}
    ...    ${ccf_id_a}
    ...    ${DESTINATION_PROVIDER_DOMAIN}
    ...    ${ccf_crt}
    ${resp}=    Post Request Capif
    ...    /helper/interconnection/establish
    # 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}
    ...    capif_prov_doms=${INTERCONNECTION_CCF_HOSTNAME}

    ## 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=${CCF_USERNAME}
    ...    json=${body}
    ...    username=${INVOKER_USERNAME}

    Should Be Equal As Integers    ${resp.status_code}    201
    Log Dictionary    ${resp.json()}
    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs

    # Delete interconnection
    ${resp}=    Delete Request Capif
    ...    /helper/interconnection/establish/${ccf_id_a}
    # 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}

    # Request interconnection between CCF-A and CCF-B
    ${resp}=    Create Capif Interconnection    server=${CAPIF_HTTPS_URL}   ccf_hostname=${INTERCONNECTION_CCF_HOSTNAME}  superadmin_username=${SUPERADMIN_USERNAME}
    ${ccf_id_b}=   Set Variable    ${resp.json()['ccfId']}

    ## 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=${INVOKER_USERNAME}_B

    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    ${ccf_id_a}


Interconnection Request between CCF-A and CCF-B with one API published on CCF-A capifProvDoms present with OTHER hostname
    [Tags]    interconnection-4

    # Interconnection Request between CCF-A and CCF-B
    ${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}/

    # 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}
    ...    capif_prov_doms=OTHER

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

    Should Be Equal As Integers    ${resp.status_code}    204
    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}

    # Request interconnection between CCF-A and CCF-B
    ${resp}=    Create Capif Interconnection    server=${CAPIF_HTTPS_URL}   ccf_hostname=${INTERCONNECTION_CCF_HOSTNAME}  superadmin_username=${SUPERADMIN_USERNAME}
    ${ccf_id_b}=   Set Variable    ${resp.json()['ccfId']}

    ## 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=${INVOKER_USERNAME}_B

    Check Response Variable Type And Values
    ...    ${resp}
    ...    404
    ...    ProblemDetails
    ...    title=Not Found
    ...    status=404
    ...    detail=API Invoker ${register_user_info_invoker['api_invoker_id']} has no API Published that accomplish filter conditions
    ...    cause=No API Published accomplish filter conditions



Publish API after CAPIFs Interconnection with capifProvDoms present with CCF-B hostname
    [Tags]    interconnection-5

    ${ccf_id_a}=    Get Capif Ccf Id

    # Interconnection Request between CCF-A and CCF-B
    ${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}/

    # Request interconnection between CCF-A and CCF-B
    ${resp}=    Create Capif Interconnection    server=${CAPIF_HTTPS_URL}   ccf_hostname=${INTERCONNECTION_CCF_HOSTNAME}  superadmin_username=${SUPERADMIN_USERNAME}
    ${ccf_id_b}=   Set Variable    ${resp.json()['ccfId']}

    # 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}
    ...    capif_prov_doms=${INTERCONNECTION_CCF_HOSTNAME}

    ## 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=${INVOKER_USERNAME}_B

    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    ${ccf_id_a}

Publish API after CAPIFs Interconnection with capifProvDoms not present
    [Tags]    interconnection-6

    ${ccf_id_a}=    Get Capif Ccf Id

    # Interconnection Request between CCF-A and CCF-B
    ${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}/

    # Request interconnection between CCF-A and CCF-B
    ${resp}=    Create Capif Interconnection    server=${CAPIF_HTTPS_URL}   ccf_hostname=${INTERCONNECTION_CCF_HOSTNAME}  superadmin_username=${SUPERADMIN_USERNAME}
    ${ccf_id_b}=   Set Variable    ${resp.json()['ccfId']}

    # 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
    ...  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=${INVOKER_USERNAME}_B

    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    1
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    1
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions'][0]['pubApiPath']['ccfIds']}    ${ccf_id_a}



# 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

#     ${ccf_crt}=    Read File Utf8    ${CCF_USERNAME}.crt
#     ${ccf_key}=    Read File Utf8    ${CCF_USERNAME}.key
#     ${ccf_ca}=    Read File Utf8    ${CCF_USERNAME}_ca.crt

#     ${body}=    Create Connection Request Body
#     ...    ${ccf_ca}
#     ...    ${ccf_id_a}
#     ...    ${DESTINATION_PROVIDER_DOMAIN}
#     ...    ${ccf_crt}
#     ${resp}=    Post Request Capif
#     ...    /helper/interconnection/establish
#     ...    server=${CAPIF_HTTPS_URL}
#     ...    verify=ca.crt
#     ...    username=${CCF_USERNAME}
#     ...    json=${body}

#     Should Be Equal As Integers    ${resp.status_code}    201
#     Log Dictionary    ${resp.json()}

#     # Delete interconnection
#     ${resp}=    Delete Request Capif
#     ...    /helper/interconnection/establish/${ccf_id_a}
#     ...    server=${CAPIF_HTTPS_URL}
#     ...    verify=ca.crt
#     ...    username=${CCF_USERNAME}

#     Should Be Equal As Integers    ${resp.status_code}    204
+20 −9
Original line number Diff line number Diff line
@@ -8,7 +8,10 @@ def create_service_api_description(api_name="service_1",
                                   domain_name=None,
                                   interface_descriptions=None,
                                   is_shareable=None,
                                   capif_prov_doms=None):
                                   capif_prov_doms=None,
                                   service_api_category=None,
                                   pub_api_path_ccf_ids=None,
                                   ccf_id=None):
    aef_ids = list()
    if isinstance(aef_id, list):
        aef_ids = aef_id
@@ -49,14 +52,7 @@ def create_service_api_description(api_name="service_1",
        "apiName": api_name,
        "aefProfiles": profiles,
        "description": "ROBOT_TESTING",
        "serviceAPICategory": "string",
        "apiSuppFeats": "fffff",
        "pubApiPath": {
            "ccfIds": [
                "string"
            ]
        },
        "ccfId": "string"
        "apiSuppFeats": "fffff"
    }

    if vendor_specific_service_api_description is not None:
@@ -83,13 +79,28 @@ def create_service_api_description(api_name="service_1",
    # shareable info
    if is_shareable is not None:
        body['shareableInfo'] = dict()
        print(f"Setting isShareable to {is_shareable}")
        body['shareableInfo']['isShareable'] = is_shareable
        if capif_prov_doms is not None:
            print(f"Setting capifProvDoms to {capif_prov_doms}")
            if isinstance(capif_prov_doms, list):
                body['shareableInfo']['capifProvDoms'] = capif_prov_doms
            elif isinstance(capif_prov_doms, str):
                body['shareableInfo']['capifProvDoms'] = [capif_prov_doms]

    if service_api_category is not None:
        body['serviceAPICategory'] = service_api_category

    if pub_api_path_ccf_ids is not None:
        body['pubApiPath'] = dict()
        if isinstance(pub_api_path_ccf_ids, list):
            body['pubApiPath']['ccfIds'] = pub_api_path_ccf_ids
        elif isinstance(pub_api_path_ccf_ids, str):
            body['pubApiPath']['ccfIds'] = [pub_api_path_ccf_ids]

    if ccf_id is not None:
        body['ccfId'] = ccf_id

    return body


+45 −11
Original line number Diff line number Diff line
@@ -722,6 +722,28 @@ Remove Resource

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

Create Capif Interconnection
    [Arguments]
    ...    ${server}
    ...    ${ccf_hostname}
    ...    ${superadmin_username}=${SUPERADMIN_USERNAME}

    ${body}=    Create Interconnection Request Body    ${ccf_hostname}

    # Create interconnection
    ${resp}=    Post Request Capif
    ...    /helper/interconnection/request
    ...    server=${server}
    ...    verify=ca.crt
    ...    username=${superadmin_username}
    ...    json=${body}

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

    Call Method  ${CAPIF_USERS}    update_ccf_interconnected    ${server}    ${resp.json()['ccfId']}    ${superadmin_username}

    RETURN   ${resp}

Remove Capif Interconnection
    [Arguments]
    ...    ${server}
@@ -902,6 +924,9 @@ Publish Service Api Request
    ...    ${interface_descriptions}=${NONE}
    ...    ${is_shareable}=${NONE}
    ...    ${capif_prov_doms}=${NONE}
    ...    ${service_api_category}=${NONE}
    ...    ${pub_api_path_ccf_ids}=${NONE}
    ...    ${ccf_id}=${NONE}

    ${aef_ids}=    Create List
    IF    "${aef_id}" == "${NONE}"
@@ -926,17 +951,20 @@ Publish Service Api Request
    END

    ${request_body}=    Create Service Api Description
    ...    ${service_name}
    ...    ${aef_ids}
    ...    ${supported_features}
    ...    ${vendor_specific_service_api_description}
    ...    ${vendor_specific_aef_profile}
    ...    ${api_status}
    ...    ${security_methods}
    ...    ${domain_name}
    ...    ${interface_descriptions}
    ...    ${is_shareable}
    ...    ${capif_prov_doms}
    ...    api_name=${service_name}
    ...    aef_id=${aef_ids}
    ...    supported_features=${supported_features}
    ...    vendor_specific_service_api_description=${vendor_specific_service_api_description}
    ...    vendor_specific_aef_profile=${vendor_specific_aef_profile}
    ...    api_status=${api_status}
    ...    security_methods=${security_methods}
    ...    domain_name=${domain_name}
    ...    interface_descriptions=${interface_descriptions}
    ...    is_shareable=${is_shareable}
    ...    capif_prov_doms=${capif_prov_doms}
    ...    service_api_category=${service_api_category}
    ...    pub_api_path_ccf_ids=${pub_api_path_ccf_ids}
    ...    ccf_id=${ccf_id}

    ${resp}=    Post Request Capif
    ...    /published-apis/v1/${apf_id_to_use}/service-apis
@@ -963,6 +991,9 @@ Publish Service Api
    ...    ${interface_descriptions}=${NONE}
    ...    ${is_shareable}=${NONE}
    ...    ${capif_prov_doms}=${NONE}
    ...    ${service_api_category}=${NONE}
    ...    ${pub_api_path_ccf_ids}=${NONE}
    ...    ${ccf_id}=${NONE}

    ${resp}  ${request_body}=  Publish Service Api Request
    ...    ${register_user_info_provider}
@@ -979,6 +1010,9 @@ Publish Service Api
    ...    ${interface_descriptions}
    ...    ${is_shareable}
    ...    ${capif_prov_doms}
    ...    ${service_api_category}
    ...    ${pub_api_path_ccf_ids}
    ...    ${ccf_id}

    Check Response Variable Type And Values    ${resp}    201    ServiceAPIDescription
    Dictionary Should Contain Key    ${resp.json()}    apiId