Commit ce96fde7 authored by mengxuan.zhao's avatar mengxuan.zhao
Browse files

Complete SOL003 VNFFaultManagementNotification, VNFLifecycleOperationGranting

parent 4c0a20dd
*** Settings ***
Resource variables.txt
Suite Setup Create Sessions
Suite Teardown Terminate All Processes kill=true
Library MockServerLibrary
Library Process
Library OperatingSystem
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${notification_port}
*** Variables ***
${sleep_interval} 20s
*** Test Cases ***
Deliver a notification - Alarm
log The POST method delivers a notification - Information of a VNF alarm.
${json}= Get File schemas/alarmNotification.schema.json
${BODY}= evaluate json.loads('''${json}''') json
Log Creating mock request and response to handle alarmNotification
&{req}= Create Mock Request Matcher Schema POST ${notification_ep} body=${BODY}
&{rsp}= Create Mock Response Schema headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Sleep ${sleep_interval}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${notification_ep}
Deliver a notification - Alarm Clearance
log The POST method delivers a notification - Information of a VNF alarm.
${json}= Get File schemas/alarmClearedNotification.schema.json
${BODY}= evaluate json.loads('''${json}''') json
Log Creating mock request and response to handle alarmNotification
&{req}= Create Mock Request Matcher Schema POST ${notification_ep} body=${BODY}
&{rsp}= Create Mock Response Schema headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Sleep ${sleep_interval}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${notification_ep}
Deliver a notification - Alarm List Rebuilt
log The POST method delivers a notification - Information of a VNF alarm.
${json}= Get File schemas/alarmListRebuiltNotification.schema.json
${BODY}= evaluate json.loads('''${json}''') json
Log Creating mock request and response to handle alarmNotification
&{req}= Create Mock Request Matcher Schema POST ${notification_ep} body=${BODY}
&{rsp}= Create Mock Response Schema headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Sleep ${sleep_interval}
Log Verifying results
Verify Mock Expectation ${req}
Log Cleaning the endpoint
Clear Requests ${notification_ep}
Test a notification end point
log The GET method allows the server to test the notification endpoint
&{req}= Create Mock Request Matcher Schema GET ${notification_ep}
&{rsp}= Create Mock Response Schema headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${req} ${rsp}
Sleep ${sleep_interval}
Verify Mock Expectation ${req}
Clear Requests ${notification_ep}
PUT notification - Method not implemented
log Trying to perform a PUT. This method should not be implemented
Put ${notification_ep}
Log Validate Status code
Output response
Integer response status 405
PATCH subscriptions - Method not implemented
log Trying to perform a PATCH. This method should not be implemented
Patch ${notification_ep}
Log Validate Status code
Output response
Integer response status 405
DELETE subscriptions - Method not implemented
log Trying to perform a DELETE. This method should not be implemented
Delete ${notification_ep}
Log Validate Status code
Output response
Integer response status 405
*** Keywords ***
Create Sessions
Start Process java -jar ../../mockserver-netty-5.3.0-jar-with-dependencies.jar -serverPort ${notification_port} alias=mockInstance
Wait For Process handle=mockInstance timeout=5s on_timeout=continue
Create Mock Session ${NFVO_SCHEMA}://${NFVO_HOST}:${notification_port} #The API producer is set to NFVO according to SOL003-7.3.4
\ No newline at end of file
{
"description": "This type represents an alarm cleared notification about VNF faults. The notification shall be triggered by the VNFM when an alarm has been cleared.\n",
"type": "object",
"required": [
"id",
"notificationType",
"subscriptionId",
"timeStamp",
"alarmId",
"alarmClearedTime",
"_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 \"AlarmClearedNotification\" for this notification type.\n",
"type": "string",
"enum": [
"AlarmClearedNotification"
]
},
"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"
},
"alarmId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"alarmClearedTime": {
"description": "The time stamp indicating when the alarm was cleared.\n"
},
"_links": {
"description": "Links to resources related to this notification.\n",
"type": "object",
"required": [
"subscription",
"alarm"
],
"properties": {
"subscription": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
},
"alarm": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
}
}
}
}
}
\ No newline at end of file
{
"description": "This type represents a notification that the alarm list has been rebuilt, e.g. if the VNFM detects its storage holding the alarm list is corrupted. The notification shall be triggered by the VNFM when the alarm list has been rebuilt.\n",
"type": "object",
"required": [
"id",
"notificationType",
"subscriptionId",
"timeStamp",
"_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 \"AlarmListRebuiltNotification\" for this notification type.\n",
"type": "string",
"enum": [
"AlarmListRebuiltNotification"
]
},
"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"
},
"_links": {
"description": "Links to resources related to this notification.\n",
"type": "object",
"required": [
"subscription",
"alarms"
],
"properties": {
"subscription": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
},
"alarms": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
}
}
}
}
}
\ No newline at end of file
{
"name": "AlarmNotification",
"description": "Information of a VNF alarm.\n",
"in": "body",
"required": true,
"schema": {
"description": "This type represents an alarm notification about VNF faults. This notification shall be triggered by the VNFM when: * An alarm has been created. * An alarm has been updated, e.g. if the severity of the alarm has changed.\n",
"type": "object",
"required": [
"id",
"notificationType",
"subscriptionId",
"timeStamp",
"alarm",
"_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 \"AlarmNotification\" for this notification type.\n",
"type": "string",
"enum": [
"AlarmNotification"
]
},
"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"
},
"alarm": {
"description": "The alarm data type encapsulates information about an alarm.\n",
"type": "object",
"required": [
"id",
"managedObjectId",
"rootCauseFaultyResource",
"alarmRaisedTime",
"ackState",
"perceivedSeverity",
"eventTime",
"eventType",
"probableCause",
"isRootCause",
"_links"
],
"properties": {
"id": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"managedObjectId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"rootCauseFaultyResource": {
"description": "This type represents the faulty virtual resources that have a negative impact on a VNF.\n",
"type": "object",
"required": [
"faultyResource",
"faultyResourceType"
],
"properties": {
"faultyResource": {
"required": [
"vimConnectionId",
"resourceId"
],
"type": "object",
"description": "This type represents the information that allows addressing a virtualised resource that is used by a VNF instance. Information about the resource is available from the VIM.\n",
"properties": {
"vimConnectionId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"resourceProviderId": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
},
"resourceId": {
"description": "An identifier maintained by the VIM or other resource provider. It is expected to be unique within the VIM instance.\n",
"type": "string"
},
"vimLevelResourceType": {
"description": "Type of the resource in the scope of the VIM or the resource provider.\n",
"type": "string"
}
}
},
"faultyResourceType": {
"description": "The enumeration FaultyResourceType represents those types of faulty resource.\n",
"type": "string",
"enum": [
"COMPUTE",
"STORAGE",
"NETWORK"
]
}
}
},
"alarmRaisedTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"alarmChangedTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"alarmClearedTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"ackState": {
"description": "Acknowledgement state of the alarm. Permitted values: * UNACKNOWLEDGED * ACKNOWLEDGED.\n",
"type": "string",
"enum": [
"UNACKNOWLEDGED",
"ACKNOWLEDGED"
]
},
"perceivedSeverity": {
"description": "Indicates the relative level of urgency for operator attention. * CRITICAL: The Critical severity level indicates that a service affecting condition has occurred and an immediate corrective action\n is required. Such a severity can be reported, for example, when a\n managed object becomes totally out of service and its capability needs\n to be restored (ITU-T Recommendation X.733).\n* MAJOR: The Major severity level indicates that a service affecting condition has developed and an urgent corrective action is required.\n Such a severity can be reported, for example, when there is a severe\n degradation in the capability of the managed object and its full\n capability needs to be restored (ITU-T Recommendation X.733).\n* MINOR: The Minor severity level indicates the existence of a non-service affecting fault condition and that corrective action\n should be taken in order to prevent a more serious (for example,\n service affecting) fault. Such a severity can be reported, for\n example, when the detected alarm condition is not currently degrading\n the capacity of the managed object (ITU-T Recommendation X.733).\n* WARNING: The Warning severity level indicates the detection of a potential or impending service affecting fault, before any significant\n effects have been felt. Action should be taken to further diagnose (if\n necessary) and correct the problem in order to prevent it from\n becoming a more serious service affecting fault (ITU-T Recommendation\n X.733).\n* INDETERMINATE: The Indeterminate severity level indicates that the severity level cannot be determined (ITU-T Recommendation X.733).\n* CLEARED: The Cleared severity level indicates the clearing of one or more previously reported alarms. This alarm clears all alarms for this\n managed object that have the same Alarm type, Probable cause and\n Specific problems (if given) (ITU-T Recommendation X.733).\n",
"type": "string",
"enum": [
"CRITICAL",
"MAJOR",
"MINOR",
"WARNING",
"INDETERMINATE",
"CLEARED"
]
},
"eventTime": {
"description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n",
"type": "string",
"format": "date-time"
},
"eventType": {
"description": "The enumeration EventType represents those types of events that trigger an alarm. * COMMUNICATIONS_ALARM: An alarm of this type is associated with the procedure and/or process required conveying information from one point\n to another (ITU-T Recommendation X.733).\n* PROCESSING_ERROR_ALARM: An alarm of this type is associated with a software or processing fault (ITU-T Recommendation X.733).\n* ENVIRONMENTAL_ALARM: An alarm of this type is associated with a condition related to an enclosure in which the equipment resides\n (ITU-T Recommendation X.733).\n* QOS_ALARM: An alarm of this type is associated with degradation in the quality of a service (ITU-T Recommendation X.733).\n* EQUIPMENT_ALARM: An alarm of this type is associated with an equipment fault (ITU-T Recommendation X.733).\n",
"type": "string",
"enum": [
"COMMUNICATIONS_ALARM",
"PROCESSING_ERROR_ALARM",
"ENVIRONMENTAL_ALARM",
"QOS_ALARM",
"EQUIPMENT_ALARM"
]
},
"faultType": {
"description": "Additional information to clarify the type of the fault.\n",
"type": "string"
},
"probableCause": {
"description": "Information about the probable cause of the fault.\n",
"type": "string"
},
"isRootCause": {
"description": "Attribute indicating if this fault is the root for other correlated alarms. If TRUE, then the alarms listed in the attribute CorrelatedAlarmId are caused by this fault.\n",
"type": "boolean"
},
"correlatedAlarmIds": {
"description": "List of identifiers of other alarms correlated to this fault.\n",
"type": "array",
"items": {
"description": "An identifier with the intention of being globally unique.\n",
"type": "string"
}
},
"faultDetails": {
"description": "Provides additional information about the fault.\n",
"type": "array",
"items": {
"type": "string"
}
},
"_links": {
"description": "Links for this resource.\n",
"type": "object",
"required": [
"self"
],
"properties": {
"self": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
},
"objectInstance": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
}
}
}
}
},
"_links": {
"description": "Links to resources related to this notification.\n",
"type": "object",
"required": [
"subscription"
],
"properties": {
"subscription": {
"description": "This type represents a link to a resource.\n",
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"description": "URI of the referenced resource.\n",
"type": "string",
"format": "url"
}
}
}
}
}
}
}
}
\ No newline at end of file
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "The definition of the general \"ProblemDetails\" data structure from IETF RFC 7807 [19] is reproduced inthis structure. Compared to the general framework defined in IETF RFC 7807 [19], the \"status\" and \"detail\" attributes are mandated to be included by the present document, to ensure that the response contains additional textual information about an error. IETF RFC 7807 [19] foresees extensibility of the \"ProblemDetails\" type. It is possible that particular APIs in the present document, or particular implementations, define extensions to define additional attributes that provide more information about the error. The description column only provides some explanation of the meaning to Facilitate understanding of the design. For a full description, see IETF RFC 7807 [19].\n",
"properties": {
"type": {
"type": "string",
"description": "A URI reference according to IETF RFC 3986 [5] that identifies the problem type. It is encouraged that the URI provides human-readable documentation for the problem (e.g. using HTML) when dereferenced. When this member is not present, its value is assumed to be \"about:blank\".\n",
"format": "URI"
},
"title": {
"type": "string",
"description": "A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem, except for purposes of localization. If type is given and other than \"about:blank\", this attribute shall also be provided. A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive content negotiation; see [RFC7231], Section 3.4).\n"
},
"status": {
"type": "integer",
"description": "The HTTP status code for this occurrence of the problem. The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.\n"
},
"detail": {
"type": "string",
"description": "A human-readable explanation specific to this occurrence of the problem.\n"
},
"instance": {
"type": "string",
"description": "A URI reference that identifies the specific occurrence of the problem. It may yield further information if dereferenced.\n",
"format": "URI"
}
},
"required": [
"status",
"detail"
]
}
\ No newline at end of file
*** Variables ***
${VNFM_HOST} localhost # Hostname of the VNFM
${VNFM_PORT} 8080 # Listening port of the VNFM
${NFVO_HOST} localhost # Hostname of the NFVO
${NFVO_PORT} 8081 # Listening port of the NFVO
${VNFM_SCHEMA} https
${NFVO_SCHEMA} https
${AUTHORIZATION} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE} application/json
${CONTENT_TYPE_PATCH} application/merge-patch+json
${ACCEPT} application/json
${apiRoot} /
${apiName} vnflcm
${apiVersion} v1
${AUTH_USAGE} 1
${WRONG_AUTHORIZATION} Bearer XXXXXWRONGXXXXX
${vnfInstanceId} 6fc3539c-e602-4afa-8e13-962fb5a7d81f
${vnfInstanceName} Test-VnfInstance
${vnfInstanceDescription} description vnf
${vnfInstanceDescription_Update} Updated description vnf
${SINGLE_FILE_VNFD} 1 # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN} text/plain
${ACCEPT_ZIP} application/zip
${vnfPkgId_processing} 007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE} application/octet-stream
${ARTIFACT_ID} artifactId
${WRONG_ACCEPT} application/json
${vnfLcmOpOccId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode} GRACEFUL
${NVFM_DUPLICATION} 0