BUG-2383: wire DOMDataBroker into RIBImpl
[bgpcep.git] / bgp / rib-impl / src / main / yang / odl-bgp-rib-impl-cfg.yang
index 1f05ccc70a30f8e4ccac9ac2406b3d4e712f74f5..c84f70d14fc312b0094e40a09b09d79f478846dd 100644 (file)
@@ -12,11 +12,13 @@ module odl-bgp-rib-impl-cfg {
     import odl-bgp-rib-spi-cfg { prefix ribspi; revision-date 2013-11-15; }
     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
+    import opendaylight-md-sal-dom {prefix sal; revision-date 2013-10-28; }
     import netty { prefix netty; revision-date 2013-11-19; }
     import config { prefix config; revision-date 2013-04-05; }
     import protocol-framework { prefix pf; revision-date 2014-03-13; }
     import odl-tcpmd5-cfg { prefix tcpmd5; revision-date 2014-04-27; }
     import odl-tcpmd5-netty-cfg { prefix tcpmd5n; revision-date 2014-04-27; }
+    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
 
     organization "Cisco Systems, Inc.";
 
@@ -246,7 +248,7 @@ module odl-bgp-rib-impl-cfg {
                 mandatory true;
             }
 
-            leaf bgp-id {
+            leaf bgp-peer-id {
                 type inet:ipv4-address;
                 mandatory true;
             }
@@ -318,6 +320,7 @@ module odl-bgp-rib-impl-cfg {
             }
 
             list advertized-table {
+                key "type name";
                 uses config:service-ref {
                     refine type {
                         mandatory true;
@@ -360,6 +363,225 @@ module odl-bgp-rib-impl-cfg {
         }
     }
 
+    grouping message-state {
+        leaf count {
+            description "Total number of BGP messages.";
+            type uint32;
+            default 0;
+        }
+
+        leaf timestamp {
+            description "The BGP message timestamp (seconds).";
+            type uint32;
+            default 0;
+        }
+    }
+
+    grouping message-stats {
+        container received {
+            description "The received BGP messages statistics.";
+            uses message-state;
+        }
+
+        container sent {
+            description "The sent BGP messages statistics.";
+            uses message-state;
+        }
+    }
+
+    grouping error {
+        leaf code {
+            description "The BGP error code.";
+            type uint8;
+            default 0;
+        }
+
+        leaf sub-code {
+            description "The BGP error sub-code.";
+            type uint8;
+            default 0;
+        }
+    }
+
+    grouping preferences {
+        leaf bgp-id {
+            description "The BGP Identifier.";
+            type string;
+            default "";
+        }
+
+        leaf address {
+            description "The IP address of BGP connection.";
+            type string;
+            default "";
+        }
+
+        leaf port {
+            description "The port for connection between the BGP peers.";
+            type uint16;
+            default 0;
+        }
+
+        leaf as {
+            description "Autonomous system number.";
+            type uint32;
+            default 0;
+        }
+
+        leaf holdtime {
+            description "Time interval (in seconds) for HoldTimer proposed by the peer.";
+            type uint16;
+            default 0;
+        }
+
+        leaf four-octet-as-capability {
+            description "The BGP peer 4 byte AS numbers support capability.";
+            type boolean;
+            default "false";
+        }
+
+        leaf gr-capability {
+            description "BGP graceful restart support capability.";
+            type boolean;
+            default "false";
+        }
+
+        list advertized-table-types {
+            description "The BGP Table-type capabilities advertized by the BGP peer.";
+            leaf afi {
+                description "Address Family Identifier.";
+                type string;
+                default "";
+            }
+            leaf safi {
+                description "Subsequent Address Family Identifier.";
+                type string;
+                default "";
+            }
+        }
+    }
+
+    identity peer-rpc;
+
+    augment "/config:modules/config:module/config:state" {
+        case bgp-peer {
+            when "/config:modules/config:module/config:type = 'bgp-peer'";
+
+            rpcx:rpc-context-instance "peer-rpc";
+
+            container bgp-peer-state {
+                list route-table {
+
+                    leaf table-type {
+                        description "The table name - composed of AFI and SAFI.";
+                        type string;
+                    }
+
+                    leaf routes-count {
+                        description "The total number of routes in table.";
+                        type uint32;
+                        default 0;
+                    }
+                }
+
+                leaf session-established-count {
+                    description "The total number of time the BGP session was transitioned to Up state.";
+                    type uint32;
+                    default 0;
+                }
+            }
+
+            container bgp-session-state {
+
+                leaf session-state {
+                    description "The BGP peer connection state.";
+                    type string;
+                }
+
+                leaf session-duration {
+                    description "The session duration (time formated d:HH:mm:ss).";
+                    type string;
+                }
+
+                leaf holdtime-current {
+                    description "Time interval (in seconds) for HoldTimer established with the peer.";
+                    type uint16;
+                    default 0;
+                }
+
+                leaf keepalive-current {
+                    description "Time interval (in seconds) for KeepAlive established with the peer.";
+                    type uint16;
+                    default 0;
+                }
+
+                container speaker-preferences {
+                    description "The BGP speaker preferences, to which this BGP peer is connected.";
+                    uses preferences;
+                }
+
+                container peer-preferences {
+                    description "The BGP peer preferences.";
+                    uses preferences;
+                }
+
+                container messages-stats {
+                    description "The BGP messages statistics.";
+                    container total-msgs {
+                        description "The statistics for all received/sent BGP messages.";
+                        uses message-stats;
+                    }
+
+                    container keep-alive-msgs {
+                        description "The statistics for received/sent BGP Keep-Alive messages.";
+                        uses message-stats;
+                    }
+
+                    container update-msgs {
+                        description "The statistics for received/sent BGP Update messages.";
+                        uses message-stats;
+                    }
+
+                    container error-msgs {
+                        container error-received {
+                            description "The received BGP Error (notification) messages statistics.";
+                            uses message-state;
+                            uses error;
+                        }
+
+                        container error-sent {
+                            description "The sent BGP Error (notification) messages statistics.";
+                            uses message-state;
+                            uses error;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    rpc reset-session {
+        description "Restart the session between BGP peers";
+        input {
+            uses rpcx:rpc-context-ref {
+                refine context-instance {
+                    rpcx:rpc-context-instance peer-rpc;
+                }
+            }
+        }
+     }
+
+     rpc reset-stats {
+        description "Reset the BGP peer statistics.";
+        input {
+            uses rpcx:rpc-context-ref {
+                refine context-instance {
+                    rpcx:rpc-context-instance peer-rpc;
+                }
+            }
+        }
+     }
+
     identity rib-impl {
         base config:module-type;
         config:provided-service bgprib:rib;
@@ -416,13 +638,22 @@ module odl-bgp-rib-impl-cfg {
                 }
             }
 
+            container dom-data-provider {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal:dom-async-data-broker;
+                    }
+                }
+            }
+
             leaf local-as {
                 description "Our local AS number. Needed by best selection path attribute.";
                 type uint32;
                 mandatory true;
             }
 
-            leaf bgp-id {
+            leaf bgp-rib-id {
                 description "Our local BGP identifier. Needed by best selection path attribute.";
                 mandatory true;
                 type inet:ipv4-address;