HONEYCOMB-281 Loopback interface management
[honeycomb.git] / v3po / api / src / main / yang / vpp-acl.yang
1 module vpp-acl {
2   yang-version 1;
3   namespace "urn:opendaylight:params:xml:ns:yang:vpp:acl";
4   prefix "vpp-acl";
5
6   revision "2016-12-14" {
7     description
8       "Initial revision of vpp-acl model.";
9   }
10
11   import ietf-access-control-list {
12     prefix "acl";
13   }
14
15   import vpp-classifier {
16     prefix "vpp-classifier";
17   }
18
19   import yang-ext {
20     prefix "ext";
21   }
22
23   import ietf-packet-fields {
24     prefix packet-fields;
25   }
26
27   identity mixed-acl {
28     base acl:acl-base;
29     description
30       "ACL that can match on any of L2/L3/L4 fields.";
31   }
32
33   typedef interface-mode {
34     type enumeration {
35       enum "l2";
36       enum "l3";
37     }
38   }
39
40   grouping acl-base-attributes {
41     description
42       "Defines references to classify tables.
43        At least one table reference should be specified.";
44     container l2-acl {
45       leaf classify-table {
46         type vpp-classifier:classify-table-ref;
47         description
48           "An L2 ACL table";
49       }
50     }
51     container ip4-acl {
52       leaf classify-table {
53         type vpp-classifier:classify-table-ref;
54         description
55           "An IPv4 ACL table";
56       }
57     }
58     container ip6-acl {
59       leaf classify-table {
60         type vpp-classifier:classify-table-ref;
61         description
62           "An IPv6 ACL table";
63       }
64     }
65   }
66
67   grouping ietf-acl-base-attributes {
68     description
69       "Provides limited support for ietf-acl model.";
70
71     container access-lists {
72       description
73         "Defines references to ietf-acl lists.
74         ACLs are translated into classify tables and sessions when assigned to interface.
75
76         In case of L2 interfaces, acls are translated into a chain of classify tables and assigned as L2 table.
77         In case of L3 interfaces, acls are translated into ip4 and ip6 chains (eth only rules go to both chains,
78         rest - depending on ip-version).
79         User ordering is preserved in both cases.
80
81         Assignment update/delete removes all created tables and sessions and repeats process described above.
82         Update/delete of ACL lists referenced here is not permitted (assignment needs to be removed first).
83
84         Read is supported only for acls that were created and assigned by Honeycomb agent
85         (corresponding metadata is present).
86
87         Extensions:
88         - mixing ACEs of different type in one list is permited
89         - mixing L2/L3/L4 rules in one ACE is permited
90
91         Limitations (due to vpp limitations):
92         - egress rules are currently ignored (HONEYCOMB-234)
93         - L4 rules support is limited (every <src,dst> port pair from provided ranges is translated to single classify
94         session; which can very slow or even crash vpp if ranges are big, see HONEYCOMB-260)
95         - ace-ip-version needs to be provided for all aces (consequence of posibility to mix ACEs of different types,
96           and vpp classfier api limitation: common header fields for IP4/IP6 have different offsets)
97         - L2 rules on L3 interfaces are applied only to IP traffic (vpp classfier limitation)
98         - vlan tags are supported only for sub-interfaces defined as exact-match";
99
100       list acl {
101         key "type name";
102         ordered-by user;
103
104         leaf type {
105           type acl:acl-type;
106         }
107
108         leaf name {
109           type acl:access-control-list-ref;
110         }
111       }
112
113       leaf default-action {
114         type enumeration {
115           enum "deny";
116           enum "permit";
117          }
118          default "deny";
119         description
120           "Default action applied to packet that does not match any of rules defined in assigned ACLs.
121            It is translated to single classify table and applied at the end of assigned chains.";
122       }
123
124       leaf mode {
125         type interface-mode;
126         default l3;
127         description
128           "The way ACLs are translated depends on the interface mode.
129            In case of L2 interfaces (bridge/interconnection)
130            classify tables are assigned as l2_table using input_acl_set_interface (ether type matching is automatically
131            added in case of L3 rules).
132            In case of L3 interfaces, classify tables are assigned as ip4/ip6 tables.
133
134            It is the user responsibility to choose mode that matches target interface.
135            ";
136       }
137     }
138   }
139
140   augment /acl:access-lists/acl:acl/acl:access-list-entries/acl:ace/acl:matches/acl:ace-type {
141     ext:augment-identifier "vpp-acl-type-augmentation";
142     case ace-ip-and-eth {
143       description
144         "Access List entry that can define both ip and eth rules.";
145       choice ace-ip-version {
146         description
147           "IP version used in this Access List Entry.";
148         mandatory true;
149         case ace-ipv4 {
150           uses packet-fields:acl-ipv4-header-fields;
151         }
152         case ace-ipv6 {
153           uses packet-fields:acl-ipv6-header-fields;
154         }
155       }
156       uses packet-fields:acl-ip-header-fields;
157       uses packet-fields:acl-eth-header-fields;
158     }
159   }
160 }