Commit ad1de307 authored by Najam UI Hassan's avatar Najam UI Hassan Committed by Giacomo Bernini
Browse files

Added Test Cases for NFV-MANO Entity.robot

parent 428d5d87
Loading
Loading
Loading
Loading
+97 −0
Original line number Diff line number Diff line
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          environment/variables.txt
Library           JSONLibrary
Library           OperatingSystem
Resource          NFVMANOCimKeywords.robot
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library           MockServerLibrary

*** Test Cases ***
POST NFV-MANO entity - Method not implemented
    [Documentation]    Test ID: 8.3.4.1.1
    ...    Test title: POST NFV-MANO entity - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create an NFV-MANO Entity.
    ...    Pre-conditions: 
    ...    Reference: clause 5.5.3.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send Post request for NFV-MANO Entity
    Check HTTP Response Status Code Is    405

GET NFV-MANO entity
    [Documentation]    Test ID: 8.3.4.1.2
    ...    Test title: Get NFV-MANO entity
    ...    Test objective: The objective is to test the retrieval of information about an NFV-MANO functional entity by reading the NFV-MANO entity resource and perform a JSON schema and content validation of the collected job data structure.
    ...    Pre-conditions: 
    ...    Reference: clause 5.5.3.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET NFV-MANO entity resource
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   ManoEntity
    
PUT NFV-MANO entity - Method not implemented
    [Documentation]    Test ID: 8.3.4.1.3
    ...    Test title: PUT NFV-MANO entity - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an NFV-MANO Entity.
    ...    Pre-conditions: 
    ...    Reference: clause 5.5.3.3.3 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send Put request for NFV-MANO Entity
    Check HTTP Response Status Code Is    405

PATCH NFV-MANO entity
    [Documentation]    Test ID: 8.3.4.1.4
    ...    Test title: PATCH NFV-MANO entity
    ...    Test objective: This method modifies the NFV-MANO entity resource
    ...    Pre-conditions: NFV-MANO entity resource is already created.
    ...    Reference: clause 5.5.3.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO entity is modified by the operation
    Send Patch request for NFV-MANO Entity
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   ManoConfigModifications
    
PATCH NFV-MANO entity - Conflict
    [Documentation]    Test ID: 8.3.4.1.5
    ...    Test title: PATCH NFV-MANO entity - Conflict
    ...    Test objective: The objective is to test that the modification of the NFV-MANO entity resource failed due to a conflict with the state of the NFV-MANO entity resource and perform the JSON schema validation of the failed operation HTTP response.
    ...    Pre-conditions: NFV-MANO entity resource is already created.
    ...    Reference: clause 5.5.3.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO entity is not modified by the operation
    Send Patch request for NFV-MANO Entity
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
PATCH NFV-MANO entity - PreCondition Failed
    [Documentation]    Test ID: 8.3.4.1.6
    ...    Test title: PATCH NFV-MANO entity - PreCondition Failed
    ...    Test objective: The objective is to test that the modification of the NFV-MANO entity resource failed because precondition given in an HTTP request header is not fulfilled and perform the JSON schema validation of the failed operation HTTP response.
    ...    Pre-conditions: NFV-MANO entity resource is already created.
    ...    Reference: clause 5.5.3.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO entity is not modified by the operation
    Send Patch request for NFV-MANO Entity
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
DELETE NFV-MANO entity - Method not implemented
    [Documentation]    Test ID: 8.3.4.1.7
    ...    Test title: DELETE NFV-MANO entity - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an NFV-MANO Entity.
    ...    Pre-conditions: 
    ...    Reference: clause 5.5.3.3.5 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send Delete request for NFV-MANO Entity
    Check HTTP Response Status Code Is    405
+74 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt
Library    REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library    MockServerLibrary 
Library    OperatingSystem
Library    BuiltIn
Library    JSONLibrary
Library    Collections
Library    JSONSchemaLibrary    schemas/
Library    Process

*** Keywords ***
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

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK

Send Post request for NFV-MANO Entity
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET NFV-MANO entity resource
    Log    Trying to get a NFV-MANO entity resource 
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Put request for NFV-MANO Entity  
    Log    Trying to perform a PUT (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/mano_entity
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/mano_entity
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Patch request for NFV-MANO Entity
    log    Trying to modify an NFV-MANO Entity
    Set Headers    {"Accept":"${ACCEPT_JSON}"}  
    Set Headers    {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/ManoConfigModificationRequest.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity   ${body}	
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse} 
	
Send Delete request for NFV-MANO Entity
    Log    Trying to perform a DELETE (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
*** Variables ***
${NFVMANOHOST}      localhost  
${NFVMANO_PORT}      8080    
${NFVMANO_SCHEMA}    https


${AUTHORIZATION}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${NEG_AUTHORIZATION}    Bearer negativetoken

${CONTENT_TYPE_JSON}    application/json
${ACCEPT_JSON}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json
${AUTH_USAGE}     1
${FIELD_USAGE}    1
${NFVMANO_CHECKS_NOTIF_ENDPOINT}    1        ## If true, during subscription, the FUT performs a get to the notification endpoint

${NFVMANO_ALLOWS_DUPLICATE_SUBS}    1

${apiRoot}        /
${apiMajorVersion}     v1
${apiName}        nfvmanocim

${response}    
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
{
  "name": "NFV-MANO Entity"
}
 No newline at end of file
+99 −0
Original line number Diff line number Diff line
{
    "description": "This type represents attribute modifications that were performed on the  \"NFV-MANO entity\" resource of the producer NFV-MANO functional entity.  The attributes that can be included consist of those requested to be  modified explicitly in the \"ManoConfigModificationRequest\" data structure. \n",
    "type": "object",
    "properties": {
      "name": {
        "description": "If present, this attribute signals modifications of the \"name\"  attribute in \"ManoEntity\", as defined in clause 5.6.2.3\n",
        "type": "string"
      },
      "description": {
        "description": "If present, this attribute signals modifications of the \"description\"  attribute in \"ManoEntity\", as defined in clause 5.6.2.3.\n",
        "type": "string"
      },
      "clockSyncs": {
        "description": "If present, this attribute signals modifications of the \"clockSyncs\"  attribute in \"ManoEntityConfigurableParams\", as defined in  clause 5.6.2.3.\n",
        "type": "array",
        "items": {
          "description": "This type represents parameters for connecting to an NTP server. \n",
          "type": "object",
          "properties": {
            "id": {
              "description": "An identifier with the intention of being globally unique.\n",
              "type": "string"
            },
            "type": {
              "description": "Type of clock synchronization.\nPermitted values:\n  - NTP: For Network Time Protocol (NTP) based clock synchronization.\n  - OTHER: For other types of clock synchronization.\n",
              "type": "string",
              "enum": [
                "NTP",
                "OTHER"
              ]
            },
            "ntpServerInfo": {
              "description": "Information for the NTP based clock synchronization.  Shall be present if type = \"NTP\".\n",
              "type": "object",
              "properties": {
                "ipAddress": {
                  "description": "An IPV4 or IPV6 address. Representation: In case of an IPV4 address, string that consists of four decimal integers separated by dots, each integer ranging from 0 to 255. In case of an IPV6 address, string that consists of groups of zero to four hexadecimal digits, separated by colons.\n",
                  "type": "string",
                  "format": "IP"
                },
                "hostname": {
                  "description": "Indicates the hostname of the NTP server. \nNOTE:\tEither ipAddress or hostname shall be set, but not both  at the same time.\n",
                  "type": "string"
                }
              }
            },
            "otherClockSyncParams": {
              "description": "This type represents a list of key-value pairs. The order of the pairs in the list is not significant. In JSON, a set of keyvalue pairs is represented as an object. It shall comply with the provisions defined in clause 4 of IETF RFC 8259. In the following example, a list of key-value pairs with four keys (\"aString\", \"aNumber\", \"anArray\" and \"anObject\") is provided to illustrate that the values associated with different keys can be of different type.\n",
              "type": "object"
            }
          },
          "required": [
            "id",
            "type"
          ]
        }
      },
      "clockSyncsDeleteIds": {
        "description": "If present, this attribute signals modifications of certain entries in  \"clockSyncs\" attribute in \"ManoEntityConfigurableParams\", as defined  in clause 5.6.2.3.\n",
        "type": "array",
        "items": {
          "description": "An identifier with the intention of being globally unique.\n",
          "type": "string"
        }
      },
      "defaultLogCompileBySizeValue": {
        "description": "Unsigned integer\n",
        "type": "number"
      },
      "defaultLogCompileByTimerValue": {
        "description": "Unsigned integer\n",
        "type": "number"
      },
      "manoServiceModifications": {
        "description": "If present, this attribute signals modifications of the \"manoServices\"  attribute array in the \"ManoEntity\", as defined in clause 5.6.2.3.\n",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "description": "An identifier that is unique for the respective type within a NFV-MANO functional entity, but that need not be globally unique. Representation: string of variable length..\n",
              "type": "string"
            },
            "name": {
              "description": "If present, this attribute signals modification of the \"name\"  attribute in the \"ManoService\".\n",
              "type": "string"
            },
            "description": {
              "description": "If present, this attribute signals modification of the  \"description\" attribute in the \"ManoService\".\n",
              "type": "string"
            }
          },
          "required": [
            "id"
          ]
        }
      }
    }
  }
 No newline at end of file
Loading