Merge changes from topic 'ofj-models-to-ofp-models'
[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 flow-port-status {
96         leaf reason {
97             type port-reason;
98         }
99
100         uses flow-capable-port;
101     }
102
103     grouping queues {
104         list queue {
105                 key "queue-id";
106                 uses queue-types:queue-packet;
107         }
108     }
109
110     grouping flow-capable-port {
111
112         uses common-port;
113
114         leaf name {
115             type string;
116             description "Human readable name of the port";
117         }
118
119         container state {
120             uses port-state;
121             description "Description of state of port";
122         }
123
124         leaf current-feature {
125             type port-features;
126             description "Bit map of OFPPF-* flags";
127         }
128
129         leaf supported {
130             type port-features;
131             description "Features supported by the port";
132         }
133
134         leaf peer-features {
135             type port-features;
136             description "Features advertised by peer";
137         }
138
139         leaf current-speed {
140             type uint32;
141             units "kbps";
142             description "Current port bit rate in kbps";
143         }
144
145         leaf maximum-speed {
146             type uint32;
147             units "kbps";
148             description "Max port bit rate in kbps";
149         }
150
151         uses queues;
152     }
153
154     grouping port-mod {
155         container port {
156             list port {
157                 key "port-mod-order";
158                 leaf port-mod-order {
159                     type uint32;
160                 }
161
162                 uses common-port;
163
164                 leaf mask {
165                     type port-config;
166                     description "Bitmap of OFPPC-* flags to be changed";
167                 }
168
169                 leaf container-name {
170                     type string;
171                 }
172
173                 leaf port-name {
174                     type string;
175                 }
176
177                 leaf barrier {
178                     type boolean;
179                 }
180             }
181         }
182     }
183
184     container port-message {
185         uses common-port;
186         uses ofproto:ofHeader;
187     }
188
189     augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
190         case multipart-reply-port-desc {
191             list ports {
192                 uses flow-capable-port;
193             }
194         }
195     }
196 }