Commit 9418eaed authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

added API version header in http requests - SOL011 NS LCOP Grant v5.3.1

parent f05699eb
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ DELETE API Version with apiMajorVerion - Method not implemented
*** Keywords ***
POST API Version
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
@@ -140,6 +141,7 @@ POST API Version
	
GET API Version
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
@@ -147,6 +149,7 @@ GET API Version
	
PUT API Version
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
@@ -154,6 +157,7 @@ PUT API Version
	
PATCH API Version
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
@@ -161,6 +165,7 @@ PATCH API Version
	
DELETE API Version
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
@@ -168,6 +173,7 @@ DELETE API Version
	
POST API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/v1/api_versions
    ${outputResponse}=    Output    response
@@ -175,6 +181,7 @@ POST API Version with apiMajorVersion
	
GET API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/v1/api_versions
    ${outputResponse}=    Output    response
@@ -182,6 +189,7 @@ GET API Version with apiMajorVersion
	
PUT API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/v1/api_versions
    ${outputResponse}=    Output    response
@@ -189,6 +197,7 @@ PUT API Version with apiMajorVersion
	
PATCH API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/v1/api_versions
    ${outputResponse}=    Output    response
@@ -196,6 +205,7 @@ PATCH API Version with apiMajorVersion
	
DELETE API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/v1/api_versions
    ${outputResponse}=    Output    response
+28 −11
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ Send Post Request for Grant
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    ${body}=    Get File    jsons/grantNSLifecycleOperationRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}
    ${body}=    Output    response
@@ -23,6 +24,7 @@ Send Request for a new Grant Forbiden Operation
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    ${body}=    Get File    jsons/grantRejected.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}
    ${body}=    Output    response
@@ -53,6 +55,7 @@ Get Grants
    Log    Trying to perform a GET. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -61,6 +64,7 @@ Put Grants
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -69,6 +73,7 @@ Patch Grants
    Log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -78,6 +83,7 @@ Delete Grants
    Log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/grants
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -86,6 +92,7 @@ Get an individual grant - Successful
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Get    ${response['headers']['Location']}
    Log    Validate Status code
    Integer    response status    200
@@ -94,6 +101,7 @@ Get individual grant
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -102,6 +110,7 @@ Post individual Grant
    log    Trying to create an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -110,6 +119,7 @@ Put individual Grant
    Log    Trying to update an individual grant. This method should not be implemented.
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -118,6 +128,7 @@ Patch individual Grant
    Log    Trying to update an individual grant. This method should not be implemented.
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -126,6 +137,7 @@ Delete individual Grant
    Log    Trying to delete an individual grant. This method should not be implemented.
    Set Headers  {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}
    ${body}=    Output    response
    Set Suite Variable    ${response}    ${body}
@@ -139,6 +151,7 @@ Check Postcondition Grant Is Set
    Log    Trying to get the subscription
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/grants/${response['body']['id']}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
@@ -150,6 +163,7 @@ JWT Encode
Send Post Request for Grant with permitted authorization scope
    Log    Request a new Grant for an NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${OPERATION_GRANTING_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
@@ -161,6 +175,7 @@ Send Post Request for Grant with permitted authorization scope
Send Post Request for Grant with not permitted authorization scope
    Log    Request a new Grant for an NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${NEG_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
@@ -172,6 +187,7 @@ Send Post Request for Grant with not permitted authorization scope
Get individual grant with permitted authorization scope
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}  
    Set Headers    {"Accept":"${API_VERSION}"}
    Set Headers    {"Content-Type":"${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${OPERATION_GRANTING_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
@@ -182,6 +198,7 @@ Get individual grant with permitted authorization scope
Get individual grant with permitted not authorization scope
    log    Trying to read an individual grant
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${API_VERSION}"}  
    Set Headers    {"Content-Type":"${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${NEG_SCOPE}
    ${authorizationToken}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ ${NFVO_SCHEMA} https
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${ACCEPT}         application/json
${API_VERSION}         1.0.0
${AUTH_USAGE}     1
${grantId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d