ef233be182162e891c96b2d7529ed8c89c23f4d7
[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-inet-types {prefix inet;}
10
11     description 
12         "This module defines the mapping model between Neutron entities and GBP entities.";
13
14     revision "2015-05-13" {
15         description
16             "Initial revision.";
17     }
18
19     grouping neutron-port-key {
20         leaf port-id {
21             description "A unique ID for the neutron port";
22             type gbp-common:unique-id;
23         }
24     }
25     
26     grouping internal-port-floating-ip-port-association-fields {
27         leaf floating-ip-port-id {
28             description "A unique ID for the neutron port";
29             type gbp-common:unique-id;
30             mandatory true;
31         }
32         leaf floating-ip-port-ip-address {
33             type inet:ip-address;
34             mandatory true;
35         }
36         leaf internal-port-id {
37             description "A unique ID for the neutron port";
38             type gbp-common:unique-id;
39             mandatory true;
40         }
41         leaf internal-port-ip-address {
42             type inet:ip-address;
43             mandatory true;
44         }
45     }
46
47     container mappings {
48         description "Mapping of neutron entities by groupbasedpolicy entities and vice versa.";
49         config false;
50         container neutron-by-gbp-mappings {
51             description "Neutron entities by groupbasedpolicy entities";
52             container ports-by-endpoints {
53                 description "Neutron ports by groupbasedpolicy endpoint";
54                 list port-by-endpoint {
55                     description "Neutron port key by groupbasedpolicy endpoint key";
56                     key "l2-context mac-address";
57                     uses gbp-endpoint:l2-key;
58                     uses neutron-port-key;
59                 }
60             }
61             container router-gateway-ports-by-endpoints {
62                 description "Neutron router gateway ports by groupbasedpolicy endpoint";
63                 list router-gateway-port-by-endpoint {
64                     description "Neutron router gateway port key by groupbasedpolicy endpoint key";
65                     key "l2-context mac-address";
66                     uses gbp-endpoint:l2-key;
67                     uses neutron-port-key;
68                 }
69             }
70             container router-interface-ports-by-endpoints {
71                 description "Neutron router interface ports by groupbasedpolicy endpoint";
72                 list router-interface-port-by-endpoint {
73                     description "Neutron router interface port key by groupbasedpolicy endpoint key";
74                     key "l2-context mac-address";
75                     uses gbp-endpoint:l2-key;
76                     uses neutron-port-key;
77                 }
78             }
79             container floating-ip-ports-by-endpoints {
80                 description "Neutron floating IP ports by groupbasedpolicy endpoint";
81                 list floating-ip-port-by-endpoint {
82                     description "Neutron floating ip port key by groupbasedpolicy endpoint key";
83                     key "l2-context mac-address";
84                     uses gbp-endpoint:l2-key;
85                     uses neutron-port-key;
86                 }
87             }
88
89             container external-gateways-as-l3-endpoints {
90                 description "L3Endpoints that represent Neutron External Gateways for External Subnets.
91                     Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
92                 list external-gateway-as-l3-endpoint {
93                     description "L3Endpoints that represent Neutron External Gateways for External Subnets.
94                         Please note these ARE NOT Neutron router ports, they are outside of Neutron.";
95                     key "l3-context ip-address";
96                     uses gbp-endpoint:l3-key;
97                 }
98             }
99
100             container external-networks-by-l2-flood-domains {
101                 list external-network-by-l2-flood-domain {
102                     key l2-flood-domain-id;
103                     leaf l2-flood-domain-id {
104                         description "The L2 Flood Domain ID";
105                         type gbp-common:l2-flood-domain-id;
106                     }
107                 }
108             }
109         }
110
111         container gbp-by-neutron-mappings {
112             description "Groupbasedpolicy entities by neutron entities";
113             container endpoints-by-ports {
114                 description "Groupbasedpolicy endpoints by neutron ports";
115                 list endpoint-by-port {
116                     description "Groupbasedpolicy endpoint key by neutron port key";
117                     key port-id;
118                     uses neutron-port-key;
119                     uses gbp-endpoint:l2-key;
120                 }
121             }
122             container endpoints-by-router-gateway-ports {
123                 description "Groupbasedpolicy endpoints by neutron router gateway ports";
124                 list endpoint-by-router-gateway-port {
125                     description "Groupbasedpolicy endpoint key by neutron router gateway port key";
126                     key port-id;
127                     uses neutron-port-key;
128                     uses gbp-endpoint:l2-key;
129                 }
130             }
131             container endpoints-by-router-interface-ports {
132                 description "Groupbasedpolicy endpoints by neutron router interface ports";
133                 list endpoint-by-router-interface-port {
134                     description "Groupbasedpolicy endpoint key by neutron router interface port key";
135                     key port-id;
136                     uses neutron-port-key;
137                     uses gbp-endpoint:l2-key;
138                 }
139             }
140             container endpoints-by-floating-ip-ports {
141                 description "Groupbasedpolicy endpoints by neutron floating IP ports";
142                 list endpoint-by-floating-ip-port {
143                     description "Groupbasedpolicy endpoint key by neutron floating IP port key";
144                     key port-id;
145                     uses neutron-port-key;
146                     uses gbp-endpoint:l2-key;
147                 }
148             }
149         }
150
151         container floating-ip-association-mappings {
152             description "Mapping of association between neutron port representing floating IP and internal neutron port";
153             container internal-ports-by-floating-ip-ports {
154                 list internal-port-by-floating-ip-port {
155                     key floating-ip-port-id;
156                     uses internal-port-floating-ip-port-association-fields;
157                 }
158             }
159             container floating-ip-ports-by-internal-ports {
160                 list floating-ip-port-by-internal-port {
161                     key internal-port-id;
162                     uses internal-port-floating-ip-port-association-fields;
163                 }
164             }
165         }
166     }
167
168 }