diff --git a/yang/frr-route-map.yang b/yang/frr-route-map.yang index 34a7e28a77..dd8ce5e6fc 100644 --- a/yang/frr-route-map.yang +++ b/yang/frr-route-map.yang @@ -179,17 +179,27 @@ module frr-route-map { description "Match a route tag"; value 10; } - - /* - * Protocol YANG models should augment the parent node to - * contain the routing protocol specific value. The protocol - * must also augment `condition-value` to include its specific - * values or expand the `when` statement on the existing cases. - */ - enum routing-protocol-specific { - description "Match a routing protocol specific type"; + /* zebra specific conditions. */ + enum ipv4-prefix-length { + description "Match IPv4 prefix length"; value 100; } + enum ipv6-prefix-length { + description "Match IPv6 prefix length"; + value 101; + } + enum ipv4-next-hop-prefix-length { + description "Match next-hop prefix length"; + value 102; + } + enum source-protocol { + description "Match prefix length"; + value 103; + } + enum source-instance { + description "Match prefix length"; + value 104; + } } } @@ -291,15 +301,9 @@ module frr-route-map { description "Set tag"; value 3; } - - /* - * Protocol YANG models should augment the parent node to - * contain the routing protocol specific value. The protocol - * must also augment `action-value` to include its specific - * values or expand the `when` statement on the existing cases. - */ - enum routing-protocol-specific { - description "Set a routing protocol specific action"; + /* zebra specific conditions. */ + enum source { + description "Set source address for route"; value 100; } } diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang index 74922a22f7..58798455d5 100644 --- a/yang/frr-zebra.yang +++ b/yang/frr-zebra.yang @@ -11,6 +11,10 @@ module frr-zebra { prefix inet; } + import frr-route-map { + prefix frr-route-map; + } + import frr-route-types { prefix frr-route-types; } @@ -1985,4 +1989,63 @@ module frr-zebra { } // End interface model augmentation + + augment "/frr-route-map:lib" + + "/frr-route-map:route-map" + + "/frr-route-map:entry" + + "/frr-route-map:match-condition" + + "/frr-route-map:condition-value" { + case ipv4-prefix-length { + when "./condition = 'ipv4-prefix-length' or + ./condition = 'ipv4-next-hop-prefix-length'"; + leaf ipv4-prefix-length { + type uint8 { + range "0..32"; + } + } + } + case ipv6-prefix-length { + when "./condition = 'ipv6-prefix-length'"; + leaf ipv6-prefix-length { + type uint8 { + range "0..128"; + } + } + } + case source-protocol { + when "./condition = 'source-protocol'"; + leaf source-protocol { + type frr-route-types:frr-route-types; + } + } + case source-instance { + when "./condition = 'source-instance'"; + leaf source-instance { + type uint8 { + range "0..255"; + } + } + } + } + + augment "/frr-route-map:lib" + + "/frr-route-map:route-map" + + "/frr-route-map:entry" + + "/frr-route-map:set-action" + + "/frr-route-map:action-value" { + case source-v4 { + when "./action = 'source'"; + leaf source-v4 { + description "IPv4 address"; + type inet:ipv4-address; + } + } + case source-v6 { + when "./action = 'source'"; + leaf source-v6 { + description "IPv6 address"; + type inet:ipv6-address; + } + } + } }