/*
* 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 {
* Configuration data.
*/
container lib {
- list access-list-legacy {
- description "Access list legacy instance";
-
- key "number";
-
- leaf number {
- description "Access list sequence value";
- type access-list-legacy;
- }
-
- leaf remark {
- description "Access list remark";
- type string;
- }
-
- list entry {
- description "Access list legacy entry";
-
- key "sequence";
-
- 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;
- }
-
- 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 "../number >= 100 and ../number <= 199 or
- ../number >= 2000 and ../number <= 2699";
- description "Destination value to match";
- mandatory true;
-
- 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;
- }
- }
- }
- }
-
list access-list {
description "Access list instance";
case ipv4-prefix {
when "../type = 'ipv4'";
- 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;
+ 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 {