]> git.proxmox.com Git - mirror_frr.git/blobdiff - yang/frr-filter.yang
Merge pull request #7590 from opensourcerouting/isisd-lfa
[mirror_frr.git] / yang / frr-filter.yang
index c55af34161938502c0b0287e9cbe8e161cd20918..eb84dd746083d03f5eaf8cab71d3ae065e232f7f 100644 (file)
@@ -49,31 +49,11 @@ module frr-filter {
   /*
    * Types.
    */
-  typedef access-list-standard {
-    description "Standard IPv4 access list (any, host or a prefix)";
-    type uint16 {
-      range "1..99 | 1300..1999";
-    }
-  }
-
-  typedef access-list-extended {
-    description
-      "Extended IPv4 access list (source / destination any, hosts or prefixes)";
-    type uint16 {
-      range "100..199 | 2000..2699";
-    }
-  }
-
-  typedef access-list-legacy {
-    description "Standard/Extended IPv4 access list";
-    type uint16 {
-      range "1..199 | 1300..2699";
-    }
-  }
-
   typedef access-list-name {
     description "Access list name formatting";
-    type string;
+    type string {
+      length 1..128;
+    }
   }
 
   typedef access-list-sequence {
@@ -100,77 +80,11 @@ module frr-filter {
   /*
    * Configuration data.
    */
-  container filter-list {
-    list access-list-legacy {
-      description "Access list legacy instance";
-
-      key "number sequence";
-
-      leaf number {
-        description "Access list sequence value";
-        type access-list-legacy;
-      }
-
-      leaf sequence {
-        description "Access list sequence value";
-        type access-list-sequence;
-      }
-
-      leaf action {
-        description "Access list action on match";
-        type access-list-action;
-        mandatory true;
-      }
-
-      leaf remark {
-        description "Access list remark";
-        type string;
-      }
-
-      choice value {
-        description
-          "Standard access list: value to match.
-           Extended access list: source value to match.";
-        mandatory true;
-
-        leaf host {
-          description "Host to match";
-          type inet:ipv4-address;
-        }
-        leaf network {
-          description "Network to match";
-          type inet:ipv4-prefix;
-        }
-        leaf any {
-          description "Match any";
-          type empty;
-        }
-      }
-
-      choice extended-value {
-        when "./sequence >= 100 and ./sequence <= 199 or
-              ./sequence >= 2000 and ./sequence <= 2699";
-        description "Destination value to match";
-
-        leaf destination-host {
-          description "Host to match";
-          type inet:ipv4-address;
-        }
-        leaf destination-network {
-          description "Network to match";
-          type inet:ipv4-prefix;
-        }
-        leaf destination-any {
-          description "Match any";
-          type empty;
-        }
-      }
-    }
-
+  container lib {
     list access-list {
       description "Access list instance";
 
-      key "type identifier sequence";
+      key "type name";
 
       leaf type {
         description "Access list content type";
@@ -187,85 +101,142 @@ module frr-filter {
             description "Media Access Control address";
             value 2;
           }
-
-          /*
-           * Protocol YANG models should augment the parent node to
-           * contain the routing protocol specific value. The protocol
-           * must also augment `value` leaf to include its specific
-           * values or expand the `when` statement on the existing cases.
-           */
-          enum custom {
-            description "Custom data type";
-            value 100;
-          }
         }
       }
 
-      leaf identifier {
-        description "Access list identifier";
+      leaf name {
+        description "Access list name";
         type access-list-name;
       }
 
-      leaf sequence {
-        description "Access list sequence value";
-        type access-list-sequence;
-      }
-
-      leaf action {
-        description "Access list action on match";
-        type access-list-action;
-        mandatory true;
-      }
-
       leaf remark {
         description "Access list remark";
         type string;
       }
 
-      choice value {
-        description "Access list value to match";
-        mandatory true;
+      list entry {
+        description "Access list entry";
 
-        case ipv4-prefix {
-          when "./type = 'ipv4'";
+        key "sequence";
 
-          leaf ipv4-prefix {
-            description "Configure IPv4 prefix to match";
-            type inet:ipv4-prefix;
-          }
+        leaf sequence {
+          description "Access list sequence value";
+          type access-list-sequence;
+        }
 
-          leaf ipv4-exact-match {
-            description "Exact match of prefix";
-            type boolean;
-            default false;
-          }
+        leaf action {
+          description "Access list action on match";
+          type access-list-action;
+          mandatory true;
         }
-        case ipv6-prefix {
-          when "./type = 'ipv6'";
 
-          leaf ipv6-prefix {
-            description "Configure IPv6 prefix to match";
-            type inet:ipv6-prefix;
+        choice value {
+          description "Access list value to match";
+          mandatory true;
+
+          case ipv4-prefix {
+            when "../type = 'ipv4'";
+
+            choice style {
+              description "Access list entry style selection: zebra or cisco.";
+              mandatory true;
+
+              case zebra {
+                leaf ipv4-prefix {
+                  description "Configure IPv4 prefix to match";
+                  type inet:ipv4-prefix;
+                }
+
+                leaf ipv4-exact-match {
+                  description "Exact match of prefix";
+                  type boolean;
+                  default false;
+                }
+              }
+              case cisco {
+                choice standard-value {
+                  description "Source value to match";
+
+                  leaf host {
+                    description "Host to match";
+                    type inet:ipv4-address;
+                  }
+                  container network {
+                    leaf address {
+                      mandatory true;
+                      description "Network address part.";
+                      type inet:ipv4-address;
+                    }
+                    leaf mask {
+                      mandatory true;
+                      description "Network mask/wildcard part.";
+                      type inet:ipv4-address;
+                    }
+                  }
+                  leaf source-any {
+                    /*
+                     * Was `any`, however it conflicts with `any` leaf
+                     * outside this choice.
+                     */
+                    description "Match any";
+                    type empty;
+                  }
+                }
+
+                choice extended-value {
+                  description "Destination value to match";
+
+                  leaf destination-host {
+                    description "Host to match";
+                    type inet:ipv4-address;
+                  }
+                  container destination-network {
+                    leaf address {
+                      mandatory true;
+                      description "Network address part.";
+                      type inet:ipv4-address;
+                    }
+                    leaf mask {
+                      mandatory true;
+                      description "Network mask/wildcard part.";
+                      type inet:ipv4-address;
+                    }
+                  }
+                  leaf destination-any {
+                    description "Match any";
+                    type empty;
+                  }
+                }
+              }
+            }
           }
+          case ipv6-prefix {
+            when "../type = 'ipv6'";
 
-          leaf ipv6-exact-match {
-            description "Exact match of prefix";
-            type boolean;
-            default false;
+            leaf ipv6-prefix {
+              description "Configure IPv6 prefix to match";
+              type inet:ipv6-prefix;
+            }
+
+            leaf ipv6-exact-match {
+              description "Exact match of prefix";
+              type boolean;
+              default false;
+            }
           }
-        }
-        case mac {
-          when "./type = 'mac'";
+          case mac {
+            when "../type = 'mac'";
 
-          leaf mac {
-            description "Configure MAC address to match";
-            type yang:mac-address;
+            leaf mac {
+              description "Configure MAC address to match";
+              type yang:mac-address;
+            }
           }
-        }
-        case any {
-          leaf any {
-            description "Match anything";
-            type empty;
+          case any {
+            leaf any {
+              description "Match anything";
+              type empty;
+            }
           }
         }
       }
@@ -274,7 +245,7 @@ module frr-filter {
     list prefix-list {
       description "Prefix list instance";
 
-      key "type name sequence";
+      key "type name";
 
       leaf type {
         description "Prefix list type";
@@ -295,82 +266,88 @@ module frr-filter {
         type access-list-name;
       }
 
-      leaf sequence {
-        description "Access list sequence value";
-        type access-list-sequence;
-      }
-
-      leaf action {
-        description "Prefix list action on match";
-        type access-list-action;
-        mandatory true;
-      }
-
-      leaf description {
+      leaf remark {
         description "Prefix list user description";
         type string;
       }
 
-      choice value {
-        description "Prefix list value to match";
-        mandatory true;
+      list entry {
+        description "Prefix list entry";
 
-        case ipv4-prefix {
-          when "./type = 'ipv4'";
+        key "sequence";
 
-          leaf ipv4-prefix {
-            description "Configure IPv4 prefix to match";
-            type inet:ipv4-prefix;
-          }
+        leaf sequence {
+          description "Access list sequence value";
+          type access-list-sequence;
+        }
+
+        leaf action {
+          description "Prefix list action on match";
+          type access-list-action;
+          mandatory true;
+        }
+
+        choice value {
+          description "Prefix list value to match";
+          mandatory true;
+
+          case ipv4-prefix {
+            when "../type = 'ipv4'";
 
-          leaf ipv4-prefix-length-greater-or-equal {
-            description
-              "Specifies if matching prefixes with length greater than
-               or equal to value";
-            type uint8 {
-              range "0..32";
+            leaf ipv4-prefix {
+              description "Configure IPv4 prefix to match";
+              type inet:ipv4-prefix;
             }
-          }
 
-          leaf ipv4-prefix-length-lesser-or-equal {
-            description
-              "Specifies if matching prefixes with length lesser than
-               or equal to value";
-            type uint8 {
-              range "0..32";
+            leaf ipv4-prefix-length-greater-or-equal {
+              description
+                "Specifies if matching prefixes with length greater than
+                 or equal to value";
+              type uint8 {
+                range "0..32";
+              }
             }
-          }
-        }
-        case ipv6-prefix {
-          when "./type = 'ipv6'";
 
-          leaf ipv6-prefix {
-            description "Configure IPv6 prefix to match";
-            type inet:ipv6-prefix;
+            leaf ipv4-prefix-length-lesser-or-equal {
+              description
+                "Specifies if matching prefixes with length lesser than
+                 or equal to value";
+              type uint8 {
+                range "0..32";
+              }
+            }
           }
+          case ipv6-prefix {
+            when "../type = 'ipv6'";
 
-          leaf ipv6-prefix-length-greater-or-equal {
-            description
-              "Specifies if matching prefixes with length greater than
-               or equal to value";
-            type uint8 {
-              range "0..128";
+            leaf ipv6-prefix {
+              description "Configure IPv6 prefix to match";
+              type inet:ipv6-prefix;
             }
-          }
 
-          leaf ipv6-prefix-length-lesser-or-equal {
-            description
-              "Specifies if matching prefixes with length lesser than
-               or equal to value";
-            type uint8 {
-              range "0..128";
+            leaf ipv6-prefix-length-greater-or-equal {
+              description
+                "Specifies if matching prefixes with length greater than
+                 or equal to value";
+              type uint8 {
+                range "0..128";
+              }
+            }
+
+            leaf ipv6-prefix-length-lesser-or-equal {
+              description
+                "Specifies if matching prefixes with length lesser than
+                 or equal to value";
+              type uint8 {
+                range "0..128";
+              }
             }
           }
-        }
-        case any {
-          leaf any {
-            description "Match anything";
-            type empty;
+          case any {
+            leaf any {
+              description "Match anything";
+              type empty;
+            }
           }
         }
       }