Move all neutron YANG models under "neutron" top-level
[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     // It requires rfc6991 (revision 2013-07-15), but odl don't have it, so this patch verify build will fail.
18     import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
19     import neutron-attrs { prefix "attrs"; }
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 Security group objects that are used by Openstack
26         Ice House Neutron YANG modules.";
27
28     revision "2014-10-02" {
29         description
30                 "Initial version of Security group objects used by OpenStack Ice House Neutron
31                 models";
32     }
33
34     grouping security-group-attrs {
35         description "OpenStack Layer3 Security group information.";
36         leaf description {
37             type string;
38             description "Description for the security group.";
39         }
40     }
41     grouping security-rule-attrs {
42         description "OpenStack Layer3 Security Group rules.";
43         leaf id {
44             type yang:uuid;
45             description "Security Rule ID.";
46         }
47         leaf tenant-id {
48             type yang:uuid;
49             description "UUID of the tenant.";
50         }
51         leaf direction {
52             type enumeration {
53                 enum ingress {
54                     description "Ingress direction.";
55                   }
56                   enum egress {
57                     description "Egress direction.";
58                   }
59             }
60             description "The direction in which metering rule is applied.
61                 For a compute instance, an ingress security group rule is
62                 applied to incoming (ingress) traffic for that instance.
63                 An egress rule is applied to traffic leaving the instance.";
64             default "ingress";
65         }
66         leaf security-group-id {
67             type yang:uuid;
68             description "The security group ID to associate with this security group rule.";
69         }
70         leaf remote-group-id {
71             description "The remote group ID to be associated with this security group rule.
72                 You can specify either remote-ip-prefix or remote-group-id in the request body.";
73             type yang:uuid;
74         }
75         leaf remote-ip-prefix {
76             description "The remote IP Prefix to be associated with this security group rule.
77                 You can specify either remote-ip-prefix or remote-group-id in the request body.";
78             type inet:ip-address;
79         }
80         leaf protocol {
81             type enumeration {
82                 enum null {
83                     description "NULL protocol.";
84                 }
85                 enum icmp {
86                     description "ICMP protocol.";
87                 }
88                 enum udp {
89                     description "UDP protocol.";
90                 }
91                 enum tcp {
92                     description "TCP protocol.";
93                 }
94             }
95             description "The protocol that is matched by the security group rule.";
96         }
97         leaf ethertype {
98             description "Must be IPv4 or IPv6, and addresses represented in CIDR must
99                 match the ingress or egress rules.";
100             type enumeration {
101                 enum ipv4 {
102                     description "ipv4 type.";
103                 }
104                 enum ipv6 {
105                     description "ipv6 type.";
106                 }
107             }
108         }
109         leaf port-range-min {
110             type uint32;
111             description "The minimum port number in the range that is matched by the
112                 security group rule. If the protocol is TCP or UDP, this value must
113                 be less than or equal to the value of the attribute. If the protocol
114                 is ICMP, this value must be an ICMP type.";
115         }
116         leaf port-range-max {
117             type uint32;
118             description "The maximum port number in the range that is matched by the
119                 security group rule. If the protocol is TCP or UDP, this value must
120                 be less than or equal to the value of the attribute. If the protocol
121                 is ICMP, this value must be an ICMP type.";
122         }
123     }
124
125     grouping security-groups-attributes {
126         container security-groups {
127             description "Container for security groups.";
128             list security-group {
129                 uses attrs:base-attrs;
130                 uses security-group-attrs;
131                 description "List of Metering Labels.";
132             }
133         }
134     }
135
136     grouping security-rules-attributes {
137         container security-rules {
138             description "Container for security group rules.";
139             list security-rule {
140                 uses security-rule-attrs;
141                 description "List of Security Group Rules.";
142             }
143         }
144     }
145 }