Commit 900adfc2 authored by Michele Carignani's avatar Michele Carignani
Browse files

fixes for Asynchronous Notifications

parent 1c9ba2ad
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,7 @@ Initialize System
Check Postcondition VNF Instance Created status is
Check Postcondition VNF Instance Created status is
    [Arguments]    ${status}
    [Arguments]    ${status}
    Check VNF Instance    ${vnfInstanceId}
    Check VNF Instance    ${vnfInstanceId}
    Check HTTP Response Status Code Is    ${status}
    Check HTTP Response Status Code Is    200
    Check VNF Status    ${response['body']['instantiationState']}  ${status}
    Check VNF Status    ${response['body']['instantiationState']}  ${status}


Check Operation Notification For VNF Instance Creation
Check Operation Notification For VNF Instance Creation
+18 −15
Original line number Original line Diff line number Diff line
@@ -40,24 +40,26 @@ Configure Notification Status Handler


Configure Notification VNF Instance Handler
Configure Notification VNF Instance Handler
    [Arguments]    ${endpoint}    ${instanceId}=""
    [Arguments]    ${endpoint}    ${instanceId}=""
    ${json}=     Create Dictionary
    ${instanceIdSchema}=  Create Dictionary  const=${instanceId}
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${instanceId}        ""
    ${properties}=  Create Dictionary
    Run Keyword If   ${value} == True      Set to dictionary    ${json}    vnfInstanceId    ${instanceId}
    Run Keyword If   "${instanceId}"!=""  Set to dictionary    ${properties}    instanceId=${instanceIdSchema}
    ${payload}=  Create Dictionary  properties=${properties}
    ${BODY}=    evaluate    json.dumps(${payload})    json
    Log  Creating mock request and response to handle ${element}
    Log  Creating mock request and response to handle ${element}
    ${notification_request}=  Create Mock Request Matcher	POST  ${endpoint}    body_type='JSON'  body=${json}
    &{notification_request}=    Create Mock Request Matcher    POST    ${endpoint}    body_type=JSON_SCHEMA    body=${BODY}
    &{headers}=  Create Dictionary  Content-Type=application/json
    &{headers}=  Create Dictionary  "Content-Type"="application/json"
    ${notification_response}=  Create Mock Response     204    headers=${headers}    
    &{notification_response}=  Create Mock Response     headers=${headers}  status_code=204
    Log    ${notification_request}
    ${exp}=  Create Mock Expectation  ${Notification_request}  ${notification_response}
    Log    ${notification_response}
    Create Mock Expectation  ${notification_request}  ${notification_response}
    [Return]  ${notification_request}
    [Return]  ${notification_request}


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


@@ -75,6 +77,7 @@ Check VNF Instance Operation Notification
    ${json}=	Get File	schemas/${element}.schema.json
    ${json}=	Get File	schemas/${element}.schema.json
    ${req1}=  Configure Notification Forward   ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req1}=  Configure Notification Forward   ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    ${req2}=  Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    ${req2}=  Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    Wait Until Keyword Succeeds    12 sec   3 sec   Verify Mock Expectation    ${req1}
    Wait Until Keyword Succeeds    12 sec   3 sec   Verify Mock Expectation    ${req2}
    Wait Until Keyword Succeeds    12 sec   3 sec   Verify Mock Expectation    ${req2}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    Clear Requests    ${callback_endpoint_fwd}
+73 −72
Original line number Original line 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",
  "type": "object",
  "required": [
  "required": [
    "id",
    "id",
    "notificationType",
    "notificationType",
        "subscriptionId",
    "timeStamp",
    "timeStamp",
    "vnfInstanceId",
    "vnfInstanceId",
    "_links"
    "_links"
  ],
  ],
  "properties": {
  "properties": {
    "id": {
    "id": {
          "description": "An identifier with the intention of being globally unique.\n",
      "description": "An identifier with the intention of being globally unique.",
      "type": "string"
      "type": "string"
    },
    },
    "notificationType": {
    "notificationType": {
          "description": "Discriminator for the different notification types. Shall be set to \"VnfIdentifierCreationNotification\" for this notification type.\n",
      "description": "Discriminator for the different notification types. Shall be set to VnfIdentifierCreationNotification for this notification type.",
      "type": "string",
      "type": "string",
      "enum": [
      "enum": [
        "VnfIdentifierCreationNotification"
        "VnfIdentifierCreationNotification"
      ]
      ]
    },
    },
    "subscriptionId": {
    "subscriptionId": {
          "description": "An identifier with the intention of being globally unique.\n",
      "description": "An identifier with the intention of being globally unique.",
      "type": "string"
      "type": "string"
    },
    },
    "timeStamp": {
    "timeStamp": {
          "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
      "description": "Date-time stamp.  Representation: String formatted according to IETF RFC 3339.",
      "type": "string",
      "type": "string",
      "format": "date-time"
      "format": "date-time"
    },
    },
    "vnfInstanceId": {
    "vnfInstanceId": {
          "description": "An identifier with the intention of being globally unique.\n",
      "description": "An identifier with the intention of being globally unique.",
      "type": "string"
      "type": "string"
    },
    },
    "_links": {
    "_links": {
          "description": "This type represents the links to resources that a notification can contain.\n",
      "description": "This type represents the links to resources that a notification can contain.",
      "type": "object",
      "type": "object",
      "required": [
      "required": [
        "vnfInstance",
        "vnfInstance",
@@ -43,41 +41,44 @@
      ],
      ],
      "properties": {
      "properties": {
        "vnfInstance": {
        "vnfInstance": {
              "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
          "description": "This type represents a link to a resource.",
          "type": "object",
          "type": "object",
          "required": [
          "required": [
            "href"
            "href"
          ],
          ],
          "properties": {
          "properties": {
            "href": {
            "href": {
                  "description": "String formatted according to IETF RFC 3986.\n",
              "description": "URI of the referenced resource.",
                  "type": "string"
              "type": "string",
              "format": "url"
            }
            }
          }
          }
        },
        },
        "subscription": {
        "subscription": {
              "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
          "description": "This type represents a link to a resource.",
          "type": "object",
          "type": "object",
          "required": [
          "required": [
            "href"
            "href"
          ],
          ],
          "properties": {
          "properties": {
            "href": {
            "href": {
                  "description": "String formatted according to IETF RFC 3986.\n",
              "description": "URI of the referenced resource.",
                  "type": "string"
              "type": "string",
              "format": "url"
            }
            }
          }
          }
        },
        },
        "vnfLcmOpOcc": {
        "vnfLcmOpOcc": {
              "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n",
          "description": "This type represents a link to a resource.",
          "type": "object",
          "type": "object",
          "required": [
          "required": [
            "href"
            "href"
          ],
          ],
          "properties": {
          "properties": {
            "href": {
            "href": {
                  "description": "String formatted according to IETF RFC 3986.\n",
              "description": "URI of the referenced resource.",
                  "type": "string"
              "type": "string",
              "format": "url"
            }
            }
          }
          }
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -7,5 +7,5 @@ RESTinstance==1.0.0rc4
robotframework-dependencylibrary==1.0.0.post1
robotframework-dependencylibrary==1.0.0.post1
robotframework-jsonlibrary==0.3
robotframework-jsonlibrary==0.3
robotframework-jsonschemalibrary==1.0
robotframework-jsonschemalibrary==1.0
robotframework-mockserver==0.0.4
robotframework-mockserver==0.0.7