blob: 61da66ed3bb16fc14bc129cf3131e695d787095d [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2// Copyright (c) 2011, 2012 Open Networking Foundation
3// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4// This library was generated by the LoxiGen Compiler.
5// See the file LICENSE.txt which should have been included in the source distribution
6
7// Automatically generated by LOXI from template of_class.java
8// Do not modify
9
10package org.projectfloodlight.openflow.protocol.ver10;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import org.slf4j.Logger;
27import org.slf4j.LoggerFactory;
28import java.util.Set;
29import com.google.common.collect.ImmutableSet;
30import org.jboss.netty.buffer.ChannelBuffer;
31import com.google.common.hash.PrimitiveSink;
32import com.google.common.hash.Funnel;
33
34class OFPortDescVer10 implements OFPortDesc {
35 private static final Logger logger = LoggerFactory.getLogger(OFPortDescVer10.class);
36 // version: 1.0
37 final static byte WIRE_VERSION = 1;
38 final static int LENGTH = 48;
39
40 private final static OFPort DEFAULT_PORT_NO = OFPort.ANY;
41 private final static MacAddress DEFAULT_HW_ADDR = MacAddress.NONE;
42 private final static String DEFAULT_NAME = "";
43 private final static Set<OFPortConfig> DEFAULT_CONFIG = ImmutableSet.<OFPortConfig>of();
44 private final static Set<OFPortState> DEFAULT_STATE = ImmutableSet.<OFPortState>of();
45 private final static Set<OFPortFeatures> DEFAULT_CURR = ImmutableSet.<OFPortFeatures>of();
46 private final static Set<OFPortFeatures> DEFAULT_ADVERTISED = ImmutableSet.<OFPortFeatures>of();
47 private final static Set<OFPortFeatures> DEFAULT_SUPPORTED = ImmutableSet.<OFPortFeatures>of();
48 private final static Set<OFPortFeatures> DEFAULT_PEER = ImmutableSet.<OFPortFeatures>of();
49
50 // OF message fields
51 private final OFPort portNo;
52 private final MacAddress hwAddr;
53 private final String name;
54 private final Set<OFPortConfig> config;
55 private final Set<OFPortState> state;
56 private final Set<OFPortFeatures> curr;
57 private final Set<OFPortFeatures> advertised;
58 private final Set<OFPortFeatures> supported;
59 private final Set<OFPortFeatures> peer;
60//
61 // Immutable default instance
62 final static OFPortDescVer10 DEFAULT = new OFPortDescVer10(
63 DEFAULT_PORT_NO, DEFAULT_HW_ADDR, DEFAULT_NAME, DEFAULT_CONFIG, DEFAULT_STATE, DEFAULT_CURR, DEFAULT_ADVERTISED, DEFAULT_SUPPORTED, DEFAULT_PEER
64 );
65
66 // package private constructor - used by readers, builders, and factory
67 OFPortDescVer10(OFPort portNo, MacAddress hwAddr, String name, Set<OFPortConfig> config, Set<OFPortState> state, Set<OFPortFeatures> curr, Set<OFPortFeatures> advertised, Set<OFPortFeatures> supported, Set<OFPortFeatures> peer) {
68 this.portNo = portNo;
69 this.hwAddr = hwAddr;
70 this.name = name;
71 this.config = config;
72 this.state = state;
73 this.curr = curr;
74 this.advertised = advertised;
75 this.supported = supported;
76 this.peer = peer;
77 }
78
79 // Accessors for OF message fields
80 @Override
81 public OFPort getPortNo() {
82 return portNo;
83 }
84
85 @Override
86 public MacAddress getHwAddr() {
87 return hwAddr;
88 }
89
90 @Override
91 public String getName() {
92 return name;
93 }
94
95 @Override
96 public Set<OFPortConfig> getConfig() {
97 return config;
98 }
99
100 @Override
101 public Set<OFPortState> getState() {
102 return state;
103 }
104
105 @Override
106 public Set<OFPortFeatures> getCurr() {
107 return curr;
108 }
109
110 @Override
111 public Set<OFPortFeatures> getAdvertised() {
112 return advertised;
113 }
114
115 @Override
116 public Set<OFPortFeatures> getSupported() {
117 return supported;
118 }
119
120 @Override
121 public Set<OFPortFeatures> getPeer() {
122 return peer;
123 }
124
125 @Override
126 public long getCurrSpeed()throws UnsupportedOperationException {
127 throw new UnsupportedOperationException("Property currSpeed not supported in version 1.0");
128 }
129
130 @Override
131 public long getMaxSpeed()throws UnsupportedOperationException {
132 throw new UnsupportedOperationException("Property maxSpeed not supported in version 1.0");
133 }
134
135 @Override
136 public OFVersion getVersion() {
137 return OFVersion.OF_10;
138 }
139
140
141
142 public OFPortDesc.Builder createBuilder() {
143 return new BuilderWithParent(this);
144 }
145
146 static class BuilderWithParent implements OFPortDesc.Builder {
147 final OFPortDescVer10 parentMessage;
148
149 // OF message fields
150 private boolean portNoSet;
151 private OFPort portNo;
152 private boolean hwAddrSet;
153 private MacAddress hwAddr;
154 private boolean nameSet;
155 private String name;
156 private boolean configSet;
157 private Set<OFPortConfig> config;
158 private boolean stateSet;
159 private Set<OFPortState> state;
160 private boolean currSet;
161 private Set<OFPortFeatures> curr;
162 private boolean advertisedSet;
163 private Set<OFPortFeatures> advertised;
164 private boolean supportedSet;
165 private Set<OFPortFeatures> supported;
166 private boolean peerSet;
167 private Set<OFPortFeatures> peer;
168
169 BuilderWithParent(OFPortDescVer10 parentMessage) {
170 this.parentMessage = parentMessage;
171 }
172
173 @Override
174 public OFPort getPortNo() {
175 return portNo;
176 }
177
178 @Override
179 public OFPortDesc.Builder setPortNo(OFPort portNo) {
180 this.portNo = portNo;
181 this.portNoSet = true;
182 return this;
183 }
184 @Override
185 public MacAddress getHwAddr() {
186 return hwAddr;
187 }
188
189 @Override
190 public OFPortDesc.Builder setHwAddr(MacAddress hwAddr) {
191 this.hwAddr = hwAddr;
192 this.hwAddrSet = true;
193 return this;
194 }
195 @Override
196 public String getName() {
197 return name;
198 }
199
200 @Override
201 public OFPortDesc.Builder setName(String name) {
202 this.name = name;
203 this.nameSet = true;
204 return this;
205 }
206 @Override
207 public Set<OFPortConfig> getConfig() {
208 return config;
209 }
210
211 @Override
212 public OFPortDesc.Builder setConfig(Set<OFPortConfig> config) {
213 this.config = config;
214 this.configSet = true;
215 return this;
216 }
217 @Override
218 public Set<OFPortState> getState() {
219 return state;
220 }
221
222 @Override
223 public OFPortDesc.Builder setState(Set<OFPortState> state) {
224 this.state = state;
225 this.stateSet = true;
226 return this;
227 }
228 @Override
229 public Set<OFPortFeatures> getCurr() {
230 return curr;
231 }
232
233 @Override
234 public OFPortDesc.Builder setCurr(Set<OFPortFeatures> curr) {
235 this.curr = curr;
236 this.currSet = true;
237 return this;
238 }
239 @Override
240 public Set<OFPortFeatures> getAdvertised() {
241 return advertised;
242 }
243
244 @Override
245 public OFPortDesc.Builder setAdvertised(Set<OFPortFeatures> advertised) {
246 this.advertised = advertised;
247 this.advertisedSet = true;
248 return this;
249 }
250 @Override
251 public Set<OFPortFeatures> getSupported() {
252 return supported;
253 }
254
255 @Override
256 public OFPortDesc.Builder setSupported(Set<OFPortFeatures> supported) {
257 this.supported = supported;
258 this.supportedSet = true;
259 return this;
260 }
261 @Override
262 public Set<OFPortFeatures> getPeer() {
263 return peer;
264 }
265
266 @Override
267 public OFPortDesc.Builder setPeer(Set<OFPortFeatures> peer) {
268 this.peer = peer;
269 this.peerSet = true;
270 return this;
271 }
272 @Override
273 public long getCurrSpeed()throws UnsupportedOperationException {
274 throw new UnsupportedOperationException("Property currSpeed not supported in version 1.0");
275 }
276
277 @Override
278 public OFPortDesc.Builder setCurrSpeed(long currSpeed) throws UnsupportedOperationException {
279 throw new UnsupportedOperationException("Property currSpeed not supported in version 1.0");
280 }
281 @Override
282 public long getMaxSpeed()throws UnsupportedOperationException {
283 throw new UnsupportedOperationException("Property maxSpeed not supported in version 1.0");
284 }
285
286 @Override
287 public OFPortDesc.Builder setMaxSpeed(long maxSpeed) throws UnsupportedOperationException {
288 throw new UnsupportedOperationException("Property maxSpeed not supported in version 1.0");
289 }
290 @Override
291 public OFVersion getVersion() {
292 return OFVersion.OF_10;
293 }
294
295
296
297 @Override
298 public OFPortDesc build() {
299 OFPort portNo = this.portNoSet ? this.portNo : parentMessage.portNo;
300 if(portNo == null)
301 throw new NullPointerException("Property portNo must not be null");
302 MacAddress hwAddr = this.hwAddrSet ? this.hwAddr : parentMessage.hwAddr;
303 if(hwAddr == null)
304 throw new NullPointerException("Property hwAddr must not be null");
305 String name = this.nameSet ? this.name : parentMessage.name;
306 if(name == null)
307 throw new NullPointerException("Property name must not be null");
308 Set<OFPortConfig> config = this.configSet ? this.config : parentMessage.config;
309 if(config == null)
310 throw new NullPointerException("Property config must not be null");
311 Set<OFPortState> state = this.stateSet ? this.state : parentMessage.state;
312 if(state == null)
313 throw new NullPointerException("Property state must not be null");
314 Set<OFPortFeatures> curr = this.currSet ? this.curr : parentMessage.curr;
315 if(curr == null)
316 throw new NullPointerException("Property curr must not be null");
317 Set<OFPortFeatures> advertised = this.advertisedSet ? this.advertised : parentMessage.advertised;
318 if(advertised == null)
319 throw new NullPointerException("Property advertised must not be null");
320 Set<OFPortFeatures> supported = this.supportedSet ? this.supported : parentMessage.supported;
321 if(supported == null)
322 throw new NullPointerException("Property supported must not be null");
323 Set<OFPortFeatures> peer = this.peerSet ? this.peer : parentMessage.peer;
324 if(peer == null)
325 throw new NullPointerException("Property peer must not be null");
326
327 //
328 return new OFPortDescVer10(
329 portNo,
330 hwAddr,
331 name,
332 config,
333 state,
334 curr,
335 advertised,
336 supported,
337 peer
338 );
339 }
340
341 }
342
343 static class Builder implements OFPortDesc.Builder {
344 // OF message fields
345 private boolean portNoSet;
346 private OFPort portNo;
347 private boolean hwAddrSet;
348 private MacAddress hwAddr;
349 private boolean nameSet;
350 private String name;
351 private boolean configSet;
352 private Set<OFPortConfig> config;
353 private boolean stateSet;
354 private Set<OFPortState> state;
355 private boolean currSet;
356 private Set<OFPortFeatures> curr;
357 private boolean advertisedSet;
358 private Set<OFPortFeatures> advertised;
359 private boolean supportedSet;
360 private Set<OFPortFeatures> supported;
361 private boolean peerSet;
362 private Set<OFPortFeatures> peer;
363
364 @Override
365 public OFPort getPortNo() {
366 return portNo;
367 }
368
369 @Override
370 public OFPortDesc.Builder setPortNo(OFPort portNo) {
371 this.portNo = portNo;
372 this.portNoSet = true;
373 return this;
374 }
375 @Override
376 public MacAddress getHwAddr() {
377 return hwAddr;
378 }
379
380 @Override
381 public OFPortDesc.Builder setHwAddr(MacAddress hwAddr) {
382 this.hwAddr = hwAddr;
383 this.hwAddrSet = true;
384 return this;
385 }
386 @Override
387 public String getName() {
388 return name;
389 }
390
391 @Override
392 public OFPortDesc.Builder setName(String name) {
393 this.name = name;
394 this.nameSet = true;
395 return this;
396 }
397 @Override
398 public Set<OFPortConfig> getConfig() {
399 return config;
400 }
401
402 @Override
403 public OFPortDesc.Builder setConfig(Set<OFPortConfig> config) {
404 this.config = config;
405 this.configSet = true;
406 return this;
407 }
408 @Override
409 public Set<OFPortState> getState() {
410 return state;
411 }
412
413 @Override
414 public OFPortDesc.Builder setState(Set<OFPortState> state) {
415 this.state = state;
416 this.stateSet = true;
417 return this;
418 }
419 @Override
420 public Set<OFPortFeatures> getCurr() {
421 return curr;
422 }
423
424 @Override
425 public OFPortDesc.Builder setCurr(Set<OFPortFeatures> curr) {
426 this.curr = curr;
427 this.currSet = true;
428 return this;
429 }
430 @Override
431 public Set<OFPortFeatures> getAdvertised() {
432 return advertised;
433 }
434
435 @Override
436 public OFPortDesc.Builder setAdvertised(Set<OFPortFeatures> advertised) {
437 this.advertised = advertised;
438 this.advertisedSet = true;
439 return this;
440 }
441 @Override
442 public Set<OFPortFeatures> getSupported() {
443 return supported;
444 }
445
446 @Override
447 public OFPortDesc.Builder setSupported(Set<OFPortFeatures> supported) {
448 this.supported = supported;
449 this.supportedSet = true;
450 return this;
451 }
452 @Override
453 public Set<OFPortFeatures> getPeer() {
454 return peer;
455 }
456
457 @Override
458 public OFPortDesc.Builder setPeer(Set<OFPortFeatures> peer) {
459 this.peer = peer;
460 this.peerSet = true;
461 return this;
462 }
463 @Override
464 public long getCurrSpeed()throws UnsupportedOperationException {
465 throw new UnsupportedOperationException("Property currSpeed not supported in version 1.0");
466 }
467
468 @Override
469 public OFPortDesc.Builder setCurrSpeed(long currSpeed) throws UnsupportedOperationException {
470 throw new UnsupportedOperationException("Property currSpeed not supported in version 1.0");
471 }
472 @Override
473 public long getMaxSpeed()throws UnsupportedOperationException {
474 throw new UnsupportedOperationException("Property maxSpeed not supported in version 1.0");
475 }
476
477 @Override
478 public OFPortDesc.Builder setMaxSpeed(long maxSpeed) throws UnsupportedOperationException {
479 throw new UnsupportedOperationException("Property maxSpeed not supported in version 1.0");
480 }
481 @Override
482 public OFVersion getVersion() {
483 return OFVersion.OF_10;
484 }
485
486//
487 @Override
488 public OFPortDesc build() {
489 OFPort portNo = this.portNoSet ? this.portNo : DEFAULT_PORT_NO;
490 if(portNo == null)
491 throw new NullPointerException("Property portNo must not be null");
492 MacAddress hwAddr = this.hwAddrSet ? this.hwAddr : DEFAULT_HW_ADDR;
493 if(hwAddr == null)
494 throw new NullPointerException("Property hwAddr must not be null");
495 String name = this.nameSet ? this.name : DEFAULT_NAME;
496 if(name == null)
497 throw new NullPointerException("Property name must not be null");
498 Set<OFPortConfig> config = this.configSet ? this.config : DEFAULT_CONFIG;
499 if(config == null)
500 throw new NullPointerException("Property config must not be null");
501 Set<OFPortState> state = this.stateSet ? this.state : DEFAULT_STATE;
502 if(state == null)
503 throw new NullPointerException("Property state must not be null");
504 Set<OFPortFeatures> curr = this.currSet ? this.curr : DEFAULT_CURR;
505 if(curr == null)
506 throw new NullPointerException("Property curr must not be null");
507 Set<OFPortFeatures> advertised = this.advertisedSet ? this.advertised : DEFAULT_ADVERTISED;
508 if(advertised == null)
509 throw new NullPointerException("Property advertised must not be null");
510 Set<OFPortFeatures> supported = this.supportedSet ? this.supported : DEFAULT_SUPPORTED;
511 if(supported == null)
512 throw new NullPointerException("Property supported must not be null");
513 Set<OFPortFeatures> peer = this.peerSet ? this.peer : DEFAULT_PEER;
514 if(peer == null)
515 throw new NullPointerException("Property peer must not be null");
516
517
518 return new OFPortDescVer10(
519 portNo,
520 hwAddr,
521 name,
522 config,
523 state,
524 curr,
525 advertised,
526 supported,
527 peer
528 );
529 }
530
531 }
532
533
534 final static Reader READER = new Reader();
535 static class Reader implements OFMessageReader<OFPortDesc> {
536 @Override
537 public OFPortDesc readFrom(ChannelBuffer bb) throws OFParseError {
538 OFPort portNo = OFPort.read2Bytes(bb);
539 MacAddress hwAddr = MacAddress.read6Bytes(bb);
540 String name = ChannelUtils.readFixedLengthString(bb, 16);
541 Set<OFPortConfig> config = OFPortConfigSerializerVer10.readFrom(bb);
542 Set<OFPortState> state = OFPortStateSerializerVer10.readFrom(bb);
543 Set<OFPortFeatures> curr = OFPortFeaturesSerializerVer10.readFrom(bb);
544 Set<OFPortFeatures> advertised = OFPortFeaturesSerializerVer10.readFrom(bb);
545 Set<OFPortFeatures> supported = OFPortFeaturesSerializerVer10.readFrom(bb);
546 Set<OFPortFeatures> peer = OFPortFeaturesSerializerVer10.readFrom(bb);
547
548 OFPortDescVer10 portDescVer10 = new OFPortDescVer10(
549 portNo,
550 hwAddr,
551 name,
552 config,
553 state,
554 curr,
555 advertised,
556 supported,
557 peer
558 );
559 if(logger.isTraceEnabled())
560 logger.trace("readFrom - read={}", portDescVer10);
561 return portDescVer10;
562 }
563 }
564
565 public void putTo(PrimitiveSink sink) {
566 FUNNEL.funnel(this, sink);
567 }
568
569 final static OFPortDescVer10Funnel FUNNEL = new OFPortDescVer10Funnel();
570 static class OFPortDescVer10Funnel implements Funnel<OFPortDescVer10> {
571 private static final long serialVersionUID = 1L;
572 @Override
573 public void funnel(OFPortDescVer10 message, PrimitiveSink sink) {
574 message.portNo.putTo(sink);
575 message.hwAddr.putTo(sink);
576 sink.putUnencodedChars(message.name);
577 OFPortConfigSerializerVer10.putTo(message.config, sink);
578 OFPortStateSerializerVer10.putTo(message.state, sink);
579 OFPortFeaturesSerializerVer10.putTo(message.curr, sink);
580 OFPortFeaturesSerializerVer10.putTo(message.advertised, sink);
581 OFPortFeaturesSerializerVer10.putTo(message.supported, sink);
582 OFPortFeaturesSerializerVer10.putTo(message.peer, sink);
583 }
584 }
585
586
587 public void writeTo(ChannelBuffer bb) {
588 WRITER.write(bb, this);
589 }
590
591 final static Writer WRITER = new Writer();
592 static class Writer implements OFMessageWriter<OFPortDescVer10> {
593 @Override
594 public void write(ChannelBuffer bb, OFPortDescVer10 message) {
595 message.portNo.write2Bytes(bb);
596 message.hwAddr.write6Bytes(bb);
597 ChannelUtils.writeFixedLengthString(bb, message.name, 16);
598 OFPortConfigSerializerVer10.writeTo(bb, message.config);
599 OFPortStateSerializerVer10.writeTo(bb, message.state);
600 OFPortFeaturesSerializerVer10.writeTo(bb, message.curr);
601 OFPortFeaturesSerializerVer10.writeTo(bb, message.advertised);
602 OFPortFeaturesSerializerVer10.writeTo(bb, message.supported);
603 OFPortFeaturesSerializerVer10.writeTo(bb, message.peer);
604
605
606 }
607 }
608
609 @Override
610 public String toString() {
611 StringBuilder b = new StringBuilder("OFPortDescVer10(");
612 b.append("portNo=").append(portNo);
613 b.append(", ");
614 b.append("hwAddr=").append(hwAddr);
615 b.append(", ");
616 b.append("name=").append(name);
617 b.append(", ");
618 b.append("config=").append(config);
619 b.append(", ");
620 b.append("state=").append(state);
621 b.append(", ");
622 b.append("curr=").append(curr);
623 b.append(", ");
624 b.append("advertised=").append(advertised);
625 b.append(", ");
626 b.append("supported=").append(supported);
627 b.append(", ");
628 b.append("peer=").append(peer);
629 b.append(")");
630 return b.toString();
631 }
632
633 @Override
634 public boolean equals(Object obj) {
635 if (this == obj)
636 return true;
637 if (obj == null)
638 return false;
639 if (getClass() != obj.getClass())
640 return false;
641 OFPortDescVer10 other = (OFPortDescVer10) obj;
642
643 if (portNo == null) {
644 if (other.portNo != null)
645 return false;
646 } else if (!portNo.equals(other.portNo))
647 return false;
648 if (hwAddr == null) {
649 if (other.hwAddr != null)
650 return false;
651 } else if (!hwAddr.equals(other.hwAddr))
652 return false;
653 if (name == null) {
654 if (other.name != null)
655 return false;
656 } else if (!name.equals(other.name))
657 return false;
658 if (config == null) {
659 if (other.config != null)
660 return false;
661 } else if (!config.equals(other.config))
662 return false;
663 if (state == null) {
664 if (other.state != null)
665 return false;
666 } else if (!state.equals(other.state))
667 return false;
668 if (curr == null) {
669 if (other.curr != null)
670 return false;
671 } else if (!curr.equals(other.curr))
672 return false;
673 if (advertised == null) {
674 if (other.advertised != null)
675 return false;
676 } else if (!advertised.equals(other.advertised))
677 return false;
678 if (supported == null) {
679 if (other.supported != null)
680 return false;
681 } else if (!supported.equals(other.supported))
682 return false;
683 if (peer == null) {
684 if (other.peer != null)
685 return false;
686 } else if (!peer.equals(other.peer))
687 return false;
688 return true;
689 }
690
691 @Override
692 public int hashCode() {
693 final int prime = 31;
694 int result = 1;
695
696 result = prime * result + ((portNo == null) ? 0 : portNo.hashCode());
697 result = prime * result + ((hwAddr == null) ? 0 : hwAddr.hashCode());
698 result = prime * result + ((name == null) ? 0 : name.hashCode());
699 result = prime * result + ((config == null) ? 0 : config.hashCode());
700 result = prime * result + ((state == null) ? 0 : state.hashCode());
701 result = prime * result + ((curr == null) ? 0 : curr.hashCode());
702 result = prime * result + ((advertised == null) ? 0 : advertised.hashCode());
703 result = prime * result + ((supported == null) ? 0 : supported.hashCode());
704 result = prime * result + ((peer == null) ? 0 : peer.hashCode());
705 return result;
706 }
707
708}