Fixup openflow-protocol-impl dependencies
[openflowplugin.git] / model / model-flow-base / src / main / yang / opendaylight-port-types.yang
1 module opendaylight-port-types {
2     namespace "urn:opendaylight:flow:types:port";
3     prefix port-types;
4
5     import ietf-yang-types {prefix yang; revision-date "2013-07-15";}
6     import opendaylight-queue-types {prefix queue-types; revision-date "2013-09-25";}
7     import openflow-protocol { prefix ofproto; revision-date "2013-07-31"; }
8     import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }
9
10     revision "2013-09-25" {
11         description "Initial revision of Port Inventory model";
12     }
13
14     typedef port-reason {
15         type enumeration {
16             enum add;
17             enum delete;
18             enum update;
19         }
20     }
21
22     typedef port-config {
23         type bits {
24             bit PORT-DOWN;
25             bit NO-RECV;
26             bit NO-FWD;
27             bit NO-PACKET-IN;
28         }
29     }
30
31     grouping port-state {
32         leaf link-down {
33             type boolean;
34         }
35         leaf blocked {
36             type boolean;
37         }
38         leaf live {
39             type boolean;
40         }
41     }
42
43     typedef port-features {
44         type bits {
45             bit ten-mb-hd;
46             bit ten-mb-fd;
47             bit hundred-mb-hd;
48             bit hundred-mb-fd;
49             bit one-gb-hd;
50             bit one-gb-fd;
51             bit ten-gb-fd;
52             bit forty-gb-fd;
53             bit hundred-gb-fd;
54             bit one-tb-fd;
55             bit other;
56             bit copper;
57             bit fiber;
58             bit autoeng;
59             bit pause;
60             bit pause-asym;
61         }
62     }
63
64     typedef port-number-uni {
65         description "Union port number: 4B number / string (reserved port name)";
66         type union {
67             type uint32;
68             type string;
69         }
70     }
71
72     grouping common-port {
73
74         leaf port-number {
75             type port-number-uni;
76         }
77
78         leaf hardware-address {
79             type yang:mac-address;
80             description "MAC Address of the port";
81
82         }
83
84         leaf configuration {
85             type port-config;
86             description "Bit map of OFPPC-* flags";
87         }
88
89         leaf advertised-features {
90             type port-features;
91             description "Features being advertised by the port";
92         }
93     }
94
95     grouping  common-port-with-mask {
96         uses common-port;
97
98         leaf mask {
99             type port-config;
100             description "Bitmap of OFPPC-* flags to be changed";
101         }
102     }
103
104     grouping flow-port-status {
105         leaf reason {
106             type port-reason;
107         }
108
109         uses flow-capable-port;
110     }
111
112     grouping queues {
113         list queue {
114                 key "queue-id";
115                 uses queue-types:queue-packet;
116         }
117     }
118
119     grouping flow-capable-port {
120
121         uses common-port;
122
123         leaf name {
124             type string;
125             description "Human readable name of the port";
126         }
127
128         container state {
129             uses port-state;
130             description "Description of state of port";
131         }
132
133         leaf current-feature {
134             type port-features;
135             description "Bit map of OFPPF-* flags";
136         }
137
138         leaf supported {
139             type port-features;
140             description "Features supported by the port";
141         }
142
143         leaf peer-features {
144             type port-features;
145             description "Features advertised by peer";
146         }
147
148         leaf current-speed {
149             type uint32;
150             units "kbps";
151             description "Current port bit rate in kbps";
152         }
153
154         leaf maximum-speed {
155             type uint32;
156             units "kbps";
157             description "Max port bit rate in kbps";
158         }
159
160         uses queues;
161     }
162
163     grouping port-mod {
164         container port {
165             list port {
166                 key "port-mod-order";
167                 leaf port-mod-order {
168                     type uint32;
169                 }
170
171                 uses common-port-with-mask;
172
173                 leaf container-name {
174                     type string;
175                 }
176
177                 leaf port-name {
178                     type string;
179                 }
180
181                 leaf barrier {
182                     type boolean;
183                 }
184             }
185         }
186     }
187
188     container port-message {
189         uses common-port-with-mask;
190         uses ofproto:ofHeader;
191     }
192
193     augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
194         case multipart-reply-port-desc {
195             list ports {
196                 uses flow-capable-port;
197             }
198         }
199     }
200
201
202     augment "/multipart:multipart-request/multipart:multipart-request-body" {
203         case multipart-request-port-desc {
204             // Empty case
205         }
206     }
207 }