Commit 64839856 authored by Najam UI Hassan's avatar Najam UI Hassan
Browse files

New Resource NotificationConsumer added

parent 5ceae56b
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          environment/variables.txt
Library           JSONLibrary
Library           OperatingSystem
Library           String
Library           REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    ssl_verify=false
Suite Setup    Check resource existence and get CallbackUri

*** Test Cases ***
VNF Performance Information Availability Notification
    [Documentation]    Test ID: 6.3.3.9.1
    ...    Test title: VNF Performance Information Availability Notification
    ...    Test objective: The objective is to test the POST request to callbackUri trigger VNF Performance Information Availability Notification
    ...    Pre-conditions: A VNF performance job is created, and a subscription for information availability notifications is available in the VNFM.
    ...    Reference: Clause 6.4.9.3.1 - ETSI GS NFV-SOL 002 [2] v2.7.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post VNF Performance Information Availability Notification
    Check HTTP Response Status Code Is    204
    
VNF Threshold Crossed Notification
    [Documentation]    Test ID: 6.3.3.9.2
    ...    Test title: VNF Threshold Crossed Notification
    ...    Test objective: The objective is to test the POST request to callbackUri trigger VNF Threshold Crossed Notification
    ...    Pre-conditions: A VNF performance job is created, and a subscription for Threshold Crossed Notification is available in the VNFM.
    ...    Reference: Clause 6.4.9.3.1 - ETSI GS NFV-SOL 002 [2] v2.7.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post VNF Threshold Crossed Notification
    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}/pm_jobs/${pmJobId}	
    Integer    response status    200
    Validate Json    response body    PmJob.schema.json
    Set Global Variable    ${callbackResp}    response body callbackUri
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
    Should Be Equal    ${response['status']}    ${status} 
    Log    Status code validated
    
Post VNF Performance Information Availability 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/PerformanceInformationAvaliableNotification.json
    ${body}=        Format String   ${template}    objectInstanceId=${objectInstanceId} 
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}	

Post VNF 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}    thresholdId=${thresholdId}    objectInstanceId=${objectInstanceId} 
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}	
+3 −0
Original line number Diff line number Diff line
@@ -63,3 +63,6 @@ ${filter_ko} erroneousFilter=erroneous
${total_polling_time}   2 min
${polling_interval}     10 sec

${callbackResp}    localhost

${objectInstanceId}    
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
{{
	"id":"",
	"notificationType":"PerformanceInformationAvailableNotification",
	"timeStamp":"",
	"objectType":"",
	"objectInstanceId":"{objectInstanceId}",
	"_links":{{
		"objectInstance":"",
		"pmJob":"",
		"performanceReport":""
	}}
}}
+15 −0
Original line number Diff line number Diff line
{{
	"id":"",
	"notificationType":"ThresholdCrossedNotification",
	"timeStamp":"",
	"thresholdId":"{thresholdId}",
	"crossingDirection":"UP",
	"objectType":"",
	"objectInstanceId":"{objectInstanceId}",
	"performanceMetric":"",
	"performanceValue":"",
	"_links":{{
		"objectInstance":"",
		"threshold":""
	}}
}}