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

Added Test Cases for IndividualReport.robot

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

*** Test Cases ***
POST Individual Log Report - Method not implemented
    [Documentation]    Test ID: 8.3.4.3.1
    ...    Test title: POST Individual Log Report - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new log report.
    ...    Pre-conditions: Logging Job is already created.
    ...    Reference: clause 8.5.5.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The log report is not created.
    Send Post request for Individual Log Report
    Check HTTP Response Status Code Is    405
    Check Postcondition Individual Log Report is not Created

Get Individual Log Report
    [Documentation]    Test ID: 8.3.4.3.2
    ...    Test title: Get Individual Log Report
    ...    Test objective: The objective is to test the retrieval of an individual log report and perform a JSON schema validation of the collected report data structure
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Log Report
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   LogReport
    
Get Individual Log Report (asynchronous)
    [Documentation]    Test ID: 8.3.4.3.3
    ...    Test title: Get Individual Log Report  (asynchronous)
    ...    Test objective: The objective is to test the retrieval of an individual log report is ongoing and no log report is available yet.
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Log Report
    Check HTTP Response Status Code Is    202

Get Individual Log Report with invalid resource endpoint
        [Documentation]    Test ID: 8.3.4.3.4
    ...    Test title: Get Individual Log Report with invalid resource endpoint
    ...    Test objective:  The objective is to test that the retrieval of an individual log report  fails when using an invalid resource endpoint. 
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Log Report with invalid resource endpoint
    Check HTTP Response Status Code Is    404

PUT Individual Log Report - Method not implemented
    [Documentation]    Test ID: 8.3.4.3.5
    ...    Test title: PUT Individual Log Report - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing log report.
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.3 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO log report is not modified by the operation
    Send Put request for Individual Log Report
    Check HTTP Response Status Code Is    405
    Check Postcondition Individual Log Report is Unmodified (Implicit)

PATCH Individual Log Report - Method not implemented
    [Documentation]    Test ID: 8.3.4.3.6
    ...    Test title: PATCH Individual Log Report - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existinglog report.
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The log report is not modified by the operation
    Send Patch request for Individual Log Report
    Check HTTP Response Status Code Is    405
    Check Postcondition Individual Log Report is Unmodified (Implicit)

DELETE Individual Log Report - Method not implemented
    [Documentation]    Test ID: 8.3.4.3.7
    ...    Test title: DELETE Individual Log Report - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an existing log report.
    ...    Pre-conditions: One or more log reports are set.
    ...    Reference: clause 8.5.5.3.5 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The log report is not deleted by the operation
    Send Delete request for Individual Log Report
    Check HTTP Response Status Code Is    405
    Check Postcondition Individual Log Report Exists
+71 −1
Original line number Original line Diff line number Diff line
@@ -204,7 +204,6 @@ Check Postcondition Logging Job is Deleted
    GET individual Logging Job
    GET individual Logging Job
    Check HTTP Response Status Code Is    404
    Check HTTP Response Status Code Is    404


    
Send Delete request for individual Logging Job with invalid resource identifier
Send Delete request for individual Logging Job with invalid resource identifier
    Log    Trying to perform a negative delete, using erroneous Logging Job identifier
    Log    Trying to perform a negative delete, using erroneous Logging Job identifier
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
@@ -212,3 +211,74 @@ Send Delete request for individual Logging Job with invalid resource identifier
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${erroneousLogJobId}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${erroneousLogJobId}
    ${output}=    Output    response
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${response}    ${output}
    
Send Post request for Individual Log Report
    Log    Trying to create new log report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${newReportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition Individual Log Report is not Created
    Log    Trying to get a new report
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${newReportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Check HTTP Response Status Code Is    404

Get Individual Log Report
    Log    Trying to get log report
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Individual Log Report with invalid resource endpoint
    Log    Trying to get a log report with invalid resource endpoint
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${erroneousReportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Put request for Individual Log Report
    Log    Trying to update log report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Patch request for Individual Log Report
    Log    Trying to update log report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Delete request for Individual Log Report
    Log    Trying to delete log report   
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/log_reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition Individual Log Report is Unmodified (Implicit)
    Log    Check Postcondition Log job is not modified
    Get Individual Log Report
    Log    Check Response matches original report
    ${report}=    evaluate    json.loads('''${response['body']}''')    json
    Should Be Equal    ${origResponse['body']['readyTime']}    ${report['readyTime']}
    
Check Postcondition Individual Log Report Exists
    Log    Checking that report still exists
    Get Individual Log Report
    Check HTTP Response Status Code Is    200
+5 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ ${apiMajorVersion} v1
${apiName}        nfvmanologm
${apiName}        nfvmanologm


${response}    {}
${response}    {}
${origResponse}    {}


${callback_port}    9091
${callback_port}    9091
${callback_uri}    http://172.22.1.7:${callback_port}
${callback_uri}    http://172.22.1.7:${callback_port}
@@ -40,3 +41,7 @@ ${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.
${alarm_filter}       id
${alarm_filter}       id
${filter_value}     50daca910b000d4f1a2b675d604257e42
${filter_value}     50daca910b000d4f1a2b675d604257e42
${fields}
${fields}

${reportId}       0fb4c875-e07f-46ca-a9dd-13907667a568
${erroneousReportId}    erroneousReportId
${newReportId}    newReportId
+176 −0
Original line number Original line Diff line number Diff line
{
    "description": "This type represents a log report, which provides information about a compiled log and how to obtain it. It shall comply with the provisions defined in table 8.6.2.7-1.\n",
    "type": "object",
    "required": [
      "id",
      "objectInstanceId",
      "compilationTrigger",
      "readyTime",
      "fileFormat",
      "fileLocationInfo",
      "securityAndIntegrityInfo",
      "_links"
    ],
    "properties": {
      "id": {
        "description": "An identifier with the intention of being globally unique.\n",
        "type": "string"
      },
      "objectInstanceId": {
        "description": "This type represents the identifier to reference a managed object of a  particular type. \n",
        "type": "object",
        "properties": {
          "type": {
            "description": "Indicates the type of managed object. Permitted values:\n  - MANO_ENTITY\n  - MANO_SERVICE\n  - MANO_SERVICE_IF\n  - CONSUMED_MANO_IF\n  - MANO_ENTITY_COMPONENT\n\nThe \"MANO_ENTITY COMPONENT\" is only applicable if attribute \"manoEntityComponents\" in \"ManoEntity\" is supported by the API producer.\n",
            "type": "string",
            "enum": [
              "MANO_ENTITY",
              "MANO_SERVICE",
              "MANO_SERVICE_IF",
              "CONSUMED_MANO_IF",
              "MANO_ENTITY_COMPONENT"
            ]
          },
          "objectId": {
            "description": "An identifier with the intention of being globally unique.\n",
            "type": "string"
          },
          "subObjectId": {
            "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"
          }
        },
        "required": [
          "type",
          "objectId"
        ]
      },
      "compilationTrigger": {
        "description": "The trigger for the compilation of the log file.\nPermitted values: - ON_DEMAND: created based on explicit request by a client. - AUTOMATIC: created according to the logging job compilation configuration.",
        "type": "string",
        "enum": [
          "ON_DEMAND",
          "AUTOMATIC"
        ]
      },
      "readyTime": {
        "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
        "type": "string",
        "format": "date-time"
      },
      "expiryTime": {
        "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
        "type": "string",
        "format": "date-time"
      },
      "fileSize": {
        "description": "The size of the compiled log file in bytes, if known.",
        "type": "integer",
        "format": "int32"
      },
      "fileFormat": {
        "description": "The encoding used by the file.",
        "type": "string"
      },
      "fileLocationInfo": {
        "description": "Location and address information of the compiled log file. The consumer can use this information to obtain the compiled log file.",
        "type": "object",
        "required": [
          "protocol",
          "fileEndpoint"
        ],
        "properties": {
          "protocol": {
            "description": "Protocol over which the compiled log file can be retrieved.\nPermitted values: - HTTPS: transmission over HTTP Secure (HTTPS). - SFTP: transmission over SSH file transfer protocol (SFTP). - SCP: transmission over secure copy protocol (SCP). - FTPS: transmission over file transfer protocol secure (FTPS), as specified in IETF RFC 2228 [i.11],\n     using explicit mode as specified in IETF RFC 4217 [i.12]. If FTPS is supported, \"private\" protection level shall be used.\n\nHTTPS shall be supported, and other protocols may be supported.",
            "type": "string",
            "enum": [
              "HTTPS",
              "SFTP",
              "SCP",
              "FTPS"
            ]
          },
          "fileEndpoint": {
            "description": "The host name (or IP address), optionally a port number (if the host with the compile log file uses a non-standard port number as per the supported transmission protocol), a valid file directory path, and the file name of the compiled log file, or a valid URL.",
            "type": "string",
            "format": "URI"
          }
        }
      },
      "securityAndIntegrityInfo": {
        "description": "Security and integrity information for the compilation of the log files.",
        "type": "object",
        "required": [
          "algorithm",
          "hash",
          "logFileSignature",
          "signingCertificate"
        ],
        "properties": {
          "algorithm": {
            "description": "Algorithm used to generate the hash of the compiled log file. Only SHA-256 and SHA-512 shall be used",
            "type": "string"
          },
          "hash": {
            "description": "The hexadecimal value of the hash of the compiled log file. The hash shall be computed from the encrypted compiled log file, in case the encryption applies.",
            "type": "string"
          },
          "encryptionPublicKey": {
            "description": "Public key used for the encryption of the compiled log file. Shall be present if the compiled log file is encrypted.",
            "type": "string"
          },
          "cipherAlgorithm": {
            "description": "The cryptographic algorithm used for the encryption. Shall be present if the compiled log file is encrypted. Valid values are: \"AES-CBC-128\", \"AES-GCM-128\", \"AES-CBC-256\", and \"AES-GCM-256\", as specified in clause 6.5 of ETSI GS NFV-SEC 012 [14].",
            "type": "string"
          },
          "logFileSignature": {
            "description": "Signature to the compiled log file generated with the NFV-MANO functional entity’s private key, which is used to ensure the authenticity of the compiled log file. The signature shall be applied according to the \"encryptAndSignOrder\" of the \"LoggingJobConfig\".",
            "type": "string"
          },
          "signingCertificate": {
            "description": "X.509 certificate with the NFV-MANO functional entity’s public key used for verifying the log report and compiled log file signatures.",
            "type": "string"
          }
        }
      },
      "_links": {
        "description": "Links for this resource.",
        "type": "object",
        "required": [
          "self"
        ],
        "properties": {
          "self": {
            "description": "This type represents a link to a resource using an absolute URI.\n",
            "type": "object",
            "required": [
              "href"
            ],
            "properties": {
              "href": {
                "description": "String formatted according to IETF RFC 3986.\n",
                "type": "string"
              }
            }
          },
          "objects": {
            "description": "Links to resources representing the object instances that are logged. Shall be present if the logged object instance information is accessible as a resource.",
            "type": "array",
            "items": {
              "description": "This type represents a link to a resource using an absolute URI.\n",
              "type": "object",
              "required": [
                "href"
              ],
              "properties": {
                "href": {
                  "description": "String formatted according to IETF RFC 3986.\n",
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
 No newline at end of file