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

Added Schema and file for NotificationEndpoint.robot

parent 8e6d2e87
Loading
Loading
Loading
Loading
+73 −0
Original line number Original line Diff line number Diff line
*** Setting ***
Resource	environment/variables.txt
Suite Setup    Create Sessions
Suite Teardown    Terminate All Processes    kill=true
Library    MockServerLibrary
Library    Process
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    String


*** Test Cases ***
Log Report Avaliable Notification
    [Documentation]    Test ID: 8.3.4.7.1
    ...    Test title: Log Report Avaliable Notification
    ...    Test objective: The objective is to test the dispatch of Log Report Avaliable Notification when new log report is available in the NFV-MANO, 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: 
    ...    Reference: clause 8.5.9.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the availability of Log Report (external action) 
    Check Log Report Available Notification Http POST Request Body Json Schema Is    LogReportAvailableNotification
    Check Log Report Available Notification Http POST Request Body notificationType attribute Is    LogReportAvailableNotification


*** Keywords ***
Trigger the availability of Log Report (external action) 
    #do nothing
    Log    do nothing
 
  
Check Log Report Available 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 Log Report Available Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Log Report Available 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}

Check Threshold Crossed 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}
    
    
Configure Notification Log Report Available 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
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}

  
Configure Notification Forward
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    Log  Creating mock Http POST forward to handle ${schema}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}

Create Sessions
    Start Process  java  -jar  ${MOCK_SERVER_JAR}  -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${callback_uri}:${callback_port}
 No newline at end of file
+126 −0
Original line number Original line Diff line number Diff line
{
    "description": "This notification informs the receiver that the log report of the NFV-MANO functional entity is available. It shall comply with the provisions defined in table 8.6.2.4-1. The notification shall be triggered by the NFV-MANO functional entity when log information has been collected by the logging job and the log report is available.",
    "type": "object",
    "required": [
      "id",
      "notificationType",
      "subscriptionId",
      "timeStamp",
      "objectInstanceId",
      "_links"
    ],
    "properties": {
      "id": {
        "description": "An identifier with the intention of being globally unique.\n",
        "type": "string"
      },
      "notificationType": {
        "description": "Discriminator for the different notification types. Shall be set to \"LogReportAvailableNotification\" for this notification type.",
        "type": "string"
      },
      "subscriptionId": {
        "description": "An identifier with the intention of being globally unique.\n",
        "type": "string"
      },
      "timeStamp": {
        "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
        "type": "string",
        "format": "date-time"
      },
      "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"
        ]
      },
      "_links": {
        "description": "Links to resources related to this notification.",
        "type": "object",
        "required": [
          "subscription",
          "logReports"
        ],
        "properties": {
          "subscription": {
            "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
            "type": "object",
            "required": [
              "href"
            ],
            "properties": {
              "href": {
                "description": "String formatted according to IETF RFC 3986.\n",
                "type": "string"
              }
            }
          },
          "objectInstance": {
            "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
            "type": "object",
            "required": [
              "href"
            ],
            "properties": {
              "href": {
                "description": "String formatted according to IETF RFC 3986.\n",
                "type": "string"
              }
            }
          },
          "LoggingJob": {
            "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
            "type": "object",
            "required": [
              "href"
            ],
            "properties": {
              "href": {
                "description": "String formatted according to IETF RFC 3986.\n",
                "type": "string"
              }
            }
          },
          "logReports": {
            "description": "Link from which the available log report can be obtained. Due to the relationship of the logging job compilation and the logging information availability reporting, more than one logReport notification link can be provided.",
            "type": "array",
            "items": {
              "description": "This type represents a link to a resource in a notification, using an absolute or relative 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