Commit 69aecd00 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added NSChange and NSLCMCapacityShortage notification related tests in v3.5.1

parent e4143614
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1141,6 +1141,8 @@ POST subscriptions
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    allow_redirects=false
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
    Log    Verify the tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}
		
POST subscriptions DUPLICATION
@@ -1160,6 +1162,8 @@ POST subscriptions DUPLICATION
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    allow_redirects=false
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
    Log    Verify the tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}
	
POST subscriptions NO DUPLICATION
@@ -1179,6 +1183,8 @@ POST subscriptions NO DUPLICATION
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    allow_redirects=false
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
    Log    Verify the tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}

GET Subscriptions
+48 −2
Original line number Diff line number Diff line
@@ -46,6 +46,30 @@ Ns Identifier Deletion Notification
    Post Ns Identifier Deletion Notification
    Check HTTP Response Status Code Is    204

Ns Change Notification
    [Documentation]    Test ID: 5.3.2.26.4
    ...    Test title: Ns Change Notification
    ...    Test objective: The objective is to test that Ns Change Notification is delivered with success to the notification consumer.
    ...    Pre-conditions: A subscription for Ns Change notification is available in the NFVO.
    ...    Reference: Clause 6.4.18.3.1 - ETSI GS NFV-SOL 005 [3] v3.5.1
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post Ns Change Notification
    Check HTTP Response Status Code Is    204

Ns LCM Capacity Shortage Notification
    [Documentation]    Test ID: 5.3.2.26.5
    ...    Test title: Ns LCM Capacity Shortage Notification
    ...    Test objective: The objective is to test that Ns LCM Capacity Shortage Notification is delivered with success to the notification consumer.
    ...    Pre-conditions: A subscription for Ns LCM Capacity Shortage notification is available in the NFVO.
    ...    Reference: Clause 6.4.18.3.1 - ETSI GS NFV-SOL 005 [3] v3.5.1
    ...    Config ID: Config_prod_Notif_Endpoint
    ...    Applicability: none
    ...    Post-Conditions: none 
    Post Ns LCM Capacity Shortage Notification
    Check HTTP Response Status Code Is    204

*** Keywords ***
Check resource existence and get CallbackUri
    Set Headers  {"Accept":"${ACCEPT}"}  
@@ -53,7 +77,7 @@ Check resource existence and get CallbackUri
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    Validate Json    response body    subscription.schema.json
    Validate Json    response body    schemas/subscription.schema.json
    Set Global Variable    ${callbackResp}    response body callbackUri
    
Post Ns Lcm Operation Occurrence Notification
@@ -90,3 +114,25 @@ Post Ns Identifier Deletion Notification
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	
Post Ns Change Notification
    log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template} =    Get File    jsons/NsChangeNotification.json
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}    nsInstanceId=${nsInstanceId}    nsLcmOpOccId=${nsLcmOpOccId}   
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

Post Ns LCM Capacity Shortage Notification
    log    Trying to perform a POST to get notification
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template} =    Get File    jsons/NsLcmCapacityShortageNotification.json
    ${body}=        Format String   ${template}    subscriptionId=${subscriptionId}
    Post    ${callbackResp}    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
+83 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ NS Identifier Deletion Notification
    [Documentation]    Test ID: 5.3.2.17.4
    ...    Test title: NS Identifier Deletion Notification
    ...    Test objective: The objective is to test the dispatch of NS Identifier Deletion Notification when a NS instance resource is deleted in the NFVO, and perform a JSON schema and content validation of the delivered notification.The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
    ...    Pre-conditions: A NS instance resource is created, and a subscription for NS identifier creation notifications is available in the NFVO.
    ...    Pre-conditions: A NS instance resource is created, and a subscription for NS identifier deletion notifications is available in the NFVO.
    ...    Reference: Clause 6.4.18.3.1 - ETSI GS NFV-SOL 005 [3] v3.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
@@ -62,6 +62,32 @@ NS Identifier Deletion Notification
    Check NS Identifier Deletion Notification Http POST Request Body Json Schema Is    NsIdentifierDeletionNotification
    Check NS Identifier Deletion Notification Http POST Request Body notificationType attribute Is    NsIdentifierDeletionNotification
    
NS Change Notification
    [Documentation]    Test ID: 5.3.2.17.5
    ...    Test title: NS Change Notification
    ...    Test objective: The objective is to test the dispatch of NS Change Notification when a NS instance component is affected by an LCM operation occurrence, and perform a JSON schema and content validation of the delivered notification.The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
    ...    Pre-conditions: A NS instance resource is created, and a subscription for NS change notifications is available in the NFVO.
    ...    Reference: Clause 6.4.18.3.1 - ETSI GS NFV-SOL 005 [3] v3.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger a NS LCM operation that affects a NS instance component (external action)
    Check NS Change Notification Http POST Request Body Json Schema Is    NsChangeNotification
    Check NS Change Notification Http POST Request Body notificationType attribute Is    NsChangeNotification

NS LCM Capacity Shortage Notification
    [Documentation]    Test ID: 5.3.2.17.6
    ...    Test title: NS LCM Capacity Shortage Notification
    ...    Test objective: The objective is to test the dispatch of NS LCM Capacity Shortage Notification when a resource shortage occurs during the execution of an NS LCM operation, and perform a JSON schema and content validation of the delivered notification.The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
    ...    Pre-conditions: A NS instance resource is created, and a subscription for NS LCM Capacity Shortage notifications is available in the NFVO.
    ...    Reference: Clause 6.4.18.3.1 - ETSI GS NFV-SOL 005 [3] v3.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger a resource shortage for a NS LCM operation (external action)
    Check NS LCM Capacity Shortage Notification Http POST Request Body Json Schema Is    NsLcmCapacityShortageNotification
    Check NS LCM Capacity Shortage Notification Http POST Request Body notificationType attribute Is    NsLcmCapacityShortageNotification

*** Keywords ***
Trigger a NS LCM operation (external action) 
    #do nothing
@@ -79,6 +105,62 @@ Trigger the deletion of a NS instance resource (external action)
    #do nothing
    Log    do nothing     

Trigger a NS LCM operation that affects a NS instance component (external action)
    #do nothing
    Log    do nothing

Trigger a resource shortage for a NS LCM operation (external action)
    #do nothing
    Log    do nothing

Check NS LCM Capacity Shortage Notification Http POST Request Body Json Schema Is
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}
    
Check NS LCM Capacity Shortage Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification NS LCM Capacity Shortage Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Configure Notification NS LCM Capacity Shortage Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{req}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    Set Global Variable    ${notification_request}    ${req}
    &{headers}=  Create Dictionary  Content-Type=application/json
    &{notification_response}=  Create Mock Response	headers=${headers}  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}

Check NS Change Notification Http POST Request Body Json Schema Is
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}
    
Check NS Change Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification NS Change Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Configure Notification NS Change Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{req}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    Set Global Variable    ${notification_request}    ${req}
    &{headers}=  Create Dictionary  Content-Type=application/json
    &{notification_response}=  Create Mock Response	headers=${headers}  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}

Check NS LCM Operation Occurrence Start Notification Http POST Request Body Json Schema Is  
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
+17 −0
Original line number Diff line number Diff line
{{
	"id":"123",
	"nsInstanceId":"{nsInstanceId}",
	"lcmOpOccIdImpactingNsComponent":"{nsLcmOpOccId}",
	"lcmOpNameImpactingNsComponent" : "VNF_INSTANTIATE",
	"lcmOpOccStatusImpactingNsComponent" : "START",
	"nsComponentType" : "VNF",
	"nsComponentId" : "abcd",
	"notificationType":"NsChangeNotification",
	"subscriptionId":"{subscriptionId}",
	"timeStamp":"",
	"_links": 
	{{
	  "nsInstance": "",
	  "subscription": ""
	}}
}}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
{{
	"id":"",
	"id":"123",
	"notificationType":"NsIdentifierCreationNotification",
	"subscriptionId":"{subscriptionId}",
	"timeStamp":"",
Loading