Jonathan Hart | 44bdbfc | 2020-04-14 17:45:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 3 | * Copyright (c) 2011, 2012 Open Networking Foundation |
| 4 | * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler. |
| 5 | * Copyright 2018, Red Hat, Inc. |
| 6 | */ |
| 7 | // Automatically generated by LOXI from template const.go |
| 8 | // Do not modify |
| 9 | |
| 10 | package of11 |
| 11 | |
| 12 | import ( |
| 13 | "fmt" |
| 14 | "strings" |
| 15 | ) |
| 16 | |
| 17 | const ( |
| 18 | // Identifiers from group macro_definitions |
| 19 | MaxTableNameLen = 32 // OFP_MAX_TABLE_NAME_LEN |
| 20 | MaxPortNameLen = 16 // OFP_MAX_PORT_NAME_LEN |
| 21 | TCPPort = 6653 // OFP_TCP_PORT |
| 22 | SSLPort = 6653 // OFP_SSL_PORT |
| 23 | EthAlen = 6 // OFP_ETH_ALEN |
| 24 | DefaultMissSendLen = 128 // OFP_DEFAULT_MISS_SEND_LEN |
| 25 | OFPFWICMPType = 64 // OFPFW_ICMP_TYPE |
| 26 | OFPFWICMPCode = 128 // OFPFW_ICMP_CODE |
| 27 | DlTypeEth2Cutoff = 1536 // OFP_DL_TYPE_ETH2_CUTOFF |
| 28 | DlTypeNotEthType = 1535 // OFP_DL_TYPE_NOT_ETH_TYPE |
| 29 | VLANNone = 0 // OFP_VLAN_NONE |
| 30 | OFPMTStandardLength = 88 // OFPMT_STANDARD_LENGTH |
| 31 | FlowPermanent = 0 // OFP_FLOW_PERMANENT |
| 32 | DefaultPriority = 32768 // OFP_DEFAULT_PRIORITY |
| 33 | DescStrLen = 256 // DESC_STR_LEN |
| 34 | SerialNumLen = 32 // SERIAL_NUM_LEN |
| 35 | OFPQAll = 4294967295 // OFPQ_ALL |
| 36 | OFPQMinRateUncfg = 65535 // OFPQ_MIN_RATE_UNCFG |
| 37 | ) |
| 38 | |
| 39 | const ( |
| 40 | // Identifiers from group nx_action_controller2_prop_type |
| 41 | Nxac2PtMaxLen = 0 // NXAC2PT_MAX_LEN |
| 42 | Nxac2PtControllerID = 1 // NXAC2PT_CONTROLLER_ID |
| 43 | Nxac2PtReason = 2 // NXAC2PT_REASON |
| 44 | Nxac2PtUserdata = 3 // NXAC2PT_USERDATA |
| 45 | Nxac2PtPause = 4 // NXAC2PT_PAUSE |
| 46 | Nxac2PtMeterID = 5 // NXAC2PT_METER_ID |
| 47 | ) |
| 48 | |
| 49 | type NxActionController2PropType uint16 |
| 50 | |
| 51 | func (self NxActionController2PropType) MarshalJSON() ([]byte, error) { |
| 52 | return []byte(fmt.Sprintf("%d", self)), nil |
| 53 | } |
| 54 | |
| 55 | const ( |
| 56 | // Identifiers from group nx_bd_algorithms |
| 57 | NxBdAlgActiveBackup = 0 // NX_BD_ALG_ACTIVE_BACKUP |
| 58 | NxBdAlgHrw = 1 // NX_BD_ALG_HRW |
| 59 | ) |
| 60 | |
| 61 | type NxBdAlgorithms uint16 |
| 62 | |
| 63 | func (self NxBdAlgorithms) MarshalJSON() ([]byte, error) { |
| 64 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 65 | } |
| 66 | |
| 67 | func (self NxBdAlgorithms) String() string { |
| 68 | switch self { |
| 69 | case NxBdAlgActiveBackup: |
| 70 | return "active_backup" |
| 71 | case NxBdAlgHrw: |
| 72 | return "hrw" |
| 73 | default: |
| 74 | return fmt.Sprintf("%d", self) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | const ( |
| 79 | // Identifiers from group nx_conntrack_flags |
| 80 | NxCtFCommit = 1 // NX_CT_F_COMMIT |
| 81 | NxCtFForce = 2 // NX_CT_F_FORCE |
| 82 | ) |
| 83 | |
| 84 | type NxConntrackFlags uint16 |
| 85 | |
| 86 | func (self NxConntrackFlags) MarshalJSON() ([]byte, error) { |
| 87 | var flags []string |
| 88 | if self&NxCtFCommit == NxCtFCommit { |
| 89 | flags = append(flags, "\"Commit\": true") |
| 90 | } |
| 91 | if self&NxCtFForce == NxCtFForce { |
| 92 | flags = append(flags, "\"Force\": true") |
| 93 | } |
| 94 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 95 | } |
| 96 | |
| 97 | const ( |
| 98 | // Identifiers from group nx_flow_monitor_flags |
| 99 | NxfmfInitial = 1 // NXFMF_INITIAL |
| 100 | NxfmfAdd = 2 // NXFMF_ADD |
| 101 | NxfmfDelete = 4 // NXFMF_DELETE |
| 102 | NxfmfModify = 8 // NXFMF_MODIFY |
| 103 | NxfmfActions = 16 // NXFMF_ACTIONS |
| 104 | NxfmfOwn = 32 // NXFMF_OWN |
| 105 | ) |
| 106 | |
| 107 | type NxFlowMonitorFlags uint16 |
| 108 | |
| 109 | func (self NxFlowMonitorFlags) MarshalJSON() ([]byte, error) { |
| 110 | var flags []string |
| 111 | if self&NxfmfInitial == NxfmfInitial { |
| 112 | flags = append(flags, "\"Initial\": true") |
| 113 | } |
| 114 | if self&NxfmfAdd == NxfmfAdd { |
| 115 | flags = append(flags, "\"Add\": true") |
| 116 | } |
| 117 | if self&NxfmfDelete == NxfmfDelete { |
| 118 | flags = append(flags, "\"Delete\": true") |
| 119 | } |
| 120 | if self&NxfmfModify == NxfmfModify { |
| 121 | flags = append(flags, "\"Modify\": true") |
| 122 | } |
| 123 | if self&NxfmfActions == NxfmfActions { |
| 124 | flags = append(flags, "\"Actions\": true") |
| 125 | } |
| 126 | if self&NxfmfOwn == NxfmfOwn { |
| 127 | flags = append(flags, "\"Own\": true") |
| 128 | } |
| 129 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 130 | } |
| 131 | |
| 132 | const ( |
| 133 | // Identifiers from group nx_hash_fields |
| 134 | NxHashFieldsEthSrc = 0 // NX_HASH_FIELDS_ETH_SRC |
| 135 | NxHashFieldsSymmetricL4 = 1 // NX_HASH_FIELDS_SYMMETRIC_L4 |
| 136 | NxHashFieldsSymmetricL3L4 = 2 // NX_HASH_FIELDS_SYMMETRIC_L3L4 |
| 137 | NxHashFieldsSymmetricL3L4Udp = 3 // NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP |
| 138 | NxHashFieldsNwSrc = 4 // NX_HASH_FIELDS_NW_SRC |
| 139 | NxHashFieldsNwDst = 5 // NX_HASH_FIELDS_NW_DST |
| 140 | NxHashFieldsSymmetricL3 = 6 // NX_HASH_FIELDS_SYMMETRIC_L3 |
| 141 | ) |
| 142 | |
| 143 | type NxHashFields uint16 |
| 144 | |
| 145 | func (self NxHashFields) MarshalJSON() ([]byte, error) { |
| 146 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 147 | } |
| 148 | |
| 149 | func (self NxHashFields) String() string { |
| 150 | switch self { |
| 151 | case NxHashFieldsEthSrc: |
| 152 | return "eth_src" |
| 153 | case NxHashFieldsSymmetricL4: |
| 154 | return "symmetric_l4" |
| 155 | case NxHashFieldsSymmetricL3L4: |
| 156 | return "symmetric_l3l4" |
| 157 | case NxHashFieldsSymmetricL3L4Udp: |
| 158 | return "symmetric_l3l4_udp" |
| 159 | case NxHashFieldsNwSrc: |
| 160 | return "nw_src" |
| 161 | case NxHashFieldsNwDst: |
| 162 | return "nw_dst" |
| 163 | case NxHashFieldsSymmetricL3: |
| 164 | return "symmetric_l3" |
| 165 | default: |
| 166 | return fmt.Sprintf("%d", self) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | const ( |
| 171 | // Identifiers from group nx_mp_algorithm |
| 172 | NxMpAlgModuloN = 0 // NX_MP_ALG_MODULO_N |
| 173 | NxMpAlgHashThreshold = 1 // NX_MP_ALG_HASH_THRESHOLD |
| 174 | NxMpAlgHrw = 2 // NX_MP_ALG_HRW |
| 175 | NxMpAlgIterHash = 3 // NX_MP_ALG_ITER_HASH |
| 176 | ) |
| 177 | |
| 178 | type NxMpAlgorithm uint16 |
| 179 | |
| 180 | func (self NxMpAlgorithm) MarshalJSON() ([]byte, error) { |
| 181 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 182 | } |
| 183 | |
| 184 | func (self NxMpAlgorithm) String() string { |
| 185 | switch self { |
| 186 | case NxMpAlgModuloN: |
| 187 | return "modulo_n" |
| 188 | case NxMpAlgHashThreshold: |
| 189 | return "hash_threshold" |
| 190 | case NxMpAlgHrw: |
| 191 | return "hrw" |
| 192 | case NxMpAlgIterHash: |
| 193 | return "iter_hash" |
| 194 | default: |
| 195 | return fmt.Sprintf("%d", self) |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | const ( |
| 200 | // Identifiers from group of_action_nx_bundle_slave_type |
| 201 | NxmOfInPort = 2 // NXM_OF_IN_PORT |
| 202 | NxmOfJustThereToDefinePrefix = 10000 // NXM_OF_JUST_THERE_TO_DEFINE_PREFIX |
| 203 | ) |
| 204 | |
| 205 | type ActionNxBundleSlaveType uint32 |
| 206 | |
| 207 | func (self ActionNxBundleSlaveType) MarshalJSON() ([]byte, error) { |
| 208 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 209 | } |
| 210 | |
| 211 | func (self ActionNxBundleSlaveType) String() string { |
| 212 | switch self { |
| 213 | case NxmOfInPort: |
| 214 | return "in_port" |
| 215 | case NxmOfJustThereToDefinePrefix: |
| 216 | return "just_there_to_define_prefix" |
| 217 | default: |
| 218 | return fmt.Sprintf("%d", self) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | const ( |
| 223 | // Identifiers from group of_bsn_pdu_slot_num |
| 224 | BsnPduSlotNumAny = 255 // BSN_PDU_SLOT_NUM_ANY |
| 225 | ) |
| 226 | |
| 227 | type BsnPduSlotNum uint8 |
| 228 | |
| 229 | func (self BsnPduSlotNum) MarshalJSON() ([]byte, error) { |
| 230 | return []byte(fmt.Sprintf("%d", self)), nil |
| 231 | } |
| 232 | |
| 233 | const ( |
| 234 | // Identifiers from group of_nx_nat_range |
| 235 | NxNatRangeIpv4Min = 1 // NX_NAT_RANGE_IPV4_MIN |
| 236 | NxNatRangeIpv4Max = 2 // NX_NAT_RANGE_IPV4_MAX |
| 237 | NxNatRangeIpv6Min = 4 // NX_NAT_RANGE_IPV6_MIN |
| 238 | NxNatRangeIpv6Max = 8 // NX_NAT_RANGE_IPV6_MAX |
| 239 | NxNatRangeProtoMin = 16 // NX_NAT_RANGE_PROTO_MIN |
| 240 | NxNatRangeProtoMax = 32 // NX_NAT_RANGE_PROTO_MAX |
| 241 | ) |
| 242 | |
| 243 | type NxNatRange uint16 |
| 244 | |
| 245 | func (self NxNatRange) MarshalJSON() ([]byte, error) { |
| 246 | var flags []string |
| 247 | if self&NxNatRangeIpv4Min == NxNatRangeIpv4Min { |
| 248 | flags = append(flags, "\"Ipv4Min\": true") |
| 249 | } |
| 250 | if self&NxNatRangeIpv4Max == NxNatRangeIpv4Max { |
| 251 | flags = append(flags, "\"Ipv4Max\": true") |
| 252 | } |
| 253 | if self&NxNatRangeIpv6Min == NxNatRangeIpv6Min { |
| 254 | flags = append(flags, "\"Ipv6Min\": true") |
| 255 | } |
| 256 | if self&NxNatRangeIpv6Max == NxNatRangeIpv6Max { |
| 257 | flags = append(flags, "\"Ipv6Max\": true") |
| 258 | } |
| 259 | if self&NxNatRangeProtoMin == NxNatRangeProtoMin { |
| 260 | flags = append(flags, "\"ProtoMin\": true") |
| 261 | } |
| 262 | if self&NxNatRangeProtoMax == NxNatRangeProtoMax { |
| 263 | flags = append(flags, "\"ProtoMax\": true") |
| 264 | } |
| 265 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 266 | } |
| 267 | |
| 268 | const ( |
| 269 | // Identifiers from group ofp_action_type |
| 270 | OFPATOutput = 0 // OFPAT_OUTPUT |
| 271 | OFPATSetVLANVid = 1 // OFPAT_SET_VLAN_VID |
| 272 | OFPATSetVLANPCP = 2 // OFPAT_SET_VLAN_PCP |
| 273 | OFPATSetDlSrc = 3 // OFPAT_SET_DL_SRC |
| 274 | OFPATSetDlDst = 4 // OFPAT_SET_DL_DST |
| 275 | OFPATSetNwSrc = 5 // OFPAT_SET_NW_SRC |
| 276 | OFPATSetNwDst = 6 // OFPAT_SET_NW_DST |
| 277 | OFPATSetNwTos = 7 // OFPAT_SET_NW_TOS |
| 278 | OFPATSetNwEcn = 8 // OFPAT_SET_NW_ECN |
| 279 | OFPATSetTpSrc = 9 // OFPAT_SET_TP_SRC |
| 280 | OFPATSetTpDst = 10 // OFPAT_SET_TP_DST |
| 281 | OFPATCopyTtlOut = 11 // OFPAT_COPY_TTL_OUT |
| 282 | OFPATCopyTtlIn = 12 // OFPAT_COPY_TTL_IN |
| 283 | OFPATSetMplsLabel = 13 // OFPAT_SET_MPLS_LABEL |
| 284 | OFPATSetMplsTc = 14 // OFPAT_SET_MPLS_TC |
| 285 | OFPATSetMplsTtl = 15 // OFPAT_SET_MPLS_TTL |
| 286 | OFPATDecMplsTtl = 16 // OFPAT_DEC_MPLS_TTL |
| 287 | OFPATPushVLAN = 17 // OFPAT_PUSH_VLAN |
| 288 | OFPATPopVLAN = 18 // OFPAT_POP_VLAN |
| 289 | OFPATPushMpls = 19 // OFPAT_PUSH_MPLS |
| 290 | OFPATPopMpls = 20 // OFPAT_POP_MPLS |
| 291 | OFPATSetQueue = 21 // OFPAT_SET_QUEUE |
| 292 | OFPATGroup = 22 // OFPAT_GROUP |
| 293 | OFPATSetNwTtl = 23 // OFPAT_SET_NW_TTL |
| 294 | OFPATDecNwTtl = 24 // OFPAT_DEC_NW_TTL |
| 295 | OFPATExperimenter = 65535 // OFPAT_EXPERIMENTER |
| 296 | ) |
| 297 | |
| 298 | type ActionType uint16 |
| 299 | |
| 300 | func (self ActionType) MarshalJSON() ([]byte, error) { |
| 301 | return []byte(fmt.Sprintf("%d", self)), nil |
| 302 | } |
| 303 | |
| 304 | const ( |
| 305 | // Identifiers from group ofp_bad_action_code |
| 306 | OFPBACBadType = 0 // OFPBAC_BAD_TYPE |
| 307 | OFPBACBadLen = 1 // OFPBAC_BAD_LEN |
| 308 | OFPBACBadExperimenter = 2 // OFPBAC_BAD_EXPERIMENTER |
| 309 | OFPBACBadExperimenterType = 3 // OFPBAC_BAD_EXPERIMENTER_TYPE |
| 310 | OFPBACBadOutPort = 4 // OFPBAC_BAD_OUT_PORT |
| 311 | OFPBACBadArgument = 5 // OFPBAC_BAD_ARGUMENT |
| 312 | OFPBACEperm = 6 // OFPBAC_EPERM |
| 313 | OFPBACTooMany = 7 // OFPBAC_TOO_MANY |
| 314 | OFPBACBadQueue = 8 // OFPBAC_BAD_QUEUE |
| 315 | OFPBACBadOutGroup = 9 // OFPBAC_BAD_OUT_GROUP |
| 316 | OFPBACMatchInconsistent = 10 // OFPBAC_MATCH_INCONSISTENT |
| 317 | OFPBACUnsupportedOrder = 11 // OFPBAC_UNSUPPORTED_ORDER |
| 318 | OFPBACBadTag = 12 // OFPBAC_BAD_TAG |
| 319 | ) |
| 320 | |
| 321 | type BadActionCode uint16 |
| 322 | |
| 323 | func (self BadActionCode) MarshalJSON() ([]byte, error) { |
| 324 | return []byte(fmt.Sprintf("%d", self)), nil |
| 325 | } |
| 326 | |
| 327 | const ( |
| 328 | // Identifiers from group ofp_bad_instruction_code |
| 329 | OFPBICUnknownInst = 0 // OFPBIC_UNKNOWN_INST |
| 330 | OFPBICUnsupInst = 1 // OFPBIC_UNSUP_INST |
| 331 | OFPBICBadTableID = 2 // OFPBIC_BAD_TABLE_ID |
| 332 | OFPBICUnsupMetadata = 3 // OFPBIC_UNSUP_METADATA |
| 333 | OFPBICUnsupMetadataMask = 4 // OFPBIC_UNSUP_METADATA_MASK |
| 334 | OFPBICUnsupExpInst = 5 // OFPBIC_UNSUP_EXP_INST |
| 335 | ) |
| 336 | |
| 337 | type BadInstructionCode uint16 |
| 338 | |
| 339 | func (self BadInstructionCode) MarshalJSON() ([]byte, error) { |
| 340 | return []byte(fmt.Sprintf("%d", self)), nil |
| 341 | } |
| 342 | |
| 343 | const ( |
| 344 | // Identifiers from group ofp_bad_match_code |
| 345 | OFPBMCBadType = 0 // OFPBMC_BAD_TYPE |
| 346 | OFPBMCBadLen = 1 // OFPBMC_BAD_LEN |
| 347 | OFPBMCBadTag = 2 // OFPBMC_BAD_TAG |
| 348 | OFPBMCBadDlAddrMask = 3 // OFPBMC_BAD_DL_ADDR_MASK |
| 349 | OFPBMCBadNwAddrMask = 4 // OFPBMC_BAD_NW_ADDR_MASK |
| 350 | OFPBMCBadWildcards = 5 // OFPBMC_BAD_WILDCARDS |
| 351 | OFPBMCBadField = 6 // OFPBMC_BAD_FIELD |
| 352 | OFPBMCBadValue = 7 // OFPBMC_BAD_VALUE |
| 353 | ) |
| 354 | |
| 355 | type BadMatchCode uint16 |
| 356 | |
| 357 | func (self BadMatchCode) MarshalJSON() ([]byte, error) { |
| 358 | return []byte(fmt.Sprintf("%d", self)), nil |
| 359 | } |
| 360 | |
| 361 | const ( |
| 362 | // Identifiers from group ofp_bad_request_code |
| 363 | OFPBRCBadVersion = 0 // OFPBRC_BAD_VERSION |
| 364 | OFPBRCBadType = 1 // OFPBRC_BAD_TYPE |
| 365 | OFPBRCBadStat = 2 // OFPBRC_BAD_STAT |
| 366 | OFPBRCBadExperimenter = 3 // OFPBRC_BAD_EXPERIMENTER |
| 367 | OFPBRCBadSubtype = 4 // OFPBRC_BAD_SUBTYPE |
| 368 | OFPBRCEperm = 5 // OFPBRC_EPERM |
| 369 | OFPBRCBadLen = 6 // OFPBRC_BAD_LEN |
| 370 | OFPBRCBufferEmpty = 7 // OFPBRC_BUFFER_EMPTY |
| 371 | OFPBRCBufferUnknown = 8 // OFPBRC_BUFFER_UNKNOWN |
| 372 | OFPBRCBadTableID = 9 // OFPBRC_BAD_TABLE_ID |
| 373 | ) |
| 374 | |
| 375 | type BadRequestCode uint16 |
| 376 | |
| 377 | func (self BadRequestCode) MarshalJSON() ([]byte, error) { |
| 378 | return []byte(fmt.Sprintf("%d", self)), nil |
| 379 | } |
| 380 | |
| 381 | const ( |
| 382 | // Identifiers from group ofp_bsn_vport_l2gre_flags |
| 383 | OFBSNVportL2GreLocalMACIsValid = 1 // OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID |
| 384 | OFBSNVportL2GreDSCPAssign = 2 // OF_BSN_VPORT_L2GRE_DSCP_ASSIGN |
| 385 | OFBSNVportL2GreDSCPCopy = 4 // OF_BSN_VPORT_L2GRE_DSCP_COPY |
| 386 | OFBSNVportL2GreLoopbackIsValid = 8 // OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID |
| 387 | OFBSNVportL2GreRateLimitIsValid = 16 // OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID |
| 388 | ) |
| 389 | |
| 390 | type BsnVportL2GreFlags uint32 |
| 391 | |
| 392 | func (self BsnVportL2GreFlags) MarshalJSON() ([]byte, error) { |
| 393 | var flags []string |
| 394 | if self&OFBSNVportL2GreLocalMACIsValid == OFBSNVportL2GreLocalMACIsValid { |
| 395 | flags = append(flags, "\"LocalMACIsValid\": true") |
| 396 | } |
| 397 | if self&OFBSNVportL2GreDSCPAssign == OFBSNVportL2GreDSCPAssign { |
| 398 | flags = append(flags, "\"DscpAssign\": true") |
| 399 | } |
| 400 | if self&OFBSNVportL2GreDSCPCopy == OFBSNVportL2GreDSCPCopy { |
| 401 | flags = append(flags, "\"DscpCopy\": true") |
| 402 | } |
| 403 | if self&OFBSNVportL2GreLoopbackIsValid == OFBSNVportL2GreLoopbackIsValid { |
| 404 | flags = append(flags, "\"LoopbackIsValid\": true") |
| 405 | } |
| 406 | if self&OFBSNVportL2GreRateLimitIsValid == OFBSNVportL2GreRateLimitIsValid { |
| 407 | flags = append(flags, "\"RateLimitIsValid\": true") |
| 408 | } |
| 409 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 410 | } |
| 411 | |
| 412 | const ( |
| 413 | // Identifiers from group ofp_bsn_vport_q_in_q_untagged |
| 414 | OFBSNVportQInQUntagged = 65535 // OF_BSN_VPORT_Q_IN_Q_UNTAGGED |
| 415 | ) |
| 416 | |
| 417 | type BsnVportQInQUntagged uint16 |
| 418 | |
| 419 | func (self BsnVportQInQUntagged) MarshalJSON() ([]byte, error) { |
| 420 | return []byte(fmt.Sprintf("%d", self)), nil |
| 421 | } |
| 422 | |
| 423 | const ( |
| 424 | // Identifiers from group ofp_bsn_vport_status |
| 425 | OFBSNVportStatusOk = 0 // OF_BSN_VPORT_STATUS_OK |
| 426 | OFBSNVportStatusFailed = 1 // OF_BSN_VPORT_STATUS_FAILED |
| 427 | ) |
| 428 | |
| 429 | const ( |
| 430 | // Identifiers from group ofp_capabilities |
| 431 | OFPCFlowStats = 1 // OFPC_FLOW_STATS |
| 432 | OFPCTableStats = 2 // OFPC_TABLE_STATS |
| 433 | OFPCPortStats = 4 // OFPC_PORT_STATS |
| 434 | OFPCGroupStats = 8 // OFPC_GROUP_STATS |
| 435 | OFPCIpReasm = 32 // OFPC_IP_REASM |
| 436 | OFPCQueueStats = 64 // OFPC_QUEUE_STATS |
| 437 | OFPCARPMatchIp = 128 // OFPC_ARP_MATCH_IP |
| 438 | ) |
| 439 | |
| 440 | type Capabilities uint32 |
| 441 | |
| 442 | func (self Capabilities) MarshalJSON() ([]byte, error) { |
| 443 | var flags []string |
| 444 | if self&OFPCFlowStats == OFPCFlowStats { |
| 445 | flags = append(flags, "\"FlowStats\": true") |
| 446 | } |
| 447 | if self&OFPCTableStats == OFPCTableStats { |
| 448 | flags = append(flags, "\"TableStats\": true") |
| 449 | } |
| 450 | if self&OFPCPortStats == OFPCPortStats { |
| 451 | flags = append(flags, "\"PortStats\": true") |
| 452 | } |
| 453 | if self&OFPCGroupStats == OFPCGroupStats { |
| 454 | flags = append(flags, "\"GroupStats\": true") |
| 455 | } |
| 456 | if self&OFPCIpReasm == OFPCIpReasm { |
| 457 | flags = append(flags, "\"IpReasm\": true") |
| 458 | } |
| 459 | if self&OFPCQueueStats == OFPCQueueStats { |
| 460 | flags = append(flags, "\"QueueStats\": true") |
| 461 | } |
| 462 | if self&OFPCARPMatchIp == OFPCARPMatchIp { |
| 463 | flags = append(flags, "\"ArpMatchIp\": true") |
| 464 | } |
| 465 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 466 | } |
| 467 | |
| 468 | const ( |
| 469 | // Identifiers from group ofp_config_flags |
| 470 | OFPCFragNormal = 0 // OFPC_FRAG_NORMAL |
| 471 | OFPCFragDrop = 1 // OFPC_FRAG_DROP |
| 472 | OFPCFragReasm = 2 // OFPC_FRAG_REASM |
| 473 | OFPCFragMask = 3 // OFPC_FRAG_MASK |
| 474 | OFPCInvalidTtlToController = 4 // OFPC_INVALID_TTL_TO_CONTROLLER |
| 475 | ) |
| 476 | |
| 477 | type ConfigFlags uint16 |
| 478 | |
| 479 | func (self ConfigFlags) MarshalJSON() ([]byte, error) { |
| 480 | var flags []string |
| 481 | if self&OFPCFragNormal == OFPCFragNormal { |
| 482 | flags = append(flags, "\"FragNormal\": true") |
| 483 | } |
| 484 | if self&OFPCFragDrop == OFPCFragDrop { |
| 485 | flags = append(flags, "\"FragDrop\": true") |
| 486 | } |
| 487 | if self&OFPCFragReasm == OFPCFragReasm { |
| 488 | flags = append(flags, "\"FragReasm\": true") |
| 489 | } |
| 490 | if self&OFPCFragMask == OFPCFragMask { |
| 491 | flags = append(flags, "\"FragMask\": true") |
| 492 | } |
| 493 | if self&OFPCInvalidTtlToController == OFPCInvalidTtlToController { |
| 494 | flags = append(flags, "\"InvalidTtlToController\": true") |
| 495 | } |
| 496 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 497 | } |
| 498 | |
| 499 | const ( |
| 500 | // Identifiers from group ofp_cs_states |
| 501 | CsNew = 1 // OFP_CS_NEW |
| 502 | CsEstablished = 2 // OFP_CS_ESTABLISHED |
| 503 | CsRelated = 4 // OFP_CS_RELATED |
| 504 | CsReplyDir = 8 // OFP_CS_REPLY_DIR |
| 505 | CsInvalid = 16 // OFP_CS_INVALID |
| 506 | CsTracked = 32 // OFP_CS_TRACKED |
| 507 | CsSrcNat = 64 // OFP_CS_SRC_NAT |
| 508 | CsDstNat = 128 // OFP_CS_DST_NAT |
| 509 | ) |
| 510 | |
| 511 | type CsStates uint32 |
| 512 | |
| 513 | func (self CsStates) MarshalJSON() ([]byte, error) { |
| 514 | var flags []string |
| 515 | if self&CsNew == CsNew { |
| 516 | flags = append(flags, "\"New\": true") |
| 517 | } |
| 518 | if self&CsEstablished == CsEstablished { |
| 519 | flags = append(flags, "\"Established\": true") |
| 520 | } |
| 521 | if self&CsRelated == CsRelated { |
| 522 | flags = append(flags, "\"Related\": true") |
| 523 | } |
| 524 | if self&CsReplyDir == CsReplyDir { |
| 525 | flags = append(flags, "\"ReplyDir\": true") |
| 526 | } |
| 527 | if self&CsInvalid == CsInvalid { |
| 528 | flags = append(flags, "\"Invalid\": true") |
| 529 | } |
| 530 | if self&CsTracked == CsTracked { |
| 531 | flags = append(flags, "\"Tracked\": true") |
| 532 | } |
| 533 | if self&CsSrcNat == CsSrcNat { |
| 534 | flags = append(flags, "\"SrcNat\": true") |
| 535 | } |
| 536 | if self&CsDstNat == CsDstNat { |
| 537 | flags = append(flags, "\"DstNat\": true") |
| 538 | } |
| 539 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 540 | } |
| 541 | |
| 542 | const ( |
| 543 | // Identifiers from group ofp_ed_nsh_prop_type |
| 544 | OFPPPTPropNshNone = 0 // OFPPPT_PROP_NSH_NONE |
| 545 | OFPPPTPropNshMdtype = 1 // OFPPPT_PROP_NSH_MDTYPE |
| 546 | OFPPPTPropNshTlv = 2 // OFPPPT_PROP_NSH_TLV |
| 547 | ) |
| 548 | |
| 549 | type EdNshPropType uint8 |
| 550 | |
| 551 | func (self EdNshPropType) MarshalJSON() ([]byte, error) { |
| 552 | return []byte(fmt.Sprintf("%d", self)), nil |
| 553 | } |
| 554 | |
| 555 | const ( |
| 556 | // Identifiers from group ofp_ed_prop_class |
| 557 | OFPPPCBasic = 0 // OFPPPC_BASIC |
| 558 | OFPPPCMpls = 1 // OFPPPC_MPLS |
| 559 | OFPPPCGRE = 2 // OFPPPC_GRE |
| 560 | OFPPPCGtp = 3 // OFPPPC_GTP |
| 561 | OFPPPCNsh = 4 // OFPPPC_NSH |
| 562 | OFPPPCExperimenter = 65535 // OFPPPC_EXPERIMENTER |
| 563 | ) |
| 564 | |
| 565 | type EdPropClass uint16 |
| 566 | |
| 567 | func (self EdPropClass) MarshalJSON() ([]byte, error) { |
| 568 | return []byte(fmt.Sprintf("%d", self)), nil |
| 569 | } |
| 570 | |
| 571 | const ( |
| 572 | // Identifiers from group ofp_error_type |
| 573 | OFPETHelloFailed = 0 // OFPET_HELLO_FAILED |
| 574 | OFPETBadRequest = 1 // OFPET_BAD_REQUEST |
| 575 | OFPETBadAction = 2 // OFPET_BAD_ACTION |
| 576 | OFPETBadInstruction = 3 // OFPET_BAD_INSTRUCTION |
| 577 | OFPETBadMatch = 4 // OFPET_BAD_MATCH |
| 578 | OFPETFlowModFailed = 5 // OFPET_FLOW_MOD_FAILED |
| 579 | OFPETGroupModFailed = 6 // OFPET_GROUP_MOD_FAILED |
| 580 | OFPETPortModFailed = 7 // OFPET_PORT_MOD_FAILED |
| 581 | OFPETTableModFailed = 8 // OFPET_TABLE_MOD_FAILED |
| 582 | OFPETQueueOpFailed = 9 // OFPET_QUEUE_OP_FAILED |
| 583 | OFPETSwitchConfigFailed = 10 // OFPET_SWITCH_CONFIG_FAILED |
| 584 | ) |
| 585 | |
| 586 | type ErrorType uint16 |
| 587 | |
| 588 | func (self ErrorType) MarshalJSON() ([]byte, error) { |
| 589 | return []byte(fmt.Sprintf("%d", self)), nil |
| 590 | } |
| 591 | |
| 592 | const ( |
| 593 | // Identifiers from group ofp_ethernet_type |
| 594 | EthPLoop = 96 // ETH_P_LOOP |
| 595 | EthPPup = 512 // ETH_P_PUP |
| 596 | EthPPupat = 513 // ETH_P_PUPAT |
| 597 | EthPIp = 2048 // ETH_P_IP |
| 598 | EthPX25 = 2053 // ETH_P_X25 |
| 599 | EthPARP = 2054 // ETH_P_ARP |
| 600 | EthPBpq = 2303 // ETH_P_BPQ |
| 601 | EthPIeeepup = 2560 // ETH_P_IEEEPUP |
| 602 | EthPIeeepupat = 2561 // ETH_P_IEEEPUPAT |
| 603 | EthPDec = 24576 // ETH_P_DEC |
| 604 | EthPDnaDl = 24577 // ETH_P_DNA_DL |
| 605 | EthPDnaRc = 24578 // ETH_P_DNA_RC |
| 606 | EthPDnaRt = 24579 // ETH_P_DNA_RT |
| 607 | EthPLat = 24580 // ETH_P_LAT |
| 608 | EthPDiag = 24581 // ETH_P_DIAG |
| 609 | EthPCust = 24582 // ETH_P_CUST |
| 610 | EthPSca = 24583 // ETH_P_SCA |
| 611 | EthPTeb = 25944 // ETH_P_TEB |
| 612 | EthPRarp = 32821 // ETH_P_RARP |
| 613 | EthPAtalk = 32923 // ETH_P_ATALK |
| 614 | EthPAarp = 33011 // ETH_P_AARP |
| 615 | EthP8021Q = 33024 // ETH_P_8021Q |
| 616 | EthPIpx = 33079 // ETH_P_IPX |
| 617 | EthPIpv6 = 34525 // ETH_P_IPV6 |
| 618 | EthPPause = 34824 // ETH_P_PAUSE |
| 619 | EthPSlow = 34825 // ETH_P_SLOW |
| 620 | EthPWccp = 34878 // ETH_P_WCCP |
| 621 | EthPPppDisc = 34915 // ETH_P_PPP_DISC |
| 622 | EthPPppSes = 34916 // ETH_P_PPP_SES |
| 623 | EthPMplsUc = 34887 // ETH_P_MPLS_UC |
| 624 | EthPMplsMc = 34888 // ETH_P_MPLS_MC |
| 625 | EthPAtmmpoa = 34892 // ETH_P_ATMMPOA |
| 626 | EthPAtmfate = 34948 // ETH_P_ATMFATE |
| 627 | EthPPae = 34958 // ETH_P_PAE |
| 628 | EthPAoe = 34978 // ETH_P_AOE |
| 629 | EthPTipc = 35018 // ETH_P_TIPC |
| 630 | EthP1588 = 35063 // ETH_P_1588 |
| 631 | EthPFcoe = 35078 // ETH_P_FCOE |
| 632 | EthPFip = 35092 // ETH_P_FIP |
| 633 | EthPEdsa = 56026 // ETH_P_EDSA |
| 634 | ) |
| 635 | |
| 636 | type EthernetType uint16 |
| 637 | |
| 638 | func (self EthernetType) MarshalJSON() ([]byte, error) { |
| 639 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 640 | } |
| 641 | |
| 642 | func (self EthernetType) String() string { |
| 643 | switch self { |
| 644 | case EthPLoop: |
| 645 | return "loop" |
| 646 | case EthPPup: |
| 647 | return "pup" |
| 648 | case EthPPupat: |
| 649 | return "pupat" |
| 650 | case EthPIp: |
| 651 | return "ip" |
| 652 | case EthPX25: |
| 653 | return "x25" |
| 654 | case EthPARP: |
| 655 | return "arp" |
| 656 | case EthPBpq: |
| 657 | return "bpq" |
| 658 | case EthPIeeepup: |
| 659 | return "ieeepup" |
| 660 | case EthPIeeepupat: |
| 661 | return "ieeepupat" |
| 662 | case EthPDec: |
| 663 | return "dec" |
| 664 | case EthPDnaDl: |
| 665 | return "dna_dl" |
| 666 | case EthPDnaRc: |
| 667 | return "dna_rc" |
| 668 | case EthPDnaRt: |
| 669 | return "dna_rt" |
| 670 | case EthPLat: |
| 671 | return "lat" |
| 672 | case EthPDiag: |
| 673 | return "diag" |
| 674 | case EthPCust: |
| 675 | return "cust" |
| 676 | case EthPSca: |
| 677 | return "sca" |
| 678 | case EthPTeb: |
| 679 | return "teb" |
| 680 | case EthPRarp: |
| 681 | return "rarp" |
| 682 | case EthPAtalk: |
| 683 | return "atalk" |
| 684 | case EthPAarp: |
| 685 | return "aarp" |
| 686 | case EthP8021Q: |
| 687 | return "8021q" |
| 688 | case EthPIpx: |
| 689 | return "ipx" |
| 690 | case EthPIpv6: |
| 691 | return "ipv6" |
| 692 | case EthPPause: |
| 693 | return "pause" |
| 694 | case EthPSlow: |
| 695 | return "slow" |
| 696 | case EthPWccp: |
| 697 | return "wccp" |
| 698 | case EthPPppDisc: |
| 699 | return "ppp_disc" |
| 700 | case EthPPppSes: |
| 701 | return "ppp_ses" |
| 702 | case EthPMplsUc: |
| 703 | return "mpls_uc" |
| 704 | case EthPMplsMc: |
| 705 | return "mpls_mc" |
| 706 | case EthPAtmmpoa: |
| 707 | return "atmmpoa" |
| 708 | case EthPAtmfate: |
| 709 | return "atmfate" |
| 710 | case EthPPae: |
| 711 | return "pae" |
| 712 | case EthPAoe: |
| 713 | return "aoe" |
| 714 | case EthPTipc: |
| 715 | return "tipc" |
| 716 | case EthP1588: |
| 717 | return "1588" |
| 718 | case EthPFcoe: |
| 719 | return "fcoe" |
| 720 | case EthPFip: |
| 721 | return "fip" |
| 722 | case EthPEdsa: |
| 723 | return "edsa" |
| 724 | default: |
| 725 | return fmt.Sprintf("%d", self) |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | const ( |
| 730 | // Identifiers from group ofp_flow_mod_command |
| 731 | OFPFCAdd = 0 // OFPFC_ADD |
| 732 | OFPFCModify = 1 // OFPFC_MODIFY |
| 733 | OFPFCModifyStrict = 2 // OFPFC_MODIFY_STRICT |
| 734 | OFPFCDelete = 3 // OFPFC_DELETE |
| 735 | OFPFCDeleteStrict = 4 // OFPFC_DELETE_STRICT |
| 736 | ) |
| 737 | |
| 738 | type FlowModCommand uint8 |
| 739 | |
| 740 | func (self FlowModCommand) MarshalJSON() ([]byte, error) { |
| 741 | return []byte(fmt.Sprintf("%d", self)), nil |
| 742 | } |
| 743 | |
| 744 | const ( |
| 745 | // Identifiers from group ofp_flow_mod_failed_code |
| 746 | OFPFMFCUnknown = 0 // OFPFMFC_UNKNOWN |
| 747 | OFPFMFCTableFull = 1 // OFPFMFC_TABLE_FULL |
| 748 | OFPFMFCBadTableID = 2 // OFPFMFC_BAD_TABLE_ID |
| 749 | OFPFMFCOverlap = 3 // OFPFMFC_OVERLAP |
| 750 | OFPFMFCEperm = 4 // OFPFMFC_EPERM |
| 751 | OFPFMFCBadTimeout = 5 // OFPFMFC_BAD_TIMEOUT |
| 752 | OFPFMFCBadCommand = 6 // OFPFMFC_BAD_COMMAND |
| 753 | ) |
| 754 | |
| 755 | type FlowModFailedCode uint16 |
| 756 | |
| 757 | func (self FlowModFailedCode) MarshalJSON() ([]byte, error) { |
| 758 | return []byte(fmt.Sprintf("%d", self)), nil |
| 759 | } |
| 760 | |
| 761 | const ( |
| 762 | // Identifiers from group ofp_flow_mod_flags |
| 763 | OFPFFSendFlowRem = 1 // OFPFF_SEND_FLOW_REM |
| 764 | OFPFFCheckOverlap = 2 // OFPFF_CHECK_OVERLAP |
| 765 | ) |
| 766 | |
| 767 | type FlowModFlags uint16 |
| 768 | |
| 769 | func (self FlowModFlags) MarshalJSON() ([]byte, error) { |
| 770 | var flags []string |
| 771 | if self&OFPFFSendFlowRem == OFPFFSendFlowRem { |
| 772 | flags = append(flags, "\"SendFlowRem\": true") |
| 773 | } |
| 774 | if self&OFPFFCheckOverlap == OFPFFCheckOverlap { |
| 775 | flags = append(flags, "\"CheckOverlap\": true") |
| 776 | } |
| 777 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 778 | } |
| 779 | |
| 780 | const ( |
| 781 | // Identifiers from group ofp_flow_removed_reason |
| 782 | OFPRRIdleTimeout = 0 // OFPRR_IDLE_TIMEOUT |
| 783 | OFPRRHardTimeout = 1 // OFPRR_HARD_TIMEOUT |
| 784 | OFPRRDelete = 2 // OFPRR_DELETE |
| 785 | OFPRRGroupDelete = 3 // OFPRR_GROUP_DELETE |
| 786 | ) |
| 787 | |
| 788 | type FlowRemovedReason uint8 |
| 789 | |
| 790 | func (self FlowRemovedReason) MarshalJSON() ([]byte, error) { |
| 791 | return []byte(fmt.Sprintf("%d", self)), nil |
| 792 | } |
| 793 | |
| 794 | const ( |
| 795 | // Identifiers from group ofp_flow_wildcards |
| 796 | OFPFWInPort = 1 // OFPFW_IN_PORT |
| 797 | OFPFWDlVLAN = 2 // OFPFW_DL_VLAN |
| 798 | OFPFWDlVLANPCP = 4 // OFPFW_DL_VLAN_PCP |
| 799 | OFPFWDlType = 8 // OFPFW_DL_TYPE |
| 800 | OFPFWNwTos = 16 // OFPFW_NW_TOS |
| 801 | OFPFWNwProto = 32 // OFPFW_NW_PROTO |
| 802 | OFPFWTpSrc = 64 // OFPFW_TP_SRC |
| 803 | OFPFWTpDst = 128 // OFPFW_TP_DST |
| 804 | OFPFWMplsLabel = 256 // OFPFW_MPLS_LABEL |
| 805 | OFPFWMplsTc = 512 // OFPFW_MPLS_TC |
| 806 | OFPFWAll = 1023 // OFPFW_ALL |
| 807 | ) |
| 808 | |
| 809 | type FlowWildcards uint32 |
| 810 | |
| 811 | func (self FlowWildcards) MarshalJSON() ([]byte, error) { |
| 812 | var flags []string |
| 813 | if self&OFPFWInPort == OFPFWInPort { |
| 814 | flags = append(flags, "\"InPort\": true") |
| 815 | } |
| 816 | if self&OFPFWDlVLAN == OFPFWDlVLAN { |
| 817 | flags = append(flags, "\"DlVLAN\": true") |
| 818 | } |
| 819 | if self&OFPFWDlVLANPCP == OFPFWDlVLANPCP { |
| 820 | flags = append(flags, "\"DlVLANPCP\": true") |
| 821 | } |
| 822 | if self&OFPFWDlType == OFPFWDlType { |
| 823 | flags = append(flags, "\"DlType\": true") |
| 824 | } |
| 825 | if self&OFPFWNwTos == OFPFWNwTos { |
| 826 | flags = append(flags, "\"NwTos\": true") |
| 827 | } |
| 828 | if self&OFPFWNwProto == OFPFWNwProto { |
| 829 | flags = append(flags, "\"NwProto\": true") |
| 830 | } |
| 831 | if self&OFPFWTpSrc == OFPFWTpSrc { |
| 832 | flags = append(flags, "\"TpSrc\": true") |
| 833 | } |
| 834 | if self&OFPFWTpDst == OFPFWTpDst { |
| 835 | flags = append(flags, "\"TpDst\": true") |
| 836 | } |
| 837 | if self&OFPFWMplsLabel == OFPFWMplsLabel { |
| 838 | flags = append(flags, "\"MplsLabel\": true") |
| 839 | } |
| 840 | if self&OFPFWMplsTc == OFPFWMplsTc { |
| 841 | flags = append(flags, "\"MplsTc\": true") |
| 842 | } |
| 843 | if self&OFPFWAll == OFPFWAll { |
| 844 | flags = append(flags, "\"All\": true") |
| 845 | } |
| 846 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 847 | } |
| 848 | |
| 849 | const ( |
| 850 | // Identifiers from group ofp_group |
| 851 | OFPGMax = 4294967040 // OFPG_MAX |
| 852 | OFPGAll = 4294967292 // OFPG_ALL |
| 853 | OFPGAny = 4294967295 // OFPG_ANY |
| 854 | ) |
| 855 | |
| 856 | type Group uint32 |
| 857 | |
| 858 | func (self Group) MarshalJSON() ([]byte, error) { |
| 859 | return []byte(fmt.Sprintf("%d", self)), nil |
| 860 | } |
| 861 | |
| 862 | const ( |
| 863 | // Identifiers from group ofp_group_mod_command |
| 864 | OFPGCAdd = 0 // OFPGC_ADD |
| 865 | OFPGCModify = 1 // OFPGC_MODIFY |
| 866 | OFPGCDelete = 2 // OFPGC_DELETE |
| 867 | ) |
| 868 | |
| 869 | type GroupModCommand uint16 |
| 870 | |
| 871 | func (self GroupModCommand) MarshalJSON() ([]byte, error) { |
| 872 | return []byte(fmt.Sprintf("%d", self)), nil |
| 873 | } |
| 874 | |
| 875 | const ( |
| 876 | // Identifiers from group ofp_group_mod_failed_code |
| 877 | OFPGMFCGroupExists = 0 // OFPGMFC_GROUP_EXISTS |
| 878 | OFPGMFCInvalidGroup = 1 // OFPGMFC_INVALID_GROUP |
| 879 | OFPGMFCWeightUnsupported = 2 // OFPGMFC_WEIGHT_UNSUPPORTED |
| 880 | OFPGMFCOutOfGroups = 3 // OFPGMFC_OUT_OF_GROUPS |
| 881 | OFPGMFCOutOfBuckets = 4 // OFPGMFC_OUT_OF_BUCKETS |
| 882 | OFPGMFCChainingUnsupported = 5 // OFPGMFC_CHAINING_UNSUPPORTED |
| 883 | OFPGMFCWatchUnsupported = 6 // OFPGMFC_WATCH_UNSUPPORTED |
| 884 | OFPGMFCLoop = 7 // OFPGMFC_LOOP |
| 885 | OFPGMFCUnknownGroup = 8 // OFPGMFC_UNKNOWN_GROUP |
| 886 | ) |
| 887 | |
| 888 | type GroupModFailedCode uint16 |
| 889 | |
| 890 | func (self GroupModFailedCode) MarshalJSON() ([]byte, error) { |
| 891 | return []byte(fmt.Sprintf("%d", self)), nil |
| 892 | } |
| 893 | |
| 894 | const ( |
| 895 | // Identifiers from group ofp_group_type |
| 896 | OFPGTAll = 0 // OFPGT_ALL |
| 897 | OFPGTSelect = 1 // OFPGT_SELECT |
| 898 | OFPGTIndirect = 2 // OFPGT_INDIRECT |
| 899 | OFPGTFf = 3 // OFPGT_FF |
| 900 | ) |
| 901 | |
| 902 | type GroupType uint8 |
| 903 | |
| 904 | func (self GroupType) MarshalJSON() ([]byte, error) { |
| 905 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 906 | } |
| 907 | |
| 908 | func (self GroupType) String() string { |
| 909 | switch self { |
| 910 | case OFPGTAll: |
| 911 | return "all" |
| 912 | case OFPGTSelect: |
| 913 | return "select" |
| 914 | case OFPGTIndirect: |
| 915 | return "indirect" |
| 916 | case OFPGTFf: |
| 917 | return "ff" |
| 918 | default: |
| 919 | return fmt.Sprintf("%d", self) |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | const ( |
| 924 | // Identifiers from group ofp_hello_failed_code |
| 925 | OFPHFCIncompatible = 0 // OFPHFC_INCOMPATIBLE |
| 926 | OFPHFCEperm = 1 // OFPHFC_EPERM |
| 927 | ) |
| 928 | |
| 929 | type HelloFailedCode uint16 |
| 930 | |
| 931 | func (self HelloFailedCode) MarshalJSON() ([]byte, error) { |
| 932 | return []byte(fmt.Sprintf("%d", self)), nil |
| 933 | } |
| 934 | |
| 935 | const ( |
| 936 | // Identifiers from group ofp_icmp_type |
| 937 | IcmpEchoreply = 0 // ICMP_ECHOREPLY |
| 938 | IcmpDestUnreach = 3 // ICMP_DEST_UNREACH |
| 939 | IcmpSourceQuench = 4 // ICMP_SOURCE_QUENCH |
| 940 | IcmpRedirect = 5 // ICMP_REDIRECT |
| 941 | IcmpEcho = 8 // ICMP_ECHO |
| 942 | IcmpTimeExceeded = 11 // ICMP_TIME_EXCEEDED |
| 943 | IcmpParameterprob = 12 // ICMP_PARAMETERPROB |
| 944 | IcmpTimestamp = 13 // ICMP_TIMESTAMP |
| 945 | IcmpTimestampreply = 14 // ICMP_TIMESTAMPREPLY |
| 946 | IcmpInfoRequest = 15 // ICMP_INFO_REQUEST |
| 947 | IcmpInfoReply = 16 // ICMP_INFO_REPLY |
| 948 | IcmpAddress = 17 // ICMP_ADDRESS |
| 949 | IcmpAddressreply = 18 // ICMP_ADDRESSREPLY |
| 950 | ) |
| 951 | |
| 952 | type IcmpType uint8 |
| 953 | |
| 954 | func (self IcmpType) MarshalJSON() ([]byte, error) { |
| 955 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 956 | } |
| 957 | |
| 958 | func (self IcmpType) String() string { |
| 959 | switch self { |
| 960 | case IcmpEchoreply: |
| 961 | return "echoreply" |
| 962 | case IcmpDestUnreach: |
| 963 | return "dest_unreach" |
| 964 | case IcmpSourceQuench: |
| 965 | return "source_quench" |
| 966 | case IcmpRedirect: |
| 967 | return "redirect" |
| 968 | case IcmpEcho: |
| 969 | return "echo" |
| 970 | case IcmpTimeExceeded: |
| 971 | return "time_exceeded" |
| 972 | case IcmpParameterprob: |
| 973 | return "parameterprob" |
| 974 | case IcmpTimestamp: |
| 975 | return "timestamp" |
| 976 | case IcmpTimestampreply: |
| 977 | return "timestampreply" |
| 978 | case IcmpInfoRequest: |
| 979 | return "info_request" |
| 980 | case IcmpInfoReply: |
| 981 | return "info_reply" |
| 982 | case IcmpAddress: |
| 983 | return "address" |
| 984 | case IcmpAddressreply: |
| 985 | return "addressreply" |
| 986 | default: |
| 987 | return fmt.Sprintf("%d", self) |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | const ( |
| 992 | // Identifiers from group ofp_icmpv6_type |
| 993 | Icmpv6EchoRequest = 128 // ICMPV6_ECHO_REQUEST |
| 994 | Icmpv6EchoReply = 129 // ICMPV6_ECHO_REPLY |
| 995 | Icmpv6MgmQuery = 130 // ICMPV6_MGM_QUERY |
| 996 | Icmpv6MgmReport = 131 // ICMPV6_MGM_REPORT |
| 997 | Icmpv6MgmReduction = 132 // ICMPV6_MGM_REDUCTION |
| 998 | Icmpv6NiQuery = 139 // ICMPV6_NI_QUERY |
| 999 | Icmpv6NiReply = 140 // ICMPV6_NI_REPLY |
| 1000 | Icmpv6Mld2Report = 143 // ICMPV6_MLD2_REPORT |
| 1001 | Icmpv6DhaadRequest = 144 // ICMPV6_DHAAD_REQUEST |
| 1002 | Icmpv6DhaadReply = 145 // ICMPV6_DHAAD_REPLY |
| 1003 | Icmpv6MobilePrefixSol = 146 // ICMPV6_MOBILE_PREFIX_SOL |
| 1004 | Icmpv6MobilePrefixAdv = 147 // ICMPV6_MOBILE_PREFIX_ADV |
| 1005 | ) |
| 1006 | |
| 1007 | type Icmpv6Type uint8 |
| 1008 | |
| 1009 | func (self Icmpv6Type) MarshalJSON() ([]byte, error) { |
| 1010 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1011 | } |
| 1012 | |
| 1013 | func (self Icmpv6Type) String() string { |
| 1014 | switch self { |
| 1015 | case Icmpv6EchoRequest: |
| 1016 | return "echo_request" |
| 1017 | case Icmpv6EchoReply: |
| 1018 | return "echo_reply" |
| 1019 | case Icmpv6MgmQuery: |
| 1020 | return "mgm_query" |
| 1021 | case Icmpv6MgmReport: |
| 1022 | return "mgm_report" |
| 1023 | case Icmpv6MgmReduction: |
| 1024 | return "mgm_reduction" |
| 1025 | case Icmpv6NiQuery: |
| 1026 | return "ni_query" |
| 1027 | case Icmpv6NiReply: |
| 1028 | return "ni_reply" |
| 1029 | case Icmpv6Mld2Report: |
| 1030 | return "mld2_report" |
| 1031 | case Icmpv6DhaadRequest: |
| 1032 | return "dhaad_request" |
| 1033 | case Icmpv6DhaadReply: |
| 1034 | return "dhaad_reply" |
| 1035 | case Icmpv6MobilePrefixSol: |
| 1036 | return "mobile_prefix_sol" |
| 1037 | case Icmpv6MobilePrefixAdv: |
| 1038 | return "mobile_prefix_adv" |
| 1039 | default: |
| 1040 | return fmt.Sprintf("%d", self) |
| 1041 | } |
| 1042 | } |
| 1043 | |
| 1044 | const ( |
| 1045 | // Identifiers from group ofp_instruction_type |
| 1046 | OFPITGotoTable = 1 // OFPIT_GOTO_TABLE |
| 1047 | OFPITWriteMetadata = 2 // OFPIT_WRITE_METADATA |
| 1048 | OFPITWriteActions = 3 // OFPIT_WRITE_ACTIONS |
| 1049 | OFPITApplyActions = 4 // OFPIT_APPLY_ACTIONS |
| 1050 | OFPITClearActions = 5 // OFPIT_CLEAR_ACTIONS |
| 1051 | OFPITExperimenter = 65535 // OFPIT_EXPERIMENTER |
| 1052 | ) |
| 1053 | |
| 1054 | type InstructionType uint16 |
| 1055 | |
| 1056 | func (self InstructionType) MarshalJSON() ([]byte, error) { |
| 1057 | var flags []string |
| 1058 | if self&OFPITGotoTable == OFPITGotoTable { |
| 1059 | flags = append(flags, "\"GotoTable\": true") |
| 1060 | } |
| 1061 | if self&OFPITWriteMetadata == OFPITWriteMetadata { |
| 1062 | flags = append(flags, "\"WriteMetadata\": true") |
| 1063 | } |
| 1064 | if self&OFPITWriteActions == OFPITWriteActions { |
| 1065 | flags = append(flags, "\"WriteActions\": true") |
| 1066 | } |
| 1067 | if self&OFPITApplyActions == OFPITApplyActions { |
| 1068 | flags = append(flags, "\"ApplyActions\": true") |
| 1069 | } |
| 1070 | if self&OFPITClearActions == OFPITClearActions { |
| 1071 | flags = append(flags, "\"ClearActions\": true") |
| 1072 | } |
| 1073 | if self&OFPITExperimenter == OFPITExperimenter { |
| 1074 | flags = append(flags, "\"Experimenter\": true") |
| 1075 | } |
| 1076 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1077 | } |
| 1078 | |
| 1079 | const ( |
| 1080 | // Identifiers from group ofp_ip_prototype |
| 1081 | IpprotoIp = 0 // IPPROTO_IP |
| 1082 | IpprotoICMP = 1 // IPPROTO_ICMP |
| 1083 | IpprotoIgmp = 2 // IPPROTO_IGMP |
| 1084 | IpprotoIpip = 4 // IPPROTO_IPIP |
| 1085 | IpprotoTCP = 6 // IPPROTO_TCP |
| 1086 | IpprotoEgp = 8 // IPPROTO_EGP |
| 1087 | IpprotoPup = 12 // IPPROTO_PUP |
| 1088 | IpprotoUdp = 17 // IPPROTO_UDP |
| 1089 | IpprotoIdp = 22 // IPPROTO_IDP |
| 1090 | IpprotoTp = 29 // IPPROTO_TP |
| 1091 | IpprotoDccp = 33 // IPPROTO_DCCP |
| 1092 | IpprotoIpv6 = 41 // IPPROTO_IPV6 |
| 1093 | IpprotoRsvp = 46 // IPPROTO_RSVP |
| 1094 | IpprotoGRE = 47 // IPPROTO_GRE |
| 1095 | IpprotoEsp = 50 // IPPROTO_ESP |
| 1096 | IpprotoAh = 51 // IPPROTO_AH |
| 1097 | IpprotoMtp = 92 // IPPROTO_MTP |
| 1098 | IpprotoBeetph = 94 // IPPROTO_BEETPH |
| 1099 | IpprotoEncap = 98 // IPPROTO_ENCAP |
| 1100 | IpprotoPim = 103 // IPPROTO_PIM |
| 1101 | IpprotoComp = 108 // IPPROTO_COMP |
| 1102 | IpprotoSctp = 132 // IPPROTO_SCTP |
| 1103 | IpprotoUdplite = 136 // IPPROTO_UDPLITE |
| 1104 | IpprotoMpls = 137 // IPPROTO_MPLS |
| 1105 | IpprotoRaw = 255 // IPPROTO_RAW |
| 1106 | IpprotoRouting = 43 // IPPROTO_ROUTING |
| 1107 | IpprotoFragment = 44 // IPPROTO_FRAGMENT |
| 1108 | IpprotoIcmpv6 = 58 // IPPROTO_ICMPV6 |
| 1109 | IpprotoNone = 59 // IPPROTO_NONE |
| 1110 | IpprotoDstopts = 60 // IPPROTO_DSTOPTS |
| 1111 | IpprotoMh = 135 // IPPROTO_MH |
| 1112 | IpprotoL2Tp = 115 // IPPROTO_L2TP |
| 1113 | ) |
| 1114 | |
| 1115 | type IpPrototype uint8 |
| 1116 | |
| 1117 | func (self IpPrototype) MarshalJSON() ([]byte, error) { |
| 1118 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1119 | } |
| 1120 | |
| 1121 | func (self IpPrototype) String() string { |
| 1122 | switch self { |
| 1123 | case IpprotoIp: |
| 1124 | return "ip" |
| 1125 | case IpprotoICMP: |
| 1126 | return "icmp" |
| 1127 | case IpprotoIgmp: |
| 1128 | return "igmp" |
| 1129 | case IpprotoIpip: |
| 1130 | return "ipip" |
| 1131 | case IpprotoTCP: |
| 1132 | return "tcp" |
| 1133 | case IpprotoEgp: |
| 1134 | return "egp" |
| 1135 | case IpprotoPup: |
| 1136 | return "pup" |
| 1137 | case IpprotoUdp: |
| 1138 | return "udp" |
| 1139 | case IpprotoIdp: |
| 1140 | return "idp" |
| 1141 | case IpprotoTp: |
| 1142 | return "tp" |
| 1143 | case IpprotoDccp: |
| 1144 | return "dccp" |
| 1145 | case IpprotoIpv6: |
| 1146 | return "ipv6" |
| 1147 | case IpprotoRsvp: |
| 1148 | return "rsvp" |
| 1149 | case IpprotoGRE: |
| 1150 | return "gre" |
| 1151 | case IpprotoEsp: |
| 1152 | return "esp" |
| 1153 | case IpprotoAh: |
| 1154 | return "ah" |
| 1155 | case IpprotoMtp: |
| 1156 | return "mtp" |
| 1157 | case IpprotoBeetph: |
| 1158 | return "beetph" |
| 1159 | case IpprotoEncap: |
| 1160 | return "encap" |
| 1161 | case IpprotoPim: |
| 1162 | return "pim" |
| 1163 | case IpprotoComp: |
| 1164 | return "comp" |
| 1165 | case IpprotoSctp: |
| 1166 | return "sctp" |
| 1167 | case IpprotoUdplite: |
| 1168 | return "udplite" |
| 1169 | case IpprotoMpls: |
| 1170 | return "mpls" |
| 1171 | case IpprotoRaw: |
| 1172 | return "raw" |
| 1173 | case IpprotoRouting: |
| 1174 | return "routing" |
| 1175 | case IpprotoFragment: |
| 1176 | return "fragment" |
| 1177 | case IpprotoIcmpv6: |
| 1178 | return "icmpv6" |
| 1179 | case IpprotoNone: |
| 1180 | return "none" |
| 1181 | case IpprotoDstopts: |
| 1182 | return "dstopts" |
| 1183 | case IpprotoMh: |
| 1184 | return "mh" |
| 1185 | case IpprotoL2Tp: |
| 1186 | return "l2tp" |
| 1187 | default: |
| 1188 | return fmt.Sprintf("%d", self) |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | const ( |
| 1193 | // Identifiers from group ofp_match_type |
| 1194 | OFPMTStandard = 0 // OFPMT_STANDARD |
| 1195 | ) |
| 1196 | |
| 1197 | type MatchType uint16 |
| 1198 | |
| 1199 | func (self MatchType) MarshalJSON() ([]byte, error) { |
| 1200 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1201 | } |
| 1202 | |
| 1203 | const ( |
| 1204 | // Identifiers from group ofp_packet_in_reason |
| 1205 | OFPRNoMatch = 0 // OFPR_NO_MATCH |
| 1206 | OFPRAction = 1 // OFPR_ACTION |
| 1207 | ) |
| 1208 | |
| 1209 | type PacketInReason uint8 |
| 1210 | |
| 1211 | func (self PacketInReason) MarshalJSON() ([]byte, error) { |
| 1212 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1213 | } |
| 1214 | |
| 1215 | const ( |
| 1216 | // Identifiers from group ofp_packet_type |
| 1217 | PtEthernet = 0 // OFP_PT_ETHERNET |
| 1218 | PtUseNextProto = 65534 // OFP_PT_USE_NEXT_PROTO |
| 1219 | PtIpv4 = 67584 // OFP_PT_IPV4 |
| 1220 | PtMpls = 100423 // OFP_PT_MPLS |
| 1221 | PtMplsMc = 100424 // OFP_PT_MPLS_MC |
| 1222 | PtNsh = 100687 // OFP_PT_NSH |
| 1223 | PtUnknown = 4294967295 // OFP_PT_UNKNOWN |
| 1224 | ) |
| 1225 | |
| 1226 | type PacketType uint32 |
| 1227 | |
| 1228 | func (self PacketType) MarshalJSON() ([]byte, error) { |
| 1229 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1230 | } |
| 1231 | |
| 1232 | func (self PacketType) String() string { |
| 1233 | switch self { |
| 1234 | case PtEthernet: |
| 1235 | return "ethernet" |
| 1236 | case PtUseNextProto: |
| 1237 | return "use_next_proto" |
| 1238 | case PtIpv4: |
| 1239 | return "ipv4" |
| 1240 | case PtMpls: |
| 1241 | return "mpls" |
| 1242 | case PtMplsMc: |
| 1243 | return "mpls_mc" |
| 1244 | case PtNsh: |
| 1245 | return "nsh" |
| 1246 | case PtUnknown: |
| 1247 | return "unknown" |
| 1248 | default: |
| 1249 | return fmt.Sprintf("%d", self) |
| 1250 | } |
| 1251 | } |
| 1252 | |
| 1253 | const ( |
| 1254 | // Identifiers from group ofp_port |
| 1255 | OFPPMax = 4294967040 // OFPP_MAX |
| 1256 | OFPPInPort = 4294967288 // OFPP_IN_PORT |
| 1257 | OFPPTable = 4294967289 // OFPP_TABLE |
| 1258 | OFPPNormal = 4294967290 // OFPP_NORMAL |
| 1259 | OFPPFlood = 4294967291 // OFPP_FLOOD |
| 1260 | OFPPAll = 4294967292 // OFPP_ALL |
| 1261 | OFPPController = 4294967293 // OFPP_CONTROLLER |
| 1262 | OFPPLocal = 4294967294 // OFPP_LOCAL |
| 1263 | OFPPAny = 4294967295 // OFPP_ANY |
| 1264 | ) |
| 1265 | |
| 1266 | type Port uint32 |
| 1267 | |
| 1268 | func (self Port) MarshalJSON() ([]byte, error) { |
| 1269 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1270 | } |
| 1271 | |
| 1272 | const ( |
| 1273 | // Identifiers from group ofp_port_config |
| 1274 | OFPPCPortDown = 1 // OFPPC_PORT_DOWN |
| 1275 | OFPPCNoRecv = 4 // OFPPC_NO_RECV |
| 1276 | OFPPCNoFwd = 32 // OFPPC_NO_FWD |
| 1277 | OFPPCNoPacketIn = 64 // OFPPC_NO_PACKET_IN |
| 1278 | OFPPCBSNMirrorDest = 2147483648 // OFPPC_BSN_MIRROR_DEST |
| 1279 | ) |
| 1280 | |
| 1281 | type PortConfig uint32 |
| 1282 | |
| 1283 | func (self PortConfig) MarshalJSON() ([]byte, error) { |
| 1284 | var flags []string |
| 1285 | if self&OFPPCPortDown == OFPPCPortDown { |
| 1286 | flags = append(flags, "\"PortDown\": true") |
| 1287 | } |
| 1288 | if self&OFPPCNoRecv == OFPPCNoRecv { |
| 1289 | flags = append(flags, "\"NoRecv\": true") |
| 1290 | } |
| 1291 | if self&OFPPCNoFwd == OFPPCNoFwd { |
| 1292 | flags = append(flags, "\"NoFwd\": true") |
| 1293 | } |
| 1294 | if self&OFPPCNoPacketIn == OFPPCNoPacketIn { |
| 1295 | flags = append(flags, "\"NoPacketIn\": true") |
| 1296 | } |
| 1297 | if self&OFPPCBSNMirrorDest == OFPPCBSNMirrorDest { |
| 1298 | flags = append(flags, "\"BsnMirrorDest\": true") |
| 1299 | } |
| 1300 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1301 | } |
| 1302 | |
| 1303 | const ( |
| 1304 | // Identifiers from group ofp_port_features |
| 1305 | OFPPF10MbHd = 1 // OFPPF_10MB_HD |
| 1306 | OFPPF10MbFd = 2 // OFPPF_10MB_FD |
| 1307 | OFPPF100MbHd = 4 // OFPPF_100MB_HD |
| 1308 | OFPPF100MbFd = 8 // OFPPF_100MB_FD |
| 1309 | OFPPF1GbHd = 16 // OFPPF_1GB_HD |
| 1310 | OFPPF1GbFd = 32 // OFPPF_1GB_FD |
| 1311 | OFPPF10GbFd = 64 // OFPPF_10GB_FD |
| 1312 | OFPPF40GbFd = 128 // OFPPF_40GB_FD |
| 1313 | OFPPF100GbFd = 256 // OFPPF_100GB_FD |
| 1314 | OFPPF1TbFd = 512 // OFPPF_1TB_FD |
| 1315 | OFPPFOther = 1024 // OFPPF_OTHER |
| 1316 | OFPPFCopper = 2048 // OFPPF_COPPER |
| 1317 | OFPPFFiber = 4096 // OFPPF_FIBER |
| 1318 | OFPPFAutoneg = 8192 // OFPPF_AUTONEG |
| 1319 | OFPPFPause = 16384 // OFPPF_PAUSE |
| 1320 | OFPPFPauseAsym = 32768 // OFPPF_PAUSE_ASYM |
| 1321 | ) |
| 1322 | |
| 1323 | type PortFeatures uint32 |
| 1324 | |
| 1325 | func (self PortFeatures) MarshalJSON() ([]byte, error) { |
| 1326 | var flags []string |
| 1327 | if self&OFPPF10MbHd == OFPPF10MbHd { |
| 1328 | flags = append(flags, "\"10MbHd\": true") |
| 1329 | } |
| 1330 | if self&OFPPF10MbFd == OFPPF10MbFd { |
| 1331 | flags = append(flags, "\"10MbFd\": true") |
| 1332 | } |
| 1333 | if self&OFPPF100MbHd == OFPPF100MbHd { |
| 1334 | flags = append(flags, "\"100MbHd\": true") |
| 1335 | } |
| 1336 | if self&OFPPF100MbFd == OFPPF100MbFd { |
| 1337 | flags = append(flags, "\"100MbFd\": true") |
| 1338 | } |
| 1339 | if self&OFPPF1GbHd == OFPPF1GbHd { |
| 1340 | flags = append(flags, "\"1GbHd\": true") |
| 1341 | } |
| 1342 | if self&OFPPF1GbFd == OFPPF1GbFd { |
| 1343 | flags = append(flags, "\"1GbFd\": true") |
| 1344 | } |
| 1345 | if self&OFPPF10GbFd == OFPPF10GbFd { |
| 1346 | flags = append(flags, "\"10GbFd\": true") |
| 1347 | } |
| 1348 | if self&OFPPF40GbFd == OFPPF40GbFd { |
| 1349 | flags = append(flags, "\"40GbFd\": true") |
| 1350 | } |
| 1351 | if self&OFPPF100GbFd == OFPPF100GbFd { |
| 1352 | flags = append(flags, "\"100GbFd\": true") |
| 1353 | } |
| 1354 | if self&OFPPF1TbFd == OFPPF1TbFd { |
| 1355 | flags = append(flags, "\"1TbFd\": true") |
| 1356 | } |
| 1357 | if self&OFPPFOther == OFPPFOther { |
| 1358 | flags = append(flags, "\"Other\": true") |
| 1359 | } |
| 1360 | if self&OFPPFCopper == OFPPFCopper { |
| 1361 | flags = append(flags, "\"Copper\": true") |
| 1362 | } |
| 1363 | if self&OFPPFFiber == OFPPFFiber { |
| 1364 | flags = append(flags, "\"Fiber\": true") |
| 1365 | } |
| 1366 | if self&OFPPFAutoneg == OFPPFAutoneg { |
| 1367 | flags = append(flags, "\"Autoneg\": true") |
| 1368 | } |
| 1369 | if self&OFPPFPause == OFPPFPause { |
| 1370 | flags = append(flags, "\"Pause\": true") |
| 1371 | } |
| 1372 | if self&OFPPFPauseAsym == OFPPFPauseAsym { |
| 1373 | flags = append(flags, "\"PauseAsym\": true") |
| 1374 | } |
| 1375 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1376 | } |
| 1377 | |
| 1378 | const ( |
| 1379 | // Identifiers from group ofp_port_mod_failed_code |
| 1380 | OFPPMFCBadPort = 0 // OFPPMFC_BAD_PORT |
| 1381 | OFPPMFCBadHwAddr = 1 // OFPPMFC_BAD_HW_ADDR |
| 1382 | OFPPMFCBadConfig = 2 // OFPPMFC_BAD_CONFIG |
| 1383 | OFPPMFCBadAdvertise = 3 // OFPPMFC_BAD_ADVERTISE |
| 1384 | ) |
| 1385 | |
| 1386 | type PortModFailedCode uint16 |
| 1387 | |
| 1388 | func (self PortModFailedCode) MarshalJSON() ([]byte, error) { |
| 1389 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1390 | } |
| 1391 | |
| 1392 | const ( |
| 1393 | // Identifiers from group ofp_port_reason |
| 1394 | OFPPRAdd = 0 // OFPPR_ADD |
| 1395 | OFPPRDelete = 1 // OFPPR_DELETE |
| 1396 | OFPPRModify = 2 // OFPPR_MODIFY |
| 1397 | ) |
| 1398 | |
| 1399 | type PortReason uint8 |
| 1400 | |
| 1401 | func (self PortReason) MarshalJSON() ([]byte, error) { |
| 1402 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1403 | } |
| 1404 | |
| 1405 | const ( |
| 1406 | // Identifiers from group ofp_port_state |
| 1407 | OFPPSLinkDown = 1 // OFPPS_LINK_DOWN |
| 1408 | OFPPSBlocked = 2 // OFPPS_BLOCKED |
| 1409 | OFPPSLive = 4 // OFPPS_LIVE |
| 1410 | ) |
| 1411 | |
| 1412 | type PortState uint32 |
| 1413 | |
| 1414 | func (self PortState) MarshalJSON() ([]byte, error) { |
| 1415 | var flags []string |
| 1416 | if self&OFPPSLinkDown == OFPPSLinkDown { |
| 1417 | flags = append(flags, "\"LinkDown\": true") |
| 1418 | } |
| 1419 | if self&OFPPSBlocked == OFPPSBlocked { |
| 1420 | flags = append(flags, "\"Blocked\": true") |
| 1421 | } |
| 1422 | if self&OFPPSLive == OFPPSLive { |
| 1423 | flags = append(flags, "\"Live\": true") |
| 1424 | } |
| 1425 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1426 | } |
| 1427 | |
| 1428 | const ( |
| 1429 | // Identifiers from group ofp_queue_op_failed_code |
| 1430 | OFPQOFCBadPort = 0 // OFPQOFC_BAD_PORT |
| 1431 | OFPQOFCBadQueue = 1 // OFPQOFC_BAD_QUEUE |
| 1432 | OFPQOFCEperm = 2 // OFPQOFC_EPERM |
| 1433 | ) |
| 1434 | |
| 1435 | type QueueOpFailedCode uint16 |
| 1436 | |
| 1437 | func (self QueueOpFailedCode) MarshalJSON() ([]byte, error) { |
| 1438 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1439 | } |
| 1440 | |
| 1441 | const ( |
| 1442 | // Identifiers from group ofp_queue_properties |
| 1443 | OFPQTNone = 0 // OFPQT_NONE |
| 1444 | OFPQTMinRate = 1 // OFPQT_MIN_RATE |
| 1445 | ) |
| 1446 | |
| 1447 | type QueueProperties uint16 |
| 1448 | |
| 1449 | func (self QueueProperties) MarshalJSON() ([]byte, error) { |
| 1450 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1451 | } |
| 1452 | |
| 1453 | const ( |
| 1454 | // Identifiers from group ofp_stats_reply_flags |
| 1455 | OFPSFReplyMore = 1 // OFPSF_REPLY_MORE |
| 1456 | ) |
| 1457 | |
| 1458 | type StatsReplyFlags uint16 |
| 1459 | |
| 1460 | func (self StatsReplyFlags) MarshalJSON() ([]byte, error) { |
| 1461 | var flags []string |
| 1462 | if self&OFPSFReplyMore == OFPSFReplyMore { |
| 1463 | flags = append(flags, "\"OFPSFReplyMore\": true") |
| 1464 | } |
| 1465 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1466 | } |
| 1467 | |
| 1468 | const ( |
| 1469 | // Identifiers from group ofp_stats_request_flags |
| 1470 | ) |
| 1471 | |
| 1472 | type StatsRequestFlags uint16 |
| 1473 | |
| 1474 | func (self StatsRequestFlags) MarshalJSON() ([]byte, error) { |
| 1475 | var flags []string |
| 1476 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1477 | } |
| 1478 | |
| 1479 | const ( |
| 1480 | // Identifiers from group ofp_stats_type |
| 1481 | OFPSTDesc = 0 // OFPST_DESC |
| 1482 | OFPSTFlow = 1 // OFPST_FLOW |
| 1483 | OFPSTAggregate = 2 // OFPST_AGGREGATE |
| 1484 | OFPSTTable = 3 // OFPST_TABLE |
| 1485 | OFPSTPort = 4 // OFPST_PORT |
| 1486 | OFPSTQueue = 5 // OFPST_QUEUE |
| 1487 | OFPSTGroup = 6 // OFPST_GROUP |
| 1488 | OFPSTGroupDesc = 7 // OFPST_GROUP_DESC |
| 1489 | OFPSTExperimenter = 65535 // OFPST_EXPERIMENTER |
| 1490 | ) |
| 1491 | |
| 1492 | type StatsType uint16 |
| 1493 | |
| 1494 | func (self StatsType) MarshalJSON() ([]byte, error) { |
| 1495 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1496 | } |
| 1497 | |
| 1498 | const ( |
| 1499 | // Identifiers from group ofp_switch_config_failed_code |
| 1500 | OFPSCFCBadFlags = 0 // OFPSCFC_BAD_FLAGS |
| 1501 | OFPSCFCBadLen = 1 // OFPSCFC_BAD_LEN |
| 1502 | ) |
| 1503 | |
| 1504 | type SwitchConfigFailedCode uint16 |
| 1505 | |
| 1506 | func (self SwitchConfigFailedCode) MarshalJSON() ([]byte, error) { |
| 1507 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1508 | } |
| 1509 | |
| 1510 | const ( |
| 1511 | // Identifiers from group ofp_table_config |
| 1512 | OFPTCTableMissController = 0 // OFPTC_TABLE_MISS_CONTROLLER |
| 1513 | OFPTCTableMissContinue = 1 // OFPTC_TABLE_MISS_CONTINUE |
| 1514 | OFPTCTableMissDrop = 2 // OFPTC_TABLE_MISS_DROP |
| 1515 | OFPTCTableMissMask = 3 // OFPTC_TABLE_MISS_MASK |
| 1516 | ) |
| 1517 | |
| 1518 | type TableConfig uint32 |
| 1519 | |
| 1520 | func (self TableConfig) MarshalJSON() ([]byte, error) { |
| 1521 | var flags []string |
| 1522 | if self&OFPTCTableMissController == OFPTCTableMissController { |
| 1523 | flags = append(flags, "\"Controller\": true") |
| 1524 | } |
| 1525 | if self&OFPTCTableMissContinue == OFPTCTableMissContinue { |
| 1526 | flags = append(flags, "\"Continue\": true") |
| 1527 | } |
| 1528 | if self&OFPTCTableMissDrop == OFPTCTableMissDrop { |
| 1529 | flags = append(flags, "\"Drop\": true") |
| 1530 | } |
| 1531 | if self&OFPTCTableMissMask == OFPTCTableMissMask { |
| 1532 | flags = append(flags, "\"Mask\": true") |
| 1533 | } |
| 1534 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1535 | } |
| 1536 | |
| 1537 | const ( |
| 1538 | // Identifiers from group ofp_table_mod_failed_code |
| 1539 | OFPTMFCBadTable = 0 // OFPTMFC_BAD_TABLE |
| 1540 | OFPTMFCBadConfig = 1 // OFPTMFC_BAD_CONFIG |
| 1541 | ) |
| 1542 | |
| 1543 | type TableModFailedCode uint16 |
| 1544 | |
| 1545 | func (self TableModFailedCode) MarshalJSON() ([]byte, error) { |
| 1546 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1547 | } |
| 1548 | |
| 1549 | const ( |
| 1550 | // Identifiers from group ofp_tcp_flags |
| 1551 | TcpFlagCwr = 128 // TCP_FLAG_CWR |
| 1552 | TcpFlagEce = 64 // TCP_FLAG_ECE |
| 1553 | TcpFlagUrg = 32 // TCP_FLAG_URG |
| 1554 | TcpFlagAck = 16 // TCP_FLAG_ACK |
| 1555 | TcpFlagPsh = 8 // TCP_FLAG_PSH |
| 1556 | TcpFlagRst = 4 // TCP_FLAG_RST |
| 1557 | TcpFlagSyn = 2 // TCP_FLAG_SYN |
| 1558 | TcpFlagFin = 1 // TCP_FLAG_FIN |
| 1559 | ) |
| 1560 | |
| 1561 | type TcpFlags uint16 |
| 1562 | |
| 1563 | func (self TcpFlags) MarshalJSON() ([]byte, error) { |
| 1564 | var flags []string |
| 1565 | if self&TcpFlagCwr == TcpFlagCwr { |
| 1566 | flags = append(flags, "\"Cwr\": true") |
| 1567 | } |
| 1568 | if self&TcpFlagEce == TcpFlagEce { |
| 1569 | flags = append(flags, "\"Ece\": true") |
| 1570 | } |
| 1571 | if self&TcpFlagUrg == TcpFlagUrg { |
| 1572 | flags = append(flags, "\"Urg\": true") |
| 1573 | } |
| 1574 | if self&TcpFlagAck == TcpFlagAck { |
| 1575 | flags = append(flags, "\"Ack\": true") |
| 1576 | } |
| 1577 | if self&TcpFlagPsh == TcpFlagPsh { |
| 1578 | flags = append(flags, "\"Psh\": true") |
| 1579 | } |
| 1580 | if self&TcpFlagRst == TcpFlagRst { |
| 1581 | flags = append(flags, "\"Rst\": true") |
| 1582 | } |
| 1583 | if self&TcpFlagSyn == TcpFlagSyn { |
| 1584 | flags = append(flags, "\"Syn\": true") |
| 1585 | } |
| 1586 | if self&TcpFlagFin == TcpFlagFin { |
| 1587 | flags = append(flags, "\"Fin\": true") |
| 1588 | } |
| 1589 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1590 | } |
| 1591 | |
| 1592 | const ( |
| 1593 | // Identifiers from group ofp_type |
| 1594 | OFPTHello = 0 // OFPT_HELLO |
| 1595 | OFPTError = 1 // OFPT_ERROR |
| 1596 | OFPTEchoRequest = 2 // OFPT_ECHO_REQUEST |
| 1597 | OFPTEchoReply = 3 // OFPT_ECHO_REPLY |
| 1598 | OFPTExperimenter = 4 // OFPT_EXPERIMENTER |
| 1599 | OFPTFeaturesRequest = 5 // OFPT_FEATURES_REQUEST |
| 1600 | OFPTFeaturesReply = 6 // OFPT_FEATURES_REPLY |
| 1601 | OFPTGetConfigRequest = 7 // OFPT_GET_CONFIG_REQUEST |
| 1602 | OFPTGetConfigReply = 8 // OFPT_GET_CONFIG_REPLY |
| 1603 | OFPTSetConfig = 9 // OFPT_SET_CONFIG |
| 1604 | OFPTPacketIn = 10 // OFPT_PACKET_IN |
| 1605 | OFPTFlowRemoved = 11 // OFPT_FLOW_REMOVED |
| 1606 | OFPTPortStatus = 12 // OFPT_PORT_STATUS |
| 1607 | OFPTPacketOut = 13 // OFPT_PACKET_OUT |
| 1608 | OFPTFlowMod = 14 // OFPT_FLOW_MOD |
| 1609 | OFPTGroupMod = 15 // OFPT_GROUP_MOD |
| 1610 | OFPTPortMod = 16 // OFPT_PORT_MOD |
| 1611 | OFPTTableMod = 17 // OFPT_TABLE_MOD |
| 1612 | OFPTStatsRequest = 18 // OFPT_STATS_REQUEST |
| 1613 | OFPTStatsReply = 19 // OFPT_STATS_REPLY |
| 1614 | OFPTBarrierRequest = 20 // OFPT_BARRIER_REQUEST |
| 1615 | OFPTBarrierReply = 21 // OFPT_BARRIER_REPLY |
| 1616 | OFPTQueueGetConfigRequest = 22 // OFPT_QUEUE_GET_CONFIG_REQUEST |
| 1617 | OFPTQueueGetConfigReply = 23 // OFPT_QUEUE_GET_CONFIG_REPLY |
| 1618 | ) |
| 1619 | |
| 1620 | type Type uint8 |
| 1621 | |
| 1622 | func (self Type) MarshalJSON() ([]byte, error) { |
| 1623 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1624 | } |
| 1625 | |
| 1626 | func (self Type) String() string { |
| 1627 | switch self { |
| 1628 | case OFPTHello: |
| 1629 | return "hello" |
| 1630 | case OFPTError: |
| 1631 | return "error" |
| 1632 | case OFPTEchoRequest: |
| 1633 | return "echo_request" |
| 1634 | case OFPTEchoReply: |
| 1635 | return "echo_reply" |
| 1636 | case OFPTExperimenter: |
| 1637 | return "experimenter" |
| 1638 | case OFPTFeaturesRequest: |
| 1639 | return "features_request" |
| 1640 | case OFPTFeaturesReply: |
| 1641 | return "features_reply" |
| 1642 | case OFPTGetConfigRequest: |
| 1643 | return "get_config_request" |
| 1644 | case OFPTGetConfigReply: |
| 1645 | return "get_config_reply" |
| 1646 | case OFPTSetConfig: |
| 1647 | return "set_config" |
| 1648 | case OFPTPacketIn: |
| 1649 | return "packet_in" |
| 1650 | case OFPTFlowRemoved: |
| 1651 | return "flow_removed" |
| 1652 | case OFPTPortStatus: |
| 1653 | return "port_status" |
| 1654 | case OFPTPacketOut: |
| 1655 | return "packet_out" |
| 1656 | case OFPTFlowMod: |
| 1657 | return "flow_mod" |
| 1658 | case OFPTGroupMod: |
| 1659 | return "group_mod" |
| 1660 | case OFPTPortMod: |
| 1661 | return "port_mod" |
| 1662 | case OFPTTableMod: |
| 1663 | return "table_mod" |
| 1664 | case OFPTStatsRequest: |
| 1665 | return "stats_request" |
| 1666 | case OFPTStatsReply: |
| 1667 | return "stats_reply" |
| 1668 | case OFPTBarrierRequest: |
| 1669 | return "barrier_request" |
| 1670 | case OFPTBarrierReply: |
| 1671 | return "barrier_reply" |
| 1672 | case OFPTQueueGetConfigRequest: |
| 1673 | return "queue_get_config_request" |
| 1674 | case OFPTQueueGetConfigReply: |
| 1675 | return "queue_get_config_reply" |
| 1676 | default: |
| 1677 | return fmt.Sprintf("%d", self) |
| 1678 | } |
| 1679 | } |
| 1680 | |
| 1681 | const ( |
| 1682 | // Identifiers from group ofp_vlan_id |
| 1683 | OFPVIDAny = 65534 // OFPVID_ANY |
| 1684 | OFPVIDNone = 65535 // OFPVID_NONE |
| 1685 | ) |
| 1686 | |
| 1687 | type VlanId uint16 |
| 1688 | |
| 1689 | func (self VlanId) MarshalJSON() ([]byte, error) { |
| 1690 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1691 | } |