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