You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

390 lines
12 KiB

  1. --- a/dev/null 2020-04-10 18:48:03.582667900 +0300
  2. +++ b/yang/frr-route-map.yang 2020-05-02 11:43:04.182956847 +0300
  3. @@ -0,0 +1,387 @@
  4. +module frr-route-map {
  5. + yang-version 1.1;
  6. + namespace "http://frrouting.org/yang/route-map";
  7. + prefix frr-route-map;
  8. +
  9. + import ietf-inet-types {
  10. + prefix inet;
  11. + }
  12. + import frr-filter {
  13. + prefix filter;
  14. + }
  15. + import frr-interface {
  16. + prefix frr-interface;
  17. + }
  18. +
  19. + organization "FRRouting";
  20. + contact
  21. + "FRR Users List: <mailto:frog@lists.frrouting.org>
  22. + FRR Development List: <mailto:dev@lists.frrouting.org>";
  23. + description "This module defines route map settings";
  24. +
  25. + revision 2019-07-01 {
  26. + description "Initial revision";
  27. + }
  28. +
  29. + /*
  30. + * Types.
  31. + */
  32. + typedef route-map-sequence {
  33. + description "Route map valid sequence numbers";
  34. + type uint16 {
  35. + range "1..65535";
  36. + }
  37. + }
  38. +
  39. + typedef route-map-name {
  40. + description "Route map name format";
  41. + type string;
  42. + }
  43. +
  44. + /*
  45. + * Operational data.
  46. + */
  47. + container lib {
  48. + list route-map {
  49. + description "Route map instance";
  50. +
  51. + key "name";
  52. +
  53. + leaf name {
  54. + description "Route map instance name";
  55. + type route-map-name;
  56. + }
  57. +
  58. + list entry {
  59. + description "Route map entry";
  60. +
  61. + key "sequence";
  62. +
  63. + leaf sequence {
  64. + description
  65. + "Route map instance priority (low number means higher priority)";
  66. + type route-map-sequence;
  67. + }
  68. +
  69. + leaf description {
  70. + description "Route map description";
  71. + type string;
  72. + }
  73. +
  74. + leaf action {
  75. + description
  76. + "Route map actions: permit (executes action), deny (quits evaluation)";
  77. + mandatory true;
  78. + type enumeration {
  79. + enum permit {
  80. + description
  81. + "Executes configured action and permits the prefix/route
  82. + if the conditions matched. An alternative exit action can
  83. + be configured to continue processing the route map list
  84. + or jump to process another route map.";
  85. + value 0;
  86. + }
  87. + enum deny {
  88. + description
  89. + "If all conditions are met the prefix/route is denied and
  90. + route map processing stops.";
  91. + value 1;
  92. + }
  93. + }
  94. + }
  95. +
  96. + leaf call {
  97. + description
  98. + "Call another route map before calling `exit-policy`. If the
  99. + called route map returns deny then this route map will also
  100. + return deny";
  101. + type route-map-name;
  102. + }
  103. +
  104. + leaf exit-policy {
  105. + description "What do to after route map successful match, set and call";
  106. + type enumeration {
  107. + enum permit-or-deny {
  108. + description "End route map evaluation and return";
  109. + value 0;
  110. + }
  111. + enum next {
  112. + description
  113. + "Proceed evaluating next route map entry per sequence";
  114. + value 1;
  115. + }
  116. + enum goto {
  117. + description
  118. + "Go to route map entry with the provided sequence number";
  119. + value 2;
  120. + }
  121. + }
  122. + default "permit-or-deny";
  123. + }
  124. +
  125. + leaf goto-value {
  126. + when "../exit-policy = 'goto'";
  127. + description
  128. + "Sequence number to jump (when using `goto` exit policy)";
  129. + mandatory true;
  130. + type route-map-sequence;
  131. + }
  132. +
  133. + list match-condition {
  134. + description "Route map match conditions";
  135. +
  136. + key "condition";
  137. +
  138. + leaf condition {
  139. + description "Match condition";
  140. + type enumeration {
  141. + enum interface {
  142. + description "Match interface";
  143. + value 0;
  144. + }
  145. + enum ipv4-address-list {
  146. + description "Match an IPv4 access-list";
  147. + value 1;
  148. + }
  149. + enum ipv4-prefix-list {
  150. + description "Match an IPv4 prefix-list";
  151. + value 2;
  152. + }
  153. + enum ipv4-next-hop-list {
  154. + description "Match an IPv4 next-hop";
  155. + value 3;
  156. + }
  157. + enum ipv4-next-hop-prefix-list {
  158. + description "Match an IPv4 next-hop prefix list";
  159. + value 4;
  160. + }
  161. + enum ipv4-next-hop-type {
  162. + description "Match an IPv4 next-hop type";
  163. + value 5;
  164. + }
  165. + enum ipv6-address-list {
  166. + description "Match an IPv6 access-list";
  167. + value 6;
  168. + }
  169. + enum ipv6-prefix-list {
  170. + description "Match an IPv6 prefix-list";
  171. + value 7;
  172. + }
  173. + enum ipv6-next-hop-type {
  174. + description "Match an IPv6 next-hop type";
  175. + value 8;
  176. + }
  177. + enum metric {
  178. + description "Match a route metric";
  179. + value 9;
  180. + }
  181. + enum tag {
  182. + description "Match a route tag";
  183. + value 10;
  184. + }
  185. + /* zebra specific conditions. */
  186. + enum ipv4-prefix-length {
  187. + description "Match IPv4 prefix length";
  188. + value 100;
  189. + }
  190. + enum ipv6-prefix-length {
  191. + description "Match IPv6 prefix length";
  192. + value 101;
  193. + }
  194. + enum ipv4-next-hop-prefix-length {
  195. + description "Match next-hop prefix length";
  196. + value 102;
  197. + }
  198. + enum source-protocol {
  199. + description "Match source protocol";
  200. + value 103;
  201. + }
  202. + enum source-instance {
  203. + description "Match source protocol instance";
  204. + value 104;
  205. + }
  206. + }
  207. + }
  208. +
  209. + choice condition-value {
  210. + description
  211. + "Value to match (interpretation depends on condition type)";
  212. + mandatory true;
  213. + case interface {
  214. + when "./condition = 'interface'";
  215. + leaf interface {
  216. + type string;
  217. + }
  218. + }
  219. + case access-list-num {
  220. + when "./condition = 'ipv4-address-list' or
  221. + ./condition = 'ipv4-next-hop-list'";
  222. + leaf access-list-num {
  223. + type filter:access-list-standard;
  224. + }
  225. + }
  226. + case access-list-num-extended {
  227. + when "./condition = 'ipv4-address-list' or
  228. + ./condition = 'ipv4-next-hop-list'";
  229. + leaf access-list-num-extended {
  230. + type filter:access-list-extended;
  231. + }
  232. + }
  233. + case list-name {
  234. + when "./condition = 'ipv4-address-list' or
  235. + ./condition = 'ipv4-prefix-list' or
  236. + ./condition = 'ipv4-next-hop-list' or
  237. + ./condition = 'ipv4-next-hop-prefix-list' or
  238. + ./condition = 'ipv6-address-list' or
  239. + ./condition = 'ipv6-prefix-list'";
  240. + leaf list-name {
  241. + type filter:access-list-name;
  242. + }
  243. + }
  244. + case ipv4-next-hop-type {
  245. + when "./condition = 'ipv4-next-hop-type'";
  246. + leaf ipv4-next-hop-type {
  247. + type enumeration {
  248. + enum blackhole {
  249. + value 0;
  250. + }
  251. + }
  252. + }
  253. + }
  254. + case ipv6-next-hop-type {
  255. + when "./condition = 'ipv6-next-hop-type'";
  256. + leaf ipv6-next-hop-type {
  257. + type enumeration {
  258. + enum blackhole {
  259. + value 0;
  260. + }
  261. + }
  262. + }
  263. + }
  264. + case metric {
  265. + when "./condition = 'metric'";
  266. + leaf metric {
  267. + type uint32 {
  268. + range "1..4294967295";
  269. + }
  270. + }
  271. + }
  272. + case tag {
  273. + when "./condition = 'tag'";
  274. + leaf tag {
  275. + type uint32 {
  276. + range "1..4294967295";
  277. + }
  278. + }
  279. + }
  280. + }
  281. + }
  282. +
  283. + list set-action {
  284. + description "Route map set actions";
  285. +
  286. + key "action";
  287. +
  288. + leaf action {
  289. + description "Action to do when the route map matches";
  290. + type enumeration {
  291. + enum ipv4-next-hop {
  292. + description "Set IPv4 address of the next hop";
  293. + value 0;
  294. + }
  295. + enum ipv6-next-hop {
  296. + description "Set IPv6 address of the next hop";
  297. + value 1;
  298. + }
  299. + enum metric {
  300. + description "Set prefix/route metric";
  301. + value 2;
  302. + }
  303. + enum tag {
  304. + description "Set tag";
  305. + value 3;
  306. + }
  307. + /* zebra specific conditions. */
  308. + enum source {
  309. + description "Set source address for route";
  310. + value 100;
  311. + }
  312. + }
  313. + }
  314. +
  315. + choice action-value {
  316. + description
  317. + "Value to set (interpretation depends on action-type)";
  318. + case ipv4-address {
  319. + when "./action = 'ipv4-next-hop'";
  320. + leaf ipv4-address {
  321. + description "IPv4 address";
  322. + type inet:ipv4-address;
  323. + }
  324. + }
  325. + case ipv6-address {
  326. + when "./action = 'ipv6-next-hop'";
  327. + leaf ipv6-address {
  328. + description "IPv6 address";
  329. + type inet:ipv6-address;
  330. + }
  331. + }
  332. + case metric {
  333. + when "./action = 'metric'";
  334. + choice metric-value {
  335. + description "Metric to set or use";
  336. + case value {
  337. + leaf value {
  338. + description "Use the following metric value";
  339. + type uint32 {
  340. + range "0..4294967295";
  341. + }
  342. + }
  343. + }
  344. + case add-metric {
  345. + leaf add-metric {
  346. + description "Add unit to metric";
  347. + type boolean;
  348. + }
  349. + }
  350. + case subtract-metric {
  351. + leaf subtract-metric {
  352. + description "Subtract unit from metric";
  353. + type boolean;
  354. + }
  355. + }
  356. + case use-round-trip-time {
  357. + leaf use-round-trip-time {
  358. + description "Use the round trip time as metric";
  359. + type boolean;
  360. + }
  361. + }
  362. + case add-round-trip-time {
  363. + leaf add-round-trip-time {
  364. + description "Add round trip time to metric";
  365. + type boolean;
  366. + }
  367. + }
  368. + case subtract-round-trip-time {
  369. + leaf subtract-round-trip-time {
  370. + description "Subtract round trip time to metric";
  371. + type boolean;
  372. + }
  373. + }
  374. + }
  375. + }
  376. + case tag {
  377. + when "./action = 'tag'";
  378. + leaf tag {
  379. + description "Tag value";
  380. + type uint32 {
  381. + range "0..4294967295";
  382. + }
  383. + }
  384. + }
  385. + }
  386. + }
  387. + }
  388. + }
  389. + }
  390. +}