Commit c751c16c authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for PNF Descriptors

parent 1fdd3f82
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -614,6 +614,32 @@ Send Post Request to create new PNF Descriptor Resource
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Send Post Request to create new PNF Descriptor Resource with permitted authorization scope
    Log    Creating a new network service descriptor
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/createPnfdInfoRequest.json
    ${scopeValue}=    Create Dictionary    scope=${PNFD_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.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/pnf_descriptors    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Send Post Request to create new PNF Descriptor Resource with not permitted authorization scope
    Log    Creating a new network service descriptor
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/createPnfdInfoRequest.json
    ${scopeValue}=    Create Dictionary    scope=${PNFD_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.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/pnf_descriptors    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Check Postcondition PnfdInfo Exists
    Log    Checking that nsd info exists
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+28 −1
Original line number Diff line number Diff line
@@ -194,3 +194,30 @@ GET all PNF Descriptors Information with "exclude_default" and "fields" attribut
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PnfdInfos
    Check HTTP Response Body PnfdInfos Matches the requested fields selector

Create new PNF Descriptor Resource with permitted authorization scope
    [Documentation]    Test ID: 5.3.1.4.15
    ...    Test title:  Create new PNF Descriptor Resource with permitted authorization scope
    ...    Test objective: The objective is to test the creation of a new Create new PNF Descriptor resource with permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.5.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The PNF Descriptor resource is successfully created on the NFVO
    Send Post Request to create new PNF Descriptor Resource with permitted authorization scope
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is   PnfdInfo
    Check HTTP Response Header Contains    Location
    Check Postcondition PnfdInfo Exists

Create new PNF Descriptor Resource with not permitted authorization scope
    [Documentation]    Test ID: 5.3.1.4.16
    ...    Test title:  Create new PNF Descriptor Resource with not permitted authorization scope
    ...    Test objective: The objective is to test that the creation of a new Create new PNF Descriptor resource fails when using not permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.5.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send Post Request to create new PNF Descriptor Resource with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -18,7 +18,13 @@ ${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 

${PNFD_PERMITTED_SCOPE}    nsd:v2:pnf_descriptors
${PNFD_NOT_PERMITTED_SCOPE}    nsd:v2:pnf_descriptors:readonly
${PNF_ARCHIVE_PERMITTED_SCOPE}    nsd:v2:pnfd_archive_content
${ARCHIVE_NOT_PERMITTED_SCOPE}    nsd:v2:pnfd_archive_content:readonly
${PNFF_PERMITTED_SCOPE}    nsd:v2:pnfd:readonly
${PNFF_MANIFEST_PERMITTED_SCOPE}    nsd:v2:pnfd:readonly
${PNFD_ARTIFACTS_PERMITTED_SCOPE}    nsd:<vn>:pnfd_artifacts:readonly 
${NOT_PERMITTED_SCOPE}    nfvmanologm:v2:nvalid