Bug 3738: GBP coexistence with SFC
[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     import policy {prefix policy;}
24
25     description
26         "This module defines the group-based policy ofoverlay renderer model.";
27
28     revision "2014-05-28" {
29         description
30             "Initial revision.";
31     }
32
33     // ******************
34     // Configuration Data
35     // ******************
36     container of-overlay-config {
37         description
38             "Configuration for the OpenFlow overlay renderer";
39
40         config true;
41
42         leaf encapsulation-format {
43             description "The encapsulation format to use for tunnels";
44             type enumeration {
45                 enum vxlan {
46                     description "Use VXLAN encapsulation";
47                 }
48             }
49         }
50
51         leaf learning-mode {
52             description
53                 "Selects how and whether we learn endpoints";
54             type enumeration {
55                 enum orchestrated {
56                     description
57                         "An external orchestration system will provide
58                          information about all endpoints, and no
59                          direct learning will occur.";
60                 }
61             }
62         }
63
64         uses initial-values;
65     }
66
67     grouping initial-values {
68         description
69             "Initial value of table offset is set in config subsystem";
70         leaf gbp-ofoverlay-table-offset {
71             description
72                 "Used to offset pipeline to start at offset+1. Table0 is required.
73                 This is to allow the enduser to configure where the GBP pipeline starts.";
74             type uint8;
75         }
76     }
77
78     grouping endpoint-location {
79         description
80             "The location for this endpoint in the overlay network";
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     augment "/endpoint:endpoints/endpoint:endpoint" {
111         ext:augment-identifier "of-overlay-context";
112         uses endpoint-location;
113     }
114
115     augment "/endpoint:endpoints/endpoint:endpoint-l3" {
116         ext:augment-identifier "of-overlay-l3-context";
117         uses endpoint-location;
118     }
119
120     augment "/endpoint:register-endpoint/endpoint:input" {
121         ext:augment-identifier "of-overlay-context-input";
122         uses endpoint-location;
123     }
124
125     augment "/policy:tenants/policy:tenant/policy:forwarding-context/policy:l2-flood-domain" {
126         ext:augment-identifier "segmentation";
127         leaf segmentation-id {
128             description "Logical segmentation of an l2-flood-domain, e.g. by using VLANs.";
129             type uint16 {
130                 range "1 .. 4095";
131             }
132         }
133     }
134
135     /* 
136     * TODO: should add "portname" to this instead of using heuristic name.
137     * Then SwitchManager could pull from here potentially. The only things that should
138     * populate this are REST or OVSDB-Neutron ... but now we could listen on OVSDB for when
139     * an SFF creates this for us and use the same tunnel... 
140     */
141     augment "/inv:nodes/inv:node" {
142         ext:augment-identifier "of-overlay-node-config";
143         list tunnel {
144             key "tunnel-type";
145             uses ovsdb-overlay:tunnel-type-attributes;
146             uses ovsdb-overlay:ip-port-locator;
147             leaf node-connector-id {
148                 description
149                     "The node connector where is the tunnel located. The
150                      format is openflow:[dpid]:[port] where the dpid is
151                      the value of the switch DPID cast to a long, and port
152                      is the openflow port number of the interface where
153                      the endpoint is connected.";
154                 type inv:node-connector-id;
155             }
156         }
157         container ovsdb-config {
158             leaf ip {
159                 description
160                     "The IP address used to connect to OVSDB on this switch";
161                 type inet:ip-address;
162             }
163             leaf port {
164                 description
165                     "The port number used to connect to OVSDB on this switch";
166                 type inet:port-number;
167                 default 6640;
168             }
169         }
170         list external-interfaces {
171             description
172                 "The node connectors for the external interfaces to the underlay.
173                 If interface name is required, can be looked up from inventory using
174                 this field as a key to FCNC (FlowCapableNodeConnector)";
175             key "node-connector-id";
176             leaf node-connector-id {
177                 type inv:node-connector-id;
178             }
179         }
180     }
181 }