diff --git a/17-subscription-and-notification.md b/17-subscription-and-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..2d532da5c0c6c13e3401908e725b3718488f1356 --- /dev/null +++ b/17-subscription-and-notification.md @@ -0,0 +1,121 @@ +# 17 Subscription and Notification support in OSM + +## Introduction + +[ETSI NFV SOL005](https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/005/02.04.01_60/gs_NFV-SOL005v020401p.pdf) defines a class of Northbound APIs through which entities can subscribe for changes in the Network Service (NS) life-cycle, Network service descriptor (NSD) and Virtual network service descriptor (VNFD). The entities get notified via HTTP REST APIs which those entities expose. + + Since the current support is for NS and NSD, VNFD are in roadmap. For here onwards we will refer subscription and notification for NS. + +- The entities which are interested to know the life-cycle changes of network service are called Subscribers. +- Subscribers receive messages called notifications when an event of their interest occurs. +- SOL005 specifies usage of filters in the registration phase, through which subscribers can select events and NS they are interested in. +- Subscribers can choose the authentication mechanism of their notification receiver endpoint. +- Events need to be notified with very little latency and make them near real-time. +- Deregistration of subscription should be possible however subscribers can not modify existing subscriptions as per SOL005. + +## NS Subscription And Notification + +### Steps for subscription + +Step 1: Get bearer token. + + NBI API: https://:9999/osm/admin/v1/tokens/ + Sample payload + { + "username": "admin", + "password": "admin", + "project": "admin" + } + +Step 2: Select for events for which you are intrested in and prepare payload. + +**Please check the Kafka messages for the filter scenario. If kafka message is not of the format, which contain operation state and operation type. If message does not contain operation state and operation type notification will not be raised.** + +Kafka messages will be improved in future. + + {_admin: {created: 1579592163.561016, modified: 1579592163.561016, projects_read: [ + 894160c9-1ead-4c85-9742-e7453260ea5f], projects_write: [894160c9-1ead-4c85-9742-e7453260ea5f]}, + _id: 5c53f989-defc-4f93-8ab9-93c62136c37e, id: 5c53f989-defc-4f93-8ab9-93c62136c37e, + isAutomaticInvocation: false, isCancelPending: false, lcmOperationType: instantiate, + links: {nsInstance: /osm/nslcm/v1/ns_instances/35f7ae25-2cf6-4a63-8388-a114513198ed, + self: /osm/nslcm/v1/ns_lcm_op_occs/5c53f989-defc-4f93-8ab9-93c62136c37e}, nsInstanceId: 35f7ae25-2cf6-4a63-8388-a114513198ed, + operationParams: {lcmOperationType: instantiate, nsDescription: testing, nsInstanceId: 35f7ae25-2cf6-4a63-8388-a114513198ed, + nsName: check, nsdId: f445b11a-63d8-44b3-85a8-b4b864ccccd6, nsr_id: 35f7ae25-2cf6-4a63-8388-a114513198ed, + ssh_keys: [], vimAccountId: d5d59b88-7015-4f4b-8df6-bd05765cfa25}, operationState: PROCESSING, + startTime: 1579592163.5609882, statusEnteredTime: 1579592163.5609882} + + +Refer ETSI SOL005 document for filter options +[Page no 154](https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/005/02.04.01_60/gs_NFV-SOL005v020401p.pdf) + + Sample payload + { + "filter": { + "nsInstanceSubscriptionFilter": { + "nsdIds": [ + "93b3c041-cac4-4ef3-8ad6-400fbad32a90" + ] + }, + "notificationTypes": [ + "NsLcmOperationOccurrenceNotification" + ], + "operationTypes": [ + "INSTANTIATE" + ], + "operationStates": [ + "PROCESSING" + ] + }, + "CallbackUri": "http://192.168.61.143:5050/notifications", + "authentication": { + "authType": "basic", + "paramsBasic": { + "userName": "user", + "password": "user" + } + } + } + + - This payload implies that, for nsd id 93b3c041-cac4-4ef3-8ad6-400fbad32a90 if operation state is PROCESSING and operation type is INSTANTIATE then, send a notification to http://192.168.61.143:5050/notifications using the "authentication" mechanism whose payload is of datatype NsLcmOperationOccurrenceNotification. + +Step 3: Send an HTTPS POST request to create subscription. + - Add the bearer token as authentication parameter from step 1. + - Payload from step 2 to https://:9999/osm/nslcm/v1/subscriptions + +Step 4: Verify successful regestration of subscription via HTTPS GET https://:9999/osm/nslcm/v1/subscriptions + +### Steps for notification + +Step 1: Create an event in osm satisfying the filter criteria. + + example: Launch any ns. + This event has operation state as PROCESSING and operation type as INSTANTIATE, when network service is just launched. + +Step 2: See the notification in notification recevier. + + +## Current support and future roadmap + +### Current support + + - Subscriptions for NS lifecycle​ + + - JSON schema validation.​ + - Pre-chech of notification endpoint.​ + - Duplicate subscription detection. + + - Notifications for NS lifecycle​ + + - SOL005 compliant structure for each subscriber according to their filters and authentication types.​ + - POST events to notification endpoints.​- Retry and backoff for failed notifications.​ + + + +### Future roadmap +- Integration of subscription steps in NG-UI. +- Support for OAuth and TLS authentication types for notification endpoint.​ +- Support for subscription and notification for NSD. +- Support for subscription and notification for VNFD. +- Cache to store subscribers.​ + +