Commit 7b54c6f9 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSD management subscriptions

parent a2247eb9
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -924,6 +924,32 @@ Get all NSD Management Subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all NSD Management Subscriptions with permitted authorization scope
    [Documentation]    This method shall support the URI query parameters, request and response data structures, and response codes, as
    ...    specified in the Tables 5.4.8.3.2-1 and 5.4.8.3.2-2.
    Log    Trying to get the list of subscriptions
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${SUBSCRIPTIONS_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all NSD Management Subscriptions with not permitted authorization scope
    [Documentation]    This method shall support the URI query parameters, request and response data structures, and response codes, as
    ...    specified in the Tables 5.4.8.3.2-1 and 5.4.8.3.2-2.
    Log    Trying to get the list of subscriptions
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get NSD Management Subscriptions with attribute-based filters
    Log    Trying to get the list of subscriptions using filters
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+25 −0
Original line number Diff line number Diff line
@@ -184,3 +184,28 @@ Create new NSD Management subscription - Unprocessable Content
    ...    Post-Conditions: none
    Send Post Request for NSD Management Subscription
    Check HTTP Response Status Code Is    422

Get All NSD Management Subscriptions with permitted authorization scope
    [Documentation]    Test ID: 5.3.1.7.14
    ...    Test title: Get All NSD Management Subscriptions with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of all NSD Management subscriptions with permitted authorization scope
    ...    Pre-conditions: At least one NSD Management subscription is available in the NFVO.
    ...    Reference: Clause 5.4.8.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all NSD Management Subscriptions with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    NsdmSubscriptions

Get All NSD Management Subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 5.3.1.7.15
    ...    Test title: Get All NSD Management Subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test that the retrieval of all NSD Management subscriptions fails when using a not permitted authorization scope
    ...    Pre-conditions: At least one NSD Management subscription is available in the NFVO.
    ...    Reference: Clause 5.4.8.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all NSD Management Subscriptions with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+4 −3
Original line number Diff line number Diff line
@@ -17,15 +17,16 @@ ${ARCHIVE_PERMITTED_SCOPE} nsd:v2:nsd_archive_content
${ARCHIVE_NOT_PERMITTED_SCOPE}    nsd:v2:nsd_archive_content:readonly
${NSDF_PERMITTED_SCOPE}    nsd:v2:nsd:readonly
${NSD_MANIFEST_PERMITTED_SCOPE}    nsd:v2:nsd:readonly
${NSD_ARTIFACTS_PERMITTED_SCOPE}    nsd:<vn>:nsd_artifacts:readonly 
${NSD_ARTIFACTS_PERMITTED_SCOPE}    nsd:v2:nsd_artifacts:readonly 
${PNFD_PERMITTED_SCOPE}    nsd:v2:pnf_descriptors
${PNFD_NOT_PERMITTED_SCOPE}    nsd:v2:pnf_descriptors:readonly
${PNFD_ARCHIVE_PERMITTED_SCOPE}    nsd:v2:pnfd_archive_content
${PNFD_ARCHIVE_NOT_PERMITTED_SCOPE}    nsd:v2:pnfd_archive_content:readonly
${PNFF_PERMITTED_SCOPE}    nsd:v2:pnfd:readonly
${PNFD_MANIFEST_PERMITTED_SCOPE}    nsd:v2:pnfd:readonly
${PNFD_ARTIFACTS_PERMITTED_SCOPE}    nsd:<vn>:pnfd_artifacts:readonly 
${NOT_PERMITTED_SCOPE}    nfvmanologm:v2:nvalid
${PNFD_ARTIFACTS_PERMITTED_SCOPE}    nsd:v2:pnfd_artifacts:readonly 
${SUBCRIPTIONS_PERMITTED_SCOPE}    nsd:v2:subscriptions
${NOT_PERMITTED_SCOPE}    nsd:v2:nvalid


${apiMajorVersion}     v2