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.

385 lines
9.5 KiB

  1. From 2332428d3c80ac3d3b4e1c0bdba830b098ef440f Mon Sep 17 00:00:00 2001
  2. From: Rafael Zalamena <rzalamena@opensourcerouting.org>
  3. Date: Fri, 5 Jul 2019 11:07:30 -0300
  4. Subject: [PATCH] yang: initial filter YANG model import
  5. This model contains the description of access-list, prefix-list and
  6. other lists used by route map and other filtering interfaces.
  7. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  8. ---
  9. yang/frr-filter.yang | 365 +++++++++++++++++++++++++++++++++++++++++++
  10. 1 file changed, 365 insertions(+)
  11. create mode 100644 yang/frr-filter.yang
  12. diff --git a/yang/frr-filter.yang b/yang/frr-filter.yang
  13. new file mode 100644
  14. index 0000000000..92af6aebfd
  15. --- /dev/null
  16. +++ b/yang/frr-filter.yang
  17. @@ -0,0 +1,365 @@
  18. +module frr-filter {
  19. + yang-version 1.1;
  20. + namespace "http://frrouting.org/yang/filter";
  21. + prefix frr-filter;
  22. +
  23. + import ietf-inet-types {
  24. + prefix inet;
  25. + }
  26. + import ietf-yang-types {
  27. + prefix yang;
  28. + }
  29. +
  30. + organization "Free Range Routing";
  31. + contact
  32. + "FRR Users List: <mailto:frog@lists.frrouting.org>
  33. + FRR Development List: <mailto:dev@lists.frrouting.org>";
  34. + description "This module defines filter settings";
  35. +
  36. + revision 2019-07-04 {
  37. + description "Initial revision";
  38. + }
  39. +
  40. + /*
  41. + * Types.
  42. + */
  43. + typedef access-list-standard {
  44. + description "Standard IPv4 access list (any, host or a prefix)";
  45. + type uint16 {
  46. + range "1..99 | 1300..1999";
  47. + }
  48. + }
  49. +
  50. + typedef access-list-extended {
  51. + description
  52. + "Extended IPv4 access list (source / destination any, hosts or prefixes)";
  53. + type uint16 {
  54. + range "100..199 | 2000..2699";
  55. + }
  56. + }
  57. +
  58. + typedef access-list-legacy {
  59. + description "Standard/Extended IPv4 access list";
  60. + type uint16 {
  61. + range "1..199 | 1300..2699";
  62. + }
  63. + }
  64. +
  65. + typedef access-list-name {
  66. + description "Access list name formatting";
  67. + type string;
  68. + }
  69. +
  70. + typedef access-list-sequence {
  71. + description "Access list sequence number";
  72. + type uint32 {
  73. + range "1..4294967295";
  74. + }
  75. + }
  76. +
  77. + typedef access-list-action {
  78. + description "Access list return action on match";
  79. + type enumeration {
  80. + enum deny {
  81. + description "Deny an entry";
  82. + value 0;
  83. + }
  84. + enum permit {
  85. + description "Accept an entry";
  86. + value 1;
  87. + }
  88. + }
  89. + }
  90. +
  91. + /*
  92. + * Configuration data.
  93. + */
  94. + container filter-list {
  95. + list access-list-legacy {
  96. + description "Access list legacy instance";
  97. +
  98. + key "number sequence";
  99. +
  100. + leaf number {
  101. + description "Access list sequence value";
  102. + type access-list-legacy;
  103. + }
  104. +
  105. + leaf sequence {
  106. + description "Access list sequence value";
  107. + type access-list-sequence;
  108. + }
  109. +
  110. + leaf action {
  111. + description "Access list action on match";
  112. + type access-list-action;
  113. + mandatory true;
  114. + }
  115. +
  116. + leaf remark {
  117. + description "Access list remark";
  118. + type string;
  119. + }
  120. +
  121. + choice value {
  122. + description
  123. + "Standard access list: value to match.
  124. + Extended access list: source value to match.";
  125. + mandatory true;
  126. +
  127. + case host {
  128. + leaf host {
  129. + description "Host to match";
  130. + type inet:ipv4-address;
  131. + }
  132. + }
  133. + case network {
  134. + leaf network {
  135. + description "Network to match";
  136. + type inet:ipv4-prefix;
  137. + }
  138. + }
  139. + case any {
  140. + leaf any {
  141. + description "Match any";
  142. + type empty;
  143. + }
  144. + }
  145. + }
  146. +
  147. + choice extended-value {
  148. + when "./sequence >= 100 and ./sequence <= 199 or
  149. + ./sequence >= 2000 and ./sequence <= 2699";
  150. + description "Destination value to match";
  151. +
  152. + case destination-host {
  153. + leaf destination-host {
  154. + description "Host to match";
  155. + type inet:ipv4-address;
  156. + }
  157. + }
  158. + case destination-network {
  159. + leaf destination-network {
  160. + description "Network to match";
  161. + type inet:ipv4-prefix;
  162. + }
  163. + }
  164. + case destination-any {
  165. + leaf destination-any {
  166. + description "Match any";
  167. + type empty;
  168. + }
  169. + }
  170. + }
  171. + }
  172. +
  173. + list access-list {
  174. + description "Access list instance";
  175. +
  176. + key "type identifier sequence";
  177. +
  178. + leaf type {
  179. + description "Access list content type";
  180. + type enumeration {
  181. + enum ipv4 {
  182. + description "Internet Protocol address version 4";
  183. + value 0;
  184. + }
  185. + enum ipv6 {
  186. + description "Internet Protocol address version 6";
  187. + value 1;
  188. + }
  189. + enum mac {
  190. + description "Media Access Control address";
  191. + value 2;
  192. + }
  193. +
  194. + /*
  195. + * Protocol YANG models should augment the parent node to
  196. + * contain the routing protocol specific value. The protocol
  197. + * must also augment `value` leaf to include its specific
  198. + * values or expand the `when` statement on the existing cases.
  199. + */
  200. + enum custom {
  201. + description "Custom data type";
  202. + value 100;
  203. + }
  204. + }
  205. + }
  206. +
  207. + leaf identifier {
  208. + description "Access list identifier";
  209. + type access-list-name;
  210. + }
  211. +
  212. + leaf sequence {
  213. + description "Access list sequence value";
  214. + type access-list-sequence;
  215. + }
  216. +
  217. + leaf action {
  218. + description "Access list action on match";
  219. + type access-list-action;
  220. + mandatory true;
  221. + }
  222. +
  223. + leaf remark {
  224. + description "Access list remark";
  225. + type string;
  226. + }
  227. +
  228. + choice value {
  229. + description "Access list value to match";
  230. + mandatory true;
  231. +
  232. + case ipv4-prefix {
  233. + when "./type = 'ipv4'";
  234. +
  235. + leaf ipv4-prefix {
  236. + description "Configure IPv4 prefix to match";
  237. + type inet:ipv4-prefix;
  238. + }
  239. +
  240. + leaf ipv4-exact-match {
  241. + description "Exact match of prefix";
  242. + type boolean;
  243. + default false;
  244. + }
  245. + }
  246. + case ipv6-prefix {
  247. + when "./type = 'ipv6'";
  248. +
  249. + leaf ipv6-prefix {
  250. + description "Configure IPv6 prefix to match";
  251. + type inet:ipv6-prefix;
  252. + }
  253. +
  254. + leaf ipv6-exact-match {
  255. + description "Exact match of prefix";
  256. + type boolean;
  257. + default false;
  258. + }
  259. + }
  260. + case mac {
  261. + when "./type = 'mac'";
  262. +
  263. + leaf mac {
  264. + description "Configure MAC address to match";
  265. + type yang:mac-address;
  266. + }
  267. + }
  268. + case any {
  269. + leaf any {
  270. + description "Match anything";
  271. + type empty;
  272. + }
  273. + }
  274. + }
  275. + }
  276. +
  277. + list prefix-list {
  278. + description "Prefix list instance";
  279. +
  280. + key "type name sequence";
  281. +
  282. + leaf type {
  283. + description "Prefix list type";
  284. + type enumeration {
  285. + enum ipv4 {
  286. + description "Internet Protocol address version 4";
  287. + value 0;
  288. + }
  289. + enum ipv6 {
  290. + description "Internet Protocol address version 6";
  291. + value 1;
  292. + }
  293. + }
  294. + }
  295. +
  296. + leaf name {
  297. + description "Prefix list name";
  298. + type access-list-name;
  299. + }
  300. +
  301. + leaf sequence {
  302. + description "Access list sequence value";
  303. + type access-list-sequence;
  304. + }
  305. +
  306. + leaf action {
  307. + description "Prefix list action on match";
  308. + type access-list-action;
  309. + mandatory true;
  310. + }
  311. +
  312. + leaf description {
  313. + description "Prefix list user description";
  314. + type string;
  315. + }
  316. +
  317. + choice value {
  318. + description "Prefix list value to match";
  319. + mandatory true;
  320. +
  321. + case ipv4-prefix {
  322. + when "./type = 'ipv4'";
  323. +
  324. + leaf ipv4-prefix {
  325. + description "Configure IPv4 prefix to match";
  326. + type inet:ipv4-prefix;
  327. + }
  328. +
  329. + leaf ipv4-prefix-length-greater-or-equal {
  330. + description
  331. + "Specifies if matching prefixes with length greater than
  332. + or equal to value";
  333. + type uint8 {
  334. + range "0..32";
  335. + }
  336. + }
  337. +
  338. + leaf ipv4-prefix-length-lesser-or-equal {
  339. + description
  340. + "Specifies if matching prefixes with length lesser than
  341. + or equal to value";
  342. + type uint8 {
  343. + range "0..32";
  344. + }
  345. + }
  346. + }
  347. + case ipv6-prefix {
  348. + when "./type = 'ipv6'";
  349. +
  350. + leaf ipv6-prefix {
  351. + description "Configure IPv6 prefix to match";
  352. + type inet:ipv6-prefix;
  353. + }
  354. +
  355. + leaf ipv6-prefix-length-greater-or-equal {
  356. + description
  357. + "Specifies if matching prefixes with length greater than
  358. + or equal to value";
  359. + type uint8 {
  360. + range "0..128";
  361. + }
  362. + }
  363. +
  364. + leaf ipv6-prefix-length-lesser-or-equal {
  365. + description
  366. + "Specifies if matching prefixes with length lesser than
  367. + or equal to value";
  368. + type uint8 {
  369. + range "0..128";
  370. + }
  371. + }
  372. + }
  373. + case any {
  374. + leaf any {
  375. + description "Match anything";
  376. + type empty;
  377. + }
  378. + }
  379. + }
  380. + }
  381. + }
  382. +}