ACL: Part-II implementation of the spec.
[netvirt.git] / vpnservice / aclservice / api / src / main / yang / aclservice.yang
1 module aclservice {
2     yang-version 1;
3     namespace "urn:opendaylight:netvirt:aclservice";
4     prefix "aclservice";
5
6     import ietf-access-control-list { prefix ietf-acl;}
7     import ietf-yang-types { prefix "yang"; revision-date 2013-07-15; }
8     import yang-ext { prefix ext; revision-date 2013-07-09;}
9     import ietf-interfaces { prefix "ietf-if"; revision-date 2014-05-08;}
10     import ietf-inet-types { prefix "inet"; revision-date 2013-07-15; }
11
12     description
13         "ACL Service module";
14
15     revision "2016-06-08" {
16         description
17             "Initial revision";
18     }
19
20     identity direction-base {
21         description "Base identity for direction";
22     }
23
24     identity direction-ingress {
25         description "Ingress direction.";
26         base direction-base;
27     }
28
29     identity direction-egress {
30         description "Egress direction.";
31         base direction-base;
32
33     }
34
35     typedef ip-prefix-or-address {
36         description "ip prefix or ip address";
37         type union {
38             type inet:ip-prefix;
39             type inet:ip-address;
40         }
41     }
42
43     augment "/ietf-acl:access-lists/ietf-acl:acl/ietf-acl:access-list-entries/ietf-acl:ace" {
44         description "Security Rule Attributes";
45         ext:augment-identifier "security-rule-attr";
46         leaf remote-group-id {
47             description "The remote group ID to be associated with this security group rule.";
48             type yang:uuid;
49         }
50         leaf direction {
51             type identityref {
52                 base "direction-base";
53             }
54             description "The direction in which metering rule is applied.
55                 For a compute instance, an ingress security group rule is
56                 applied to incoming (ingress) traffic for that instance.
57                 An egress rule is applied to traffic leaving the instance.";
58         }
59     }
60
61     augment "/ietf-if:interfaces/ietf-if:interface" {
62         description "Apply ACL to interfaces";
63         ext:augment-identifier "interface-acl";
64         leaf port-security-enabled {
65             type boolean;
66             description "The port security status. The status is enabled (true) or disabled (false).";
67         }
68         leaf-list security-groups {
69             type yang:uuid;
70             description "The security group ID to associate with this interface.";
71         }
72         list allowed-address-pairs {
73             description "Allowed address pairs for this interface.";
74             key "mac-address ip-address";
75             leaf mac-address {
76                 type yang:mac-address;
77             }
78             leaf ip-address {
79                 type ip-prefix-or-address;
80             }
81         }
82     }
83
84     container ports-subnet-ip-prefixes {
85         list port-subnet-ip-prefixes {
86             key port-id;
87             leaf port-id {
88                 type string;
89                 description "Port ID";
90             }
91             leaf-list subnet-ip-prefixes {
92                 type ip-prefix-or-address;
93                 description "Subnet IP Prefixes of the Port.";
94             }
95         }
96     }
97
98     container acl-ports-lookup {
99         config false;
100         description "Container used to manage list of ports per ACL based on
101             port's IP address/prefix (including IP address/prefix specified in
102             allowed-address-pair)";
103
104         list acl-ports-by-ip {
105             key "acl-name";
106             description "Refers to an ACL which are associated with list of
107                 ports filtered based on IP address/prefix.";
108
109             leaf acl-name {
110                 type string;
111                 description "ACL name.";
112             }
113             list acl-ip-prefixes {
114                 key "ip-prefix";
115                 description "IP Prefixes and Allowed-Address-Pairs owned by
116                     ports where all such ports enforce the same ACL identified
117                     by acl-name";
118
119                 leaf ip-prefix {
120                     type ip-prefix-or-address;
121                     description "IP address/prefix";
122                 }
123                 list port-ids {
124                     key "port-id";
125                     description "Contains a list of ports that are enforcing
126                         the same ACL identified by acl-name.";
127                     leaf port-id {
128                         type string;
129                         description "Port UUID string";
130                     }
131                 }
132             }
133         }
134     }
135 }