Commit dd795e1a authored by Elian Kraja's avatar Elian Kraja
Browse files
parents e03ac559 db6621c3
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
Create a new NsInstance
    Do POST New vnfInstance
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location
    Check HTTP Response Header ContentType is    ${CONTENT_TYPE}
    Check HTTP Response Body Json Schema Is    NsInstance.schema.json

Get information about multiple NS instances  
    Do GET NsInstances
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header ContentType is    ${CONTENT_TYPE}
    Check HTTP Response Body Json Schema Is    vnfInstances.schema.json  
    Log    Validation OK
+53 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt
Library    REST     ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem


*** Keywords ***
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    Log    Validate Status code    
    Should Be Equal    ${response[0]['status']}    ${expected_status}
    Log    Status code validated 
    
Check HTTP Response Header Contains
    [Arguments]    ${HEADER_TOCHECK}
    Should Contain     ${response[0]['headers']}    ${HEADER_TOCHECK}
    Log    Header is present    
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
    
Check HTTP Response Header ContentType is 
    [Arguments]    ${expected_contentType}
    Log    Validate content type
    Should Be Equal    ${response[0]['headers']['Content-Type']}    ${expected_contentType}
    Log    Content Type validated 
    

Do POST New vnfInstance
    Log    Create NS instance by POST to ${apiRoot}/${apiName}/${apiVersion}/ns_instances
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/CreateNsRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/ns_instances    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}     


Do GET NsInstances
    Log    Query NS The GET method queries information about multiple NS instances.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/ns_instances
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}
	
      
 No newline at end of file
+45 −0
Original line number Diff line number Diff line
*** Variables ***
${VNFM_HOST}      localhost    # Hostname of the VNFM
${VNFM_PORT}      8080    # Listening port of the VNFM
${NFVO_HOST}      localhost    # Hostname of the NFVO
${NFVO_PORT}      8081    # Listening port of the NFVO
${VNFM_SCHEMA}    https
${NFVO_SCHEMA}    https

${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json
${ACCEPT}         application/json
${apiRoot}        /
${apiName}        nslcm
${apiVersion}     v1
${AUTH_USAGE}     1
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX
${vnfInstanceId}       6fc3539c-e602-4afa-8e13-962fb5a7d81f
${vnfInstanceName}    Test-VnfInstance
${vnfInstanceDescription}    description vnf
${vnfInstanceDescription_Update}    Updated description vnf
${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN}    text/plain
${ACCEPT_ZIP}     application/zip
${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json
${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode}    GRACEFUL
${VNFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${VnfLcmOperationOccurrenceNotification}    {}
${VnfIdentifierCreationNotification}    {}
${VnfIdentifierDeletionNotification}    {}

${callback_uri}    http://localhost
${callback_port}    9091
${callback_endpoint}    /endpoint
${callback_endpoint_error}    /endpoint_404
${sleep_interval}    20s

${response}    {}
+24 −0
Original line number Diff line number Diff line
{
"CreateNsRequest": {
		"type": "object",
		"required": [
			"nsdId",
			"nsName",
			"nsDescription"
		],
		"properties": {
			"nsdId": {
				"description": "Identifier of the NSD that defines the NS instance to be created.\n",
				"$ref": "SOL005_def.yaml#/definitions/Identifier"
			},
			"nsName": {
				"description": "Human-readable name of the NS instance to be created.\n",
				"type": "string"
			},
			"nsDescription": {
				"description": "Human-readable description of the NS instance to be created.\n",
				"type": "string"
			}
		}
	}
}
 No newline at end of file
+2880 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading