Introducing new API in neutron-mapper
[groupbasedpolicy.git] / neutron-mapper / src / main / yang / neutron-gbp-mapper.yang
1 module neutron-gbp-mapper {
2     yang-version 1;
3
4     namespace "urn:opendaylight:groupbasedpolicy:neutron-gbp-mapper";
5     prefix "neutron-gbp-mapper";
6
7     import gbp-common { prefix gbp-common; }
8     import endpoint { prefix gbp-endpoint; }
9     import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
10     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
11     import base-endpoint { prefix base-ep; revision-date 2016-04-27; }
12     import forwarding { prefix fwd; revision-date 2016-04-27; }
13     import l2-l3-forwarding { prefix l2-l3; revision-date 2016-04-27; }
14
15
16
17     description
18         "This module defines the mapping model between Neutron entities and GBP entities.";
19
20     revision "2015-05-13" {
21         description
22             "Initial revision.";
23     }
24
25     grouping neutron-port-key {
26         leaf port-id {
27             description "A unique ID for the neutron port";
28             type gbp-common:unique-id;
29         }
30     }
31
32     container mappings {
33         description "Mapping of neutron entities by groupbasedpolicy entities and vice versa.";
34         config false;
35         container neutron-by-gbp-mappings {
36             description "Neutron entities by groupbasedpolicy entities";
37             container ports-by-endpoints {
38                 description "Neutron ports by groupbasedpolicy endpoint";
39                 status deprecated;
40                 list port-by-endpoint {
41                     description "Neutron port key by groupbasedpolicy endpoint key";
42                     key "l2-context mac-address";
43                     uses gbp-endpoint:l2-key;
44                     uses neutron-port-key;
45                 }
46             }
47             container ports-by-base-endpoints {
48                 description "Neutron ports by groupbasedpolicy base-endpoint";
49                 list port-by-base-endpoint {
50                     description "Neutron port key by groupbasedpolicy base-endpoint key";
51                     key "context-type context-id address-type address";
52                     uses base-ep:address-endpoint-key;
53                     uses neutron-port-key;
54                 }
55             }
56
57             container external-gateways-as-endpoints {
58                 description "Endpoints that represent Neutron External Gateways for External Subnets.
59                     Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
60                 list external-gateway-as-endpoint {
61                     description "Endpoints that represent Neutron External Gateways for External Subnets.
62                         Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
63
64                     key "context-id context-type address address-type";
65
66                     uses base-ep:address-endpoint-key;
67                 }
68             }
69
70             container external-gateways-as-l3-endpoints {
71                 status deprecated; // use external-gateways-as-endpoints
72                 description "L3Endpoints that represent Neutron External Gateways for External Subnets.
73                     Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
74                 list external-gateway-as-l3-endpoint {
75                     description "L3Endpoints that represent Neutron External Gateways for External Subnets.
76                         Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
77                     key "l3-context ip-address";
78                     uses gbp-endpoint:l3-key;
79                 }
80             }
81
82             container provider-physical-networks-as-l2-flood-domains {
83                 status deprecated;
84                 list provider-physical-network-as-l2-flood-domain {
85                     key "tenant-id l2-flood-domain-id";
86                     leaf tenant-id {
87                         description "Tenant of L2 Flood Domain";
88                         type gbp-common:tenant-id;
89                     }
90                     leaf l2-flood-domain-id {
91                         description "The L2 Flood Domain ID";
92                         type gbp-common:l2-flood-domain-id;
93                     }
94                     leaf segmentation-id {
95                         mandatory true;
96                         description "An isolated segment on the physical network. The network-type
97                             attribute defines the segmentation model. For example, if network-type
98                             is vlan, this ID is a vlan identifier.";
99                         type string;
100                     }
101                 }
102             }
103
104             container provider-networks-as-l2-flood-domains {
105                 list provider-physical-network-as-l2-flood-domain {
106                     key "tenant-id l2-flood-domain-id";
107                     leaf tenant-id {
108                         description "Tenant of L2 Flood Domain";
109                         type gbp-common:tenant-id;
110                     }
111                     leaf l2-flood-domain-id {
112                         type gbp-common:context-id;
113                     }
114                     leaf segmentation-id {
115                         mandatory true;
116                         description "An isolated segment on the physical network. The network-type
117                             attribute defines the segmentation model. For example, if network-type
118                             is vlan, this ID is a vlan identifier.";
119                         type string;
120                     }
121                 }
122             }
123         }
124
125         container gbp-by-neutron-mappings {
126             description "Groupbasedpolicy entities by neutron entities";
127             container endpoints-by-ports {
128                 description "Groupbasedpolicy endpoints by neutron ports";
129                 status deprecated;
130                 list endpoint-by-port {
131                     description "Groupbasedpolicy endpoint key by neutron port key";
132                     key port-id;
133                     uses neutron-port-key;
134                     uses gbp-endpoint:l2-key;
135                 }
136             }
137             container base-endpoints-by-ports {
138                 description "Groupbasedpolicy base-endpoints by neutron ports";
139                 list base-endpoint-by-port {
140                     description "Groupbasedpolicy base-endpoint key by neutron port key";
141                     key port-id;
142                     uses neutron-port-key;
143                     uses base-ep:address-endpoint-key;
144                 }
145             }
146         }
147     }
148
149     rpc change-action-of-security-group-rules {
150         input {
151             list security-group-rule {
152                 key uuid;
153                 leaf uuid {
154                     type yang:uuid;
155                     description "UUID to index this neutron security group rule.";
156                 }
157             }
158             container action {
159                 choice action-choice {
160                     case sfc-action-case {
161                         leaf sfc-chain-name {
162                             type string;
163                         }
164                     }
165                     case allow-action-case {
166                         container allow {
167                             presence true;
168                         }
169                     }
170                 }
171             }
172         }
173     }
174
175 }