alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame] | 1 | // 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 const_serializer.java |
| 8 | // Do not modify |
| 9 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver13; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.projectfloodlight.openflow.protocol.OFGroupModFailedCode; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFGroupModFailedCodeSerializerVer13 { |
| 31 | |
| 32 | public final static short GROUP_EXISTS_VAL = (short) 0x0; |
| 33 | public final static short INVALID_GROUP_VAL = (short) 0x1; |
| 34 | public final static short WEIGHT_UNSUPPORTED_VAL = (short) 0x2; |
| 35 | public final static short OUT_OF_GROUPS_VAL = (short) 0x3; |
| 36 | public final static short OUT_OF_BUCKETS_VAL = (short) 0x4; |
| 37 | public final static short CHAINING_UNSUPPORTED_VAL = (short) 0x5; |
| 38 | public final static short WATCH_UNSUPPORTED_VAL = (short) 0x6; |
| 39 | public final static short LOOP_VAL = (short) 0x7; |
| 40 | public final static short UNKNOWN_GROUP_VAL = (short) 0x8; |
| 41 | public final static short CHAINED_GROUP_VAL = (short) 0x9; |
| 42 | public final static short BAD_TYPE_VAL = (short) 0xa; |
| 43 | public final static short BAD_COMMAND_VAL = (short) 0xb; |
| 44 | public final static short BAD_BUCKET_VAL = (short) 0xc; |
| 45 | public final static short BAD_WATCH_VAL = (short) 0xd; |
| 46 | public final static short EPERM_VAL = (short) 0xe; |
| 47 | |
| 48 | public static OFGroupModFailedCode readFrom(ChannelBuffer bb) throws OFParseError { |
| 49 | try { |
| 50 | return ofWireValue(bb.readShort()); |
| 51 | } catch (IllegalArgumentException e) { |
| 52 | throw new OFParseError(e); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | public static void writeTo(ChannelBuffer bb, OFGroupModFailedCode e) { |
| 57 | bb.writeShort(toWireValue(e)); |
| 58 | } |
| 59 | |
| 60 | public static void putTo(OFGroupModFailedCode e, PrimitiveSink sink) { |
| 61 | sink.putShort(toWireValue(e)); |
| 62 | } |
| 63 | |
| 64 | public static OFGroupModFailedCode ofWireValue(short val) { |
| 65 | switch(val) { |
| 66 | case GROUP_EXISTS_VAL: |
| 67 | return OFGroupModFailedCode.GROUP_EXISTS; |
| 68 | case INVALID_GROUP_VAL: |
| 69 | return OFGroupModFailedCode.INVALID_GROUP; |
| 70 | case WEIGHT_UNSUPPORTED_VAL: |
| 71 | return OFGroupModFailedCode.WEIGHT_UNSUPPORTED; |
| 72 | case OUT_OF_GROUPS_VAL: |
| 73 | return OFGroupModFailedCode.OUT_OF_GROUPS; |
| 74 | case OUT_OF_BUCKETS_VAL: |
| 75 | return OFGroupModFailedCode.OUT_OF_BUCKETS; |
| 76 | case CHAINING_UNSUPPORTED_VAL: |
| 77 | return OFGroupModFailedCode.CHAINING_UNSUPPORTED; |
| 78 | case WATCH_UNSUPPORTED_VAL: |
| 79 | return OFGroupModFailedCode.WATCH_UNSUPPORTED; |
| 80 | case LOOP_VAL: |
| 81 | return OFGroupModFailedCode.LOOP; |
| 82 | case UNKNOWN_GROUP_VAL: |
| 83 | return OFGroupModFailedCode.UNKNOWN_GROUP; |
| 84 | case CHAINED_GROUP_VAL: |
| 85 | return OFGroupModFailedCode.CHAINED_GROUP; |
| 86 | case BAD_TYPE_VAL: |
| 87 | return OFGroupModFailedCode.BAD_TYPE; |
| 88 | case BAD_COMMAND_VAL: |
| 89 | return OFGroupModFailedCode.BAD_COMMAND; |
| 90 | case BAD_BUCKET_VAL: |
| 91 | return OFGroupModFailedCode.BAD_BUCKET; |
| 92 | case BAD_WATCH_VAL: |
| 93 | return OFGroupModFailedCode.BAD_WATCH; |
| 94 | case EPERM_VAL: |
| 95 | return OFGroupModFailedCode.EPERM; |
| 96 | default: |
| 97 | throw new IllegalArgumentException("Illegal wire value for type OFGroupModFailedCode in version 1.3: " + val); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | public static short toWireValue(OFGroupModFailedCode e) { |
| 103 | switch(e) { |
| 104 | case GROUP_EXISTS: |
| 105 | return GROUP_EXISTS_VAL; |
| 106 | case INVALID_GROUP: |
| 107 | return INVALID_GROUP_VAL; |
| 108 | case WEIGHT_UNSUPPORTED: |
| 109 | return WEIGHT_UNSUPPORTED_VAL; |
| 110 | case OUT_OF_GROUPS: |
| 111 | return OUT_OF_GROUPS_VAL; |
| 112 | case OUT_OF_BUCKETS: |
| 113 | return OUT_OF_BUCKETS_VAL; |
| 114 | case CHAINING_UNSUPPORTED: |
| 115 | return CHAINING_UNSUPPORTED_VAL; |
| 116 | case WATCH_UNSUPPORTED: |
| 117 | return WATCH_UNSUPPORTED_VAL; |
| 118 | case LOOP: |
| 119 | return LOOP_VAL; |
| 120 | case UNKNOWN_GROUP: |
| 121 | return UNKNOWN_GROUP_VAL; |
| 122 | case CHAINED_GROUP: |
| 123 | return CHAINED_GROUP_VAL; |
| 124 | case BAD_TYPE: |
| 125 | return BAD_TYPE_VAL; |
| 126 | case BAD_COMMAND: |
| 127 | return BAD_COMMAND_VAL; |
| 128 | case BAD_BUCKET: |
| 129 | return BAD_BUCKET_VAL; |
| 130 | case BAD_WATCH: |
| 131 | return BAD_WATCH_VAL; |
| 132 | case EPERM: |
| 133 | return EPERM_VAL; |
| 134 | default: |
| 135 | throw new IllegalArgumentException("Illegal enum value for type OFGroupModFailedCode in version 1.3: " + e); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | } |