Skip to content
Snippets Groups Projects
Commit 2831cc8a authored by Najam UI Hassan's avatar Najam UI Hassan Committed by Giacomo Bernini
Browse files

Added Test Cases for NotificationEndpoint.robot

parent a7cf9f0b
No related branches found
No related tags found
2 merge requests!199Merge "3.3.1 dev" into "release 3" master,!1743.3.1 dev sol009
*** 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 ***
Information Changed Notification
[Documentation] Test ID: 8.3.1.12.1
... Test title: Information Changed Notification
... Test objective: The objective is to test the dispatch of Information Changed Notification when configuration or information is changed 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: A subscription for information availability notifications is available in the NFV-MANO.
... Reference: clause 5.5.6.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 Information Changed Notification (external action)
Check Information Changed Notification Available Http POST Request Body Json Schema Is InformationChangedNotification
Check Information Changed Notification Available Http POST Request Body notificationType attribute Is InformationChangedNotification
Change State Notification
[Documentation] Test ID: 8.3.1.12.2
... Test title: Change State Notification
... Test objective: The objective is to test the dispatch of Change State Notification when state changes of the NFV-MANO functional entity and its managed objects, 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: A performance job is created, and a state change subscription is available in the NFV-MANO.
... Reference: clause 5.5.6.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
... Config ID: Config_prod_NFV-MANOz
... Applicability: none
... Post-Conditions: none
Trigger the cross of Change State (external action)
Check Change State Notification Http POST Request Body Json Schema Is ChangeStateNotification
Check Change State Notification Http POST Request Body notificationType attribute Is ChangeStateNotification
*** Keywords ***
Trigger the availability of Information Changed Notification (external action)
#do nothing
Log do nothing
Trigger the cross of Change State (external action)
#do nothing
Log do nothing
Check Information Changed Notification Available 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 Information Changed Notification Available Http POST Request Body notificationType attribute Is
[Arguments] ${type}
Configure Notification Information Changed Notification 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 Change State 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 Change State Notification Http POST Request Body notificationType attribute Is
[Arguments] ${type}
Configure Notification State Crossed 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 Change State Notification Http POST Request Body changeType attribute Is
[Arguments] ${type}
#do nothing
Log do nothing
Configure Notification Information Changed Notification 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 State Crossed 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}
{
"description": "This type represents a Change state operation occurrence.\n",
"type": "object",
"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 \"ChangeStateNotification\" for this notification type.\n",
"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"
},
"changeStateOpOccId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"stateChangedTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"changeStateOperationState": {
"description": "The enumeration ChangeStateOpOccStateEnumType defines permitted values for the change state operation. It shall comply with the provisions :\n - PROCESSING\tThe change state operation is currently in execution.\n - COMPLETED\tThe change state operation has been completed successfully.\n - FAILED\tThe change state operation has failed.\n",
"type": "string",
"enum": [
"PROCESSING",
"COMPLETED",
"FAILED"
]
},
"managedObjectRef": {
"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"
]
},
"operationalState": {
"description": "The enumeration OperationalStateEnumType defines values representing the operational state of an NFV-MANO functional application type of managed entity. The OperationalStateEnumType shall comply with the provisions:\n - STARTED\tThe managed entity is operational.\n - STOPPED\tThe managed entity is not operational.\n - STOPPING\tThe managed entity is in the transition to stop.\n - STARTING\tThe managed entity is in the transition to start and become operational.\n - RESTARTING\tThe managed entity is in the transition to stop and start again.\n",
"type": "string",
"enum": [
"STARTED",
"STOPPED",
"STOPPING",
"STARTING",
"RESTARTING"
]
},
"administrativeState": {
"description": "The enumeration AdministrativeStateEnumType defines values representing the administrative state of a managed entity. The AdministrativeStateEnumType shall comply with the provisions:\n - LOCKED\tThe managed entity is administratively prohibited to be used.\n - UNLOCKED\tThe managed entity is administratively allowed to be used.\n - LOCKING\tThe managed entity is in the transition to be locked.\n",
"type": "string",
"enum": [
"LOCKED",
"UNLOCKED",
"LOCKING"
]
},
"_links": {
"description": "Links to resources related to this notification.\n",
"type": "object",
"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"
}
}
},
"changeStateOpOcc": {
"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"
}
}
}
},
"required": [
"subscription",
"objectInstance",
"changeStateOpOcc"
]
}
},
"required": [
"id",
"notificationType",
"subscriptionId",
"timestamp",
"changeStateOpOccId",
"stateChangedTime",
"changeStateOperationState",
"managedObjectRef",
"_links"
]
}
\ No newline at end of file
{
"description": "This type represents a notification that is sent when data about configuration and information of the NFV-MANO functional entity have been changed.\n",
"type": "object",
"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 \"InformationChangedNotification\" for this notification type.\n",
"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"
},
"informationChangedTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"manoEntityId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"changedInfo": {
"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"
},
"_links": {
"description": "Links to resources related to this notification.\n",
"type": "object",
"properties": {
"self": {
"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"
}
}
}
},
"required": [
"self"
]
}
},
"required": [
"id",
"notificationType",
"subscriptionId",
"timeStamp",
"informationChangedTime",
"manoEntityId",
"changedInfo",
"_links"
]
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment