NSLCMOperationKeywords.robot 64.7 KB
Newer Older
    ${template}=    Get File    jsons/LccnSubscriptionRequest.json
Frank Bryden's avatar
Frank Bryden committed
    ${body}=        Format String   ${template}     callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}   nsdId=${nsdId}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
aureliano sinatra's avatar
aureliano sinatra committed
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed
	
POST subscriptions DUPLICATION
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${NFVO_DUPLICATION} == 0    NFVO is not permitting duplication. Skipping the test
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${template}=    Get File    jsons/LccnSubscriptionRequest.json
Frank Bryden's avatar
Frank Bryden committed
    ${body}=        Format String   ${template}     callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}     nsdId=${nsdId}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
aureliano sinatra's avatar
aureliano sinatra committed
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed
	
POST subscriptions NO DUPLICATION
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${NFVO_DUPLICATION} == 1    NFVO is permitting duplication.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${template}=    Get File    jsons/LccnSubscriptionRequest.json
Frank Bryden's avatar
Frank Bryden committed
    ${body}=        Format String   ${template}     callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}     nsdId=${nsdId}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
aureliano sinatra's avatar
aureliano sinatra committed
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed
	

GET Subscriptions
    Log    Get the list of active subscriptions
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
Najam UI Hassan's avatar
Najam UI Hassan committed
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed

Get subscriptions with all_fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?all_fields
aureliano sinatra's avatar
aureliano sinatra committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
Get subscriptions with exclude_default attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?exclude_default
aureliano sinatra's avatar
aureliano sinatra committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
Get subscriptions with fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?fields=${fields}
aureliano sinatra's avatar
aureliano sinatra committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}	
Get subscriptions with exclude_fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?exclude_fields=${fields}
aureliano sinatra's avatar
aureliano sinatra committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}     
aureliano sinatra's avatar
aureliano sinatra committed
GET subscriptions with filter  
aureliano sinatra's avatar
aureliano sinatra committed
    Log    Get the list of active subscriptions using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?${sub_filter}
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
Giacomo Bernini's avatar
Giacomo Bernini committed
Get subscriptions - invalid filter
    Log    Get the list of active subscriptions using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions?${sub_filter_invalid} 
Giacomo Bernini's avatar
Giacomo Bernini committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed
POST Individual Subscription
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
aureliano sinatra's avatar
aureliano sinatra committed
	
PUT Individual Subscription
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Put    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}  
aureliano sinatra's avatar
aureliano sinatra committed
	
PATCH Individual Subscription
    log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed

GET Individual subscription
    log    Trying to get information about an individual subscription
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}  
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed
	
DELETE Individual subscription
    log    Try to delete an individual subscription
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
    Delete    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}    
aureliano sinatra's avatar
aureliano sinatra committed
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
aureliano sinatra's avatar
aureliano sinatra committed

POST Operation occurrence
    log    The POST method delivers a notification from the server to the client.
    ${json}=	Get File	schemas/NsLcmOperationOccurrenceNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle NSLcmOperationOccurrenceNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint} 
 
POST Id creation
    log    The POST method delivers a notification from the server to the client.
    ${json}=	Get File	schemas/NsIdentifierCreationNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle NsIdentifierCreationNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}

POST Id deletion
    log    The POST method delivers a notification from the server to the client.
    ${json}=	Get File	schemas/NsIdentifierDeletionNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle NsIdentifierDeletionNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}   

GET Notification endpoint
    log    The GET method allows the server to test the notification endpoint
    &{req}=  Create Mock Request Matcher	GET  ${callback_endpoint}    
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Verify Mock Expectation  ${req}
    Clear Requests  ${callback_endpoint}
    
PUT notification
    Log  PUT Method not implemented
    &{req}=  Create Mock Request Matcher	PUT  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
Giacomo Bernini's avatar
Giacomo Bernini committed
    Clear Requests  ${callback_endpoint}         
root's avatar
root committed
        
Check HTTP Response Header Contains Location
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link