make security group rule ID mandatory in YANG model
[neutron.git] / model / src / main / yang / neutron-secgroups.yang
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 module neutron-secgroups {
9
10     yang-version 1;
11
12     namespace "urn:opendaylight:neutron-secgroups";
13
14     prefix neutron-secgroups;
15
16     import ietf-yang-types { prefix "yang"; }
17     import ietf-inet-types { prefix "inet"; revision-date 2013-07-15; }
18     import neutron-attrs { prefix "attrs"; }
19     import neutron-constants { prefix "constants"; }
20
21     organization "OpenDaylight Neutron Group";
22
23     contact "J. Gregory Hall <ghall@brocade.com>, Kiran Sreenivasa <kkoushik@brocade.com>";
24
25     description "This YANG module defines OpenStack Neutron security group model";
26
27     revision "2015-07-12" {
28         description
29                 "OpenDaylight Beryllium release";
30     }
31
32     grouping security-group-attributes {
33         description "OpenStack Layer3 Security group information.";
34     }
35     grouping security-rule-attributes {
36         description "OpenStack Layer3 Security Group rules.";
37         leaf direction {
38             type identityref {
39                 base "constants:direction-base";
40             }
41             description "The direction in which metering rule is applied.
42                 For a compute instance, an ingress security group rule is
43                 applied to incoming (ingress) traffic for that instance.
44                 An egress rule is applied to traffic leaving the instance.";
45         }
46         leaf security-group-id {
47             type yang:uuid;
48             mandatory true;
49             description "The security group ID to associate with this security group rule.";
50         }
51         leaf remote-group-id {
52             description "The remote group ID to be associated with this security group rule.
53                 You can specify either remote-ip-prefix or remote-group-id in the request body.";
54             type yang:uuid;
55         }
56         leaf remote-ip-prefix {
57             description "The remote IP Prefix to be associated with this security group rule.
58                 You can specify either remote-ip-prefix or remote-group-id in the request body.";
59             type inet:ip-prefix;
60         }
61         leaf protocol {
62             type union {
63                 type uint8;
64                 type identityref {
65                     base "constants:protocol-base";
66                 }
67             }
68             description "The protocol that is matched by the security group rule.";
69         }
70         leaf ethertype {
71             description "Must be IPv4 or IPv6, and addresses represented in CIDR must
72                 match the ingress or egress rules.";
73             type identityref {
74                 base "constants:ethertype-base";
75             }
76         }
77         leaf port-range-min {
78             type uint16;
79             description "The minimum port number in the range that is matched by the
80                 security group rule. If the protocol is TCP or UDP, this value must
81                 be less than or equal to the value of the attribute. If the protocol
82                 is ICMP, this value must be an ICMP type.";
83         }
84         leaf port-range-max {
85             type uint16;
86             description "The maximum port number in the range that is matched by the
87                 security group rule. If the protocol is TCP or UDP, this value must
88                 be less than or equal to the value of the attribute. If the protocol
89                 is ICMP, this value must be an ICMP type.";
90         }
91     }
92
93     grouping security-groups-attributes {
94         container security-groups {
95             description "Container for security groups.";
96             list security-group {
97                 key "uuid";
98                 uses attrs:base-attributes;
99                 uses security-group-attributes;
100                 description "List of Security Groups.";
101             }
102         }
103     }
104
105     grouping security-rules-attributes {
106         container security-rules {
107             description "Container for security group rules.";
108             list security-rule {
109                 key "uuid";
110                 uses attrs:id-attributes;
111                 uses security-rule-attributes;
112                 description "List of Security Group Rules.";
113             }
114         }
115     }
116 }