Commit 7bf8d5c7 authored by M. Rehan Abbasi's avatar M. Rehan Abbasi Committed by Giacomo Bernini
Browse files

modify notifications endpoint for PM API

parent 1715227a
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -131,70 +131,70 @@ DELETE API Version with apiMajorVerion - Method not implemented
*** Keywords ***
*** Keywords ***
POST API Version
POST API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Post    ${apiRoot}/${apiName}/api_versions
    Post    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
GET API Version
GET API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/api_versions
    Get    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
PUT API Version
PUT API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Put    ${apiRoot}/${apiName}/api_versions
    Put    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
PATCH API Version
PATCH API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Patch    ${apiRoot}/${apiName}/api_versions
    Patch    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
DELETE API Version
DELETE API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Delete    ${apiRoot}/${apiName}/api_versions
    Delete    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
POST API Version with apiMajorVersion
POST API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    Post    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
GET API Version with apiMajorVersion
GET API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    Get    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
PUT API Version with apiMajorVersion
PUT API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Put    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    Put    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
PATCH API Version with apiMajorVersion
PATCH API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
	
	
DELETE API Version with apiMajorVersion
DELETE API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Delete    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    Delete    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	Set Global Variable    ${response}    ${outputResponse} 
+42 −1
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ Resource environment/pmJobs.txt
Resource    environment/IndividualPmJob.txt
Resource    environment/IndividualPmJob.txt
Resource    environment/thresholds.txt
Resource    environment/thresholds.txt
Resource    environment/individualThresholds.txt
Resource    environment/individualThresholds.txt
Resource    environment/notifications.txt
Library     JSONLibrary
Library     JSONLibrary
Library     OperatingSystem
Library     OperatingSystem
Library     REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library     REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
@@ -112,7 +113,7 @@ GET NFV-MANO Performance Monitoring Jobs with invalid attribute selector
    Log    Query VNF The GET method queries information about multiple VNF instances.
    Log    Query VNF The GET method queries information about multiple VNF instances.
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} 
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_instances?fields=wrong_field
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_instances?fields=wrong_field
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
@@ -497,3 +498,43 @@ Check HTTP Response Body Threshold Identifier matches the requested Threshold
    Log    Trying to check response ID
    Log    Trying to check response ID
    Should Be Equal    ${response['body']['id']}    ${thresholdId} 
    Should Be Equal    ${response['body']['id']}    ${thresholdId} 
    Log    Pm Job identifier as expected
    Log    Pm Job identifier as expected

Check PM Job resource existence and get CallbackUri
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    Integer    response status    200
    Validate Json    response body    PmJob.schema.json
    Set Global Variable    ${callbackResp}    response body callbackUri

POST Performance Information Available Notification
    Log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template} =    Get File    jsons/PerformanceInformationAvailabilityNotification.json
    ${body}=    Format String    ${template}    pmJobId=${pmJobId}    objectInstanceId=${objectInstanceIds}    
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

Check Threshold resource existence and get CallbackUri
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds/${thresholdId}
    Integer    response status    200
    Validate Json    response body    Threshold.schema.json
    Set Global Variable    ${callbackResp}    response body callbackUri

POST Threshold Crossed Notification
    Log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template} =    Get File    jsons/ThresholdCrossedNotification.json
    ${body}=    Format String    ${template}    thresholdId=${thresholdId}    objectInstanceId=${objectInstanceIds}
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
+3 −52
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          NFVMANOPMKeywords.robot
Resource          environment/variables.txt
Resource          environment/individualThresholds.txt
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library           OperatingSystem
Library           JSONLibrary
Library           String
Suite Setup    Check resource existence and get CallbackUri




*** Test Cases ***   
*** Test Cases ***   
@@ -19,6 +12,7 @@ Performance Information Available Notification
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none 
    ...    Post-Conditions: none 
    Check PM Job resource existence and get CallbackUri
    POST Performance Information Available Notification
    POST Performance Information Available Notification
    Check HTTP Response Status Code Is    204
    Check HTTP Response Status Code Is    204
    
    
@@ -31,49 +25,6 @@ Threshold Crossed Notification
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none 
    ...    Post-Conditions: none 
    Check Threshold resource existence and get CallbackUri
    POST Threshold Crossed Notification
    POST Threshold Crossed Notification
    Check HTTP Response Status Code Is    204
    Check HTTP Response Status Code Is    204
    
*** Keywords ***
Check resource existence and get CallbackUri
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    Validate Json    response body    PmSubscription.schema.json
    Set Global Variable    ${callbackResp}    response body callbackUri

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    Should Be Equal As Strings    ${response['status']}    ${expected_status}
    Log    Status code validated 
    
POST Performance Information Available Notification
    log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${template} =    Get File    jsons/PerformanceInformationAvailabilityNotification.json
    ${body}=    Format String    ${template}    subscriptionId=${subscriptionId}    objectInstanceId=${objectInstanceIds}    
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
POST Threshold Crossed Notification
    log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${template} =    Get File    jsons/ThresholdCrossedNotification.json
    ${body}=    Format String    ${template}    subscriptionId=${subscriptionId}    thresholdId=${thresholdId}    objectInstanceId=${objectInstanceIds}
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

    
    


    
    
+0 −5
Original line number Original line Diff line number Diff line
*** Variables ***
${erroneousSubscriptionId}    erroneousSubscriptionId
${newSubscriptionId}    newSubsciptionId
${response}    httpresponse
${origResponse}    httpresponse
 No newline at end of file
+2 −3
Original line number Original line Diff line number Diff line
@@ -4,7 +4,8 @@ ${NFVMANO_PORT} 8080 # Listening port of the VNFM
${NFVMANO_SCHEMA}    https
${NFVMANO_SCHEMA}    https




${AUTHORIZATION}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${AUTHORIZATION_HEADER}   Authorization
${AUTHORIZATION_TOKEN}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${NEG_AUTHORIZATION}    Bearer negativetoken
${NEG_AUTHORIZATION}    Bearer negativetoken
${BAD_AUTHORIZATION}    Bear sometoken
${BAD_AUTHORIZATION}    Bear sometoken


@@ -32,8 +33,6 @@ ${polling_interval} 10 sec


${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar


${subscriptionId}    17563e75-0e14-4bd7-94b4-6bbb869c79aa

${response}    
${response}    


${objectInstanceIds}    daca910b0-00d4f1a2b675d-604257e42
${objectInstanceIds}    daca910b0-00d4f1a2b675d-604257e42
Loading