SlideShare a Scribd company logo
1 of 32
1©2015 Tail-f Systems all rights reservedFebruary 13, 2015
CDB Subscribers
2©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Triggers when
anything in
scope changes
Subscribe to Configuration Changes
subsock = socket(PF_INET, SOCK_STREAM, 0);
cdb_connect(subsock, CDB_SUBSCRIPTION_SOCKET, &confd, size);
cdb_subscribe(subsock, 3, dhcpd__ns, &spoint, "/dhcp");
cdb_subscribe_done(subsock);
/ dhcp/
aaa/
voip/
defaultLe…
maxLeas…
SubNets/ subNet/
mask
range
lowAddr
highAddr
logFacility
net
Managed Objects typically have
several subscription points
3©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Enter Event Loop
• Event loop needs to monitor subscription socket
• Typically using poll()/select()
while(1) {
set[0].fd = subsock;
set[0].events = POLLIN;
set[0].revents = 0;
poll(set, 1, -1); // Monitor one socket, wait forever
if (set[0].revents & POLLIN) {
cdb_read_subscription_socket(subsock, sub_points, &reslen);
// React on changes here…
// sub_points[] contains triggering subscription points,
// reslen how many
}
cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY);
}
4©2015 Tail-f Systems all rights reservedFebruary 13, 2015
React to Configuration Changes
• Triggered subscription means something in scope changed, but will not tell us
what (nor to what value)
• To find out more, read all or start a diff walk
/ dhcp/
aaa/
voip/
defaultLe…
maxLeas…
SubNets/ subNet/
mask
range
lowAddr
highAddr
logFacility
net
?
?
5©2015 Tail-f Systems all rights reservedFebruary 13, 2015
React to Configuration Changes
Left extreme:
On any change, read all
configuration
• Linux daemon style
• Simple to program
• Simple to test
• Maximum code reuse
• Robust
Right extreme:
On any change, look at
every changed element
• NET-SNMP agent style
• In some cases very much
more efficient
6©2015 Tail-f Systems all rights reservedFebruary 13, 2015
React to Configuration Changes
Left extreme:
void startup() {
init_obj_A();
init_obj_B();
init_obj_C();
}
void handle_change() {
if(trigger_A) init_obj_A();
if(trigger_B) init_obj_B();
if(trigger_C) init_obj_C();
}
Right extreme:
void startup() {
init_obj_A();
init_obj_B();
init_obj_C();
}
void handle_change() {
cdb_diff_iterate(…iterator…);
}
void iterator(…keypath…) {
if(keypath is field /dhcp/logFacility)
...
if(keypath is field /…) …
7©2015 Tail-f Systems all rights reservedFebruary 13, 2015
React to Configuration Changes
No need to be extreme
Use balanced approach
Walk the diff when it makes sense, but not down to
individual leaf elements
Use multiple subscription points
• Simple to program with high degree of reuse
• Simple to test
• Robust
• Efficient
8©2015 Tail-f Systems all rights reservedFebruary 13, 2015
React to Configuration Changes
void startup() {
init_obj_A();
n = cdb_num_instances(“/B”);
for(i=0; i<n; i++)
init_obj_B(i);
init_obj_C();
}
void handle_change() {
if(trigger_A) init_obj_A();
if(trigger_B)
cdb_diff_iterate(…iterator_B…)
if(trigger_C) init_obj_C();
}
void iterator_B(…keypath…) {
table_row = extract_row(keypath);
init_obj_B(table_row);
return ITER_CONTINUE;
}
9©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Walking the Diff in a Balanced Way
Find the right level of granularity for your subscriptions and diff walks
/ dhcp/
aaa/
voip/
defaultLe…
maxLeas…
SubNets/ subNet/
mask
range
lowAddr
highAddr
logFacility
net
10©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Walking the Diff in a Balanced Way
Event loop with balanced approach
while(1) {
set[0].fd = subsock;
set[0].events = POLLIN;
set[0].revents = 0;
poll(set, 1, -1); // Monitor one socket, wait forever
if (set[0].revents & POLLIN) {
cdb_read_subscription_socket(subsock, sub_points, &reslen);
for(i=0; i<reslen; i++) {
if(…) cdb_diff_iterate(subsock, sub_points[i], iter, ITER_WANT_PREV, 0);
else if(…) init_A();
}
}
cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY);
}
11©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Walking the Diff in a Balanced Way
An iterator function might look like this
static enum cdb_iter_ret iter(confd_hkeypath_t *kp, enum cdb_iter_op op,
confd_value_t *oldv, confd_value_t *newv, void *state)
{
switch (op) {
case MOP_CREATED: {
confd_value_t *ctag = &kp->v[1][0];
switch (CONFD_GET_XMLTAG(ctag)) {
case root_RFHead: { // an rfhead was created
// keypath is /root/NodeB/RFHead{$key}
// 3 2 1 0
confd_value_t *hkey = &kp->v[0][0];
read_head(cdbsock, hkey);
return ITER_CONTINUE;
12©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Walking the Diff in a Balanced Way
• Each item seen by the iterator function is one of
• MOP_CREATED – container or leaf created
• MOP_DELETED – container or leaf deleted
• MOP_MODIFIED – container where a child element has been
created/deleted/set
• MOP_VALUE_SET – leaf that has been set
• MOP_MOVED_AFTER – list element that was moved
• Each time iterator function returns
• ITER_RECURSE – examine changes to child elements
• ITER_CONTINUE – skip changes to child elements
• ITER_UP – skip changes to child and sibling elements
• ITER_SUSPEND – suspend the iteration temporarily
• ITER_STOP – stop iteration now
13©2015 Tail-f Systems all rights reservedFebruary 13, 2015
int main(…) {
cdb_subscribe(subsock, 3, root__ns,
&headpoint,"/root/NodeB/RFHead”);
…
if (set[0].revents & POLLIN) {
cdb_diff_iterate(…, iter, …);
}
}
static enum cdb_iter_ret iter(…) {
…
switch (op) {
case MOP_CREATED: {
fprintf(stderr, "Create: %sn",…);
…
return ITER_CONTINUE;
Diff Walk Example
container root {
container NodeB {
list RFHead {
key dn;
leaf dn { type int64; }
leaf SECTORID_ID {
type string; default "N/A";
}
list Child {
key cdn;
leaf cdn { type int64; }
leaf childAttr {
type string; default "N/A";
}
}
}
}
}
14©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Create Object with Attribute
% set root NodeB RFHead 2 SECTOR_ID 2
% commit
Create: /root/NodeB/RFHead{2}
ITER_CONTINUE
15©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Modify Attribute of Object
% set root NodeB RFHead 2 SECTOR_ID 5
% commit
Modified /root/NodeB/RFHead{2}
ITER_RECURSE
Value Set: /root/NodeB/RFHead{2}/SECTORID_ID --> (5)
ITER_CONTINUE
16©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Create Object with Child Object
% set root NodeB RFHead 3 Child 1 childAttr 1
% commit
Create: /root/NodeB/RFHead{3}
ITER_CONTINUE
17©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Create additional Child Object
% set root NodeB RFHead 3 Child 2 childAttr 2
% set root NodeB RFHead 4 Child 2 childAttr 2
% commit
Modified /root/NodeB/RFHead{3}
ITER_RECURSE
Create: /root/NodeB/RFHead{3}/Child{2}
ITER_CONTINUE
Create: /root/NodeB/RFHead{4}
ITER_CONTINUE
18©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Set Attribute of Child Object
% set root NodeB RFHead 3 Child 2 childAttr 32
% commit
Modified /root/NodeB/RFHead{3}
ITER_RECURSE
Modified /root/NodeB/RFHead{3}/Child{2}
ITER_RECURSE
Value Set: /root/NodeB/RFHead{3}/Child{2}/childAttr --> (32)
ITER_CONTINUE
19©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Delete Child Object
% delete root NodeB RFHead 3 Child 1
% commit
Modified /root/NodeB/RFHead{3}
ITER_RECURSE
Delete: /root/NodeB/RFHead{3}/Child{1}
ITER_CONTINUE
20©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Delete Everything
% delete root
% commit
Delete: /root/NodeB/RFHead{2}
ITER_CONTINUE
Delete: /root/NodeB/RFHead{3}
ITER_CONTINUE
21©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Hashed Key Path (hkeypath)
• To make it easy to program (not necessarily learn)
• To make it efficient
• Encoded as two dimensional array
/root/NodeB/RFHead{1} would be encoded
• kp[0][0] contains ‘1’
• kp[1][0] contains ‘RFHead’
[0][] [1][] [2][] [3][] [4][]
[][0] INT32
‘1’
XMLTAG ‘RFHead’ XMLTAG
‘NodeB’
XMLTAG
‘root’
NOEXISTS
[][1] NOEXISTS NOEXISTS NOEXISTS NOEXISTS NOEXISTS
22©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Hashed Key Path (hkeypath)
• The second index is for multiple keys
/routes/route{12.60.0.0 16}/enabled would be encoded
• kp[1][0] contains ’12.60.0.0’
• kp[1][1] contains ‘16’
• There may be up to 8 keys in any table
• I.e. second index ranges from 0 up to possibly 7
[0][] [1][] [2][] [3][] [4][]
[][0
]
XMLTAG
‘enabled’
IPV4
‘12.60.0.0’
XMLTAG
‘route’
XMLTAG
‘routes’
NOEXISTS
[][1
]
NOEXISTS INT8
’16’
NOEXISTS NOEXISTS NOEXISTS
23©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Hashed Key Path (hkeypath)
• Sequence of XMLTAG hash values
• An XMLTAG is encoded as a 31-bit integer
• Not as strings: variable length, inefficient with string compare
• Hash function ensures same string always gets same value
• Collisions are rare (we have never seen one to date)
• Use idValue attribute in data model in case of collision
• This allows efficient and easy switch-case statements
switch (CONFD_GET_XMLTAG(ctag)) {
case root_RFHead: { // an rfhead was created
• Header file contains all the hash-constants
• Header file generated from data model using confdc
24©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Ensuring Changes happen in Order
• Consider transaction A
• Add interface eth5
Add route 55.66.0.0/18 over interface eth5
• Transactions are all-at-once, there is no internal ordering
• Transaction A is therefore equivalent to
• Add route 55.66.0.0/24 over interface eth5
Add interface eth5
25©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Ensuring Changes happen in Order
• Consider transaction A
• Add interface eth5
Add route 55.66.0.0/18 over interface eth5
• Still, in our code, the interface subsystem must be informed of this change before the
routing subsystem
• The routing subsystem will call the interface subsystem referencing eth5
• This dependency information is encoded in
cdb_subscribe(subsock, 20, dhcpd__ns, &spoint, ”/interfaces");
cdb_subscribe(subsock, 30, dhcpd__ns, &spoint, ”/routes");
cdb_subscribe_done(subsock);
26©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Ensuring Changes happen in Order
• Consider then transaction B
• Delete interface eth5
Delete route 55.66.0.0/24 over interface eth5
• In this case the ordering must be reversed
• Again, the routing subsystem will call the interface subsystem and reference eth5
• This is handled by adding more subscription points
// This subscription handles additions and modification of interfaces
cdb_subscribe(subsock, 20, dhcpd__ns, &spoint1, ”/interfaces");
cdb_subscribe(subsock, 30, dhcpd__ns, &spoint2, ”/routes");
// This subscription handles deletes of interfaces
cdb_subscribe(subsock, 40, dhcpd__ns, &spoint3, ”/interfaces");
cdb_subscribe_done(subsock);
27©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Ensuring Changes happen in Order
Event loop with balanced approach
while(1) {
set[0].fd = subsock;
set[0].events = POLLIN;
set[0].revents = 0;
poll(set, 1, -1); // Monitor one socket, wait forever
if (set[0].revents & POLLIN) {
cdb_read_subscription_socket(subsock, sub_points, &reslen);
for(i=0; i<reslen; i++) {
if(…) cdb_diff_iterate(subsock, sub_points[i], iter, ITER_WANT_PREV, 0);
else if(…) init_A();
}
}
cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY);
}
28©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Application Initialization / Start Order
• Read, Subscribe
• Protect using read session or operators locked out
• Potentially more efficient than trigger method
• Subscribe, Each application triggers its own subscriptions
• Must be able to handle all configuration changes anyway
• Subscribe, Startup process triggers all subscriptions
• Good at system start when all processes start at the same time
• Subscribe, System process triggers restarting app subscriptions
• Can handle all scenarios
29©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Yang
Validation
Application
Validation
Prepare
Phase
Notify
Applications
Commit
Phase
Point of No Return
After the Point of No Return the transaction cannot be aborted.
• Make sure you validate properly before Point of No Return
• If an application fails after this point, treat it the same regardless of it happening
2 ms/minutes/weeks after commit
Operator
types/clicks
commit
Operator gets OK
and next prompt
Point of
No Return
30©2015 Tail-f Systems all rights reservedFebruary 13, 2015
Yang
Validation
Application
Validation
Prepare
Phase
Notify
Applications
Commit
Phase
Validators and Two Phase Subscribers
Resource reservation can be handled by a
Two Phase Subscriber
• Called during Prepare Phase
• Will get an aborted
callback if transaction
aborted
• Uses cdb_subscribe() mechanism
with an extra flag
• Don’t activate, just check in prepare
MO
Changes that
might happen
Changes that did
happen
31©2015 Tail-f Systems all rights reservedFebruary 13, 2015
ConfD CDB Subscription Handling Examples
• examples.confd/intro/1-2-3-start-query-model
• examples.confd/cdb_subscription/iter
• examples.confd/cdb_subscription/trigger
• examples.confd/cdb_subscription/twophase
32©2015 Tail-f Systems all rights reservedFebruary 13, 2015

More Related Content

What's hot

FlixBus Ride with Snowflake
FlixBus Ride with SnowflakeFlixBus Ride with Snowflake
FlixBus Ride with SnowflakeTaras Slipets
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGTail-f Systems
 
nftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewallnftables - the evolution of Linux Firewall
nftables - the evolution of Linux FirewallMarian Marinov
 
Building Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFiBuilding Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFiBryan Bende
 
Integration and Interoperation of existing Nexus networks into an ACI Archite...
Integration and Interoperation of existing Nexus networks into an ACI Archite...Integration and Interoperation of existing Nexus networks into an ACI Archite...
Integration and Interoperation of existing Nexus networks into an ACI Archite...Cisco Canada
 
Getting started with YANG
Getting started with YANGGetting started with YANG
Getting started with YANGCoreStack
 
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介Juniper Networks (日本)
 
MP BGP-EVPN 실전기술-1편(개념잡기)
MP BGP-EVPN 실전기술-1편(개념잡기)MP BGP-EVPN 실전기술-1편(개념잡기)
MP BGP-EVPN 실전기술-1편(개념잡기)JuHwan Lee
 
What's Coming in CloudStack 4.19
What's Coming in CloudStack 4.19What's Coming in CloudStack 4.19
What's Coming in CloudStack 4.19ShapeBlue
 
Git Introduction
Git IntroductionGit Introduction
Git IntroductionGareth Hall
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...Jitendra Bafna
 
OpenFlow 1.5.1
OpenFlow 1.5.1OpenFlow 1.5.1
OpenFlow 1.5.1jungbh
 
SDN Architecture & Ecosystem
SDN Architecture & EcosystemSDN Architecture & Ecosystem
SDN Architecture & EcosystemKingston Smiler
 
Anypoint platform architecture and components
Anypoint platform architecture and componentsAnypoint platform architecture and components
Anypoint platform architecture and componentsD.Rajesh Kumar
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast EssentialsRahul Gupta
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Krishna-Kumar
 
VXLAN and FRRouting
VXLAN and FRRoutingVXLAN and FRRouting
VXLAN and FRRoutingFaisal Reza
 
Summit 16: ETSI NFV Interface and Architecture Overview
Summit 16: ETSI NFV Interface and Architecture OverviewSummit 16: ETSI NFV Interface and Architecture Overview
Summit 16: ETSI NFV Interface and Architecture OverviewOPNFV
 

What's hot (20)

FlixBus Ride with Snowflake
FlixBus Ride with SnowflakeFlixBus Ride with Snowflake
FlixBus Ride with Snowflake
 
A 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANGA 30-minute Introduction to NETCONF and YANG
A 30-minute Introduction to NETCONF and YANG
 
nftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewallnftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewall
 
Building Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFiBuilding Data Pipelines for Solr with Apache NiFi
Building Data Pipelines for Solr with Apache NiFi
 
NETCONF YANG tutorial
NETCONF YANG tutorialNETCONF YANG tutorial
NETCONF YANG tutorial
 
Integration and Interoperation of existing Nexus networks into an ACI Archite...
Integration and Interoperation of existing Nexus networks into an ACI Archite...Integration and Interoperation of existing Nexus networks into an ACI Archite...
Integration and Interoperation of existing Nexus networks into an ACI Archite...
 
Getting started with YANG
Getting started with YANGGetting started with YANG
Getting started with YANG
 
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介
【Interop Tokyo 2022】ここが見どころ!ジュニパーのShowNetにおける取組みご紹介
 
MP BGP-EVPN 실전기술-1편(개념잡기)
MP BGP-EVPN 실전기술-1편(개념잡기)MP BGP-EVPN 실전기술-1편(개념잡기)
MP BGP-EVPN 실전기술-1편(개념잡기)
 
Kubeflow
KubeflowKubeflow
Kubeflow
 
What's Coming in CloudStack 4.19
What's Coming in CloudStack 4.19What's Coming in CloudStack 4.19
What's Coming in CloudStack 4.19
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
OpenFlow 1.5.1
OpenFlow 1.5.1OpenFlow 1.5.1
OpenFlow 1.5.1
 
SDN Architecture & Ecosystem
SDN Architecture & EcosystemSDN Architecture & Ecosystem
SDN Architecture & Ecosystem
 
Anypoint platform architecture and components
Anypoint platform architecture and componentsAnypoint platform architecture and components
Anypoint platform architecture and components
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast Essentials
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!
 
VXLAN and FRRouting
VXLAN and FRRoutingVXLAN and FRRouting
VXLAN and FRRouting
 
Summit 16: ETSI NFV Interface and Architecture Overview
Summit 16: ETSI NFV Interface and Architecture OverviewSummit 16: ETSI NFV Interface and Architecture Overview
Summit 16: ETSI NFV Interface and Architecture Overview
 

Viewers also liked

Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Kentaro Ebisawa
 
Dynamic Service Chaining
Dynamic Service Chaining Dynamic Service Chaining
Dynamic Service Chaining Tail-f Systems
 
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Systems
 
Module 11: Operational Data Providers
Module 11: Operational Data ProvidersModule 11: Operational Data Providers
Module 11: Operational Data ProvidersTail-f Systems
 
Module 8: C Data Types
Module 8: C Data TypesModule 8: C Data Types
Module 8: C Data TypesTail-f Systems
 
Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Tail-f Systems
 
Module 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceModule 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceTail-f Systems
 
Module 7: Installation and Getting Started
Module 7: Installation and Getting StartedModule 7: Installation and Getting Started
Module 7: Installation and Getting StartedTail-f Systems
 

Viewers also liked (9)

Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16Open Network OS Overview as of 2015/10/16
Open Network OS Overview as of 2015/10/16
 
Dynamic Service Chaining
Dynamic Service Chaining Dynamic Service Chaining
Dynamic Service Chaining
 
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANGTail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
Tail-f Webinar OpenFlow Switch Management Using NETCONF and YANG
 
Module 11: Operational Data Providers
Module 11: Operational Data ProvidersModule 11: Operational Data Providers
Module 11: Operational Data Providers
 
Module 8: C Data Types
Module 8: C Data TypesModule 8: C Data Types
Module 8: C Data Types
 
Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View Webinar: Applying REST to Network Management – An Implementor’s View
Webinar: Applying REST to Network Management – An Implementor’s View
 
Tail-f - Why NETCONF
Tail-f - Why NETCONFTail-f - Why NETCONF
Tail-f - Why NETCONF
 
Module 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound InterfaceModule 12: NETCONF Northbound Interface
Module 12: NETCONF Northbound Interface
 
Module 7: Installation and Getting Started
Module 7: Installation and Getting StartedModule 7: Installation and Getting Started
Module 7: Installation and Getting Started
 

Similar to Module 10: CDB Subscribers

MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015Mayank Prasad
 
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...Gilles Fedak
 
Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Eugenio Minardi
 
리눅스 드라이버 실습 #3
리눅스 드라이버 실습 #3리눅스 드라이버 실습 #3
리눅스 드라이버 실습 #3Sangho Park
 
MySQL performance webinar
MySQL performance webinarMySQL performance webinar
MySQL performance webinarAbel Flórez
 
Git ops & Continuous Infrastructure with terra*
Git ops  & Continuous Infrastructure with terra*Git ops  & Continuous Infrastructure with terra*
Git ops & Continuous Infrastructure with terra*Haggai Philip Zagury
 
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…Atwix
 
C++ Generators and Property-based Testing
C++ Generators and Property-based TestingC++ Generators and Property-based Testing
C++ Generators and Property-based TestingSumant Tambe
 
La programmation concurrente par flux de données
La programmation concurrente par flux de donnéesLa programmation concurrente par flux de données
La programmation concurrente par flux de donnéesMicrosoft
 
Application High Availability and Upgrades Using Oracle GoldenGate
Application High Availability and Upgrades Using Oracle GoldenGateApplication High Availability and Upgrades Using Oracle GoldenGate
Application High Availability and Upgrades Using Oracle GoldenGateShane Borden
 
Replication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-finalReplication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-finalSujatha Sivakumar
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE studentsQuhan Arunasalam
 
Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)Martin Schütte
 
JavaOne 2015: From Java Code to Machine Code
JavaOne 2015: From Java Code to Machine CodeJavaOne 2015: From Java Code to Machine Code
JavaOne 2015: From Java Code to Machine CodeChris Bailey
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréXebia Nederland BV
 
리눅스 드라이버 #2
리눅스 드라이버 #2리눅스 드라이버 #2
리눅스 드라이버 #2Sangho Park
 
Ronalao termpresent
Ronalao termpresentRonalao termpresent
Ronalao termpresentElma Belitz
 

Similar to Module 10: CDB Subscribers (20)

MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015MySQL Performance Schema, Open Source India, 2015
MySQL Performance Schema, Open Source India, 2015
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...
Active Data: Managing Data-Life Cycle on Heterogeneous Systems and Infrastruc...
 
Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)
 
리눅스 드라이버 실습 #3
리눅스 드라이버 실습 #3리눅스 드라이버 실습 #3
리눅스 드라이버 실습 #3
 
MySQL performance webinar
MySQL performance webinarMySQL performance webinar
MySQL performance webinar
 
Git ops & Continuous Infrastructure with terra*
Git ops  & Continuous Infrastructure with terra*Git ops  & Continuous Infrastructure with terra*
Git ops & Continuous Infrastructure with terra*
 
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
Happy Together: Creating Successful Magento ERP Integrations | Imagine 2013…
 
C++ Generators and Property-based Testing
C++ Generators and Property-based TestingC++ Generators and Property-based Testing
C++ Generators and Property-based Testing
 
La programmation concurrente par flux de données
La programmation concurrente par flux de donnéesLa programmation concurrente par flux de données
La programmation concurrente par flux de données
 
Application High Availability and Upgrades Using Oracle GoldenGate
Application High Availability and Upgrades Using Oracle GoldenGateApplication High Availability and Upgrades Using Oracle GoldenGate
Application High Availability and Upgrades Using Oracle GoldenGate
 
Replication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-finalReplication featuresinmysql5.7andbeyond osi-final
Replication featuresinmysql5.7andbeyond osi-final
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE students
 
Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)Writing Ansible Modules (DENOG11)
Writing Ansible Modules (DENOG11)
 
JavaOne 2015: From Java Code to Machine Code
JavaOne 2015: From Java Code to Machine CodeJavaOne 2015: From Java Code to Machine Code
JavaOne 2015: From Java Code to Machine Code
 
Smpe
SmpeSmpe
Smpe
 
Smpe
SmpeSmpe
Smpe
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
 
리눅스 드라이버 #2
리눅스 드라이버 #2리눅스 드라이버 #2
리눅스 드라이버 #2
 
Ronalao termpresent
Ronalao termpresentRonalao termpresent
Ronalao termpresent
 

Recently uploaded

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Recently uploaded (20)

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Module 10: CDB Subscribers

  • 1. 1©2015 Tail-f Systems all rights reservedFebruary 13, 2015 CDB Subscribers
  • 2. 2©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Triggers when anything in scope changes Subscribe to Configuration Changes subsock = socket(PF_INET, SOCK_STREAM, 0); cdb_connect(subsock, CDB_SUBSCRIPTION_SOCKET, &confd, size); cdb_subscribe(subsock, 3, dhcpd__ns, &spoint, "/dhcp"); cdb_subscribe_done(subsock); / dhcp/ aaa/ voip/ defaultLe… maxLeas… SubNets/ subNet/ mask range lowAddr highAddr logFacility net Managed Objects typically have several subscription points
  • 3. 3©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Enter Event Loop • Event loop needs to monitor subscription socket • Typically using poll()/select() while(1) { set[0].fd = subsock; set[0].events = POLLIN; set[0].revents = 0; poll(set, 1, -1); // Monitor one socket, wait forever if (set[0].revents & POLLIN) { cdb_read_subscription_socket(subsock, sub_points, &reslen); // React on changes here… // sub_points[] contains triggering subscription points, // reslen how many } cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY); }
  • 4. 4©2015 Tail-f Systems all rights reservedFebruary 13, 2015 React to Configuration Changes • Triggered subscription means something in scope changed, but will not tell us what (nor to what value) • To find out more, read all or start a diff walk / dhcp/ aaa/ voip/ defaultLe… maxLeas… SubNets/ subNet/ mask range lowAddr highAddr logFacility net ? ?
  • 5. 5©2015 Tail-f Systems all rights reservedFebruary 13, 2015 React to Configuration Changes Left extreme: On any change, read all configuration • Linux daemon style • Simple to program • Simple to test • Maximum code reuse • Robust Right extreme: On any change, look at every changed element • NET-SNMP agent style • In some cases very much more efficient
  • 6. 6©2015 Tail-f Systems all rights reservedFebruary 13, 2015 React to Configuration Changes Left extreme: void startup() { init_obj_A(); init_obj_B(); init_obj_C(); } void handle_change() { if(trigger_A) init_obj_A(); if(trigger_B) init_obj_B(); if(trigger_C) init_obj_C(); } Right extreme: void startup() { init_obj_A(); init_obj_B(); init_obj_C(); } void handle_change() { cdb_diff_iterate(…iterator…); } void iterator(…keypath…) { if(keypath is field /dhcp/logFacility) ... if(keypath is field /…) …
  • 7. 7©2015 Tail-f Systems all rights reservedFebruary 13, 2015 React to Configuration Changes No need to be extreme Use balanced approach Walk the diff when it makes sense, but not down to individual leaf elements Use multiple subscription points • Simple to program with high degree of reuse • Simple to test • Robust • Efficient
  • 8. 8©2015 Tail-f Systems all rights reservedFebruary 13, 2015 React to Configuration Changes void startup() { init_obj_A(); n = cdb_num_instances(“/B”); for(i=0; i<n; i++) init_obj_B(i); init_obj_C(); } void handle_change() { if(trigger_A) init_obj_A(); if(trigger_B) cdb_diff_iterate(…iterator_B…) if(trigger_C) init_obj_C(); } void iterator_B(…keypath…) { table_row = extract_row(keypath); init_obj_B(table_row); return ITER_CONTINUE; }
  • 9. 9©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Walking the Diff in a Balanced Way Find the right level of granularity for your subscriptions and diff walks / dhcp/ aaa/ voip/ defaultLe… maxLeas… SubNets/ subNet/ mask range lowAddr highAddr logFacility net
  • 10. 10©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Walking the Diff in a Balanced Way Event loop with balanced approach while(1) { set[0].fd = subsock; set[0].events = POLLIN; set[0].revents = 0; poll(set, 1, -1); // Monitor one socket, wait forever if (set[0].revents & POLLIN) { cdb_read_subscription_socket(subsock, sub_points, &reslen); for(i=0; i<reslen; i++) { if(…) cdb_diff_iterate(subsock, sub_points[i], iter, ITER_WANT_PREV, 0); else if(…) init_A(); } } cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY); }
  • 11. 11©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Walking the Diff in a Balanced Way An iterator function might look like this static enum cdb_iter_ret iter(confd_hkeypath_t *kp, enum cdb_iter_op op, confd_value_t *oldv, confd_value_t *newv, void *state) { switch (op) { case MOP_CREATED: { confd_value_t *ctag = &kp->v[1][0]; switch (CONFD_GET_XMLTAG(ctag)) { case root_RFHead: { // an rfhead was created // keypath is /root/NodeB/RFHead{$key} // 3 2 1 0 confd_value_t *hkey = &kp->v[0][0]; read_head(cdbsock, hkey); return ITER_CONTINUE;
  • 12. 12©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Walking the Diff in a Balanced Way • Each item seen by the iterator function is one of • MOP_CREATED – container or leaf created • MOP_DELETED – container or leaf deleted • MOP_MODIFIED – container where a child element has been created/deleted/set • MOP_VALUE_SET – leaf that has been set • MOP_MOVED_AFTER – list element that was moved • Each time iterator function returns • ITER_RECURSE – examine changes to child elements • ITER_CONTINUE – skip changes to child elements • ITER_UP – skip changes to child and sibling elements • ITER_SUSPEND – suspend the iteration temporarily • ITER_STOP – stop iteration now
  • 13. 13©2015 Tail-f Systems all rights reservedFebruary 13, 2015 int main(…) { cdb_subscribe(subsock, 3, root__ns, &headpoint,"/root/NodeB/RFHead”); … if (set[0].revents & POLLIN) { cdb_diff_iterate(…, iter, …); } } static enum cdb_iter_ret iter(…) { … switch (op) { case MOP_CREATED: { fprintf(stderr, "Create: %sn",…); … return ITER_CONTINUE; Diff Walk Example container root { container NodeB { list RFHead { key dn; leaf dn { type int64; } leaf SECTORID_ID { type string; default "N/A"; } list Child { key cdn; leaf cdn { type int64; } leaf childAttr { type string; default "N/A"; } } } } }
  • 14. 14©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Create Object with Attribute % set root NodeB RFHead 2 SECTOR_ID 2 % commit Create: /root/NodeB/RFHead{2} ITER_CONTINUE
  • 15. 15©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Modify Attribute of Object % set root NodeB RFHead 2 SECTOR_ID 5 % commit Modified /root/NodeB/RFHead{2} ITER_RECURSE Value Set: /root/NodeB/RFHead{2}/SECTORID_ID --> (5) ITER_CONTINUE
  • 16. 16©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Create Object with Child Object % set root NodeB RFHead 3 Child 1 childAttr 1 % commit Create: /root/NodeB/RFHead{3} ITER_CONTINUE
  • 17. 17©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Create additional Child Object % set root NodeB RFHead 3 Child 2 childAttr 2 % set root NodeB RFHead 4 Child 2 childAttr 2 % commit Modified /root/NodeB/RFHead{3} ITER_RECURSE Create: /root/NodeB/RFHead{3}/Child{2} ITER_CONTINUE Create: /root/NodeB/RFHead{4} ITER_CONTINUE
  • 18. 18©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Set Attribute of Child Object % set root NodeB RFHead 3 Child 2 childAttr 32 % commit Modified /root/NodeB/RFHead{3} ITER_RECURSE Modified /root/NodeB/RFHead{3}/Child{2} ITER_RECURSE Value Set: /root/NodeB/RFHead{3}/Child{2}/childAttr --> (32) ITER_CONTINUE
  • 19. 19©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Delete Child Object % delete root NodeB RFHead 3 Child 1 % commit Modified /root/NodeB/RFHead{3} ITER_RECURSE Delete: /root/NodeB/RFHead{3}/Child{1} ITER_CONTINUE
  • 20. 20©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Delete Everything % delete root % commit Delete: /root/NodeB/RFHead{2} ITER_CONTINUE Delete: /root/NodeB/RFHead{3} ITER_CONTINUE
  • 21. 21©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Hashed Key Path (hkeypath) • To make it easy to program (not necessarily learn) • To make it efficient • Encoded as two dimensional array /root/NodeB/RFHead{1} would be encoded • kp[0][0] contains ‘1’ • kp[1][0] contains ‘RFHead’ [0][] [1][] [2][] [3][] [4][] [][0] INT32 ‘1’ XMLTAG ‘RFHead’ XMLTAG ‘NodeB’ XMLTAG ‘root’ NOEXISTS [][1] NOEXISTS NOEXISTS NOEXISTS NOEXISTS NOEXISTS
  • 22. 22©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Hashed Key Path (hkeypath) • The second index is for multiple keys /routes/route{12.60.0.0 16}/enabled would be encoded • kp[1][0] contains ’12.60.0.0’ • kp[1][1] contains ‘16’ • There may be up to 8 keys in any table • I.e. second index ranges from 0 up to possibly 7 [0][] [1][] [2][] [3][] [4][] [][0 ] XMLTAG ‘enabled’ IPV4 ‘12.60.0.0’ XMLTAG ‘route’ XMLTAG ‘routes’ NOEXISTS [][1 ] NOEXISTS INT8 ’16’ NOEXISTS NOEXISTS NOEXISTS
  • 23. 23©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Hashed Key Path (hkeypath) • Sequence of XMLTAG hash values • An XMLTAG is encoded as a 31-bit integer • Not as strings: variable length, inefficient with string compare • Hash function ensures same string always gets same value • Collisions are rare (we have never seen one to date) • Use idValue attribute in data model in case of collision • This allows efficient and easy switch-case statements switch (CONFD_GET_XMLTAG(ctag)) { case root_RFHead: { // an rfhead was created • Header file contains all the hash-constants • Header file generated from data model using confdc
  • 24. 24©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Ensuring Changes happen in Order • Consider transaction A • Add interface eth5 Add route 55.66.0.0/18 over interface eth5 • Transactions are all-at-once, there is no internal ordering • Transaction A is therefore equivalent to • Add route 55.66.0.0/24 over interface eth5 Add interface eth5
  • 25. 25©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Ensuring Changes happen in Order • Consider transaction A • Add interface eth5 Add route 55.66.0.0/18 over interface eth5 • Still, in our code, the interface subsystem must be informed of this change before the routing subsystem • The routing subsystem will call the interface subsystem referencing eth5 • This dependency information is encoded in cdb_subscribe(subsock, 20, dhcpd__ns, &spoint, ”/interfaces"); cdb_subscribe(subsock, 30, dhcpd__ns, &spoint, ”/routes"); cdb_subscribe_done(subsock);
  • 26. 26©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Ensuring Changes happen in Order • Consider then transaction B • Delete interface eth5 Delete route 55.66.0.0/24 over interface eth5 • In this case the ordering must be reversed • Again, the routing subsystem will call the interface subsystem and reference eth5 • This is handled by adding more subscription points // This subscription handles additions and modification of interfaces cdb_subscribe(subsock, 20, dhcpd__ns, &spoint1, ”/interfaces"); cdb_subscribe(subsock, 30, dhcpd__ns, &spoint2, ”/routes"); // This subscription handles deletes of interfaces cdb_subscribe(subsock, 40, dhcpd__ns, &spoint3, ”/interfaces"); cdb_subscribe_done(subsock);
  • 27. 27©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Ensuring Changes happen in Order Event loop with balanced approach while(1) { set[0].fd = subsock; set[0].events = POLLIN; set[0].revents = 0; poll(set, 1, -1); // Monitor one socket, wait forever if (set[0].revents & POLLIN) { cdb_read_subscription_socket(subsock, sub_points, &reslen); for(i=0; i<reslen; i++) { if(…) cdb_diff_iterate(subsock, sub_points[i], iter, ITER_WANT_PREV, 0); else if(…) init_A(); } } cdb_sync_subscription_socket(subsock, CDB_DONE_PRIORITY); }
  • 28. 28©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Application Initialization / Start Order • Read, Subscribe • Protect using read session or operators locked out • Potentially more efficient than trigger method • Subscribe, Each application triggers its own subscriptions • Must be able to handle all configuration changes anyway • Subscribe, Startup process triggers all subscriptions • Good at system start when all processes start at the same time • Subscribe, System process triggers restarting app subscriptions • Can handle all scenarios
  • 29. 29©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Yang Validation Application Validation Prepare Phase Notify Applications Commit Phase Point of No Return After the Point of No Return the transaction cannot be aborted. • Make sure you validate properly before Point of No Return • If an application fails after this point, treat it the same regardless of it happening 2 ms/minutes/weeks after commit Operator types/clicks commit Operator gets OK and next prompt Point of No Return
  • 30. 30©2015 Tail-f Systems all rights reservedFebruary 13, 2015 Yang Validation Application Validation Prepare Phase Notify Applications Commit Phase Validators and Two Phase Subscribers Resource reservation can be handled by a Two Phase Subscriber • Called during Prepare Phase • Will get an aborted callback if transaction aborted • Uses cdb_subscribe() mechanism with an extra flag • Don’t activate, just check in prepare MO Changes that might happen Changes that did happen
  • 31. 31©2015 Tail-f Systems all rights reservedFebruary 13, 2015 ConfD CDB Subscription Handling Examples • examples.confd/intro/1-2-3-start-query-model • examples.confd/cdb_subscription/iter • examples.confd/cdb_subscription/trigger • examples.confd/cdb_subscription/twophase
  • 32. 32©2015 Tail-f Systems all rights reservedFebruary 13, 2015

Editor's Notes

  1. The closing slide may be used with no text or with a short phrase and company web address.