introducing loopback port for VPP
[groupbasedpolicy.git] / renderers / vpp / src / main / yang / vpp-renderer.yang
1 /*
2  * Copyright (c) 2016 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 vpp-renderer {
10     yang-version 1;
11
12     namespace "urn:opendaylight:groupbasedpolicy:vpp_renderer";
13     prefix "vpp-renderer";
14
15     import base-endpoint { prefix base-ep; revision-date 2016-04-27; }
16     import network-topology { prefix nt; revision-date 2013-10-21; }
17     import opendaylight-l2-types { prefix l2-types; revision-date "2013-08-27"; }
18     import ietf-yang-types { prefix yang-types; revision-date "2013-07-15"; }
19     import ietf-inet-types { prefix "inet-types"; }
20
21     description
22         "This module is a baseline for the group-based policy vpp renderer model.";
23
24     revision "2016-04-25" {
25         description
26             "Initial revision.";
27     }
28
29     identity network-type-base {
30         description "Base for Network Types.";
31     }
32
33     identity flat-network {
34         description "Flat Provider Network Type";
35         base network-type-base;
36     }
37
38     identity vlan-network {
39         description "VLAN Provider Network Type";
40         base network-type-base;
41     }
42
43     typedef network-type {
44         description "Type of Network.";
45         type identityref {
46             base network-type-base;
47         }
48     }
49
50     container config {
51         list vpp-endpoint {
52             description "Renderer creates/removes interface on VPP node based on given parameters.";
53
54             key "context-type context-id address-type address";
55             uses base-ep:address-endpoint-key;
56
57             leaf vpp-node-path {
58                 description "Path to a node representing mount-point to VPP instance.";
59                 mandatory true;
60                 type instance-identifier;
61             }
62             leaf vpp-interface-name {
63                 description "Name of interface for the endpoint on VPP";
64                 mandatory true;
65                 type string;
66             }
67             leaf description {
68                 description "Additional description of the vpp-endpoint";
69                 type string;
70             }
71             choice interface-type-choice {
72                 case vhost-user-case {
73                     leaf socket {
74                         description "Identifier of a vhost user";
75                         type string {
76                             length 1..255;
77                         }
78                     }
79                 }
80                 case tap-case {
81                     leaf name {
82                         description "Identifier of a tap port";
83                         mandatory true;
84                         type string {
85                             length 1..255;
86                         }
87                     }
88                     leaf physical-address {
89                         description "MAC address of a tap port";
90                         type yang-types:phys-address;
91                     }
92                 }
93                 case loopback-case {
94                     leaf phys-address {
95                         description "MAC address of a loopback interface";
96                         type yang-types:phys-address;
97                     }
98                     leaf ip-address {
99                         description "Ip address of a loopback interface";
100                         type inet-types:ip-address;
101                     }
102                     leaf ip-prefix {
103                         description "Ip address prefix of a loopback interface";
104                         type inet-types:ip-prefix;
105                     }
106                     leaf bvi {
107                         description "Enable/disable BVI for loopback interface";
108                         type boolean;
109                     }
110                 }
111             }
112         }
113
114         list gbp-bridge-domain {
115             key "id";
116             leaf id {
117                 description "Same as in VBD.";
118                 type string;
119             }
120             leaf description {
121                type string;
122             }
123             leaf type {
124                 mandatory true;
125                 type network-type;
126             }
127             leaf vlan {
128                 when "type = 'vlan-network'";
129                 type l2-types:vlan-id;
130             }
131             list physical-location-ref {
132                 description
133                     "Refers to physical interfaces on vpp nodes through which external
134                      nodes belonging to the same bridge-domain can be reached.";
135                 key "node-id";
136                 leaf node-id {
137                     description "Refers to a VPP node.";
138                     type nt:node-id;
139                 }
140                 leaf-list interface {
141                     description "Physical interface on the VPP node.";
142                     type string;
143                 }
144             }
145         }
146     }
147 }