Commit fa3a3116 authored by mengxuan.zhao's avatar mengxuan.zhao
Browse files

Create VNF instance workflow

parent 4e96f03a
Loading
Loading
Loading
Loading
+50 −0
Original line number Original line Diff line number Diff line
*** Settings ***
Resource    environment/configuration.txt
Resource    environment/variables.txt
Resource    environment/scaleVariables.txt
Resource    VnfLcmMntOperationKeywords.robot
Resource    SubscriptionKeywords.robot
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    
...    spec=SOL003-VNFLifecycleManagement-API.yaml
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    JSONLibrary
Library    Process
Suite Setup    Initialize System
Suite Teardown    Terminate All Processes    kill=true


*** Test Cases ***
Create a VNF Instance
    [Documentation]    Test ID: 5.x.y.x
    ...    Test title: Create a VNF instance procedure
    ...    Test objective: The objective is to test the procedure for the creation of a VNF instance resource.
    ...    Pre-conditions: 
    ...    Reference: section 5.3.1 - SOL003 v2.4.1; section
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    NFVO is not subscribed for
    ...    Post-Conditions: upon successful completion, the VNF instance resource has been created in "NOT_INSTANTIATED" state.
    Send VNF create Request
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location 
    Check Operation Notification For Create   VnfIdentifierCreationNotification
    Check Postcondition VNF    CREATE

*** Keywords ***

Initialize System
    Create Sessions

Check Postcondition VNF
    [Arguments]    ${operation}
    Check VNF Instance    ${vnfInstanceId}
    Check HTTP Response Status Code Is    200
    Check VNF Status    ${response.body.instantiationState}    NOT_INSTANTIATED
   
Check Operation Notification For Create
    [Arguments]    ${element}
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Handler    ${notification_ep}       
    
 No newline at end of file
+2 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,8 @@ Resource environment/variables.txt
Resource    environment/scaleVariables.txt
Resource    environment/scaleVariables.txt
Resource    VnfLcmMntOperationKeywords.robot
Resource    VnfLcmMntOperationKeywords.robot
Resource    SubscriptionKeywords.robot
Resource    SubscriptionKeywords.robot
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    spec=SOL003-VNFLifecycleManagement-API.yaml
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    
...    spec=SOL003-VNFLifecycleManagement-API.yaml
Library    OperatingSystem
Library    OperatingSystem
Library    BuiltIn
Library    BuiltIn
Library    Collections
Library    Collections
+4 −7
Original line number Original line Diff line number Diff line
@@ -9,9 +9,6 @@ Library Collections
Library    JSONLibrary
Library    JSONLibrary
Library    MockServerLibrary
Library    MockServerLibrary


*** Variables ***
${json}    {}

*** Keywords ***
*** Keywords ***
Check subscriptions about one VNFInstance and operation type
Check subscriptions about one VNFInstance and operation type
    [Arguments]    ${vnfInstanceId}    ${notificationType}    ${operationType}=""    ${operationState}=""
    [Arguments]    ${vnfInstanceId}    ${notificationType}    ${operationType}=""    ${operationState}=""
@@ -30,8 +27,8 @@ Create Sessions
    Create Mock Session  ${callback_uri}:${callback_port}
    Create Mock Session  ${callback_uri}:${callback_port}
    
    
Configure Notification Handler
Configure Notification Handler
    [Arguments]    ${endpoint}    ${status}
    [Arguments]    ${endpoint}    ${status}=""
    set to dictionary    ${json["operationState"]}    dp=${status}    
    Run Keyword If   ${status}!=""  set to dictionary    ${json["operationState"]}    dp=${status}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle ${element}
    Log  Creating mock request and response to handle ${element}
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
@@ -40,7 +37,6 @@ Configure Notification Handler


Configure Notification Forward
Configure Notification Forward
    [Arguments]    ${element}    ${endpoint}    ${endpoint_fwd}    
    [Arguments]    ${element}    ${endpoint}    ${endpoint_fwd}    
    ${json}=	Get File	schemas/${element}.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock HTTP forward to handle ${element}
    Log  Creating mock HTTP forward to handle ${element}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
@@ -48,7 +44,8 @@ Configure Notification Forward
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}


Check Operation Notification
Check Operation Notification
    [Arguments]    ${element}    ${status}
    [Arguments]    ${element}    ${status}=""
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${notification_ep}    ${notification_ep_fwd}
    Configure Notification Forward    ${element}    ${notification_ep}    ${notification_ep_fwd}
    Configure Notification Handler    ${notification_ep_fwd}    ${status}
    Configure Notification Handler    ${notification_ep_fwd}    ${status}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
+8 −0
Original line number Original line Diff line number Diff line
@@ -75,6 +75,14 @@ Send VNF Scale Out Request
    ${aspectId}=    Set Variable    ${json.aspectId}  
    ${aspectId}=    Set Variable    ${json.aspectId}  
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/scale    ${body}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/scale    ${body}
    
    
Send VNF Create Request
    Log    Create VNF instance by POST to ${apiRoot}/${apiName}/${apiVersion}/vnf_instances
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    json/createVnfRequest.json
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/vnf_instances    ${body}
  
Create a new Grant - Synchronous mode
Create a new Grant - Synchronous mode
    [Arguments]    ${vnfInstanceId}    ${vnfLcmOpOccId}    ${operation}
    [Arguments]    ${vnfInstanceId}    ${vnfLcmOpOccId}    ${operation}
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
    Log    Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants
+2 −1
Original line number Original line Diff line number Diff line
@@ -17,3 +17,4 @@ ${VnfIdentifierDeletionNotification} {}
${response}    {}
${response}    {}
${notification_request}    []
${notification_request}    []
${notification_response}    []
${notification_response}    []
${json}    {}
 No newline at end of file