BUG-4931: Simple routing policy
[bgpcep.git] / bgp / rib-api / src / main / yang / bgp-rib.yang
index bc9b30a575871054ef00d6983d09f4fd119521f4..0133a4968316ef02b1cf7abb53623c3a6c2e4fb6 100644 (file)
@@ -31,12 +31,39 @@ module bgp-rib {
         type inet:uri;
     }
 
-    grouping route {
-        container attributes {
-            uses bgp-msg:path-attributes;
+    typedef application-rib-id {
+        type inet:uri;
+    }
+
+    typedef peer-id {
+        description
+            "An abstract peer identifier. The protocol part identifies
+            the type of the peer. One well-known protocol is define, which
+            has the following format: bgp://1.2.3.4, where 1.2.3.4 is the
+            peer's BGP Identifier in IPv4 dotted-quad format.";
+        type inet:uri;
+    }
+
+    typedef peer-role {
+        type enumeration {
+            enum ebgp;
+            enum ibgp;
+            enum rr-client;
+            enum internal;
+        }
+    }
+
+    typedef simple-routing-policy {
+        type enumeration {
+            enum announce-none { description "Don't announce routes to this peer"; }
+            enum learn-none { description "Don't learn routes from this peer"; }
         }
     }
 
+    grouping route {
+        uses bgp-msg:path-attributes;
+    }
+
     grouping rib {
         list tables {
             uses bgp-mp:bgp-table-type;
@@ -50,38 +77,22 @@ module bgp-rib {
             }
 
             choice routes {
-                case ipv4-routes-case {
-                    container ipv4-routes {
-                        list ipv4-route {
-                            when "../../afi = ipv4";
-
-                            leaf prefix {
-                                type inet:ipv4-prefix;
-                            }
-                            key prefix;
-
-                            uses route;
-                        }
-                    }
-                }
-                case ipv6-routes-case {
-                    container ipv6-routes {
-                        list ipv6-route {
-                            when "../../afi = ipv6";
-
-                            leaf prefix {
-                                type inet:ipv6-prefix;
-                            }
-                            key prefix;
-
-                            uses route;
-                        }
-                    }
-                }
+               // to be augmented
             }
         }
     }
 
+    list application-rib {
+        config true;
+
+        leaf id {
+            type application-rib-id;
+        }
+        key id;
+
+        uses rib;
+    }
+
     container bgp-rib {
         list rib {
             config false;
@@ -91,8 +102,28 @@ module bgp-rib {
             }
             key id;
 
-            list peers {
+            list peer {
+                key peer-id;
+                leaf peer-id {
+                    type peer-id;
+                }
+                leaf peer-role {
+                    type peer-role;
+                    mandatory true;
+                }
+                leaf simple-routing-policy {
+                    type simple-routing-policy;
+                }
+                list supported-tables {
+                    key "afi safi";
+                    uses bgp-mp:bgp-add-path-table-type;
+                }
                 container adj-rib-in {
+                    description "Routes as we have received them from the peer.";
+                    uses rib;
+                }
+                container effective-rib-in {
+                    description "Routes as processed by inbound policy.";
                     uses rib;
                 }
                 container adj-rib-out {