47e1d578d26377d37f8b65eb521bb42b0f19a3a5
[groupbasedpolicy.git] / renderers / ofoverlay / src / main / yang / ofoverlay.yang
1 /*
2  * Copyright (c) 2014 Cisco 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
9 module ofoverlay {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:ofoverlay";
13     prefix "ofoverlay";
14
15     import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; }
16
17     import yang-ext {prefix ext; revision-date "2013-07-09";}
18     import opendaylight-inventory {prefix inv; revision-date "2013-08-19";}
19     import overlay {prefix ovsdb-overlay; revision-date 2015-01-05;}
20
21     import gbp-common {prefix gbp-common;}
22     import endpoint {prefix endpoint;}
23
24     description
25         "This module defines the group-based policy ofoverlay renderer model.";
26
27     revision "2014-05-28" {
28         description
29             "Initial revision.";
30     }
31
32     // ******************
33     // Configuration Data
34     // ******************
35     container of-overlay-config {
36         description
37             "Configuration for the OpenFlow overlay renderer";
38
39         config true;
40
41         leaf encapsulation-format {
42             description "The encapsulation format to use for tunnels";
43             type enumeration {
44                 enum vxlan {
45                     description "Use VXLAN encapsulation";
46                 }
47             }
48         }
49
50         leaf learning-mode {
51             description
52                 "Selects how and whether we learn endpoints";
53             type enumeration {
54                 enum orchestrated {
55                     description
56                         "An external orchestration system will provide
57                          information about all endpoints, and no
58                          direct learning will occur.";
59                 }
60             }
61         }
62     }
63
64     grouping endpoint-location {
65         description
66             "The location for this endpoint in the overlay network";
67         leaf location-type {
68             default internal;
69             type enumeration {
70                 enum internal {
71                     description
72                     "The endpoint is located on a port that is part of
73                      the overlay network.  You must include the node
74                      ID and port number for this endpoint.";
75                 }
76                 enum external {
77                     description "This endpoint is not inside the overlay.";
78                 }
79             }
80         }
81         leaf node-id {
82             description
83                 "The OpenFlow switch for the endpoint. Must be included
84                  for all internal endpoints.  The format is
85                  openflow:[dpid] where the dpid is the value of the
86                  switch DPID cast to a long.";
87             type inv:node-id;
88         }
89         leaf node-connector-id {
90             description
91                 "The node connector for the endpoint's OpenFlow port. The
92                  format is openflow:[dpid]:[port] where the dpid is
93                  the value of the switch DPID cast to a long, and port
94                  is the openflow port number of the interface where
95                  the endpoint is connected.";
96             type inv:node-connector-id;
97         }
98         leaf port-name {
99             type gbp-common:name;
100             description
101                 "Port name";
102         }
103         leaf interface-id {
104             type gbp-common:unique-id;
105             description
106                 "Unique identifier for interface";
107         }
108     }
109
110     grouping napt-translations-fields {
111         container napt-translations {
112             description "List of NAPT translations";
113             list napt-translation {
114                 key "ip-address";
115                 uses napt-fields;
116             }
117         }
118     }
119
120     grouping napt-fields {
121         description "Support for IP NAPT";
122         leaf ip-address {
123             description "Ip address the L3Endpoint translates to.";
124             type inet:ip-address;
125         }
126         leaf port {
127             description "Port that L3Endpoint translates to.";
128             type inet:port-number;
129         }
130     }
131
132     augment "/endpoint:endpoints/endpoint:endpoint" {
133         ext:augment-identifier "of-overlay-context";
134         uses endpoint-location;
135     }
136
137     augment "/endpoint:endpoints/endpoint:endpoint-l3" {
138         ext:augment-identifier "of-overlay-l3-context";
139         uses endpoint-location;
140     }
141
142     augment "/endpoint:register-endpoint/endpoint:input" {
143         ext:augment-identifier "of-overlay-context-input";
144         uses endpoint-location;
145     }
146
147     augment "/endpoint:endpoints/endpoint:endpoint-l3" {
148         ext:augment-identifier "of-overlay-l3-nat";
149         uses napt-translations-fields;
150     }
151
152     augment "/endpoint:register-endpoint/endpoint:input" {
153         ext:augment-identifier "of-overlay-l3-nat-input";
154         uses napt-translations-fields;
155     }
156
157     augment "/inv:nodes/inv:node" {
158         ext:augment-identifier "of-overlay-node-config";
159         list tunnel {
160             key "tunnel-type";
161             uses ovsdb-overlay:tunnel-type-attributes;
162             uses ovsdb-overlay:ip-port-locator;
163             leaf node-connector-id {
164                 description
165                     "The node connector where is the tunnel located. The
166                      format is openflow:[dpid]:[port] where the dpid is
167                      the value of the switch DPID cast to a long, and port
168                      is the openflow port number of the interface where
169                      the endpoint is connected.";
170                 type inv:node-connector-id;
171             }
172         }
173         container ovsdb-config {
174             leaf ip {
175                 description
176                     "The IP address used to connect to OVSDB on this switch";
177                 type inet:ip-address;
178             }
179             leaf port {
180                 description
181                     "The port number used to connect to OVSDB on this switch";
182                 type inet:port-number;
183                 default 6640;
184             }
185         }
186         list external-interfaces {
187             description
188                 "The node connectors for the external interfaces to the underlay.
189                 If interface name is required, can be looked up from inventory using
190                 this field as a key to FCNC (FlowCapableNodeConnector)";
191             key "node-connector-id";
192             leaf node-connector-id {
193                 type inv:node-connector-id;
194             }
195         }
196     }
197 }