...
Previous Interaction | Current Interaction | Expectation | Notes | ||
---|---|---|---|---|---|
1 | any operation on rejected for non-existing cm-handle | operation for same non-existing cm-handle | listed in 'rejected' immediately | behavior as normal | |
2 | create operation rejected by DMI | create for same cm-handle/xpath | try again ?! | ||
3 | create pending | create for same cm-handle/xpath | TBD send again or just remain pending?! | ||
4 | create pending | delete for same cm-handle/xpath | |||
5 | delete pending | delete for same cm-handle/xpath | |||
6 | delete pending | create for same cm-handle/xpath | 7 |
Client-Schema Update
Based on Issue#10 , the incoming schema from DME to NCMP :should
- A single subscription contains multiple predicates
- Predicates should be an array of Predicates ( currently a single instance )
- Each predicate contains an array of targets ( cmhandles) - as is.
- Each predicate contains a single datastore (mandatory)
- datastore-xpath-filter should become an array of xpath-filters (instead of pipe separated single string)
...
- DMI record could reach in millions of instances
- In memory solution (ie hazelcast) can handle 10s - 100s of Megabytes (add some sample calc)
- still need persistence if we don't have enough instances
- use many small messages reduce need for amalgamation
- amalgamated string-based solution....
Storage
...
Solutions
Proposed Data Storage
Use a combination of
- Database (yang modelled) for permanent subscription details, subscribers, predicates
- In-Memory (hazelcast) for transient subscription details: state (acceptep, rejected, pending)
Example Flow 1: First Subscription
We have the below configuration managed by CPS-NCMP
# cmhandle dmi-plugin 1 ch-1 dmi-1 2 ch-2 dmi-1 3 ch-3 dmi-2 4 ch-4 dmi-2 5 ch-5 non-responding-dmi
We get a Subscription Create Request with unique subscription-id and a list of predicates(list of targets , datastore and list of filters)
Code Block title Subscription Create Message collapse true { "subscriptionId" : "A-10", "predicates" : [ { "targets": [ch-1,ch-2], "datastore" : "ncmp-datastore:passthrough-operational", "datastore-xpath-filter" : ["p1/c1","p2/c2"] }, { "targets": [ch-3], "datastore" : "ncmp-datastore:passthrough-operational", "datastore-xpath-filter" : ["p3/c3"] } ] }
- We persist the incoming request as is in our persistent store using a relevant subscription model ( this model also needs to be revised )
We also maintain a distributed datastructure in Hazelcast to keep track of the request and response to the client.
SubscriptionId dmi-plugin affectedCmHandles status A-10 dmi-1 ["ch-1","ch-2"] PENDING A-10 dmi-2 ["ch-3"] PENDING - Read the requests from the distributed data structure and form the request for the DMI-Plugin and publish it to the internal kafka channel.
- If the DMI-Plugin responds back within the configured time , so the request will either be ACCEPTED or REJECTED.
- if whole subscription request is ACCEPTED , update the distributed data structure and then store the subscription to the ActiveSubscriptions in cps-cache.
- if whole subscription request is REJECTED , update the distributed data structure and send back the response to the client.
if the DMI Plugin fails to respond then the status would remain PENDING only as there is no change.
SubscriptionId dmi-plugin affectedCmHandles status A-10 dmi-1 ["ch-1","ch-2"] ACCEPTED A-10 dmi-2 ["ch-3"] REJECTED
We store the "ActiveSubscriptions" using a new model which will look like below.
SubscriptionId cmHandle filter datastore A-10 ch-1 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-1 p2/c2 ncmp-datastore:passthrough-operational A-10 ch-2 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-2 p2/c2 ncmp-datastore:passthrough-operational Now based on whatever we have in the distributed map , we will send the response to the clients and may be clear the in-memory structure if required.
...
Example Flow 2: Second Subscription (merge)
We get a new subscription create request.
Code Block language xml title 2nd Subscription Create Message collapse true { "subscriptionId" : "B-52", "predicates" : [ { "targets": [ch-2], "datastore" : "ncmp-datastore:passthrough-operational", "datastore-xpath-filter" : ["p2/c2" , "p3/c3"] } ] }
We now look at the "ActiveSubscriptions" if we already have an active subscription either for a combination of "cmhandle and xpath filter and the datastore".
Current view of ActiveSubscriptionsSubscriptionId cmHandle filter datastore A-10 ch-1 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-1 p2/c2 ncmp-datastore:passthrough-operational A-10 ch-2 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-2 p2/c2 ncmp-datastore:passthrough-operational
Check if we have ch-2 , p2/c2 and ncmp-datastore:passthrough-operational then directly add to the ActiveSubscription.Similarly check for ch-3 , p3/c3 and ncmp-datastore:passthrough-operational ( which in this case will not be directly to the active subscription)Now the state of ActiveSubscription is :
SubscriptionId cmHandle filter datastore A-10 ch-1 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-1 p2/c2 ncmp-datastore:passthrough-operational A-10 ch-2 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-2 p2/c2 ncmp-datastore:passthrough-operational B-52 ch-2 p2/c2 ncmp-datastore:passthrough-operational and state of the in-memory data structure is as follows.
SubscriptionId dmi-plugin affectedCmHandles status B-52 dmi-1 ["ch-2"] PENDING - Now we send the request to DMI plugin (dmi-1) with just the private properties of the ch-2 with the delta xpath.
- DMI Plugin could either apply the whole subscription request or reject the whole subscription. i.e respond with accepted/rejected
Based on the response from DMI plugin the in-memory structure is updated and response is sent back to the clients.
if DMI says it is accepted then :SubscriptionId dmi-plugin affectedCmHandles status B-52 dmi-1 ["ch-2"] ACCEPTED
if DMI says it is rejected then :SubscriptionId dmi-plugin affectedCmHandles status B-52 dmi-1 ["ch-2"] REJECTED
if we get no response within the configured time then :SubscriptionId dmi-plugin affectedCmHandles status B-52 dmi-1 ["ch-2"] PENDING
But we still send some response within the pre-configured time.if the above request was accepted then we should add it to the list of "ActiveSubscriptions" as well.
SubscriptionId cmHandle filter datastore A-10 ch-1 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-1 p2/c2 ncmp-datastore:passthrough-operational A-10 ch-2 p1/c1 ncmp-datastore:passthrough-operational A-10 ch-2 p2/c2 ncmp-datastore:passthrough-operational B-52 ch-2 p2/c2 ncmp-datastore:passthrough-operational B-52 ch-2 p3/c3 ncmp-datastore:passthrough-operational - If the status was accepted/rejected then after sending the response to the client we can clear the in-memory structure for subscriptionId B-52.
Kafka Topics
# | Topic Name | Environment Variable | Source | Destination | Notes |
---|---|---|---|---|---|
1 | subscription | NCMP_CM_AVC_SUBSCRIPTION | DME | DME/Client-Apps | |
2 | ncmp-dmi-cm-avc-subscription-<dmi-name> | NCMP_FORWARD_CM_AVC_SUBSCRIPTION | NCMP | DMI Plugin | |
3 | dmi-ncmp-cm-avc-subscription | NCMP_RESPONSE_CM_AVC_SUBSCRIPTION | DMI Plugin | NCMP | |
4 | subscription-response | NCMP_OUTCOME_CM_AVC_SUBSCRIPTION | NCMP | DME/Client-Apps | |
5 | dmi-cm-events | DMI_CM_EVENTS_TOPIC | DMI Plugin | NCMP | actual data notifications as per the subscriptions |
6 | cm-events | NCMP_CM_EVENTS_TOPIC | NCMP | DME/Client-Apps | NCMP to forward the notifications to the client-apps. |
...