Commit cf9d2aa2 authored by Elian Kraja's avatar Elian Kraja Committed by Michele Carignani
Browse files

Fix on asynchronous notifications. Adding missing schemas

parent 92c90a45
Loading
Loading
Loading
Loading
+29 −18
Original line number Diff line number Diff line
@@ -28,42 +28,53 @@ Create Sessions
    
Configure Notification Status Handler
    [Arguments]    ${endpoint}    ${status}=""
    Run Keyword If   ${status}!=""  set to dictionary    ${json["operationState"]}    dp=${status}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    ${json}=     Create Dictionary
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${status}        ""
    Run Keyword If   ${value} == True      Set to dictionary    ${json}    operationState    ${status}
    Log  Creating mock request and response to handle ${element}
    &{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
    ${notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type='JSON'    body=${json}
    &{headers}=  Create Dictionary  Content-Type=application/json
    ${notification_response}=  Create Mock Response	    status_code=${status}    headers=${headers}     
    Create Mock Expectation  ${notification_request}  ${notification_response}
    [Return]    ${notification_request}
    
Configure Notification VNF Instance Handler
    [Arguments]    ${endpoint}    ${instanceId}=""
    Run Keyword If   ${instanceId}!=""  set to dictionary    ${json["vnfInstanceId"]}    dp=${instanceId}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    ${json}=     Create Dictionary
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${instanceId}        ""
    Run Keyword If   ${value} == True      Set to dictionary    ${json}    vnfInstanceId    ${instanceId}
    Log  Creating mock request and response to handle ${element}
    &{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
    ${notification_request}=  Create Mock Request Matcher	POST  ${endpoint}    body_type='JSON'  body=${json}
    &{headers}=  Create Dictionary  Content-Type=application/json
    ${notification_response}=  Create Mock Response     204    headers=${headers}    
    Log    ${notification_request}
    Log    ${notification_response}
    Create Mock Expectation  ${notification_request}  ${notification_response}
    [Return]    ${notification_request}

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

Check Operation Notification
    [Arguments]    ${element}    ${status}=""
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification Status Handler    ${callback_endpoint_fwd}    ${status}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    ${req1}=    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req2}=    Configure Notification Status Handler    ${callback_endpoint_fwd}    ${status}
    Wait Until Keyword Succeeds    12 sec   3 sec   Verify Mock Expectation    ${req2}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    
Check VNF Instance Operation Notification
    [Arguments]    ${element}   ${instance_id}
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    
 No newline at end of file
    ${req1}=  Configure Notification Forward   ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req2}=  Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    Wait Until Keyword Succeeds    12 sec  3 sec   Verify Mock Expectation    ${req2}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
 No newline at end of file
+87 −0
Original line number Diff line number Diff line
{
      "description": "This type represents a VNF identifier creation notification, which informs the receiver of the creation of a new \"Individual VNF instance\" resource and the associated VNF instance identifier. This notification shall be triggered by the VNFM when it has created an \"Individual VNF instance\" resource and the associated VNF instance identifier.\n",
      "type": "object",
      "required": [
        "id",
        "notificationType",
        "subscriptionId",
        "timeStamp",
        "vnfInstanceId",
        "_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 \"VnfIdentifierCreationNotification\" for this notification type.\n",
          "type": "string",
          "enum": [
            "VnfIdentifierCreationNotification"
          ]
        },
        "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"
        },
        "vnfInstanceId": {
          "description": "An identifier with the intention of being globally unique.\n",
          "type": "string"
        },
        "_links": {
          "description": "This type represents the links to resources that a notification can contain.\n",
          "type": "object",
          "required": [
            "vnfInstance",
            "subscription"
          ],
          "properties": {
            "vnfInstance": {
              "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"
                }
              }
            },
            "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"
                }
              }
            },
            "vnfLcmOpOcc": {
              "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
+568 −0

File added.

Preview size limit exceeded, changes collapsed.

+87 −0
Original line number Diff line number Diff line
{
      "description": "This type represents a VNF identifier deletion notification, which informs the receiver of the deletion of a new \"Individual VNF instance\" resource and the associated VNF instance identifier. This notification shall be triggered by the VNFM when it has deleted an \"Individual VNF instance\" resource and the associated VNF instance identifier.\n",
      "type": "object",
      "required": [
        "id",
        "notificationType",
        "subscriptionId",
        "timeStamp",
        "vnfInstanceId",
        "_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 \"VnfIdentifierDeletionNotification\" for this notification type.\n",
          "type": "string",
          "enum": [
            "VnfIdentifierDeletionNotification"
          ]
        },
        "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"
        },
        "vnfInstanceId": {
          "description": "An identifier with the intention of being globally unique.\n",
          "type": "string"
        },
        "_links": {
          "description": "This type represents the links to resources that a notification can contain.\n",
          "type": "object",
          "required": [
            "vnfInstance",
            "subscription"
          ],
          "properties": {
            "vnfInstance": {
              "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"
                }
              }
            },
            "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"
                }
              }
            },
            "vnfLcmOpOcc": {
              "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