Introducing RPCs for remote calls to 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     grouping bridge-domain-base-attributes {
51         leaf id {
52             description "Same as in VBD.";
53             type string;
54         }
55         leaf description {
56            type string;
57         }
58         list physical-location-ref {
59             description
60                 "Refers to physical interfaces on vpp nodes through which external
61                  nodes belonging to the same bridge-domain can be reached.";
62             key "node-id";
63             leaf node-id {
64                 description "Refers to a VPP node.";
65                 type nt:node-id;
66             }
67             leaf-list interface {
68                 description "Physical interface on the VPP node.";
69                 type string;
70             }
71         }
72     }
73
74     grouping interface-attributes {
75         uses vpp-renderer:interface-location;
76         leaf description {
77             description "Additional description of the vpp-endpoint";
78             type string;
79         }
80         choice interface-type-choice {
81             mandatory true;
82             case vhost-user-case {
83                 leaf socket {
84                     description "Identifier of a vhost user";
85                     type string {
86                         length 1..255;
87                     }
88                 }
89             }
90             case tap-case {
91                 leaf name {
92                     description "Identifier of a tap port";
93                     mandatory true;
94                     type string {
95                         length 1..255;
96                     }
97                 }
98                 leaf physical-address {
99                     description "MAC address of a tap port";
100                     type yang-types:phys-address;
101                 }
102             }
103             case loopback-case {
104                 leaf phys-address {
105                     description "MAC address of a loopback interface";
106                     type yang-types:phys-address;
107                 }
108                 leaf ip-address {
109                     description "Ip address of a loopback interface";
110                     type inet-types:ip-address;
111                 }
112                 leaf ip-prefix {
113                     description "Ip address prefix of a loopback interface";
114                     type inet-types:ip-prefix;
115                 }
116                 leaf bvi {
117                     description "Enable/disable BVI for loopback interface";
118                     type boolean;
119                 }
120             }
121         }
122     }
123
124     grouping interface-location {
125         leaf vpp-node-path {
126             description "Path to a node representing mount-point to VPP instance.";
127             mandatory true;
128             type instance-identifier;
129         }
130         leaf vpp-interface-name {
131             description "Name of interface for the endpoint on VPP";
132             mandatory true;
133             type string;
134         }
135     }
136
137     container config {
138         list vpp-endpoint {
139             description "Renderer creates/removes interface on VPP node based on given parameters.";
140
141             key "context-type context-id address-type address";
142             uses base-ep:address-endpoint-key;
143
144             uses interface-attributes;
145         }
146
147         list gbp-bridge-domain {
148             key "id";
149             uses bridge-domain-base-attributes;
150             leaf type {
151                 mandatory true;
152                 type network-type;
153             }
154             leaf vlan {
155                 when "type = 'vlan-network'";
156                 type l2-types:vlan-id;
157             }
158         }
159     }
160 }