Don Newton | 98fd881 | 2019-09-23 15:15:02 -0400 | [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 of13 |
| 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 | VLANNone = 0 // OFP_VLAN_NONE |
| 26 | FlowPermanent = 0 // OFP_FLOW_PERMANENT |
| 27 | DefaultPriority = 32768 // OFP_DEFAULT_PRIORITY |
| 28 | NoBuffer = 4294967295 // OFP_NO_BUFFER |
| 29 | DescStrLen = 256 // DESC_STR_LEN |
| 30 | SerialNumLen = 32 // SERIAL_NUM_LEN |
| 31 | OFPQAll = 4294967295 // OFPQ_ALL |
| 32 | OFPQMaxRateUncfg = 65535 // OFPQ_MAX_RATE_UNCFG |
| 33 | OFPQMinRateUncfg = 65535 // OFPQ_MIN_RATE_UNCFG |
| 34 | ) |
| 35 | |
| 36 | const ( |
| 37 | // Identifiers from group nx_action_controller2_prop_type |
| 38 | Nxac2PtMaxLen = 0 // NXAC2PT_MAX_LEN |
| 39 | Nxac2PtControllerID = 1 // NXAC2PT_CONTROLLER_ID |
| 40 | Nxac2PtReason = 2 // NXAC2PT_REASON |
| 41 | Nxac2PtUserdata = 3 // NXAC2PT_USERDATA |
| 42 | Nxac2PtPause = 4 // NXAC2PT_PAUSE |
| 43 | Nxac2PtMeterID = 5 // NXAC2PT_METER_ID |
| 44 | ) |
| 45 | |
| 46 | type NxActionController2PropType uint16 |
| 47 | |
| 48 | func (self NxActionController2PropType) MarshalJSON() ([]byte, error) { |
| 49 | return []byte(fmt.Sprintf("%d", self)), nil |
| 50 | } |
| 51 | |
| 52 | const ( |
| 53 | // Identifiers from group nx_bd_algorithms |
| 54 | NxBdAlgActiveBackup = 0 // NX_BD_ALG_ACTIVE_BACKUP |
| 55 | NxBdAlgHrw = 1 // NX_BD_ALG_HRW |
| 56 | ) |
| 57 | |
| 58 | type NxBdAlgorithms uint16 |
| 59 | |
| 60 | func (self NxBdAlgorithms) MarshalJSON() ([]byte, error) { |
| 61 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 62 | } |
| 63 | |
| 64 | func (self NxBdAlgorithms) String() string { |
| 65 | switch self { |
| 66 | case NxBdAlgActiveBackup: |
| 67 | return "active_backup" |
| 68 | case NxBdAlgHrw: |
| 69 | return "hrw" |
| 70 | default: |
| 71 | return fmt.Sprintf("%d", self) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | const ( |
| 76 | // Identifiers from group nx_conntrack_flags |
| 77 | NxCtFCommit = 1 // NX_CT_F_COMMIT |
| 78 | NxCtFForce = 2 // NX_CT_F_FORCE |
| 79 | ) |
| 80 | |
| 81 | type NxConntrackFlags uint16 |
| 82 | |
| 83 | func (self NxConntrackFlags) MarshalJSON() ([]byte, error) { |
| 84 | var flags []string |
| 85 | if self&NxCtFCommit == NxCtFCommit { |
| 86 | flags = append(flags, "\"Commit\": true") |
| 87 | } |
| 88 | if self&NxCtFForce == NxCtFForce { |
| 89 | flags = append(flags, "\"Force\": true") |
| 90 | } |
| 91 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 92 | } |
| 93 | |
| 94 | const ( |
| 95 | // Identifiers from group nx_flow_monitor_flags |
| 96 | NxfmfInitial = 1 // NXFMF_INITIAL |
| 97 | NxfmfAdd = 2 // NXFMF_ADD |
| 98 | NxfmfDelete = 4 // NXFMF_DELETE |
| 99 | NxfmfModify = 8 // NXFMF_MODIFY |
| 100 | NxfmfActions = 16 // NXFMF_ACTIONS |
| 101 | NxfmfOwn = 32 // NXFMF_OWN |
| 102 | ) |
| 103 | |
| 104 | type NxFlowMonitorFlags uint16 |
| 105 | |
| 106 | func (self NxFlowMonitorFlags) MarshalJSON() ([]byte, error) { |
| 107 | var flags []string |
| 108 | if self&NxfmfInitial == NxfmfInitial { |
| 109 | flags = append(flags, "\"Initial\": true") |
| 110 | } |
| 111 | if self&NxfmfAdd == NxfmfAdd { |
| 112 | flags = append(flags, "\"Add\": true") |
| 113 | } |
| 114 | if self&NxfmfDelete == NxfmfDelete { |
| 115 | flags = append(flags, "\"Delete\": true") |
| 116 | } |
| 117 | if self&NxfmfModify == NxfmfModify { |
| 118 | flags = append(flags, "\"Modify\": true") |
| 119 | } |
| 120 | if self&NxfmfActions == NxfmfActions { |
| 121 | flags = append(flags, "\"Actions\": true") |
| 122 | } |
| 123 | if self&NxfmfOwn == NxfmfOwn { |
| 124 | flags = append(flags, "\"Own\": true") |
| 125 | } |
| 126 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 127 | } |
| 128 | |
| 129 | const ( |
| 130 | // Identifiers from group nx_hash_fields |
| 131 | NxHashFieldsEthSrc = 0 // NX_HASH_FIELDS_ETH_SRC |
| 132 | NxHashFieldsSymmetricL4 = 1 // NX_HASH_FIELDS_SYMMETRIC_L4 |
| 133 | NxHashFieldsSymmetricL3L4 = 2 // NX_HASH_FIELDS_SYMMETRIC_L3L4 |
| 134 | NxHashFieldsSymmetricL3L4Udp = 3 // NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP |
| 135 | NxHashFieldsNwSrc = 4 // NX_HASH_FIELDS_NW_SRC |
| 136 | NxHashFieldsNwDst = 5 // NX_HASH_FIELDS_NW_DST |
| 137 | NxHashFieldsSymmetricL3 = 6 // NX_HASH_FIELDS_SYMMETRIC_L3 |
| 138 | ) |
| 139 | |
| 140 | type NxHashFields uint16 |
| 141 | |
| 142 | func (self NxHashFields) MarshalJSON() ([]byte, error) { |
| 143 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 144 | } |
| 145 | |
| 146 | func (self NxHashFields) String() string { |
| 147 | switch self { |
| 148 | case NxHashFieldsEthSrc: |
| 149 | return "eth_src" |
| 150 | case NxHashFieldsSymmetricL4: |
| 151 | return "symmetric_l4" |
| 152 | case NxHashFieldsSymmetricL3L4: |
| 153 | return "symmetric_l3l4" |
| 154 | case NxHashFieldsSymmetricL3L4Udp: |
| 155 | return "symmetric_l3l4_udp" |
| 156 | case NxHashFieldsNwSrc: |
| 157 | return "nw_src" |
| 158 | case NxHashFieldsNwDst: |
| 159 | return "nw_dst" |
| 160 | case NxHashFieldsSymmetricL3: |
| 161 | return "symmetric_l3" |
| 162 | default: |
| 163 | return fmt.Sprintf("%d", self) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | const ( |
| 168 | // Identifiers from group nx_mp_algorithm |
| 169 | NxMpAlgModuloN = 0 // NX_MP_ALG_MODULO_N |
| 170 | NxMpAlgHashThreshold = 1 // NX_MP_ALG_HASH_THRESHOLD |
| 171 | NxMpAlgHrw = 2 // NX_MP_ALG_HRW |
| 172 | NxMpAlgIterHash = 3 // NX_MP_ALG_ITER_HASH |
| 173 | ) |
| 174 | |
| 175 | type NxMpAlgorithm uint16 |
| 176 | |
| 177 | func (self NxMpAlgorithm) MarshalJSON() ([]byte, error) { |
| 178 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 179 | } |
| 180 | |
| 181 | func (self NxMpAlgorithm) String() string { |
| 182 | switch self { |
| 183 | case NxMpAlgModuloN: |
| 184 | return "modulo_n" |
| 185 | case NxMpAlgHashThreshold: |
| 186 | return "hash_threshold" |
| 187 | case NxMpAlgHrw: |
| 188 | return "hrw" |
| 189 | case NxMpAlgIterHash: |
| 190 | return "iter_hash" |
| 191 | default: |
| 192 | return fmt.Sprintf("%d", self) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | const ( |
| 197 | // Identifiers from group of_action_nx_bundle_slave_type |
| 198 | NxmOfInPort = 2 // NXM_OF_IN_PORT |
| 199 | NxmOfJustThereToDefinePrefix = 10000 // NXM_OF_JUST_THERE_TO_DEFINE_PREFIX |
| 200 | ) |
| 201 | |
| 202 | type ActionNxBundleSlaveType uint32 |
| 203 | |
| 204 | func (self ActionNxBundleSlaveType) MarshalJSON() ([]byte, error) { |
| 205 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 206 | } |
| 207 | |
| 208 | func (self ActionNxBundleSlaveType) String() string { |
| 209 | switch self { |
| 210 | case NxmOfInPort: |
| 211 | return "in_port" |
| 212 | case NxmOfJustThereToDefinePrefix: |
| 213 | return "just_there_to_define_prefix" |
| 214 | default: |
| 215 | return fmt.Sprintf("%d", self) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | const ( |
| 220 | // Identifiers from group of_bsn_gentable_error_code |
| 221 | OFBSNGentableErrorUnknown = 0 // OF_BSN_GENTABLE_ERROR_UNKNOWN |
| 222 | OFBSNGentableErrorParam = 1 // OF_BSN_GENTABLE_ERROR_PARAM |
| 223 | OFBSNGentableErrorTableFull = 2 // OF_BSN_GENTABLE_ERROR_TABLE_FULL |
| 224 | ) |
| 225 | |
| 226 | type BsnGentableErrorCode uint16 |
| 227 | |
| 228 | func (self BsnGentableErrorCode) MarshalJSON() ([]byte, error) { |
| 229 | return []byte(fmt.Sprintf("%d", self)), nil |
| 230 | } |
| 231 | |
| 232 | const ( |
| 233 | // Identifiers from group of_bsn_hash_gtp_port_match |
| 234 | OFBSNHashGtpPortMatchSrc = 1 // OF_BSN_HASH_GTP_PORT_MATCH_SRC |
| 235 | OFBSNHashGtpPortMatchDst = 2 // OF_BSN_HASH_GTP_PORT_MATCH_DST |
| 236 | OFBSNHashGtpPortMatchSrcOrDst = 3 // OF_BSN_HASH_GTP_PORT_MATCH_SRC_OR_DST |
| 237 | OFBSNHashGtpPortMatchSrcAndDst = 4 // OF_BSN_HASH_GTP_PORT_MATCH_SRC_AND_DST |
| 238 | ) |
| 239 | |
| 240 | type BsnHashGtpPortMatch uint8 |
| 241 | |
| 242 | func (self BsnHashGtpPortMatch) MarshalJSON() ([]byte, error) { |
| 243 | return []byte(fmt.Sprintf("%d", self)), nil |
| 244 | } |
| 245 | |
| 246 | const ( |
| 247 | // Identifiers from group of_bsn_hash_packet_field |
| 248 | BSNHashFieldDstMAC = 2 // OFP_BSN_HASH_FIELD_DST_MAC |
| 249 | BSNHashFieldSrcMAC = 4 // OFP_BSN_HASH_FIELD_SRC_MAC |
| 250 | BSNHashFieldEthType = 8 // OFP_BSN_HASH_FIELD_ETH_TYPE |
| 251 | BSNHashFieldVLANID = 16 // OFP_BSN_HASH_FIELD_VLAN_ID |
| 252 | BSNHashFieldInnerL2 = 32 // OFP_BSN_HASH_FIELD_INNER_L2 |
| 253 | BSNHashFieldInnerL3 = 64 // OFP_BSN_HASH_FIELD_INNER_L3 |
| 254 | BSNHashFieldSrcIp = 128 // OFP_BSN_HASH_FIELD_SRC_IP |
| 255 | BSNHashFieldDstIp = 256 // OFP_BSN_HASH_FIELD_DST_IP |
| 256 | BSNHashFieldIpProto = 512 // OFP_BSN_HASH_FIELD_IP_PROTO |
| 257 | BSNHashFieldSrcL4Port = 1024 // OFP_BSN_HASH_FIELD_SRC_L4_PORT |
| 258 | BSNHashFieldDstL4Port = 2048 // OFP_BSN_HASH_FIELD_DST_L4_PORT |
| 259 | BSNHashFieldMplsLabel1 = 4096 // OFP_BSN_HASH_FIELD_MPLS_LABEL1 |
| 260 | BSNHashFieldMplsLabel2 = 8192 // OFP_BSN_HASH_FIELD_MPLS_LABEL2 |
| 261 | BSNHashFieldMplsLabel3 = 16384 // OFP_BSN_HASH_FIELD_MPLS_LABEL3 |
| 262 | BSNHashFieldMplsLabelHiBits = 32768 // OFP_BSN_HASH_FIELD_MPLS_LABEL_HI_BITS |
| 263 | BSNHashFieldMplsPayloadSrcIp = 65536 // OFP_BSN_HASH_FIELD_MPLS_PAYLOAD_SRC_IP |
| 264 | BSNHashFieldMplsPayloadDstIp = 131072 // OFP_BSN_HASH_FIELD_MPLS_PAYLOAD_DST_IP |
| 265 | BSNHashFieldSymmetric = 262144 // OFP_BSN_HASH_FIELD_SYMMETRIC |
| 266 | ) |
| 267 | |
| 268 | type BsnHashPacketField uint64 |
| 269 | |
| 270 | func (self BsnHashPacketField) MarshalJSON() ([]byte, error) { |
| 271 | var flags []string |
| 272 | if self&BSNHashFieldDstMAC == BSNHashFieldDstMAC { |
| 273 | flags = append(flags, "\"DstMAC\": true") |
| 274 | } |
| 275 | if self&BSNHashFieldSrcMAC == BSNHashFieldSrcMAC { |
| 276 | flags = append(flags, "\"SrcMAC\": true") |
| 277 | } |
| 278 | if self&BSNHashFieldEthType == BSNHashFieldEthType { |
| 279 | flags = append(flags, "\"EthType\": true") |
| 280 | } |
| 281 | if self&BSNHashFieldVLANID == BSNHashFieldVLANID { |
| 282 | flags = append(flags, "\"VlanID\": true") |
| 283 | } |
| 284 | if self&BSNHashFieldInnerL2 == BSNHashFieldInnerL2 { |
| 285 | flags = append(flags, "\"InnerL2\": true") |
| 286 | } |
| 287 | if self&BSNHashFieldInnerL3 == BSNHashFieldInnerL3 { |
| 288 | flags = append(flags, "\"InnerL3\": true") |
| 289 | } |
| 290 | if self&BSNHashFieldSrcIp == BSNHashFieldSrcIp { |
| 291 | flags = append(flags, "\"SrcIp\": true") |
| 292 | } |
| 293 | if self&BSNHashFieldDstIp == BSNHashFieldDstIp { |
| 294 | flags = append(flags, "\"DstIp\": true") |
| 295 | } |
| 296 | if self&BSNHashFieldIpProto == BSNHashFieldIpProto { |
| 297 | flags = append(flags, "\"IpProto\": true") |
| 298 | } |
| 299 | if self&BSNHashFieldSrcL4Port == BSNHashFieldSrcL4Port { |
| 300 | flags = append(flags, "\"SrcL4Port\": true") |
| 301 | } |
| 302 | if self&BSNHashFieldDstL4Port == BSNHashFieldDstL4Port { |
| 303 | flags = append(flags, "\"DstL4Port\": true") |
| 304 | } |
| 305 | if self&BSNHashFieldMplsLabel1 == BSNHashFieldMplsLabel1 { |
| 306 | flags = append(flags, "\"MplsLabel1\": true") |
| 307 | } |
| 308 | if self&BSNHashFieldMplsLabel2 == BSNHashFieldMplsLabel2 { |
| 309 | flags = append(flags, "\"MplsLabel2\": true") |
| 310 | } |
| 311 | if self&BSNHashFieldMplsLabel3 == BSNHashFieldMplsLabel3 { |
| 312 | flags = append(flags, "\"MplsLabel3\": true") |
| 313 | } |
| 314 | if self&BSNHashFieldMplsLabelHiBits == BSNHashFieldMplsLabelHiBits { |
| 315 | flags = append(flags, "\"MplsLabelHiBits\": true") |
| 316 | } |
| 317 | if self&BSNHashFieldMplsPayloadSrcIp == BSNHashFieldMplsPayloadSrcIp { |
| 318 | flags = append(flags, "\"MplsPayloadSrcIp\": true") |
| 319 | } |
| 320 | if self&BSNHashFieldMplsPayloadDstIp == BSNHashFieldMplsPayloadDstIp { |
| 321 | flags = append(flags, "\"MplsPayloadDstIp\": true") |
| 322 | } |
| 323 | if self&BSNHashFieldSymmetric == BSNHashFieldSymmetric { |
| 324 | flags = append(flags, "\"Symmetric\": true") |
| 325 | } |
| 326 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 327 | } |
| 328 | |
| 329 | const ( |
| 330 | // Identifiers from group of_bsn_hash_packet_type |
| 331 | OFBSNHashPacketL2 = 0 // OF_BSN_HASH_PACKET_L2 |
| 332 | OFBSNHashPacketL2Gre = 1 // OF_BSN_HASH_PACKET_L2GRE |
| 333 | OFBSNHashPacketIpv4 = 3 // OF_BSN_HASH_PACKET_IPV4 |
| 334 | OFBSNHashPacketIpv6 = 4 // OF_BSN_HASH_PACKET_IPV6 |
| 335 | OFBSNHashPacketMpls = 5 // OF_BSN_HASH_PACKET_MPLS |
| 336 | OFBSNHashPacketSymmetric = 6 // OF_BSN_HASH_PACKET_SYMMETRIC |
| 337 | ) |
| 338 | |
| 339 | type BsnHashPacketType uint8 |
| 340 | |
| 341 | func (self BsnHashPacketType) MarshalJSON() ([]byte, error) { |
| 342 | return []byte(fmt.Sprintf("%d", self)), nil |
| 343 | } |
| 344 | |
| 345 | const ( |
| 346 | // Identifiers from group of_bsn_hash_type |
| 347 | BSNHashTypeL2 = 0 // OFP_BSN_HASH_TYPE_L2 |
| 348 | BSNHashTypeL3 = 1 // OFP_BSN_HASH_TYPE_L3 |
| 349 | BSNHashTypeEnhanced = 2 // OFP_BSN_HASH_TYPE_ENHANCED |
| 350 | ) |
| 351 | |
| 352 | type BsnHashType uint8 |
| 353 | |
| 354 | func (self BsnHashType) MarshalJSON() ([]byte, error) { |
| 355 | return []byte(fmt.Sprintf("%d", self)), nil |
| 356 | } |
| 357 | |
| 358 | const ( |
| 359 | // Identifiers from group of_bsn_lacp_convergence_status |
| 360 | LacpSuccess = 0 // LACP_SUCCESS |
| 361 | LacpTimedout = 1 // LACP_TIMEDOUT |
| 362 | LacpOutOfSync = 2 // LACP_OUT_OF_SYNC |
| 363 | ) |
| 364 | |
| 365 | type BsnLacpConvergenceStatus uint8 |
| 366 | |
| 367 | func (self BsnLacpConvergenceStatus) MarshalJSON() ([]byte, error) { |
| 368 | return []byte(fmt.Sprintf("%d", self)), nil |
| 369 | } |
| 370 | |
| 371 | const ( |
| 372 | // Identifiers from group of_bsn_pdu_slot_num |
| 373 | BsnPduSlotNumAny = 255 // BSN_PDU_SLOT_NUM_ANY |
| 374 | ) |
| 375 | |
| 376 | type BsnPduSlotNum uint8 |
| 377 | |
| 378 | func (self BsnPduSlotNum) MarshalJSON() ([]byte, error) { |
| 379 | return []byte(fmt.Sprintf("%d", self)), nil |
| 380 | } |
| 381 | |
| 382 | const ( |
| 383 | // Identifiers from group of_bsn_vlan_counter |
| 384 | BSNVLANCounterRxBytes = 0 // OFP_BSN_VLAN_COUNTER_RX_BYTES |
| 385 | BSNVLANCounterRxPackets = 1 // OFP_BSN_VLAN_COUNTER_RX_PACKETS |
| 386 | BSNVLANCounterTxBytes = 2 // OFP_BSN_VLAN_COUNTER_TX_BYTES |
| 387 | BSNVLANCounterTxPackets = 3 // OFP_BSN_VLAN_COUNTER_TX_PACKETS |
| 388 | ) |
| 389 | |
| 390 | type BsnVlanCounter uint8 |
| 391 | |
| 392 | func (self BsnVlanCounter) MarshalJSON() ([]byte, error) { |
| 393 | return []byte(fmt.Sprintf("%d", self)), nil |
| 394 | } |
| 395 | |
| 396 | const ( |
| 397 | // Identifiers from group of_bsn_vrf_counter |
| 398 | BSNVrfCounterBytes = 0 // OFP_BSN_VRF_COUNTER_BYTES |
| 399 | BSNVrfCounterPackets = 1 // OFP_BSN_VRF_COUNTER_PACKETS |
| 400 | ) |
| 401 | |
| 402 | type BsnVrfCounter uint8 |
| 403 | |
| 404 | func (self BsnVrfCounter) MarshalJSON() ([]byte, error) { |
| 405 | return []byte(fmt.Sprintf("%d", self)), nil |
| 406 | } |
| 407 | |
| 408 | const ( |
| 409 | // Identifiers from group of_nx_nat_range |
| 410 | NxNatRangeIpv4Min = 1 // NX_NAT_RANGE_IPV4_MIN |
| 411 | NxNatRangeIpv4Max = 2 // NX_NAT_RANGE_IPV4_MAX |
| 412 | NxNatRangeIpv6Min = 4 // NX_NAT_RANGE_IPV6_MIN |
| 413 | NxNatRangeIpv6Max = 8 // NX_NAT_RANGE_IPV6_MAX |
| 414 | NxNatRangeProtoMin = 16 // NX_NAT_RANGE_PROTO_MIN |
| 415 | NxNatRangeProtoMax = 32 // NX_NAT_RANGE_PROTO_MAX |
| 416 | ) |
| 417 | |
| 418 | type NxNatRange uint16 |
| 419 | |
| 420 | func (self NxNatRange) MarshalJSON() ([]byte, error) { |
| 421 | var flags []string |
| 422 | if self&NxNatRangeIpv4Min == NxNatRangeIpv4Min { |
| 423 | flags = append(flags, "\"Ipv4Min\": true") |
| 424 | } |
| 425 | if self&NxNatRangeIpv4Max == NxNatRangeIpv4Max { |
| 426 | flags = append(flags, "\"Ipv4Max\": true") |
| 427 | } |
| 428 | if self&NxNatRangeIpv6Min == NxNatRangeIpv6Min { |
| 429 | flags = append(flags, "\"Ipv6Min\": true") |
| 430 | } |
| 431 | if self&NxNatRangeIpv6Max == NxNatRangeIpv6Max { |
| 432 | flags = append(flags, "\"Ipv6Max\": true") |
| 433 | } |
| 434 | if self&NxNatRangeProtoMin == NxNatRangeProtoMin { |
| 435 | flags = append(flags, "\"ProtoMin\": true") |
| 436 | } |
| 437 | if self&NxNatRangeProtoMax == NxNatRangeProtoMax { |
| 438 | flags = append(flags, "\"ProtoMax\": true") |
| 439 | } |
| 440 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 441 | } |
| 442 | |
| 443 | const ( |
| 444 | // Identifiers from group ofp_action_type |
| 445 | OFPATOutput = 0 // OFPAT_OUTPUT |
| 446 | OFPATCopyTtlOut = 11 // OFPAT_COPY_TTL_OUT |
| 447 | OFPATCopyTtlIn = 12 // OFPAT_COPY_TTL_IN |
| 448 | OFPATSetMplsTtl = 15 // OFPAT_SET_MPLS_TTL |
| 449 | OFPATDecMplsTtl = 16 // OFPAT_DEC_MPLS_TTL |
| 450 | OFPATPushVLAN = 17 // OFPAT_PUSH_VLAN |
| 451 | OFPATPopVLAN = 18 // OFPAT_POP_VLAN |
| 452 | OFPATPushMpls = 19 // OFPAT_PUSH_MPLS |
| 453 | OFPATPopMpls = 20 // OFPAT_POP_MPLS |
| 454 | OFPATSetQueue = 21 // OFPAT_SET_QUEUE |
| 455 | OFPATGroup = 22 // OFPAT_GROUP |
| 456 | OFPATSetNwTtl = 23 // OFPAT_SET_NW_TTL |
| 457 | OFPATDecNwTtl = 24 // OFPAT_DEC_NW_TTL |
| 458 | OFPATSetField = 25 // OFPAT_SET_FIELD |
| 459 | OFPATPushPbb = 26 // OFPAT_PUSH_PBB |
| 460 | OFPATPopPbb = 27 // OFPAT_POP_PBB |
| 461 | OFPATExperimenter = 65535 // OFPAT_EXPERIMENTER |
| 462 | ) |
| 463 | |
| 464 | type ActionType uint16 |
| 465 | |
| 466 | func (self ActionType) MarshalJSON() ([]byte, error) { |
| 467 | return []byte(fmt.Sprintf("%d", self)), nil |
| 468 | } |
| 469 | |
| 470 | const ( |
| 471 | // Identifiers from group ofp_bad_action_code |
| 472 | OFPBACBadType = 0 // OFPBAC_BAD_TYPE |
| 473 | OFPBACBadLen = 1 // OFPBAC_BAD_LEN |
| 474 | OFPBACBadExperimenter = 2 // OFPBAC_BAD_EXPERIMENTER |
| 475 | OFPBACBadExperimenterType = 3 // OFPBAC_BAD_EXPERIMENTER_TYPE |
| 476 | OFPBACBadOutPort = 4 // OFPBAC_BAD_OUT_PORT |
| 477 | OFPBACBadArgument = 5 // OFPBAC_BAD_ARGUMENT |
| 478 | OFPBACEperm = 6 // OFPBAC_EPERM |
| 479 | OFPBACTooMany = 7 // OFPBAC_TOO_MANY |
| 480 | OFPBACBadQueue = 8 // OFPBAC_BAD_QUEUE |
| 481 | OFPBACBadOutGroup = 9 // OFPBAC_BAD_OUT_GROUP |
| 482 | OFPBACMatchInconsistent = 10 // OFPBAC_MATCH_INCONSISTENT |
| 483 | OFPBACUnsupportedOrder = 11 // OFPBAC_UNSUPPORTED_ORDER |
| 484 | OFPBACBadTag = 12 // OFPBAC_BAD_TAG |
| 485 | OFPBACBadSetType = 13 // OFPBAC_BAD_SET_TYPE |
| 486 | OFPBACBadSetLen = 14 // OFPBAC_BAD_SET_LEN |
| 487 | OFPBACBadSetArgument = 15 // OFPBAC_BAD_SET_ARGUMENT |
| 488 | ) |
| 489 | |
| 490 | type BadActionCode uint16 |
| 491 | |
| 492 | func (self BadActionCode) MarshalJSON() ([]byte, error) { |
| 493 | return []byte(fmt.Sprintf("%d", self)), nil |
| 494 | } |
| 495 | |
| 496 | const ( |
| 497 | // Identifiers from group ofp_bad_instruction_code |
| 498 | OFPBICUnknownInst = 0 // OFPBIC_UNKNOWN_INST |
| 499 | OFPBICUnsupInst = 1 // OFPBIC_UNSUP_INST |
| 500 | OFPBICBadTableID = 2 // OFPBIC_BAD_TABLE_ID |
| 501 | OFPBICUnsupMetadata = 3 // OFPBIC_UNSUP_METADATA |
| 502 | OFPBICUnsupMetadataMask = 4 // OFPBIC_UNSUP_METADATA_MASK |
| 503 | OFPBICBadExperimenter = 5 // OFPBIC_BAD_EXPERIMENTER |
| 504 | OFPBICBadExperimenterType = 6 // OFPBIC_BAD_EXPERIMENTER_TYPE |
| 505 | OFPBICBadLen = 7 // OFPBIC_BAD_LEN |
| 506 | OFPBICEperm = 8 // OFPBIC_EPERM |
| 507 | ) |
| 508 | |
| 509 | type BadInstructionCode uint16 |
| 510 | |
| 511 | func (self BadInstructionCode) MarshalJSON() ([]byte, error) { |
| 512 | return []byte(fmt.Sprintf("%d", self)), nil |
| 513 | } |
| 514 | |
| 515 | const ( |
| 516 | // Identifiers from group ofp_bad_match_code |
| 517 | OFPBMCBadType = 0 // OFPBMC_BAD_TYPE |
| 518 | OFPBMCBadLen = 1 // OFPBMC_BAD_LEN |
| 519 | OFPBMCBadTag = 2 // OFPBMC_BAD_TAG |
| 520 | OFPBMCBadDlAddrMask = 3 // OFPBMC_BAD_DL_ADDR_MASK |
| 521 | OFPBMCBadNwAddrMask = 4 // OFPBMC_BAD_NW_ADDR_MASK |
| 522 | OFPBMCBadWildcards = 5 // OFPBMC_BAD_WILDCARDS |
| 523 | OFPBMCBadField = 6 // OFPBMC_BAD_FIELD |
| 524 | OFPBMCBadValue = 7 // OFPBMC_BAD_VALUE |
| 525 | OFPBMCBadMask = 8 // OFPBMC_BAD_MASK |
| 526 | OFPBMCBadPrereq = 9 // OFPBMC_BAD_PREREQ |
| 527 | OFPBMCDupField = 10 // OFPBMC_DUP_FIELD |
| 528 | OFPBMCEperm = 11 // OFPBMC_EPERM |
| 529 | ) |
| 530 | |
| 531 | type BadMatchCode uint16 |
| 532 | |
| 533 | func (self BadMatchCode) MarshalJSON() ([]byte, error) { |
| 534 | return []byte(fmt.Sprintf("%d", self)), nil |
| 535 | } |
| 536 | |
| 537 | const ( |
| 538 | // Identifiers from group ofp_bad_request_code |
| 539 | OFPBRCBadVersion = 0 // OFPBRC_BAD_VERSION |
| 540 | OFPBRCBadType = 1 // OFPBRC_BAD_TYPE |
| 541 | OFPBRCBadStat = 2 // OFPBRC_BAD_STAT |
| 542 | OFPBRCBadExperimenter = 3 // OFPBRC_BAD_EXPERIMENTER |
| 543 | OFPBRCBadExperimenterType = 4 // OFPBRC_BAD_EXPERIMENTER_TYPE |
| 544 | OFPBRCEperm = 5 // OFPBRC_EPERM |
| 545 | OFPBRCBadLen = 6 // OFPBRC_BAD_LEN |
| 546 | OFPBRCBufferEmpty = 7 // OFPBRC_BUFFER_EMPTY |
| 547 | OFPBRCBufferUnknown = 8 // OFPBRC_BUFFER_UNKNOWN |
| 548 | OFPBRCBadTableID = 9 // OFPBRC_BAD_TABLE_ID |
| 549 | OFPBRCIsSlave = 10 // OFPBRC_IS_SLAVE |
| 550 | OFPBRCBadPort = 11 // OFPBRC_BAD_PORT |
| 551 | OFPBRCBadPacket = 12 // OFPBRC_BAD_PACKET |
| 552 | OFPBRCMultipartBufferOverflow = 13 // OFPBRC_MULTIPART_BUFFER_OVERFLOW |
| 553 | ) |
| 554 | |
| 555 | type BadRequestCode uint16 |
| 556 | |
| 557 | func (self BadRequestCode) MarshalJSON() ([]byte, error) { |
| 558 | return []byte(fmt.Sprintf("%d", self)), nil |
| 559 | } |
| 560 | |
| 561 | const ( |
| 562 | // Identifiers from group ofp_bsn_anchor |
| 563 | BSNAnchorPacketStart = 0 // OFP_BSN_ANCHOR_PACKET_START |
| 564 | BSNAnchorL3HeaderStart = 1 // OFP_BSN_ANCHOR_L3_HEADER_START |
| 565 | BSNAnchorL4HeaderStart = 2 // OFP_BSN_ANCHOR_L4_HEADER_START |
| 566 | BSNAnchorL4PayloadStart = 3 // OFP_BSN_ANCHOR_L4_PAYLOAD_START |
| 567 | ) |
| 568 | |
| 569 | type BsnAnchor uint16 |
| 570 | |
| 571 | func (self BsnAnchor) MarshalJSON() ([]byte, error) { |
| 572 | return []byte(fmt.Sprintf("%d", self)), nil |
| 573 | } |
| 574 | |
| 575 | const ( |
| 576 | // Identifiers from group ofp_bsn_auto_negotiation_type |
| 577 | BSNAutoNegotiationDefault = 0 // OFP_BSN_AUTO_NEGOTIATION_DEFAULT |
| 578 | BSNAutoNegotiationEnable = 1 // OFP_BSN_AUTO_NEGOTIATION_ENABLE |
| 579 | BSNAutoNegotiationDisable = 2 // OFP_BSN_AUTO_NEGOTIATION_DISABLE |
| 580 | ) |
| 581 | |
| 582 | type BsnAutoNegotiationType uint8 |
| 583 | |
| 584 | func (self BsnAutoNegotiationType) MarshalJSON() ([]byte, error) { |
| 585 | return []byte(fmt.Sprintf("%d", self)), nil |
| 586 | } |
| 587 | |
| 588 | const ( |
| 589 | // Identifiers from group ofp_bsn_bfd_endpoint |
| 590 | BSNBfdUnused = 0 // OFP_BSN_BFD_UNUSED |
| 591 | BSNBfdMicro = 1 // OFP_BSN_BFD_MICRO |
| 592 | BSNBfd1Hop = 2 // OFP_BSN_BFD_1_HOP |
| 593 | BSNBfdMultiHop = 3 // OFP_BSN_BFD_MULTI_HOP |
| 594 | ) |
| 595 | |
| 596 | type BsnBfdEndpoint uint8 |
| 597 | |
| 598 | func (self BsnBfdEndpoint) MarshalJSON() ([]byte, error) { |
| 599 | return []byte(fmt.Sprintf("%d", self)), nil |
| 600 | } |
| 601 | |
| 602 | const ( |
| 603 | // Identifiers from group ofp_bsn_bfd_endpoint_state |
| 604 | BSNBfdEndpointStateAdmindown = 0 // OFP_BSN_BFD_ENDPOINT_STATE_ADMINDOWN |
| 605 | BSNBfdEndpointStateDown = 1 // OFP_BSN_BFD_ENDPOINT_STATE_DOWN |
| 606 | BSNBfdEndpointStateInit = 2 // OFP_BSN_BFD_ENDPOINT_STATE_INIT |
| 607 | BSNBfdEndpointStateUp = 3 // OFP_BSN_BFD_ENDPOINT_STATE_UP |
| 608 | BSNBfdEndpointSessionError = 4 // OFP_BSN_BFD_ENDPOINT_SESSION_ERROR |
| 609 | BSNBfdEndpointRemoteAdmindown = 5 // OFP_BSN_BFD_ENDPOINT_REMOTE_ADMINDOWN |
| 610 | BSNBfdEndpointParamsChange = 6 // OFP_BSN_BFD_ENDPOINT_PARAMS_CHANGE |
| 611 | ) |
| 612 | |
| 613 | type BsnBfdEndpointState uint8 |
| 614 | |
| 615 | func (self BsnBfdEndpointState) MarshalJSON() ([]byte, error) { |
| 616 | return []byte(fmt.Sprintf("%d", self)), nil |
| 617 | } |
| 618 | |
| 619 | const ( |
| 620 | // Identifiers from group ofp_bsn_controller_connection_state |
| 621 | BSNControllerConnectionStateDisconnected = 0 // OFP_BSN_CONTROLLER_CONNECTION_STATE_DISCONNECTED |
| 622 | BSNControllerConnectionStateConnected = 1 // OFP_BSN_CONTROLLER_CONNECTION_STATE_CONNECTED |
| 623 | ) |
| 624 | |
| 625 | type BsnControllerConnectionState uint8 |
| 626 | |
| 627 | func (self BsnControllerConnectionState) MarshalJSON() ([]byte, error) { |
| 628 | return []byte(fmt.Sprintf("%d", self)), nil |
| 629 | } |
| 630 | |
| 631 | const ( |
| 632 | // Identifiers from group ofp_bsn_controller_role_reason |
| 633 | BSNControllerRoleReasonMasterRequest = 0 // OFP_BSN_CONTROLLER_ROLE_REASON_MASTER_REQUEST |
| 634 | BSNControllerRoleReasonConfig = 1 // OFP_BSN_CONTROLLER_ROLE_REASON_CONFIG |
| 635 | BSNControllerRoleReasonExperimenter = 2 // OFP_BSN_CONTROLLER_ROLE_REASON_EXPERIMENTER |
| 636 | ) |
| 637 | |
| 638 | type BsnControllerRoleReason uint8 |
| 639 | |
| 640 | func (self BsnControllerRoleReason) MarshalJSON() ([]byte, error) { |
| 641 | return []byte(fmt.Sprintf("%d", self)), nil |
| 642 | } |
| 643 | |
| 644 | const ( |
| 645 | // Identifiers from group ofp_bsn_decap |
| 646 | BSNDecapVxlan = 0 // OFP_BSN_DECAP_VXLAN |
| 647 | BSNDecapErspan = 1 // OFP_BSN_DECAP_ERSPAN |
| 648 | BSNDecapL2GRE = 2 // OFP_BSN_DECAP_L2_GRE |
| 649 | BSNDecapNvgre = 3 // OFP_BSN_DECAP_NVGRE |
| 650 | BSNDecapCapwap = 4 // OFP_BSN_DECAP_CAPWAP |
| 651 | BSNDecapL2Mpls = 5 // OFP_BSN_DECAP_L2_MPLS |
| 652 | BSNDecapL3GRE = 6 // OFP_BSN_DECAP_L3_GRE |
| 653 | BSNDecapGtp = 7 // OFP_BSN_DECAP_GTP |
| 654 | BSNDecapL3Mpls = 8 // OFP_BSN_DECAP_L3_MPLS |
| 655 | ) |
| 656 | |
| 657 | type BsnDecap uint16 |
| 658 | |
| 659 | func (self BsnDecap) MarshalJSON() ([]byte, error) { |
| 660 | return []byte(fmt.Sprintf("%d", self)), nil |
| 661 | } |
| 662 | |
| 663 | const ( |
| 664 | // Identifiers from group ofp_bsn_encap |
| 665 | BSNEncapUnused = 0 // OFP_BSN_ENCAP_UNUSED |
| 666 | BSNEncapIpv4Udp = 1 // OFP_BSN_ENCAP_IPV4_UDP |
| 667 | BSNEncapIpv6Udp = 2 // OFP_BSN_ENCAP_IPV6_UDP |
| 668 | ) |
| 669 | |
| 670 | type BsnEncap uint8 |
| 671 | |
| 672 | func (self BsnEncap) MarshalJSON() ([]byte, error) { |
| 673 | return []byte(fmt.Sprintf("%d", self)), nil |
| 674 | } |
| 675 | |
| 676 | const ( |
| 677 | // Identifiers from group ofp_bsn_enhanced_hash_type |
| 678 | BSNEnhancedHashL2 = 1 // OFP_BSN_ENHANCED_HASH_L2 |
| 679 | BSNEnhancedHashL3 = 2 // OFP_BSN_ENHANCED_HASH_L3 |
| 680 | BSNEnhancedHashL2Gre = 4 // OFP_BSN_ENHANCED_HASH_L2GRE |
| 681 | BSNEnhancedHashMpls = 8 // OFP_BSN_ENHANCED_HASH_MPLS |
| 682 | BSNEnhancedHashGtp = 16 // OFP_BSN_ENHANCED_HASH_GTP |
| 683 | BSNEnhancedHashSymmetric = 32 // OFP_BSN_ENHANCED_HASH_SYMMETRIC |
| 684 | ) |
| 685 | |
| 686 | type BsnEnhancedHashType uint64 |
| 687 | |
| 688 | func (self BsnEnhancedHashType) MarshalJSON() ([]byte, error) { |
| 689 | var flags []string |
| 690 | if self&BSNEnhancedHashL2 == BSNEnhancedHashL2 { |
| 691 | flags = append(flags, "\"L2\": true") |
| 692 | } |
| 693 | if self&BSNEnhancedHashL3 == BSNEnhancedHashL3 { |
| 694 | flags = append(flags, "\"L3\": true") |
| 695 | } |
| 696 | if self&BSNEnhancedHashL2Gre == BSNEnhancedHashL2Gre { |
| 697 | flags = append(flags, "\"L2Gre\": true") |
| 698 | } |
| 699 | if self&BSNEnhancedHashMpls == BSNEnhancedHashMpls { |
| 700 | flags = append(flags, "\"Mpls\": true") |
| 701 | } |
| 702 | if self&BSNEnhancedHashGtp == BSNEnhancedHashGtp { |
| 703 | flags = append(flags, "\"Gtp\": true") |
| 704 | } |
| 705 | if self&BSNEnhancedHashSymmetric == BSNEnhancedHashSymmetric { |
| 706 | flags = append(flags, "\"Symmetric\": true") |
| 707 | } |
| 708 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 709 | } |
| 710 | |
| 711 | const ( |
| 712 | // Identifiers from group ofp_bsn_fabric_port_role |
| 713 | BSNFabricPortRolePartitionedSpine = 1 // OFP_BSN_FABRIC_PORT_ROLE_PARTITIONED_SPINE |
| 714 | ) |
| 715 | |
| 716 | type BsnFabricPortRole uint16 |
| 717 | |
| 718 | func (self BsnFabricPortRole) MarshalJSON() ([]byte, error) { |
| 719 | return []byte(fmt.Sprintf("%d", self)), nil |
| 720 | } |
| 721 | |
| 722 | const ( |
| 723 | // Identifiers from group ofp_bsn_flow_classifier |
| 724 | BSNFlowClassifierNone = 0 // OFP_BSN_FLOW_CLASSIFIER_NONE |
| 725 | BSNFlowClassifierL2Bc = 1 // OFP_BSN_FLOW_CLASSIFIER_L2BC |
| 726 | BSNFlowClassifierL2Uc = 2 // OFP_BSN_FLOW_CLASSIFIER_L2UC |
| 727 | BSNFlowClassifierL2Unknown = 3 // OFP_BSN_FLOW_CLASSIFIER_L2UNKNOWN |
| 728 | BSNFlowClassifierL2Mcknown = 4 // OFP_BSN_FLOW_CLASSIFIER_L2MCKNOWN |
| 729 | BSNFlowClassifierL2Mcunknown = 5 // OFP_BSN_FLOW_CLASSIFIER_L2MCUNKNOWN |
| 730 | BSNFlowClassifierL3Mcunknown = 6 // OFP_BSN_FLOW_CLASSIFIER_L3MCUNKNOWN |
| 731 | BSNFlowClassifierL3Mcknown = 7 // OFP_BSN_FLOW_CLASSIFIER_L3MCKNOWN |
| 732 | BSNFlowClassifierL3Ucknown = 8 // OFP_BSN_FLOW_CLASSIFIER_L3UCKNOWN |
| 733 | BSNFlowClassifierL3Ucunknown = 9 // OFP_BSN_FLOW_CLASSIFIER_L3UCUNKNOWN |
| 734 | ) |
| 735 | |
| 736 | type BsnFlowClassifier uint16 |
| 737 | |
| 738 | func (self BsnFlowClassifier) MarshalJSON() ([]byte, error) { |
| 739 | return []byte(fmt.Sprintf("%d", self)), nil |
| 740 | } |
| 741 | |
| 742 | const ( |
| 743 | // Identifiers from group ofp_bsn_forward_error_correction_type |
| 744 | BSNForwardErrorCorrectionDefault = 0 // OFP_BSN_FORWARD_ERROR_CORRECTION_DEFAULT |
| 745 | BSNForwardErrorCorrectionEnable = 1 // OFP_BSN_FORWARD_ERROR_CORRECTION_ENABLE |
| 746 | BSNForwardErrorCorrectionDisable = 2 // OFP_BSN_FORWARD_ERROR_CORRECTION_DISABLE |
| 747 | ) |
| 748 | |
| 749 | type BsnForwardErrorCorrectionType uint8 |
| 750 | |
| 751 | func (self BsnForwardErrorCorrectionType) MarshalJSON() ([]byte, error) { |
| 752 | return []byte(fmt.Sprintf("%d", self)), nil |
| 753 | } |
| 754 | |
| 755 | const ( |
| 756 | // Identifiers from group ofp_bsn_hash_algorithm_type |
| 757 | BSNHashAlgorithmCrc16Xor8 = 0 // OFP_BSN_HASH_ALGORITHM_CRC16XOR8 |
| 758 | BSNHashAlgorithmCrc16Xor4 = 1 // OFP_BSN_HASH_ALGORITHM_CRC16XOR4 |
| 759 | BSNHashAlgorithmCrc16Xor2 = 2 // OFP_BSN_HASH_ALGORITHM_CRC16XOR2 |
| 760 | BSNHashAlgorithmCrc16Xor1 = 3 // OFP_BSN_HASH_ALGORITHM_CRC16XOR1 |
| 761 | BSNHashAlgorithmCrc16 = 4 // OFP_BSN_HASH_ALGORITHM_CRC16 |
| 762 | BSNHashAlgorithmXor16 = 5 // OFP_BSN_HASH_ALGORITHM_XOR16 |
| 763 | BSNHashAlgorithmCrc16Ccitt = 6 // OFP_BSN_HASH_ALGORITHM_CRC16CCITT |
| 764 | BSNHashAlgorithmCrc32Lo = 7 // OFP_BSN_HASH_ALGORITHM_CRC32LO |
| 765 | BSNHashAlgorithmCrc32Hi = 8 // OFP_BSN_HASH_ALGORITHM_CRC32HI |
| 766 | ) |
| 767 | |
| 768 | type BsnHashAlgorithmType uint16 |
| 769 | |
| 770 | func (self BsnHashAlgorithmType) MarshalJSON() ([]byte, error) { |
| 771 | return []byte(fmt.Sprintf("%d", self)), nil |
| 772 | } |
| 773 | |
| 774 | const ( |
| 775 | // Identifiers from group ofp_bsn_hash_select_flags |
| 776 | BSNHashSelectSrcIp = 1 // OFP_BSN_HASH_SELECT_SRC_IP |
| 777 | BSNHashSelectDstIp = 2 // OFP_BSN_HASH_SELECT_DST_IP |
| 778 | ) |
| 779 | |
| 780 | type BsnHashSelectFlags uint32 |
| 781 | |
| 782 | func (self BsnHashSelectFlags) MarshalJSON() ([]byte, error) { |
| 783 | var flags []string |
| 784 | if self&BSNHashSelectSrcIp == BSNHashSelectSrcIp { |
| 785 | flags = append(flags, "\"SrcIp\": true") |
| 786 | } |
| 787 | if self&BSNHashSelectDstIp == BSNHashSelectDstIp { |
| 788 | flags = append(flags, "\"DstIp\": true") |
| 789 | } |
| 790 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 791 | } |
| 792 | |
| 793 | const ( |
| 794 | // Identifiers from group ofp_bsn_ip_tunnel_type |
| 795 | BSNIpTunnelTypeNone = 0 // OFP_BSN_IP_TUNNEL_TYPE_NONE |
| 796 | BSNIpTunnelTypePim = 1 // OFP_BSN_IP_TUNNEL_TYPE_PIM |
| 797 | ) |
| 798 | |
| 799 | type BsnIpTunnelType uint16 |
| 800 | |
| 801 | func (self BsnIpTunnelType) MarshalJSON() ([]byte, error) { |
| 802 | return []byte(fmt.Sprintf("%d", self)), nil |
| 803 | } |
| 804 | |
| 805 | const ( |
| 806 | // Identifiers from group ofp_bsn_lacp_state |
| 807 | BSNLacpStateActivity = 1 // OFP_BSN_LACP_STATE_ACTIVITY |
| 808 | BSNLacpStateTimeout = 2 // OFP_BSN_LACP_STATE_TIMEOUT |
| 809 | BSNLacpStateAggregation = 4 // OFP_BSN_LACP_STATE_AGGREGATION |
| 810 | BSNLacpStateSynchronization = 8 // OFP_BSN_LACP_STATE_SYNCHRONIZATION |
| 811 | BSNLacpStateCollecting = 16 // OFP_BSN_LACP_STATE_COLLECTING |
| 812 | BSNLacpStateDistributing = 32 // OFP_BSN_LACP_STATE_DISTRIBUTING |
| 813 | BSNLacpStateDefaulted = 64 // OFP_BSN_LACP_STATE_DEFAULTED |
| 814 | BSNLacpStateExpired = 128 // OFP_BSN_LACP_STATE_EXPIRED |
| 815 | ) |
| 816 | |
| 817 | type BsnLacpState uint8 |
| 818 | |
| 819 | func (self BsnLacpState) MarshalJSON() ([]byte, error) { |
| 820 | var flags []string |
| 821 | if self&BSNLacpStateActivity == BSNLacpStateActivity { |
| 822 | flags = append(flags, "\"Activity\": true") |
| 823 | } |
| 824 | if self&BSNLacpStateTimeout == BSNLacpStateTimeout { |
| 825 | flags = append(flags, "\"Timeout\": true") |
| 826 | } |
| 827 | if self&BSNLacpStateAggregation == BSNLacpStateAggregation { |
| 828 | flags = append(flags, "\"Aggregation\": true") |
| 829 | } |
| 830 | if self&BSNLacpStateSynchronization == BSNLacpStateSynchronization { |
| 831 | flags = append(flags, "\"Synchronization\": true") |
| 832 | } |
| 833 | if self&BSNLacpStateCollecting == BSNLacpStateCollecting { |
| 834 | flags = append(flags, "\"Collecting\": true") |
| 835 | } |
| 836 | if self&BSNLacpStateDistributing == BSNLacpStateDistributing { |
| 837 | flags = append(flags, "\"Distributing\": true") |
| 838 | } |
| 839 | if self&BSNLacpStateDefaulted == BSNLacpStateDefaulted { |
| 840 | flags = append(flags, "\"Defaulted\": true") |
| 841 | } |
| 842 | if self&BSNLacpStateExpired == BSNLacpStateExpired { |
| 843 | flags = append(flags, "\"Expired\": true") |
| 844 | } |
| 845 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 846 | } |
| 847 | |
| 848 | const ( |
| 849 | // Identifiers from group ofp_bsn_lag_flag |
| 850 | BSNLagFlagAutoRecovery = 1 // OFP_BSN_LAG_FLAG_AUTO_RECOVERY |
| 851 | ) |
| 852 | |
| 853 | type BsnLagFlag uint16 |
| 854 | |
| 855 | func (self BsnLagFlag) MarshalJSON() ([]byte, error) { |
| 856 | var flags []string |
| 857 | if self&BSNLagFlagAutoRecovery == BSNLagFlagAutoRecovery { |
| 858 | flags = append(flags, "\"BSNLagFlagAutoRecovery\": true") |
| 859 | } |
| 860 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 861 | } |
| 862 | |
| 863 | const ( |
| 864 | // Identifiers from group ofp_bsn_loglevel |
| 865 | BSNLoglevelMsg = 0 // OFP_BSN_LOGLEVEL_MSG |
| 866 | BSNLoglevelError = 1 // OFP_BSN_LOGLEVEL_ERROR |
| 867 | BSNLoglevelWarn = 2 // OFP_BSN_LOGLEVEL_WARN |
| 868 | BSNLoglevelInfo = 3 // OFP_BSN_LOGLEVEL_INFO |
| 869 | BSNLoglevelVerbose = 4 // OFP_BSN_LOGLEVEL_VERBOSE |
| 870 | BSNLoglevelTrace = 5 // OFP_BSN_LOGLEVEL_TRACE |
| 871 | ) |
| 872 | |
| 873 | type BsnLoglevel uint8 |
| 874 | |
| 875 | func (self BsnLoglevel) MarshalJSON() ([]byte, error) { |
| 876 | return []byte(fmt.Sprintf("%d", self)), nil |
| 877 | } |
| 878 | |
| 879 | const ( |
| 880 | // Identifiers from group ofp_bsn_loopback_mode |
| 881 | BSNLoopbackModeNone = 0 // OFP_BSN_LOOPBACK_MODE_NONE |
| 882 | BSNLoopbackModeMAC = 1 // OFP_BSN_LOOPBACK_MODE_MAC |
| 883 | BSNLoopbackModePhy = 2 // OFP_BSN_LOOPBACK_MODE_PHY |
| 884 | BSNLoopbackModePhyRemote = 3 // OFP_BSN_LOOPBACK_MODE_PHY_REMOTE |
| 885 | ) |
| 886 | |
| 887 | type BsnLoopbackMode uint8 |
| 888 | |
| 889 | func (self BsnLoopbackMode) MarshalJSON() ([]byte, error) { |
| 890 | return []byte(fmt.Sprintf("%d", self)), nil |
| 891 | } |
| 892 | |
| 893 | const ( |
| 894 | // Identifiers from group ofp_bsn_lua_upload_flags |
| 895 | BSNLuaUploadMore = 1 // OFP_BSN_LUA_UPLOAD_MORE |
| 896 | BSNLuaUploadForce = 2 // OFP_BSN_LUA_UPLOAD_FORCE |
| 897 | ) |
| 898 | |
| 899 | type BsnLuaUploadFlags uint16 |
| 900 | |
| 901 | func (self BsnLuaUploadFlags) MarshalJSON() ([]byte, error) { |
| 902 | var flags []string |
| 903 | if self&BSNLuaUploadMore == BSNLuaUploadMore { |
| 904 | flags = append(flags, "\"More\": true") |
| 905 | } |
| 906 | if self&BSNLuaUploadForce == BSNLuaUploadForce { |
| 907 | flags = append(flags, "\"Force\": true") |
| 908 | } |
| 909 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 910 | } |
| 911 | |
| 912 | const ( |
| 913 | // Identifiers from group ofp_bsn_multicast_packet |
| 914 | BSNMulticastPacketNone = 0 // OFP_BSN_MULTICAST_PACKET_NONE |
| 915 | BSNMulticastPacketPimHello = 1 // OFP_BSN_MULTICAST_PACKET_PIM_HELLO |
| 916 | BSNMulticastPacketPimJoinPrune = 2 // OFP_BSN_MULTICAST_PACKET_PIM_JOIN_PRUNE |
| 917 | BSNMulticastPacketPimAssert = 3 // OFP_BSN_MULTICAST_PACKET_PIM_ASSERT |
| 918 | ) |
| 919 | |
| 920 | type BsnMulticastPacket uint16 |
| 921 | |
| 922 | func (self BsnMulticastPacket) MarshalJSON() ([]byte, error) { |
| 923 | return []byte(fmt.Sprintf("%d", self)), nil |
| 924 | } |
| 925 | |
| 926 | const ( |
| 927 | // Identifiers from group ofp_bsn_pktin_flag |
| 928 | BSNPktinFlagPdu = 1 // OFP_BSN_PKTIN_FLAG_PDU |
| 929 | BSNPktinFlagNewHost = 2 // OFP_BSN_PKTIN_FLAG_NEW_HOST |
| 930 | BSNPktinFlagStationMove = 4 // OFP_BSN_PKTIN_FLAG_STATION_MOVE |
| 931 | BSNPktinFlagARP = 8 // OFP_BSN_PKTIN_FLAG_ARP |
| 932 | BSNPktinFlagDhcp = 16 // OFP_BSN_PKTIN_FLAG_DHCP |
| 933 | BSNPktinFlagL2Cpu = 32 // OFP_BSN_PKTIN_FLAG_L2_CPU |
| 934 | BSNPktinFlagDebug = 64 // OFP_BSN_PKTIN_FLAG_DEBUG |
| 935 | BSNPktinFlagTtlExpired = 128 // OFP_BSN_PKTIN_FLAG_TTL_EXPIRED |
| 936 | BSNPktinFlagL3Miss = 256 // OFP_BSN_PKTIN_FLAG_L3_MISS |
| 937 | BSNPktinFlagL3Cpu = 512 // OFP_BSN_PKTIN_FLAG_L3_CPU |
| 938 | BSNPktinFlagIngressAcl = 1024 // OFP_BSN_PKTIN_FLAG_INGRESS_ACL |
| 939 | BSNPktinFlagSflow = 2048 // OFP_BSN_PKTIN_FLAG_SFLOW |
| 940 | BSNPktinFlagARPCache = 4096 // OFP_BSN_PKTIN_FLAG_ARP_CACHE |
| 941 | BSNPktinFlagARPTarget = 8192 // OFP_BSN_PKTIN_FLAG_ARP_TARGET |
| 942 | BSNPktinFlagIgmp = 16384 // OFP_BSN_PKTIN_FLAG_IGMP |
| 943 | BSNPktinFlagPim = 32768 // OFP_BSN_PKTIN_FLAG_PIM |
| 944 | BSNPktinFlagVxlanSipMiss = 65536 // OFP_BSN_PKTIN_FLAG_VXLAN_SIP_MISS |
| 945 | BSNPktinFlagMcReserved = 131072 // OFP_BSN_PKTIN_FLAG_MC_RESERVED |
| 946 | BSNPktinFlagAnalytics = 262144 // OFP_BSN_PKTIN_FLAG_ANALYTICS |
| 947 | BSNPktinFlagIcmpv6 = 524288 // OFP_BSN_PKTIN_FLAG_ICMPV6 |
| 948 | BSNPktinFlagIngressAclLocal = 1048576 // OFP_BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL |
| 949 | BSNPktinFlagIpmcMiss = 2097152 // OFP_BSN_PKTIN_FLAG_IPMC_MISS |
| 950 | BSNPktinFlagIpmcRpfFailed = 4194304 // OFP_BSN_PKTIN_FLAG_IPMC_RPF_FAILED |
| 951 | BSNPktinFlagBfdSlowpath = 8388608 // OFP_BSN_PKTIN_FLAG_BFD_SLOWPATH |
| 952 | ) |
| 953 | |
| 954 | type BsnPktinFlag uint64 |
| 955 | |
| 956 | func (self BsnPktinFlag) MarshalJSON() ([]byte, error) { |
| 957 | var flags []string |
| 958 | if self&BSNPktinFlagPdu == BSNPktinFlagPdu { |
| 959 | flags = append(flags, "\"Pdu\": true") |
| 960 | } |
| 961 | if self&BSNPktinFlagNewHost == BSNPktinFlagNewHost { |
| 962 | flags = append(flags, "\"NewHost\": true") |
| 963 | } |
| 964 | if self&BSNPktinFlagStationMove == BSNPktinFlagStationMove { |
| 965 | flags = append(flags, "\"StationMove\": true") |
| 966 | } |
| 967 | if self&BSNPktinFlagARP == BSNPktinFlagARP { |
| 968 | flags = append(flags, "\"Arp\": true") |
| 969 | } |
| 970 | if self&BSNPktinFlagDhcp == BSNPktinFlagDhcp { |
| 971 | flags = append(flags, "\"Dhcp\": true") |
| 972 | } |
| 973 | if self&BSNPktinFlagL2Cpu == BSNPktinFlagL2Cpu { |
| 974 | flags = append(flags, "\"L2Cpu\": true") |
| 975 | } |
| 976 | if self&BSNPktinFlagDebug == BSNPktinFlagDebug { |
| 977 | flags = append(flags, "\"Debug\": true") |
| 978 | } |
| 979 | if self&BSNPktinFlagTtlExpired == BSNPktinFlagTtlExpired { |
| 980 | flags = append(flags, "\"TtlExpired\": true") |
| 981 | } |
| 982 | if self&BSNPktinFlagL3Miss == BSNPktinFlagL3Miss { |
| 983 | flags = append(flags, "\"L3Miss\": true") |
| 984 | } |
| 985 | if self&BSNPktinFlagL3Cpu == BSNPktinFlagL3Cpu { |
| 986 | flags = append(flags, "\"L3Cpu\": true") |
| 987 | } |
| 988 | if self&BSNPktinFlagIngressAcl == BSNPktinFlagIngressAcl { |
| 989 | flags = append(flags, "\"IngressAcl\": true") |
| 990 | } |
| 991 | if self&BSNPktinFlagSflow == BSNPktinFlagSflow { |
| 992 | flags = append(flags, "\"Sflow\": true") |
| 993 | } |
| 994 | if self&BSNPktinFlagARPCache == BSNPktinFlagARPCache { |
| 995 | flags = append(flags, "\"ArpCache\": true") |
| 996 | } |
| 997 | if self&BSNPktinFlagARPTarget == BSNPktinFlagARPTarget { |
| 998 | flags = append(flags, "\"ArpTarget\": true") |
| 999 | } |
| 1000 | if self&BSNPktinFlagIgmp == BSNPktinFlagIgmp { |
| 1001 | flags = append(flags, "\"Igmp\": true") |
| 1002 | } |
| 1003 | if self&BSNPktinFlagPim == BSNPktinFlagPim { |
| 1004 | flags = append(flags, "\"Pim\": true") |
| 1005 | } |
| 1006 | if self&BSNPktinFlagVxlanSipMiss == BSNPktinFlagVxlanSipMiss { |
| 1007 | flags = append(flags, "\"VxlanSipMiss\": true") |
| 1008 | } |
| 1009 | if self&BSNPktinFlagMcReserved == BSNPktinFlagMcReserved { |
| 1010 | flags = append(flags, "\"McReserved\": true") |
| 1011 | } |
| 1012 | if self&BSNPktinFlagAnalytics == BSNPktinFlagAnalytics { |
| 1013 | flags = append(flags, "\"Analytics\": true") |
| 1014 | } |
| 1015 | if self&BSNPktinFlagIcmpv6 == BSNPktinFlagIcmpv6 { |
| 1016 | flags = append(flags, "\"Icmpv6\": true") |
| 1017 | } |
| 1018 | if self&BSNPktinFlagIngressAclLocal == BSNPktinFlagIngressAclLocal { |
| 1019 | flags = append(flags, "\"IngressAclLocal\": true") |
| 1020 | } |
| 1021 | if self&BSNPktinFlagIpmcMiss == BSNPktinFlagIpmcMiss { |
| 1022 | flags = append(flags, "\"IpmcMiss\": true") |
| 1023 | } |
| 1024 | if self&BSNPktinFlagIpmcRpfFailed == BSNPktinFlagIpmcRpfFailed { |
| 1025 | flags = append(flags, "\"IpmcRpfFailed\": true") |
| 1026 | } |
| 1027 | if self&BSNPktinFlagBfdSlowpath == BSNPktinFlagBfdSlowpath { |
| 1028 | flags = append(flags, "\"BfdSlowpath\": true") |
| 1029 | } |
| 1030 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1031 | } |
| 1032 | |
| 1033 | const ( |
| 1034 | // Identifiers from group ofp_bsn_port_counter |
| 1035 | BSNPortCounterRxBytes = 0 // OFP_BSN_PORT_COUNTER_RX_BYTES |
| 1036 | BSNPortCounterRxPacketsUnicast = 1 // OFP_BSN_PORT_COUNTER_RX_PACKETS_UNICAST |
| 1037 | BSNPortCounterRxPacketsBroadcast = 2 // OFP_BSN_PORT_COUNTER_RX_PACKETS_BROADCAST |
| 1038 | BSNPortCounterRxPacketsMulticast = 3 // OFP_BSN_PORT_COUNTER_RX_PACKETS_MULTICAST |
| 1039 | BSNPortCounterRxDropped = 4 // OFP_BSN_PORT_COUNTER_RX_DROPPED |
| 1040 | BSNPortCounterRxErrors = 5 // OFP_BSN_PORT_COUNTER_RX_ERRORS |
| 1041 | BSNPortCounterTxBytes = 6 // OFP_BSN_PORT_COUNTER_TX_BYTES |
| 1042 | BSNPortCounterTxPacketsUnicast = 7 // OFP_BSN_PORT_COUNTER_TX_PACKETS_UNICAST |
| 1043 | BSNPortCounterTxPacketsBroadcast = 8 // OFP_BSN_PORT_COUNTER_TX_PACKETS_BROADCAST |
| 1044 | BSNPortCounterTxPacketsMulticast = 9 // OFP_BSN_PORT_COUNTER_TX_PACKETS_MULTICAST |
| 1045 | BSNPortCounterTxDropped = 10 // OFP_BSN_PORT_COUNTER_TX_DROPPED |
| 1046 | BSNPortCounterTxErrors = 11 // OFP_BSN_PORT_COUNTER_TX_ERRORS |
| 1047 | BSNPortCounterRxRunts = 12 // OFP_BSN_PORT_COUNTER_RX_RUNTS |
| 1048 | BSNPortCounterRxGiants = 13 // OFP_BSN_PORT_COUNTER_RX_GIANTS |
| 1049 | BSNPortCounterRxCrcErrors = 14 // OFP_BSN_PORT_COUNTER_RX_CRC_ERRORS |
| 1050 | BSNPortCounterRxAlignmentErrors = 15 // OFP_BSN_PORT_COUNTER_RX_ALIGNMENT_ERRORS |
| 1051 | BSNPortCounterRxSymbolErrors = 16 // OFP_BSN_PORT_COUNTER_RX_SYMBOL_ERRORS |
| 1052 | BSNPortCounterRxPauseInput = 17 // OFP_BSN_PORT_COUNTER_RX_PAUSE_INPUT |
| 1053 | BSNPortCounterTxCollisions = 18 // OFP_BSN_PORT_COUNTER_TX_COLLISIONS |
| 1054 | BSNPortCounterTxLateCollisions = 19 // OFP_BSN_PORT_COUNTER_TX_LATE_COLLISIONS |
| 1055 | BSNPortCounterTxDeferred = 20 // OFP_BSN_PORT_COUNTER_TX_DEFERRED |
| 1056 | BSNPortCounterTxPauseOutput = 21 // OFP_BSN_PORT_COUNTER_TX_PAUSE_OUTPUT |
| 1057 | BSNPortCounterRxPackets = 22 // OFP_BSN_PORT_COUNTER_RX_PACKETS |
| 1058 | BSNPortCounterTxPackets = 23 // OFP_BSN_PORT_COUNTER_TX_PACKETS |
| 1059 | BSNPortCounterRxLengthErrors = 24 // OFP_BSN_PORT_COUNTER_RX_LENGTH_ERRORS |
| 1060 | BSNPortCounterRxOverflowErrors = 25 // OFP_BSN_PORT_COUNTER_RX_OVERFLOW_ERRORS |
| 1061 | BSNPortCounterTxCarrierErrors = 26 // OFP_BSN_PORT_COUNTER_TX_CARRIER_ERRORS |
| 1062 | BSNPortCounterRxPacketsBadVLAN = 27 // OFP_BSN_PORT_COUNTER_RX_PACKETS_BAD_VLAN |
| 1063 | BSNPortCounterLinkUp = 28 // OFP_BSN_PORT_COUNTER_LINK_UP |
| 1064 | BSNPortCounterLinkDown = 29 // OFP_BSN_PORT_COUNTER_LINK_DOWN |
| 1065 | BSNPortCounterRxPfcControlFrame = 30 // OFP_BSN_PORT_COUNTER_RX_PFC_CONTROL_FRAME |
| 1066 | BSNPortCounterTxPfcControlFrame = 31 // OFP_BSN_PORT_COUNTER_TX_PFC_CONTROL_FRAME |
| 1067 | BSNPortCounterRxPfcFrameXonPriority0 = 32 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_0 |
| 1068 | BSNPortCounterRxPfcFrameXonPriority1 = 33 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_1 |
| 1069 | BSNPortCounterRxPfcFrameXonPriority2 = 34 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_2 |
| 1070 | BSNPortCounterRxPfcFrameXonPriority3 = 35 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_3 |
| 1071 | BSNPortCounterRxPfcFrameXonPriority4 = 36 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_4 |
| 1072 | BSNPortCounterRxPfcFrameXonPriority5 = 37 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_5 |
| 1073 | BSNPortCounterRxPfcFrameXonPriority6 = 38 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_6 |
| 1074 | BSNPortCounterRxPfcFrameXonPriority7 = 39 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_XON_PRIORITY_7 |
| 1075 | BSNPortCounterRxPfcFramePriority0 = 40 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_0 |
| 1076 | BSNPortCounterRxPfcFramePriority1 = 41 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_1 |
| 1077 | BSNPortCounterRxPfcFramePriority2 = 42 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_2 |
| 1078 | BSNPortCounterRxPfcFramePriority3 = 43 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_3 |
| 1079 | BSNPortCounterRxPfcFramePriority4 = 44 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_4 |
| 1080 | BSNPortCounterRxPfcFramePriority5 = 45 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_5 |
| 1081 | BSNPortCounterRxPfcFramePriority6 = 46 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_6 |
| 1082 | BSNPortCounterRxPfcFramePriority7 = 47 // OFP_BSN_PORT_COUNTER_RX_PFC_FRAME_PRIORITY_7 |
| 1083 | BSNPortCounterTxPfcFramePriority0 = 48 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_0 |
| 1084 | BSNPortCounterTxPfcFramePriority1 = 49 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_1 |
| 1085 | BSNPortCounterTxPfcFramePriority2 = 50 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_2 |
| 1086 | BSNPortCounterTxPfcFramePriority3 = 51 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_3 |
| 1087 | BSNPortCounterTxPfcFramePriority4 = 52 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_4 |
| 1088 | BSNPortCounterTxPfcFramePriority5 = 53 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_5 |
| 1089 | BSNPortCounterTxPfcFramePriority6 = 54 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_6 |
| 1090 | BSNPortCounterTxPfcFramePriority7 = 55 // OFP_BSN_PORT_COUNTER_TX_PFC_FRAME_PRIORITY_7 |
| 1091 | ) |
| 1092 | |
| 1093 | type BsnPortCounter uint8 |
| 1094 | |
| 1095 | func (self BsnPortCounter) MarshalJSON() ([]byte, error) { |
| 1096 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1097 | } |
| 1098 | |
| 1099 | const ( |
| 1100 | // Identifiers from group ofp_bsn_port_mode |
| 1101 | BSNPortModeNone = 0 // OFP_BSN_PORT_MODE_NONE |
| 1102 | BSNPortMode4Xx = 1 // OFP_BSN_PORT_MODE_4XX |
| 1103 | BSNPortMode4X1 = 2 // OFP_BSN_PORT_MODE_4X1 |
| 1104 | BSNPortMode4X10 = 3 // OFP_BSN_PORT_MODE_4X10 |
| 1105 | BSNPortMode4X25 = 4 // OFP_BSN_PORT_MODE_4X25 |
| 1106 | BSNPortMode2X50 = 5 // OFP_BSN_PORT_MODE_2X50 |
| 1107 | BSNPortMode1X1 = 6 // OFP_BSN_PORT_MODE_1X1 |
| 1108 | BSNPortMode1X10 = 7 // OFP_BSN_PORT_MODE_1X10 |
| 1109 | BSNPortMode1X25 = 8 // OFP_BSN_PORT_MODE_1X25 |
| 1110 | BSNPortMode1X40 = 9 // OFP_BSN_PORT_MODE_1X40 |
| 1111 | BSNPortMode1X100 = 10 // OFP_BSN_PORT_MODE_1X100 |
| 1112 | ) |
| 1113 | |
| 1114 | type BsnPortMode uint16 |
| 1115 | |
| 1116 | func (self BsnPortMode) MarshalJSON() ([]byte, error) { |
| 1117 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1118 | } |
| 1119 | |
| 1120 | const ( |
| 1121 | // Identifiers from group ofp_bsn_port_speed_gbps_type |
| 1122 | BSNPortSpeedGbps1 = 1 // OFP_BSN_PORT_SPEED_GBPS_1 |
| 1123 | BSNPortSpeedGbps10 = 10 // OFP_BSN_PORT_SPEED_GBPS_10 |
| 1124 | BSNPortSpeedGbps25 = 25 // OFP_BSN_PORT_SPEED_GBPS_25 |
| 1125 | BSNPortSpeedGbps40 = 40 // OFP_BSN_PORT_SPEED_GBPS_40 |
| 1126 | BSNPortSpeedGbps50 = 50 // OFP_BSN_PORT_SPEED_GBPS_50 |
| 1127 | BSNPortSpeedGbps100 = 100 // OFP_BSN_PORT_SPEED_GBPS_100 |
| 1128 | ) |
| 1129 | |
| 1130 | type BsnPortSpeedGbpsType uint32 |
| 1131 | |
| 1132 | func (self BsnPortSpeedGbpsType) MarshalJSON() ([]byte, error) { |
| 1133 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1134 | } |
| 1135 | |
| 1136 | const ( |
| 1137 | // Identifiers from group ofp_bsn_port_usage |
| 1138 | BSNPortUnused = 0 // OFP_BSN_PORT_UNUSED |
| 1139 | BSNPortTransmitOnly = 1 // OFP_BSN_PORT_TRANSMIT_ONLY |
| 1140 | BSNPortReceiveOnly = 2 // OFP_BSN_PORT_RECEIVE_ONLY |
| 1141 | BSNPortBidirection = 3 // OFP_BSN_PORT_BIDIRECTION |
| 1142 | ) |
| 1143 | |
| 1144 | type BsnPortUsage uint16 |
| 1145 | |
| 1146 | func (self BsnPortUsage) MarshalJSON() ([]byte, error) { |
| 1147 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1148 | } |
| 1149 | |
| 1150 | const ( |
| 1151 | // Identifiers from group ofp_bsn_port_vxlan_mode |
| 1152 | BSNPortVxlanRecirculationEnable = 0 // OFP_BSN_PORT_VXLAN_RECIRCULATION_ENABLE |
| 1153 | BSNPortVxlanTerminationEnable = 1 // OFP_BSN_PORT_VXLAN_TERMINATION_ENABLE |
| 1154 | ) |
| 1155 | |
| 1156 | type BsnPortVxlanMode uint8 |
| 1157 | |
| 1158 | func (self BsnPortVxlanMode) MarshalJSON() ([]byte, error) { |
| 1159 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1160 | } |
| 1161 | |
| 1162 | const ( |
| 1163 | // Identifiers from group ofp_bsn_push_vlan |
| 1164 | BSNPushVLANUntagged = 1 // OFP_BSN_PUSH_VLAN_UNTAGGED |
| 1165 | BSNPushVLANSingleTagged = 2 // OFP_BSN_PUSH_VLAN_SINGLE_TAGGED |
| 1166 | BSNPushVLANDoubleTagged = 4 // OFP_BSN_PUSH_VLAN_DOUBLE_TAGGED |
| 1167 | ) |
| 1168 | |
| 1169 | type BsnPushVlan uint8 |
| 1170 | |
| 1171 | func (self BsnPushVlan) MarshalJSON() ([]byte, error) { |
| 1172 | var flags []string |
| 1173 | if self&BSNPushVLANUntagged == BSNPushVLANUntagged { |
| 1174 | flags = append(flags, "\"Untagged\": true") |
| 1175 | } |
| 1176 | if self&BSNPushVLANSingleTagged == BSNPushVLANSingleTagged { |
| 1177 | flags = append(flags, "\"SingleTagged\": true") |
| 1178 | } |
| 1179 | if self&BSNPushVLANDoubleTagged == BSNPushVLANDoubleTagged { |
| 1180 | flags = append(flags, "\"DoubleTagged\": true") |
| 1181 | } |
| 1182 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1183 | } |
| 1184 | |
| 1185 | const ( |
| 1186 | // Identifiers from group ofp_bsn_rate_unit |
| 1187 | BSNRateUnitPps = 0 // OFP_BSN_RATE_UNIT_PPS |
| 1188 | BSNRateUnitKbitps = 1 // OFP_BSN_RATE_UNIT_KBITPS |
| 1189 | ) |
| 1190 | |
| 1191 | type BsnRateUnit uint8 |
| 1192 | |
| 1193 | func (self BsnRateUnit) MarshalJSON() ([]byte, error) { |
| 1194 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1195 | } |
| 1196 | |
| 1197 | const ( |
| 1198 | // Identifiers from group ofp_bsn_routing_param |
| 1199 | BSNRoutingParamOspfUcast = 1 // OFP_BSN_ROUTING_PARAM_OSPF_UCAST |
| 1200 | BSNRoutingParamOspfMcast = 2 // OFP_BSN_ROUTING_PARAM_OSPF_MCAST |
| 1201 | BSNRoutingParamARPFrr = 3 // OFP_BSN_ROUTING_PARAM_ARP_FRR |
| 1202 | BSNRoutingParamIpv6OspfUcast = 4 // OFP_BSN_ROUTING_PARAM_IPV6_OSPF_UCAST |
| 1203 | BSNRoutingParamIpv6OspfMcast = 5 // OFP_BSN_ROUTING_PARAM_IPV6_OSPF_MCAST |
| 1204 | BSNRoutingParamIpv6NdpFrr = 6 // OFP_BSN_ROUTING_PARAM_IPV6_NDP_FRR |
| 1205 | ) |
| 1206 | |
| 1207 | type BsnRoutingParam uint16 |
| 1208 | |
| 1209 | func (self BsnRoutingParam) MarshalJSON() ([]byte, error) { |
| 1210 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1211 | } |
| 1212 | |
| 1213 | const ( |
| 1214 | // Identifiers from group ofp_bsn_status |
| 1215 | BSNStatusDisable = 0 // OFP_BSN_STATUS_DISABLE |
| 1216 | BSNStatusEnable = 1 // OFP_BSN_STATUS_ENABLE |
| 1217 | ) |
| 1218 | |
| 1219 | type BsnStatus uint8 |
| 1220 | |
| 1221 | func (self BsnStatus) MarshalJSON() ([]byte, error) { |
| 1222 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1223 | } |
| 1224 | |
| 1225 | const ( |
| 1226 | // Identifiers from group ofp_bsn_strip_vlan |
| 1227 | BSNStripVLANFirst = 1 // OFP_BSN_STRIP_VLAN_FIRST |
| 1228 | BSNStripVLANSecond = 2 // OFP_BSN_STRIP_VLAN_SECOND |
| 1229 | BSNStripVLANThird = 4 // OFP_BSN_STRIP_VLAN_THIRD |
| 1230 | ) |
| 1231 | |
| 1232 | type BsnStripVlan uint8 |
| 1233 | |
| 1234 | func (self BsnStripVlan) MarshalJSON() ([]byte, error) { |
| 1235 | var flags []string |
| 1236 | if self&BSNStripVLANFirst == BSNStripVLANFirst { |
| 1237 | flags = append(flags, "\"First\": true") |
| 1238 | } |
| 1239 | if self&BSNStripVLANSecond == BSNStripVLANSecond { |
| 1240 | flags = append(flags, "\"Second\": true") |
| 1241 | } |
| 1242 | if self&BSNStripVLANThird == BSNStripVLANThird { |
| 1243 | flags = append(flags, "\"Third\": true") |
| 1244 | } |
| 1245 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1246 | } |
| 1247 | |
| 1248 | const ( |
| 1249 | // Identifiers from group ofp_bsn_tcp_flag |
| 1250 | BSNTCPFlagFin = 1 // OFP_BSN_TCP_FLAG_FIN |
| 1251 | BSNTCPFlagSyn = 2 // OFP_BSN_TCP_FLAG_SYN |
| 1252 | BSNTCPFlagRst = 4 // OFP_BSN_TCP_FLAG_RST |
| 1253 | BSNTCPFlagPsh = 8 // OFP_BSN_TCP_FLAG_PSH |
| 1254 | BSNTCPFlagAck = 16 // OFP_BSN_TCP_FLAG_ACK |
| 1255 | BSNTCPFlagUrg = 32 // OFP_BSN_TCP_FLAG_URG |
| 1256 | BSNTCPFlagEce = 64 // OFP_BSN_TCP_FLAG_ECE |
| 1257 | BSNTCPFlagCwr = 128 // OFP_BSN_TCP_FLAG_CWR |
| 1258 | BSNTCPFlagNs = 256 // OFP_BSN_TCP_FLAG_NS |
| 1259 | ) |
| 1260 | |
| 1261 | type BsnTcpFlag uint16 |
| 1262 | |
| 1263 | func (self BsnTcpFlag) MarshalJSON() ([]byte, error) { |
| 1264 | var flags []string |
| 1265 | if self&BSNTCPFlagFin == BSNTCPFlagFin { |
| 1266 | flags = append(flags, "\"Fin\": true") |
| 1267 | } |
| 1268 | if self&BSNTCPFlagSyn == BSNTCPFlagSyn { |
| 1269 | flags = append(flags, "\"Syn\": true") |
| 1270 | } |
| 1271 | if self&BSNTCPFlagRst == BSNTCPFlagRst { |
| 1272 | flags = append(flags, "\"Rst\": true") |
| 1273 | } |
| 1274 | if self&BSNTCPFlagPsh == BSNTCPFlagPsh { |
| 1275 | flags = append(flags, "\"Psh\": true") |
| 1276 | } |
| 1277 | if self&BSNTCPFlagAck == BSNTCPFlagAck { |
| 1278 | flags = append(flags, "\"Ack\": true") |
| 1279 | } |
| 1280 | if self&BSNTCPFlagUrg == BSNTCPFlagUrg { |
| 1281 | flags = append(flags, "\"Urg\": true") |
| 1282 | } |
| 1283 | if self&BSNTCPFlagEce == BSNTCPFlagEce { |
| 1284 | flags = append(flags, "\"Ece\": true") |
| 1285 | } |
| 1286 | if self&BSNTCPFlagCwr == BSNTCPFlagCwr { |
| 1287 | flags = append(flags, "\"Cwr\": true") |
| 1288 | } |
| 1289 | if self&BSNTCPFlagNs == BSNTCPFlagNs { |
| 1290 | flags = append(flags, "\"Ns\": true") |
| 1291 | } |
| 1292 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1293 | } |
| 1294 | |
| 1295 | const ( |
| 1296 | // Identifiers from group ofp_bsn_tunnel_type |
| 1297 | BSNTunnelL2Gre = 1 // OFP_BSN_TUNNEL_L2GRE |
| 1298 | ) |
| 1299 | |
| 1300 | type BsnTunnelType uint64 |
| 1301 | |
| 1302 | func (self BsnTunnelType) MarshalJSON() ([]byte, error) { |
| 1303 | var flags []string |
| 1304 | if self&BSNTunnelL2Gre == BSNTunnelL2Gre { |
| 1305 | flags = append(flags, "\"BSNTunnelL2Gre\": true") |
| 1306 | } |
| 1307 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1308 | } |
| 1309 | |
| 1310 | const ( |
| 1311 | // Identifiers from group ofp_bsn_udf_anchor |
| 1312 | BSNUdfAnchorPacketStart = 0 // OFP_BSN_UDF_ANCHOR_PACKET_START |
| 1313 | BSNUdfAnchorL3HeaderStart = 1 // OFP_BSN_UDF_ANCHOR_L3_HEADER_START |
| 1314 | BSNUdfAnchorL4HeaderStart = 2 // OFP_BSN_UDF_ANCHOR_L4_HEADER_START |
| 1315 | ) |
| 1316 | |
| 1317 | type BsnUdfAnchor uint16 |
| 1318 | |
| 1319 | func (self BsnUdfAnchor) MarshalJSON() ([]byte, error) { |
| 1320 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1321 | } |
| 1322 | |
| 1323 | const ( |
| 1324 | // Identifiers from group ofp_bsn_udf_mode |
| 1325 | BSNUdf8X2Bytes = 1 // OFP_BSN_UDF_8X2_BYTES |
| 1326 | ) |
| 1327 | |
| 1328 | type BsnUdfMode uint8 |
| 1329 | |
| 1330 | func (self BsnUdfMode) MarshalJSON() ([]byte, error) { |
| 1331 | var flags []string |
| 1332 | if self&BSNUdf8X2Bytes == BSNUdf8X2Bytes { |
| 1333 | flags = append(flags, "\"BSNUdf8X2Bytes\": true") |
| 1334 | } |
| 1335 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1336 | } |
| 1337 | |
| 1338 | const ( |
| 1339 | // Identifiers from group ofp_bsn_upgrade |
| 1340 | BSNUpgradeInvalid = 0 // OFP_BSN_UPGRADE_INVALID |
| 1341 | BSNUpgradeInProgress = 1 // OFP_BSN_UPGRADE_IN_PROGRESS |
| 1342 | ) |
| 1343 | |
| 1344 | type BsnUpgrade uint16 |
| 1345 | |
| 1346 | func (self BsnUpgrade) MarshalJSON() ([]byte, error) { |
| 1347 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1348 | } |
| 1349 | |
| 1350 | const ( |
| 1351 | // Identifiers from group ofp_bsn_vlan_counter_constants |
| 1352 | BSNVLANAll = 65535 // OFP_BSN_VLAN_ALL |
| 1353 | ) |
| 1354 | |
| 1355 | const ( |
| 1356 | // Identifiers from group ofp_bsn_vport_l2gre_flags |
| 1357 | OFBSNVportL2GreLocalMACIsValid = 1 // OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID |
| 1358 | OFBSNVportL2GreDSCPAssign = 2 // OF_BSN_VPORT_L2GRE_DSCP_ASSIGN |
| 1359 | OFBSNVportL2GreDSCPCopy = 4 // OF_BSN_VPORT_L2GRE_DSCP_COPY |
| 1360 | OFBSNVportL2GreLoopbackIsValid = 8 // OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID |
| 1361 | OFBSNVportL2GreRateLimitIsValid = 16 // OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID |
| 1362 | ) |
| 1363 | |
| 1364 | type BsnVportL2GreFlags uint32 |
| 1365 | |
| 1366 | func (self BsnVportL2GreFlags) MarshalJSON() ([]byte, error) { |
| 1367 | var flags []string |
| 1368 | if self&OFBSNVportL2GreLocalMACIsValid == OFBSNVportL2GreLocalMACIsValid { |
| 1369 | flags = append(flags, "\"LocalMACIsValid\": true") |
| 1370 | } |
| 1371 | if self&OFBSNVportL2GreDSCPAssign == OFBSNVportL2GreDSCPAssign { |
| 1372 | flags = append(flags, "\"DscpAssign\": true") |
| 1373 | } |
| 1374 | if self&OFBSNVportL2GreDSCPCopy == OFBSNVportL2GreDSCPCopy { |
| 1375 | flags = append(flags, "\"DscpCopy\": true") |
| 1376 | } |
| 1377 | if self&OFBSNVportL2GreLoopbackIsValid == OFBSNVportL2GreLoopbackIsValid { |
| 1378 | flags = append(flags, "\"LoopbackIsValid\": true") |
| 1379 | } |
| 1380 | if self&OFBSNVportL2GreRateLimitIsValid == OFBSNVportL2GreRateLimitIsValid { |
| 1381 | flags = append(flags, "\"RateLimitIsValid\": true") |
| 1382 | } |
| 1383 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1384 | } |
| 1385 | |
| 1386 | const ( |
| 1387 | // Identifiers from group ofp_bsn_vport_q_in_q_untagged |
| 1388 | OFBSNVportQInQUntagged = 65535 // OF_BSN_VPORT_Q_IN_Q_UNTAGGED |
| 1389 | ) |
| 1390 | |
| 1391 | type BsnVportQInQUntagged uint16 |
| 1392 | |
| 1393 | func (self BsnVportQInQUntagged) MarshalJSON() ([]byte, error) { |
| 1394 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1395 | } |
| 1396 | |
| 1397 | const ( |
| 1398 | // Identifiers from group ofp_bsn_vport_status |
| 1399 | OFBSNVportStatusOk = 0 // OF_BSN_VPORT_STATUS_OK |
| 1400 | OFBSNVportStatusFailed = 1 // OF_BSN_VPORT_STATUS_FAILED |
| 1401 | ) |
| 1402 | |
| 1403 | const ( |
| 1404 | // Identifiers from group ofp_bsn_vrf_counter_constants |
| 1405 | BSNVrfAll = 4294967295 // OFP_BSN_VRF_ALL |
| 1406 | ) |
| 1407 | |
| 1408 | type BsnVrfCounterConstants uint32 |
| 1409 | |
| 1410 | func (self BsnVrfCounterConstants) MarshalJSON() ([]byte, error) { |
| 1411 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1412 | } |
| 1413 | |
| 1414 | const ( |
| 1415 | // Identifiers from group ofp_capabilities |
| 1416 | OFPCFlowStats = 1 // OFPC_FLOW_STATS |
| 1417 | OFPCTableStats = 2 // OFPC_TABLE_STATS |
| 1418 | OFPCPortStats = 4 // OFPC_PORT_STATS |
| 1419 | OFPCGroupStats = 8 // OFPC_GROUP_STATS |
| 1420 | OFPCIpReasm = 32 // OFPC_IP_REASM |
| 1421 | OFPCQueueStats = 64 // OFPC_QUEUE_STATS |
| 1422 | OFPCPortBlocked = 256 // OFPC_PORT_BLOCKED |
| 1423 | ) |
| 1424 | |
| 1425 | type Capabilities uint32 |
| 1426 | |
| 1427 | func (self Capabilities) MarshalJSON() ([]byte, error) { |
| 1428 | var flags []string |
| 1429 | if self&OFPCFlowStats == OFPCFlowStats { |
| 1430 | flags = append(flags, "\"FlowStats\": true") |
| 1431 | } |
| 1432 | if self&OFPCTableStats == OFPCTableStats { |
| 1433 | flags = append(flags, "\"TableStats\": true") |
| 1434 | } |
| 1435 | if self&OFPCPortStats == OFPCPortStats { |
| 1436 | flags = append(flags, "\"PortStats\": true") |
| 1437 | } |
| 1438 | if self&OFPCGroupStats == OFPCGroupStats { |
| 1439 | flags = append(flags, "\"GroupStats\": true") |
| 1440 | } |
| 1441 | if self&OFPCIpReasm == OFPCIpReasm { |
| 1442 | flags = append(flags, "\"IpReasm\": true") |
| 1443 | } |
| 1444 | if self&OFPCQueueStats == OFPCQueueStats { |
| 1445 | flags = append(flags, "\"QueueStats\": true") |
| 1446 | } |
| 1447 | if self&OFPCPortBlocked == OFPCPortBlocked { |
| 1448 | flags = append(flags, "\"PortBlocked\": true") |
| 1449 | } |
| 1450 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1451 | } |
| 1452 | |
| 1453 | const ( |
| 1454 | // Identifiers from group ofp_config_flags |
| 1455 | OFPCFragNormal = 0 // OFPC_FRAG_NORMAL |
| 1456 | OFPCFragDrop = 1 // OFPC_FRAG_DROP |
| 1457 | OFPCFragReasm = 2 // OFPC_FRAG_REASM |
| 1458 | OFPCFragMask = 3 // OFPC_FRAG_MASK |
| 1459 | ) |
| 1460 | |
| 1461 | type ConfigFlags uint16 |
| 1462 | |
| 1463 | func (self ConfigFlags) MarshalJSON() ([]byte, error) { |
| 1464 | var flags []string |
| 1465 | if self&OFPCFragNormal == OFPCFragNormal { |
| 1466 | flags = append(flags, "\"Normal\": true") |
| 1467 | } |
| 1468 | if self&OFPCFragDrop == OFPCFragDrop { |
| 1469 | flags = append(flags, "\"Drop\": true") |
| 1470 | } |
| 1471 | if self&OFPCFragReasm == OFPCFragReasm { |
| 1472 | flags = append(flags, "\"Reasm\": true") |
| 1473 | } |
| 1474 | if self&OFPCFragMask == OFPCFragMask { |
| 1475 | flags = append(flags, "\"Mask\": true") |
| 1476 | } |
| 1477 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1478 | } |
| 1479 | |
| 1480 | const ( |
| 1481 | // Identifiers from group ofp_controller_max_len |
| 1482 | OFPCMLMax = 65509 // OFPCML_MAX |
| 1483 | OFPCMLNoBuffer = 65535 // OFPCML_NO_BUFFER |
| 1484 | ) |
| 1485 | |
| 1486 | type ControllerMaxLen uint16 |
| 1487 | |
| 1488 | func (self ControllerMaxLen) MarshalJSON() ([]byte, error) { |
| 1489 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1490 | } |
| 1491 | |
| 1492 | const ( |
| 1493 | // Identifiers from group ofp_controller_role |
| 1494 | OFPCRRoleNochange = 0 // OFPCR_ROLE_NOCHANGE |
| 1495 | OFPCRRoleEqual = 1 // OFPCR_ROLE_EQUAL |
| 1496 | OFPCRRoleMaster = 2 // OFPCR_ROLE_MASTER |
| 1497 | OFPCRRoleSlave = 3 // OFPCR_ROLE_SLAVE |
| 1498 | ) |
| 1499 | |
| 1500 | type ControllerRole uint32 |
| 1501 | |
| 1502 | func (self ControllerRole) MarshalJSON() ([]byte, error) { |
| 1503 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1504 | } |
| 1505 | |
| 1506 | const ( |
| 1507 | // Identifiers from group ofp_cs_states |
| 1508 | CsNew = 1 // OFP_CS_NEW |
| 1509 | CsEstablished = 2 // OFP_CS_ESTABLISHED |
| 1510 | CsRelated = 4 // OFP_CS_RELATED |
| 1511 | CsReplyDir = 8 // OFP_CS_REPLY_DIR |
| 1512 | CsInvalid = 16 // OFP_CS_INVALID |
| 1513 | CsTracked = 32 // OFP_CS_TRACKED |
| 1514 | CsSrcNat = 64 // OFP_CS_SRC_NAT |
| 1515 | CsDstNat = 128 // OFP_CS_DST_NAT |
| 1516 | ) |
| 1517 | |
| 1518 | type CsStates uint32 |
| 1519 | |
| 1520 | func (self CsStates) MarshalJSON() ([]byte, error) { |
| 1521 | var flags []string |
| 1522 | if self&CsNew == CsNew { |
| 1523 | flags = append(flags, "\"New\": true") |
| 1524 | } |
| 1525 | if self&CsEstablished == CsEstablished { |
| 1526 | flags = append(flags, "\"Established\": true") |
| 1527 | } |
| 1528 | if self&CsRelated == CsRelated { |
| 1529 | flags = append(flags, "\"Related\": true") |
| 1530 | } |
| 1531 | if self&CsReplyDir == CsReplyDir { |
| 1532 | flags = append(flags, "\"ReplyDir\": true") |
| 1533 | } |
| 1534 | if self&CsInvalid == CsInvalid { |
| 1535 | flags = append(flags, "\"Invalid\": true") |
| 1536 | } |
| 1537 | if self&CsTracked == CsTracked { |
| 1538 | flags = append(flags, "\"Tracked\": true") |
| 1539 | } |
| 1540 | if self&CsSrcNat == CsSrcNat { |
| 1541 | flags = append(flags, "\"SrcNat\": true") |
| 1542 | } |
| 1543 | if self&CsDstNat == CsDstNat { |
| 1544 | flags = append(flags, "\"DstNat\": true") |
| 1545 | } |
| 1546 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1547 | } |
| 1548 | |
| 1549 | const ( |
| 1550 | // Identifiers from group ofp_ed_nsh_prop_type |
| 1551 | OFPPPTPropNshNone = 0 // OFPPPT_PROP_NSH_NONE |
| 1552 | OFPPPTPropNshMdtype = 1 // OFPPPT_PROP_NSH_MDTYPE |
| 1553 | OFPPPTPropNshTlv = 2 // OFPPPT_PROP_NSH_TLV |
| 1554 | ) |
| 1555 | |
| 1556 | type EdNshPropType uint8 |
| 1557 | |
| 1558 | func (self EdNshPropType) MarshalJSON() ([]byte, error) { |
| 1559 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1560 | } |
| 1561 | |
| 1562 | const ( |
| 1563 | // Identifiers from group ofp_ed_prop_class |
| 1564 | OFPPPCBasic = 0 // OFPPPC_BASIC |
| 1565 | OFPPPCMpls = 1 // OFPPPC_MPLS |
| 1566 | OFPPPCGRE = 2 // OFPPPC_GRE |
| 1567 | OFPPPCGtp = 3 // OFPPPC_GTP |
| 1568 | OFPPPCNsh = 4 // OFPPPC_NSH |
| 1569 | OFPPPCExperimenter = 65535 // OFPPPC_EXPERIMENTER |
| 1570 | ) |
| 1571 | |
| 1572 | type EdPropClass uint16 |
| 1573 | |
| 1574 | func (self EdPropClass) MarshalJSON() ([]byte, error) { |
| 1575 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1576 | } |
| 1577 | |
| 1578 | const ( |
| 1579 | // Identifiers from group ofp_error_type |
| 1580 | OFPETHelloFailed = 0 // OFPET_HELLO_FAILED |
| 1581 | OFPETBadRequest = 1 // OFPET_BAD_REQUEST |
| 1582 | OFPETBadAction = 2 // OFPET_BAD_ACTION |
| 1583 | OFPETBadInstruction = 3 // OFPET_BAD_INSTRUCTION |
| 1584 | OFPETBadMatch = 4 // OFPET_BAD_MATCH |
| 1585 | OFPETFlowModFailed = 5 // OFPET_FLOW_MOD_FAILED |
| 1586 | OFPETGroupModFailed = 6 // OFPET_GROUP_MOD_FAILED |
| 1587 | OFPETPortModFailed = 7 // OFPET_PORT_MOD_FAILED |
| 1588 | OFPETTableModFailed = 8 // OFPET_TABLE_MOD_FAILED |
| 1589 | OFPETQueueOpFailed = 9 // OFPET_QUEUE_OP_FAILED |
| 1590 | OFPETSwitchConfigFailed = 10 // OFPET_SWITCH_CONFIG_FAILED |
| 1591 | OFPETRoleRequestFailed = 11 // OFPET_ROLE_REQUEST_FAILED |
| 1592 | OFPETMeterModFailed = 12 // OFPET_METER_MOD_FAILED |
| 1593 | OFPETTableFeaturesFailed = 13 // OFPET_TABLE_FEATURES_FAILED |
| 1594 | OFPETExperimenter = 65535 // OFPET_EXPERIMENTER |
| 1595 | ) |
| 1596 | |
| 1597 | type ErrorType uint16 |
| 1598 | |
| 1599 | func (self ErrorType) MarshalJSON() ([]byte, error) { |
| 1600 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1601 | } |
| 1602 | |
| 1603 | const ( |
| 1604 | // Identifiers from group ofp_ethernet_type |
| 1605 | EthPLoop = 96 // ETH_P_LOOP |
| 1606 | EthPPup = 512 // ETH_P_PUP |
| 1607 | EthPPupat = 513 // ETH_P_PUPAT |
| 1608 | EthPIp = 2048 // ETH_P_IP |
| 1609 | EthPX25 = 2053 // ETH_P_X25 |
| 1610 | EthPARP = 2054 // ETH_P_ARP |
| 1611 | EthPBpq = 2303 // ETH_P_BPQ |
| 1612 | EthPIeeepup = 2560 // ETH_P_IEEEPUP |
| 1613 | EthPIeeepupat = 2561 // ETH_P_IEEEPUPAT |
| 1614 | EthPDec = 24576 // ETH_P_DEC |
| 1615 | EthPDnaDl = 24577 // ETH_P_DNA_DL |
| 1616 | EthPDnaRc = 24578 // ETH_P_DNA_RC |
| 1617 | EthPDnaRt = 24579 // ETH_P_DNA_RT |
| 1618 | EthPLat = 24580 // ETH_P_LAT |
| 1619 | EthPDiag = 24581 // ETH_P_DIAG |
| 1620 | EthPCust = 24582 // ETH_P_CUST |
| 1621 | EthPSca = 24583 // ETH_P_SCA |
| 1622 | EthPTeb = 25944 // ETH_P_TEB |
| 1623 | EthPRarp = 32821 // ETH_P_RARP |
| 1624 | EthPAtalk = 32923 // ETH_P_ATALK |
| 1625 | EthPAarp = 33011 // ETH_P_AARP |
| 1626 | EthP8021Q = 33024 // ETH_P_8021Q |
| 1627 | EthPIpx = 33079 // ETH_P_IPX |
| 1628 | EthPIpv6 = 34525 // ETH_P_IPV6 |
| 1629 | EthPPause = 34824 // ETH_P_PAUSE |
| 1630 | EthPSlow = 34825 // ETH_P_SLOW |
| 1631 | EthPWccp = 34878 // ETH_P_WCCP |
| 1632 | EthPPppDisc = 34915 // ETH_P_PPP_DISC |
| 1633 | EthPPppSes = 34916 // ETH_P_PPP_SES |
| 1634 | EthPMplsUc = 34887 // ETH_P_MPLS_UC |
| 1635 | EthPMplsMc = 34888 // ETH_P_MPLS_MC |
| 1636 | EthPAtmmpoa = 34892 // ETH_P_ATMMPOA |
| 1637 | EthPAtmfate = 34948 // ETH_P_ATMFATE |
| 1638 | EthPPae = 34958 // ETH_P_PAE |
| 1639 | EthPAoe = 34978 // ETH_P_AOE |
| 1640 | EthPTipc = 35018 // ETH_P_TIPC |
| 1641 | EthP1588 = 35063 // ETH_P_1588 |
| 1642 | EthPFcoe = 35078 // ETH_P_FCOE |
| 1643 | EthPFip = 35092 // ETH_P_FIP |
| 1644 | EthPEdsa = 56026 // ETH_P_EDSA |
| 1645 | ) |
| 1646 | |
| 1647 | type EthernetType uint16 |
| 1648 | |
| 1649 | func (self EthernetType) MarshalJSON() ([]byte, error) { |
| 1650 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1651 | } |
| 1652 | |
| 1653 | func (self EthernetType) String() string { |
| 1654 | switch self { |
| 1655 | case EthPLoop: |
| 1656 | return "loop" |
| 1657 | case EthPPup: |
| 1658 | return "pup" |
| 1659 | case EthPPupat: |
| 1660 | return "pupat" |
| 1661 | case EthPIp: |
| 1662 | return "ip" |
| 1663 | case EthPX25: |
| 1664 | return "x25" |
| 1665 | case EthPARP: |
| 1666 | return "arp" |
| 1667 | case EthPBpq: |
| 1668 | return "bpq" |
| 1669 | case EthPIeeepup: |
| 1670 | return "ieeepup" |
| 1671 | case EthPIeeepupat: |
| 1672 | return "ieeepupat" |
| 1673 | case EthPDec: |
| 1674 | return "dec" |
| 1675 | case EthPDnaDl: |
| 1676 | return "dna_dl" |
| 1677 | case EthPDnaRc: |
| 1678 | return "dna_rc" |
| 1679 | case EthPDnaRt: |
| 1680 | return "dna_rt" |
| 1681 | case EthPLat: |
| 1682 | return "lat" |
| 1683 | case EthPDiag: |
| 1684 | return "diag" |
| 1685 | case EthPCust: |
| 1686 | return "cust" |
| 1687 | case EthPSca: |
| 1688 | return "sca" |
| 1689 | case EthPTeb: |
| 1690 | return "teb" |
| 1691 | case EthPRarp: |
| 1692 | return "rarp" |
| 1693 | case EthPAtalk: |
| 1694 | return "atalk" |
| 1695 | case EthPAarp: |
| 1696 | return "aarp" |
| 1697 | case EthP8021Q: |
| 1698 | return "8021q" |
| 1699 | case EthPIpx: |
| 1700 | return "ipx" |
| 1701 | case EthPIpv6: |
| 1702 | return "ipv6" |
| 1703 | case EthPPause: |
| 1704 | return "pause" |
| 1705 | case EthPSlow: |
| 1706 | return "slow" |
| 1707 | case EthPWccp: |
| 1708 | return "wccp" |
| 1709 | case EthPPppDisc: |
| 1710 | return "ppp_disc" |
| 1711 | case EthPPppSes: |
| 1712 | return "ppp_ses" |
| 1713 | case EthPMplsUc: |
| 1714 | return "mpls_uc" |
| 1715 | case EthPMplsMc: |
| 1716 | return "mpls_mc" |
| 1717 | case EthPAtmmpoa: |
| 1718 | return "atmmpoa" |
| 1719 | case EthPAtmfate: |
| 1720 | return "atmfate" |
| 1721 | case EthPPae: |
| 1722 | return "pae" |
| 1723 | case EthPAoe: |
| 1724 | return "aoe" |
| 1725 | case EthPTipc: |
| 1726 | return "tipc" |
| 1727 | case EthP1588: |
| 1728 | return "1588" |
| 1729 | case EthPFcoe: |
| 1730 | return "fcoe" |
| 1731 | case EthPFip: |
| 1732 | return "fip" |
| 1733 | case EthPEdsa: |
| 1734 | return "edsa" |
| 1735 | default: |
| 1736 | return fmt.Sprintf("%d", self) |
| 1737 | } |
| 1738 | } |
| 1739 | |
| 1740 | const ( |
| 1741 | // Identifiers from group ofp_flow_mod_command |
| 1742 | OFPFCAdd = 0 // OFPFC_ADD |
| 1743 | OFPFCModify = 1 // OFPFC_MODIFY |
| 1744 | OFPFCModifyStrict = 2 // OFPFC_MODIFY_STRICT |
| 1745 | OFPFCDelete = 3 // OFPFC_DELETE |
| 1746 | OFPFCDeleteStrict = 4 // OFPFC_DELETE_STRICT |
| 1747 | ) |
| 1748 | |
| 1749 | type FlowModCommand uint8 |
| 1750 | |
| 1751 | func (self FlowModCommand) MarshalJSON() ([]byte, error) { |
| 1752 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1753 | } |
| 1754 | |
| 1755 | const ( |
| 1756 | // Identifiers from group ofp_flow_mod_failed_code |
| 1757 | OFPFMFCUnknown = 0 // OFPFMFC_UNKNOWN |
| 1758 | OFPFMFCTableFull = 1 // OFPFMFC_TABLE_FULL |
| 1759 | OFPFMFCBadTableID = 2 // OFPFMFC_BAD_TABLE_ID |
| 1760 | OFPFMFCOverlap = 3 // OFPFMFC_OVERLAP |
| 1761 | OFPFMFCEperm = 4 // OFPFMFC_EPERM |
| 1762 | OFPFMFCBadTimeout = 5 // OFPFMFC_BAD_TIMEOUT |
| 1763 | OFPFMFCBadCommand = 6 // OFPFMFC_BAD_COMMAND |
| 1764 | OFPFMFCBadFlags = 7 // OFPFMFC_BAD_FLAGS |
| 1765 | ) |
| 1766 | |
| 1767 | type FlowModFailedCode uint16 |
| 1768 | |
| 1769 | func (self FlowModFailedCode) MarshalJSON() ([]byte, error) { |
| 1770 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1771 | } |
| 1772 | |
| 1773 | const ( |
| 1774 | // Identifiers from group ofp_flow_mod_flags |
| 1775 | OFPFFSendFlowRem = 1 // OFPFF_SEND_FLOW_REM |
| 1776 | OFPFFCheckOverlap = 2 // OFPFF_CHECK_OVERLAP |
| 1777 | OFPFFResetCounts = 4 // OFPFF_RESET_COUNTS |
| 1778 | OFPFFNoPktCounts = 8 // OFPFF_NO_PKT_COUNTS |
| 1779 | OFPFFNoBytCounts = 16 // OFPFF_NO_BYT_COUNTS |
| 1780 | OFPFFBSNSendIdle = 128 // OFPFF_BSN_SEND_IDLE |
| 1781 | ) |
| 1782 | |
| 1783 | type FlowModFlags uint16 |
| 1784 | |
| 1785 | func (self FlowModFlags) MarshalJSON() ([]byte, error) { |
| 1786 | var flags []string |
| 1787 | if self&OFPFFSendFlowRem == OFPFFSendFlowRem { |
| 1788 | flags = append(flags, "\"SendFlowRem\": true") |
| 1789 | } |
| 1790 | if self&OFPFFCheckOverlap == OFPFFCheckOverlap { |
| 1791 | flags = append(flags, "\"CheckOverlap\": true") |
| 1792 | } |
| 1793 | if self&OFPFFResetCounts == OFPFFResetCounts { |
| 1794 | flags = append(flags, "\"ResetCounts\": true") |
| 1795 | } |
| 1796 | if self&OFPFFNoPktCounts == OFPFFNoPktCounts { |
| 1797 | flags = append(flags, "\"NoPktCounts\": true") |
| 1798 | } |
| 1799 | if self&OFPFFNoBytCounts == OFPFFNoBytCounts { |
| 1800 | flags = append(flags, "\"NoBytCounts\": true") |
| 1801 | } |
| 1802 | if self&OFPFFBSNSendIdle == OFPFFBSNSendIdle { |
| 1803 | flags = append(flags, "\"BsnSendIdle\": true") |
| 1804 | } |
| 1805 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1806 | } |
| 1807 | |
| 1808 | const ( |
| 1809 | // Identifiers from group ofp_flow_removed_reason |
| 1810 | OFPRRIdleTimeout = 0 // OFPRR_IDLE_TIMEOUT |
| 1811 | OFPRRHardTimeout = 1 // OFPRR_HARD_TIMEOUT |
| 1812 | OFPRRDelete = 2 // OFPRR_DELETE |
| 1813 | OFPRRGroupDelete = 3 // OFPRR_GROUP_DELETE |
| 1814 | ) |
| 1815 | |
| 1816 | type FlowRemovedReason uint8 |
| 1817 | |
| 1818 | func (self FlowRemovedReason) MarshalJSON() ([]byte, error) { |
| 1819 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1820 | } |
| 1821 | |
| 1822 | const ( |
| 1823 | // Identifiers from group ofp_group |
| 1824 | OFPGMax = 4294967040 // OFPG_MAX |
| 1825 | OFPGAll = 4294967292 // OFPG_ALL |
| 1826 | OFPGAny = 4294967295 // OFPG_ANY |
| 1827 | ) |
| 1828 | |
| 1829 | type Group uint32 |
| 1830 | |
| 1831 | func (self Group) MarshalJSON() ([]byte, error) { |
| 1832 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1833 | } |
| 1834 | |
| 1835 | const ( |
| 1836 | // Identifiers from group ofp_group_capabilities |
| 1837 | OFPGFCSelectWeight = 1 // OFPGFC_SELECT_WEIGHT |
| 1838 | OFPGFCSelectLiveness = 2 // OFPGFC_SELECT_LIVENESS |
| 1839 | OFPGFCChaining = 4 // OFPGFC_CHAINING |
| 1840 | OFPGFCChainingChecks = 8 // OFPGFC_CHAINING_CHECKS |
| 1841 | ) |
| 1842 | |
| 1843 | type GroupCapabilities uint32 |
| 1844 | |
| 1845 | func (self GroupCapabilities) MarshalJSON() ([]byte, error) { |
| 1846 | var flags []string |
| 1847 | if self&OFPGFCSelectWeight == OFPGFCSelectWeight { |
| 1848 | flags = append(flags, "\"SelectWeight\": true") |
| 1849 | } |
| 1850 | if self&OFPGFCSelectLiveness == OFPGFCSelectLiveness { |
| 1851 | flags = append(flags, "\"SelectLiveness\": true") |
| 1852 | } |
| 1853 | if self&OFPGFCChaining == OFPGFCChaining { |
| 1854 | flags = append(flags, "\"Chaining\": true") |
| 1855 | } |
| 1856 | if self&OFPGFCChainingChecks == OFPGFCChainingChecks { |
| 1857 | flags = append(flags, "\"ChainingChecks\": true") |
| 1858 | } |
| 1859 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 1860 | } |
| 1861 | |
| 1862 | const ( |
| 1863 | // Identifiers from group ofp_group_mod_command |
| 1864 | OFPGCAdd = 0 // OFPGC_ADD |
| 1865 | OFPGCModify = 1 // OFPGC_MODIFY |
| 1866 | OFPGCDelete = 2 // OFPGC_DELETE |
| 1867 | ) |
| 1868 | |
| 1869 | type GroupModCommand uint16 |
| 1870 | |
| 1871 | func (self GroupModCommand) MarshalJSON() ([]byte, error) { |
| 1872 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1873 | } |
| 1874 | |
| 1875 | const ( |
| 1876 | // Identifiers from group ofp_group_mod_failed_code |
| 1877 | OFPGMFCGroupExists = 0 // OFPGMFC_GROUP_EXISTS |
| 1878 | OFPGMFCInvalidGroup = 1 // OFPGMFC_INVALID_GROUP |
| 1879 | OFPGMFCWeightUnsupported = 2 // OFPGMFC_WEIGHT_UNSUPPORTED |
| 1880 | OFPGMFCOutOfGroups = 3 // OFPGMFC_OUT_OF_GROUPS |
| 1881 | OFPGMFCOutOfBuckets = 4 // OFPGMFC_OUT_OF_BUCKETS |
| 1882 | OFPGMFCChainingUnsupported = 5 // OFPGMFC_CHAINING_UNSUPPORTED |
| 1883 | OFPGMFCWatchUnsupported = 6 // OFPGMFC_WATCH_UNSUPPORTED |
| 1884 | OFPGMFCLoop = 7 // OFPGMFC_LOOP |
| 1885 | OFPGMFCUnknownGroup = 8 // OFPGMFC_UNKNOWN_GROUP |
| 1886 | OFPGMFCChainedGroup = 9 // OFPGMFC_CHAINED_GROUP |
| 1887 | OFPGMFCBadType = 10 // OFPGMFC_BAD_TYPE |
| 1888 | OFPGMFCBadCommand = 11 // OFPGMFC_BAD_COMMAND |
| 1889 | OFPGMFCBadBucket = 12 // OFPGMFC_BAD_BUCKET |
| 1890 | OFPGMFCBadWatch = 13 // OFPGMFC_BAD_WATCH |
| 1891 | OFPGMFCEperm = 14 // OFPGMFC_EPERM |
| 1892 | ) |
| 1893 | |
| 1894 | type GroupModFailedCode uint16 |
| 1895 | |
| 1896 | func (self GroupModFailedCode) MarshalJSON() ([]byte, error) { |
| 1897 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1898 | } |
| 1899 | |
| 1900 | const ( |
| 1901 | // Identifiers from group ofp_group_type |
| 1902 | OFPGTAll = 0 // OFPGT_ALL |
| 1903 | OFPGTSelect = 1 // OFPGT_SELECT |
| 1904 | OFPGTIndirect = 2 // OFPGT_INDIRECT |
| 1905 | OFPGTFf = 3 // OFPGT_FF |
| 1906 | ) |
| 1907 | |
| 1908 | type GroupType uint8 |
| 1909 | |
| 1910 | func (self GroupType) MarshalJSON() ([]byte, error) { |
| 1911 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1912 | } |
| 1913 | |
| 1914 | func (self GroupType) String() string { |
| 1915 | switch self { |
| 1916 | case OFPGTAll: |
| 1917 | return "all" |
| 1918 | case OFPGTSelect: |
| 1919 | return "select" |
| 1920 | case OFPGTIndirect: |
| 1921 | return "indirect" |
| 1922 | case OFPGTFf: |
| 1923 | return "ff" |
| 1924 | default: |
| 1925 | return fmt.Sprintf("%d", self) |
| 1926 | } |
| 1927 | } |
| 1928 | |
| 1929 | const ( |
| 1930 | // Identifiers from group ofp_hello_elem_type |
| 1931 | OFPHETVersionbitmap = 1 // OFPHET_VERSIONBITMAP |
| 1932 | ) |
| 1933 | |
| 1934 | type HelloElemType uint16 |
| 1935 | |
| 1936 | func (self HelloElemType) MarshalJSON() ([]byte, error) { |
| 1937 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1938 | } |
| 1939 | |
| 1940 | const ( |
| 1941 | // Identifiers from group ofp_hello_failed_code |
| 1942 | OFPHFCIncompatible = 0 // OFPHFC_INCOMPATIBLE |
| 1943 | OFPHFCEperm = 1 // OFPHFC_EPERM |
| 1944 | ) |
| 1945 | |
| 1946 | type HelloFailedCode uint16 |
| 1947 | |
| 1948 | func (self HelloFailedCode) MarshalJSON() ([]byte, error) { |
| 1949 | return []byte(fmt.Sprintf("%d", self)), nil |
| 1950 | } |
| 1951 | |
| 1952 | const ( |
| 1953 | // Identifiers from group ofp_icmp_type |
| 1954 | IcmpEchoreply = 0 // ICMP_ECHOREPLY |
| 1955 | IcmpDestUnreach = 3 // ICMP_DEST_UNREACH |
| 1956 | IcmpSourceQuench = 4 // ICMP_SOURCE_QUENCH |
| 1957 | IcmpRedirect = 5 // ICMP_REDIRECT |
| 1958 | IcmpEcho = 8 // ICMP_ECHO |
| 1959 | IcmpTimeExceeded = 11 // ICMP_TIME_EXCEEDED |
| 1960 | IcmpParameterprob = 12 // ICMP_PARAMETERPROB |
| 1961 | IcmpTimestamp = 13 // ICMP_TIMESTAMP |
| 1962 | IcmpTimestampreply = 14 // ICMP_TIMESTAMPREPLY |
| 1963 | IcmpInfoRequest = 15 // ICMP_INFO_REQUEST |
| 1964 | IcmpInfoReply = 16 // ICMP_INFO_REPLY |
| 1965 | IcmpAddress = 17 // ICMP_ADDRESS |
| 1966 | IcmpAddressreply = 18 // ICMP_ADDRESSREPLY |
| 1967 | ) |
| 1968 | |
| 1969 | type IcmpType uint8 |
| 1970 | |
| 1971 | func (self IcmpType) MarshalJSON() ([]byte, error) { |
| 1972 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 1973 | } |
| 1974 | |
| 1975 | func (self IcmpType) String() string { |
| 1976 | switch self { |
| 1977 | case IcmpEchoreply: |
| 1978 | return "echoreply" |
| 1979 | case IcmpDestUnreach: |
| 1980 | return "dest_unreach" |
| 1981 | case IcmpSourceQuench: |
| 1982 | return "source_quench" |
| 1983 | case IcmpRedirect: |
| 1984 | return "redirect" |
| 1985 | case IcmpEcho: |
| 1986 | return "echo" |
| 1987 | case IcmpTimeExceeded: |
| 1988 | return "time_exceeded" |
| 1989 | case IcmpParameterprob: |
| 1990 | return "parameterprob" |
| 1991 | case IcmpTimestamp: |
| 1992 | return "timestamp" |
| 1993 | case IcmpTimestampreply: |
| 1994 | return "timestampreply" |
| 1995 | case IcmpInfoRequest: |
| 1996 | return "info_request" |
| 1997 | case IcmpInfoReply: |
| 1998 | return "info_reply" |
| 1999 | case IcmpAddress: |
| 2000 | return "address" |
| 2001 | case IcmpAddressreply: |
| 2002 | return "addressreply" |
| 2003 | default: |
| 2004 | return fmt.Sprintf("%d", self) |
| 2005 | } |
| 2006 | } |
| 2007 | |
| 2008 | const ( |
| 2009 | // Identifiers from group ofp_icmpv6_type |
| 2010 | Icmpv6EchoRequest = 128 // ICMPV6_ECHO_REQUEST |
| 2011 | Icmpv6EchoReply = 129 // ICMPV6_ECHO_REPLY |
| 2012 | Icmpv6MgmQuery = 130 // ICMPV6_MGM_QUERY |
| 2013 | Icmpv6MgmReport = 131 // ICMPV6_MGM_REPORT |
| 2014 | Icmpv6MgmReduction = 132 // ICMPV6_MGM_REDUCTION |
| 2015 | Icmpv6NiQuery = 139 // ICMPV6_NI_QUERY |
| 2016 | Icmpv6NiReply = 140 // ICMPV6_NI_REPLY |
| 2017 | Icmpv6Mld2Report = 143 // ICMPV6_MLD2_REPORT |
| 2018 | Icmpv6DhaadRequest = 144 // ICMPV6_DHAAD_REQUEST |
| 2019 | Icmpv6DhaadReply = 145 // ICMPV6_DHAAD_REPLY |
| 2020 | Icmpv6MobilePrefixSol = 146 // ICMPV6_MOBILE_PREFIX_SOL |
| 2021 | Icmpv6MobilePrefixAdv = 147 // ICMPV6_MOBILE_PREFIX_ADV |
| 2022 | ) |
| 2023 | |
| 2024 | type Icmpv6Type uint8 |
| 2025 | |
| 2026 | func (self Icmpv6Type) MarshalJSON() ([]byte, error) { |
| 2027 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 2028 | } |
| 2029 | |
| 2030 | func (self Icmpv6Type) String() string { |
| 2031 | switch self { |
| 2032 | case Icmpv6EchoRequest: |
| 2033 | return "echo_request" |
| 2034 | case Icmpv6EchoReply: |
| 2035 | return "echo_reply" |
| 2036 | case Icmpv6MgmQuery: |
| 2037 | return "mgm_query" |
| 2038 | case Icmpv6MgmReport: |
| 2039 | return "mgm_report" |
| 2040 | case Icmpv6MgmReduction: |
| 2041 | return "mgm_reduction" |
| 2042 | case Icmpv6NiQuery: |
| 2043 | return "ni_query" |
| 2044 | case Icmpv6NiReply: |
| 2045 | return "ni_reply" |
| 2046 | case Icmpv6Mld2Report: |
| 2047 | return "mld2_report" |
| 2048 | case Icmpv6DhaadRequest: |
| 2049 | return "dhaad_request" |
| 2050 | case Icmpv6DhaadReply: |
| 2051 | return "dhaad_reply" |
| 2052 | case Icmpv6MobilePrefixSol: |
| 2053 | return "mobile_prefix_sol" |
| 2054 | case Icmpv6MobilePrefixAdv: |
| 2055 | return "mobile_prefix_adv" |
| 2056 | default: |
| 2057 | return fmt.Sprintf("%d", self) |
| 2058 | } |
| 2059 | } |
| 2060 | |
| 2061 | const ( |
| 2062 | // Identifiers from group ofp_instruction_type |
| 2063 | OFPITGotoTable = 1 // OFPIT_GOTO_TABLE |
| 2064 | OFPITWriteMetadata = 2 // OFPIT_WRITE_METADATA |
| 2065 | OFPITWriteActions = 3 // OFPIT_WRITE_ACTIONS |
| 2066 | OFPITApplyActions = 4 // OFPIT_APPLY_ACTIONS |
| 2067 | OFPITClearActions = 5 // OFPIT_CLEAR_ACTIONS |
| 2068 | OFPITMeter = 6 // OFPIT_METER |
| 2069 | OFPITExperimenter = 65535 // OFPIT_EXPERIMENTER |
| 2070 | ) |
| 2071 | |
| 2072 | type InstructionType uint16 |
| 2073 | |
| 2074 | func (self InstructionType) MarshalJSON() ([]byte, error) { |
| 2075 | var flags []string |
| 2076 | if self&OFPITGotoTable == OFPITGotoTable { |
| 2077 | flags = append(flags, "\"GotoTable\": true") |
| 2078 | } |
| 2079 | if self&OFPITWriteMetadata == OFPITWriteMetadata { |
| 2080 | flags = append(flags, "\"WriteMetadata\": true") |
| 2081 | } |
| 2082 | if self&OFPITWriteActions == OFPITWriteActions { |
| 2083 | flags = append(flags, "\"WriteActions\": true") |
| 2084 | } |
| 2085 | if self&OFPITApplyActions == OFPITApplyActions { |
| 2086 | flags = append(flags, "\"ApplyActions\": true") |
| 2087 | } |
| 2088 | if self&OFPITClearActions == OFPITClearActions { |
| 2089 | flags = append(flags, "\"ClearActions\": true") |
| 2090 | } |
| 2091 | if self&OFPITMeter == OFPITMeter { |
| 2092 | flags = append(flags, "\"Meter\": true") |
| 2093 | } |
| 2094 | if self&OFPITExperimenter == OFPITExperimenter { |
| 2095 | flags = append(flags, "\"Experimenter\": true") |
| 2096 | } |
| 2097 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2098 | } |
| 2099 | |
| 2100 | const ( |
| 2101 | // Identifiers from group ofp_ip_prototype |
| 2102 | IpprotoIp = 0 // IPPROTO_IP |
| 2103 | IpprotoICMP = 1 // IPPROTO_ICMP |
| 2104 | IpprotoIgmp = 2 // IPPROTO_IGMP |
| 2105 | IpprotoIpip = 4 // IPPROTO_IPIP |
| 2106 | IpprotoTCP = 6 // IPPROTO_TCP |
| 2107 | IpprotoEgp = 8 // IPPROTO_EGP |
| 2108 | IpprotoPup = 12 // IPPROTO_PUP |
| 2109 | IpprotoUdp = 17 // IPPROTO_UDP |
| 2110 | IpprotoIdp = 22 // IPPROTO_IDP |
| 2111 | IpprotoTp = 29 // IPPROTO_TP |
| 2112 | IpprotoDccp = 33 // IPPROTO_DCCP |
| 2113 | IpprotoIpv6 = 41 // IPPROTO_IPV6 |
| 2114 | IpprotoRsvp = 46 // IPPROTO_RSVP |
| 2115 | IpprotoGRE = 47 // IPPROTO_GRE |
| 2116 | IpprotoEsp = 50 // IPPROTO_ESP |
| 2117 | IpprotoAh = 51 // IPPROTO_AH |
| 2118 | IpprotoMtp = 92 // IPPROTO_MTP |
| 2119 | IpprotoBeetph = 94 // IPPROTO_BEETPH |
| 2120 | IpprotoEncap = 98 // IPPROTO_ENCAP |
| 2121 | IpprotoPim = 103 // IPPROTO_PIM |
| 2122 | IpprotoComp = 108 // IPPROTO_COMP |
| 2123 | IpprotoSctp = 132 // IPPROTO_SCTP |
| 2124 | IpprotoUdplite = 136 // IPPROTO_UDPLITE |
| 2125 | IpprotoMpls = 137 // IPPROTO_MPLS |
| 2126 | IpprotoRaw = 255 // IPPROTO_RAW |
| 2127 | IpprotoRouting = 43 // IPPROTO_ROUTING |
| 2128 | IpprotoFragment = 44 // IPPROTO_FRAGMENT |
| 2129 | IpprotoIcmpv6 = 58 // IPPROTO_ICMPV6 |
| 2130 | IpprotoNone = 59 // IPPROTO_NONE |
| 2131 | IpprotoDstopts = 60 // IPPROTO_DSTOPTS |
| 2132 | IpprotoMh = 135 // IPPROTO_MH |
| 2133 | IpprotoL2Tp = 115 // IPPROTO_L2TP |
| 2134 | ) |
| 2135 | |
| 2136 | type IpPrototype uint8 |
| 2137 | |
| 2138 | func (self IpPrototype) MarshalJSON() ([]byte, error) { |
| 2139 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 2140 | } |
| 2141 | |
| 2142 | func (self IpPrototype) String() string { |
| 2143 | switch self { |
| 2144 | case IpprotoIp: |
| 2145 | return "ip" |
| 2146 | case IpprotoICMP: |
| 2147 | return "icmp" |
| 2148 | case IpprotoIgmp: |
| 2149 | return "igmp" |
| 2150 | case IpprotoIpip: |
| 2151 | return "ipip" |
| 2152 | case IpprotoTCP: |
| 2153 | return "tcp" |
| 2154 | case IpprotoEgp: |
| 2155 | return "egp" |
| 2156 | case IpprotoPup: |
| 2157 | return "pup" |
| 2158 | case IpprotoUdp: |
| 2159 | return "udp" |
| 2160 | case IpprotoIdp: |
| 2161 | return "idp" |
| 2162 | case IpprotoTp: |
| 2163 | return "tp" |
| 2164 | case IpprotoDccp: |
| 2165 | return "dccp" |
| 2166 | case IpprotoIpv6: |
| 2167 | return "ipv6" |
| 2168 | case IpprotoRsvp: |
| 2169 | return "rsvp" |
| 2170 | case IpprotoGRE: |
| 2171 | return "gre" |
| 2172 | case IpprotoEsp: |
| 2173 | return "esp" |
| 2174 | case IpprotoAh: |
| 2175 | return "ah" |
| 2176 | case IpprotoMtp: |
| 2177 | return "mtp" |
| 2178 | case IpprotoBeetph: |
| 2179 | return "beetph" |
| 2180 | case IpprotoEncap: |
| 2181 | return "encap" |
| 2182 | case IpprotoPim: |
| 2183 | return "pim" |
| 2184 | case IpprotoComp: |
| 2185 | return "comp" |
| 2186 | case IpprotoSctp: |
| 2187 | return "sctp" |
| 2188 | case IpprotoUdplite: |
| 2189 | return "udplite" |
| 2190 | case IpprotoMpls: |
| 2191 | return "mpls" |
| 2192 | case IpprotoRaw: |
| 2193 | return "raw" |
| 2194 | case IpprotoRouting: |
| 2195 | return "routing" |
| 2196 | case IpprotoFragment: |
| 2197 | return "fragment" |
| 2198 | case IpprotoIcmpv6: |
| 2199 | return "icmpv6" |
| 2200 | case IpprotoNone: |
| 2201 | return "none" |
| 2202 | case IpprotoDstopts: |
| 2203 | return "dstopts" |
| 2204 | case IpprotoMh: |
| 2205 | return "mh" |
| 2206 | case IpprotoL2Tp: |
| 2207 | return "l2tp" |
| 2208 | default: |
| 2209 | return fmt.Sprintf("%d", self) |
| 2210 | } |
| 2211 | } |
| 2212 | |
| 2213 | const ( |
| 2214 | // Identifiers from group ofp_ipv6exthdr_flags |
| 2215 | OFPIEHNonext = 1 // OFPIEH_NONEXT |
| 2216 | OFPIEHEsp = 2 // OFPIEH_ESP |
| 2217 | OFPIEHAuth = 4 // OFPIEH_AUTH |
| 2218 | OFPIEHDest = 8 // OFPIEH_DEST |
| 2219 | OFPIEHFrag = 16 // OFPIEH_FRAG |
| 2220 | OFPIEHRouter = 32 // OFPIEH_ROUTER |
| 2221 | OFPIEHHop = 64 // OFPIEH_HOP |
| 2222 | OFPIEHUnrep = 128 // OFPIEH_UNREP |
| 2223 | OFPIEHUnseq = 256 // OFPIEH_UNSEQ |
| 2224 | ) |
| 2225 | |
| 2226 | type Ipv6ExthdrFlags uint16 |
| 2227 | |
| 2228 | func (self Ipv6ExthdrFlags) MarshalJSON() ([]byte, error) { |
| 2229 | var flags []string |
| 2230 | if self&OFPIEHNonext == OFPIEHNonext { |
| 2231 | flags = append(flags, "\"Nonext\": true") |
| 2232 | } |
| 2233 | if self&OFPIEHEsp == OFPIEHEsp { |
| 2234 | flags = append(flags, "\"Esp\": true") |
| 2235 | } |
| 2236 | if self&OFPIEHAuth == OFPIEHAuth { |
| 2237 | flags = append(flags, "\"Auth\": true") |
| 2238 | } |
| 2239 | if self&OFPIEHDest == OFPIEHDest { |
| 2240 | flags = append(flags, "\"Dest\": true") |
| 2241 | } |
| 2242 | if self&OFPIEHFrag == OFPIEHFrag { |
| 2243 | flags = append(flags, "\"Frag\": true") |
| 2244 | } |
| 2245 | if self&OFPIEHRouter == OFPIEHRouter { |
| 2246 | flags = append(flags, "\"Router\": true") |
| 2247 | } |
| 2248 | if self&OFPIEHHop == OFPIEHHop { |
| 2249 | flags = append(flags, "\"Hop\": true") |
| 2250 | } |
| 2251 | if self&OFPIEHUnrep == OFPIEHUnrep { |
| 2252 | flags = append(flags, "\"Unrep\": true") |
| 2253 | } |
| 2254 | if self&OFPIEHUnseq == OFPIEHUnseq { |
| 2255 | flags = append(flags, "\"Unseq\": true") |
| 2256 | } |
| 2257 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2258 | } |
| 2259 | |
| 2260 | const ( |
| 2261 | // Identifiers from group ofp_match_type |
| 2262 | OFPMTStandard = 0 // OFPMT_STANDARD |
| 2263 | OFPMTOXM = 1 // OFPMT_OXM |
| 2264 | ) |
| 2265 | |
| 2266 | type MatchType uint16 |
| 2267 | |
| 2268 | func (self MatchType) MarshalJSON() ([]byte, error) { |
| 2269 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2270 | } |
| 2271 | |
| 2272 | const ( |
| 2273 | // Identifiers from group ofp_meter |
| 2274 | OFPMMax = 4294901760 // OFPM_MAX |
| 2275 | OFPMSlowpath = 4294967293 // OFPM_SLOWPATH |
| 2276 | OFPMController = 4294967294 // OFPM_CONTROLLER |
| 2277 | OFPMAll = 4294967295 // OFPM_ALL |
| 2278 | ) |
| 2279 | |
| 2280 | type Meter uint32 |
| 2281 | |
| 2282 | func (self Meter) MarshalJSON() ([]byte, error) { |
| 2283 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2284 | } |
| 2285 | |
| 2286 | const ( |
| 2287 | // Identifiers from group ofp_meter_band_type |
| 2288 | OFPMBTDrop = 1 // OFPMBT_DROP |
| 2289 | OFPMBTDSCPRemark = 2 // OFPMBT_DSCP_REMARK |
| 2290 | OFPMBTExperimenter = 65535 // OFPMBT_EXPERIMENTER |
| 2291 | ) |
| 2292 | |
| 2293 | type MeterBandType uint16 |
| 2294 | |
| 2295 | func (self MeterBandType) MarshalJSON() ([]byte, error) { |
| 2296 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2297 | } |
| 2298 | |
| 2299 | const ( |
| 2300 | // Identifiers from group ofp_meter_flags |
| 2301 | OFPMFKbps = 1 // OFPMF_KBPS |
| 2302 | OFPMFPktps = 2 // OFPMF_PKTPS |
| 2303 | OFPMFBurst = 4 // OFPMF_BURST |
| 2304 | OFPMFStats = 8 // OFPMF_STATS |
| 2305 | ) |
| 2306 | |
| 2307 | type MeterFlags uint16 |
| 2308 | |
| 2309 | func (self MeterFlags) MarshalJSON() ([]byte, error) { |
| 2310 | var flags []string |
| 2311 | if self&OFPMFKbps == OFPMFKbps { |
| 2312 | flags = append(flags, "\"Kbps\": true") |
| 2313 | } |
| 2314 | if self&OFPMFPktps == OFPMFPktps { |
| 2315 | flags = append(flags, "\"Pktps\": true") |
| 2316 | } |
| 2317 | if self&OFPMFBurst == OFPMFBurst { |
| 2318 | flags = append(flags, "\"Burst\": true") |
| 2319 | } |
| 2320 | if self&OFPMFStats == OFPMFStats { |
| 2321 | flags = append(flags, "\"Stats\": true") |
| 2322 | } |
| 2323 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2324 | } |
| 2325 | |
| 2326 | const ( |
| 2327 | // Identifiers from group ofp_meter_mod_command |
| 2328 | OFPMCAdd = 0 // OFPMC_ADD |
| 2329 | OFPMCModify = 1 // OFPMC_MODIFY |
| 2330 | OFPMCDelete = 2 // OFPMC_DELETE |
| 2331 | ) |
| 2332 | |
| 2333 | type MeterModCommand uint16 |
| 2334 | |
| 2335 | func (self MeterModCommand) MarshalJSON() ([]byte, error) { |
| 2336 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2337 | } |
| 2338 | |
| 2339 | const ( |
| 2340 | // Identifiers from group ofp_meter_mod_failed_code |
| 2341 | OFPMMFCUnknown = 0 // OFPMMFC_UNKNOWN |
| 2342 | OFPMMFCMeterExists = 1 // OFPMMFC_METER_EXISTS |
| 2343 | OFPMMFCInvalidMeter = 2 // OFPMMFC_INVALID_METER |
| 2344 | OFPMMFCUnknownMeter = 3 // OFPMMFC_UNKNOWN_METER |
| 2345 | OFPMMFCBadCommand = 4 // OFPMMFC_BAD_COMMAND |
| 2346 | OFPMMFCBadFlags = 5 // OFPMMFC_BAD_FLAGS |
| 2347 | OFPMMFCBadRate = 6 // OFPMMFC_BAD_RATE |
| 2348 | OFPMMFCBadBurst = 7 // OFPMMFC_BAD_BURST |
| 2349 | OFPMMFCBadBand = 8 // OFPMMFC_BAD_BAND |
| 2350 | OFPMMFCBadBandValue = 9 // OFPMMFC_BAD_BAND_VALUE |
| 2351 | OFPMMFCOutOfMeters = 10 // OFPMMFC_OUT_OF_METERS |
| 2352 | OFPMMFCOutOfBands = 11 // OFPMMFC_OUT_OF_BANDS |
| 2353 | ) |
| 2354 | |
| 2355 | type MeterModFailedCode uint16 |
| 2356 | |
| 2357 | func (self MeterModFailedCode) MarshalJSON() ([]byte, error) { |
| 2358 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2359 | } |
| 2360 | |
| 2361 | const ( |
| 2362 | // Identifiers from group ofp_ovs_tcp_flag |
| 2363 | OvsTCPFlagFin = 1 // OFP_OVS_TCP_FLAG_FIN |
| 2364 | OvsTCPFlagSyn = 2 // OFP_OVS_TCP_FLAG_SYN |
| 2365 | OvsTCPFlagRst = 4 // OFP_OVS_TCP_FLAG_RST |
| 2366 | OvsTCPFlagPsh = 8 // OFP_OVS_TCP_FLAG_PSH |
| 2367 | OvsTCPFlagAck = 16 // OFP_OVS_TCP_FLAG_ACK |
| 2368 | OvsTCPFlagUrg = 32 // OFP_OVS_TCP_FLAG_URG |
| 2369 | OvsTCPFlagEce = 64 // OFP_OVS_TCP_FLAG_ECE |
| 2370 | OvsTCPFlagCwr = 128 // OFP_OVS_TCP_FLAG_CWR |
| 2371 | OvsTCPFlagNs = 256 // OFP_OVS_TCP_FLAG_NS |
| 2372 | ) |
| 2373 | |
| 2374 | type OvsTcpFlag uint16 |
| 2375 | |
| 2376 | func (self OvsTcpFlag) MarshalJSON() ([]byte, error) { |
| 2377 | var flags []string |
| 2378 | if self&OvsTCPFlagFin == OvsTCPFlagFin { |
| 2379 | flags = append(flags, "\"Fin\": true") |
| 2380 | } |
| 2381 | if self&OvsTCPFlagSyn == OvsTCPFlagSyn { |
| 2382 | flags = append(flags, "\"Syn\": true") |
| 2383 | } |
| 2384 | if self&OvsTCPFlagRst == OvsTCPFlagRst { |
| 2385 | flags = append(flags, "\"Rst\": true") |
| 2386 | } |
| 2387 | if self&OvsTCPFlagPsh == OvsTCPFlagPsh { |
| 2388 | flags = append(flags, "\"Psh\": true") |
| 2389 | } |
| 2390 | if self&OvsTCPFlagAck == OvsTCPFlagAck { |
| 2391 | flags = append(flags, "\"Ack\": true") |
| 2392 | } |
| 2393 | if self&OvsTCPFlagUrg == OvsTCPFlagUrg { |
| 2394 | flags = append(flags, "\"Urg\": true") |
| 2395 | } |
| 2396 | if self&OvsTCPFlagEce == OvsTCPFlagEce { |
| 2397 | flags = append(flags, "\"Ece\": true") |
| 2398 | } |
| 2399 | if self&OvsTCPFlagCwr == OvsTCPFlagCwr { |
| 2400 | flags = append(flags, "\"Cwr\": true") |
| 2401 | } |
| 2402 | if self&OvsTCPFlagNs == OvsTCPFlagNs { |
| 2403 | flags = append(flags, "\"Ns\": true") |
| 2404 | } |
| 2405 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2406 | } |
| 2407 | |
| 2408 | const ( |
| 2409 | // Identifiers from group ofp_oxm_class |
| 2410 | OFPXMCNxm0 = 0 // OFPXMC_NXM_0 |
| 2411 | OFPXMCNxm1 = 1 // OFPXMC_NXM_1 |
| 2412 | OFPXMCOpenflowBasic = 32768 // OFPXMC_OPENFLOW_BASIC |
| 2413 | OFPXMCExperimenter = 65535 // OFPXMC_EXPERIMENTER |
| 2414 | ) |
| 2415 | |
| 2416 | type OxmClass uint16 |
| 2417 | |
| 2418 | func (self OxmClass) MarshalJSON() ([]byte, error) { |
| 2419 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2420 | } |
| 2421 | |
| 2422 | const ( |
| 2423 | // Identifiers from group ofp_packet_in_reason |
| 2424 | OFPRNoMatch = 0 // OFPR_NO_MATCH |
| 2425 | OFPRAction = 1 // OFPR_ACTION |
| 2426 | OFPRInvalidTtl = 2 // OFPR_INVALID_TTL |
| 2427 | OFPRBSNNewHost = 128 // OFPR_BSN_NEW_HOST |
| 2428 | OFPRBSNStationMove = 129 // OFPR_BSN_STATION_MOVE |
| 2429 | OFPRBSNBadVLAN = 130 // OFPR_BSN_BAD_VLAN |
| 2430 | OFPRBSNDestinationLookupFailure = 131 // OFPR_BSN_DESTINATION_LOOKUP_FAILURE |
| 2431 | OFPRBSNNoRoute = 132 // OFPR_BSN_NO_ROUTE |
| 2432 | OFPRBSNICMPEchoRequest = 133 // OFPR_BSN_ICMP_ECHO_REQUEST |
| 2433 | OFPRBSNDestNetworkUnreachable = 134 // OFPR_BSN_DEST_NETWORK_UNREACHABLE |
| 2434 | OFPRBSNDestHostUnreachable = 135 // OFPR_BSN_DEST_HOST_UNREACHABLE |
| 2435 | OFPRBSNDestPortUnreachable = 136 // OFPR_BSN_DEST_PORT_UNREACHABLE |
| 2436 | OFPRBSNFragmentationRequired = 137 // OFPR_BSN_FRAGMENTATION_REQUIRED |
| 2437 | OFPRBSNARP = 139 // OFPR_BSN_ARP |
| 2438 | OFPRBSNDhcp = 140 // OFPR_BSN_DHCP |
| 2439 | OFPRBSNDebug = 141 // OFPR_BSN_DEBUG |
| 2440 | OFPRBSNPacketOfDeath = 142 // OFPR_BSN_PACKET_OF_DEATH |
| 2441 | ) |
| 2442 | |
| 2443 | type PacketInReason uint8 |
| 2444 | |
| 2445 | func (self PacketInReason) MarshalJSON() ([]byte, error) { |
| 2446 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2447 | } |
| 2448 | |
| 2449 | const ( |
| 2450 | // Identifiers from group ofp_packet_type |
| 2451 | PtEthernet = 0 // OFP_PT_ETHERNET |
| 2452 | PtUseNextProto = 65534 // OFP_PT_USE_NEXT_PROTO |
| 2453 | PtIpv4 = 67584 // OFP_PT_IPV4 |
| 2454 | PtMpls = 100423 // OFP_PT_MPLS |
| 2455 | PtMplsMc = 100424 // OFP_PT_MPLS_MC |
| 2456 | PtNsh = 100687 // OFP_PT_NSH |
| 2457 | PtUnknown = 4294967295 // OFP_PT_UNKNOWN |
| 2458 | ) |
| 2459 | |
| 2460 | type PacketType uint32 |
| 2461 | |
| 2462 | func (self PacketType) MarshalJSON() ([]byte, error) { |
| 2463 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 2464 | } |
| 2465 | |
| 2466 | func (self PacketType) String() string { |
| 2467 | switch self { |
| 2468 | case PtEthernet: |
| 2469 | return "ethernet" |
| 2470 | case PtUseNextProto: |
| 2471 | return "use_next_proto" |
| 2472 | case PtIpv4: |
| 2473 | return "ipv4" |
| 2474 | case PtMpls: |
| 2475 | return "mpls" |
| 2476 | case PtMplsMc: |
| 2477 | return "mpls_mc" |
| 2478 | case PtNsh: |
| 2479 | return "nsh" |
| 2480 | case PtUnknown: |
| 2481 | return "unknown" |
| 2482 | default: |
| 2483 | return fmt.Sprintf("%d", self) |
| 2484 | } |
| 2485 | } |
| 2486 | |
| 2487 | const ( |
| 2488 | // Identifiers from group ofp_port |
| 2489 | OFPPMax = 4294967040 // OFPP_MAX |
| 2490 | OFPPInPort = 4294967288 // OFPP_IN_PORT |
| 2491 | OFPPTable = 4294967289 // OFPP_TABLE |
| 2492 | OFPPNormal = 4294967290 // OFPP_NORMAL |
| 2493 | OFPPFlood = 4294967291 // OFPP_FLOOD |
| 2494 | OFPPAll = 4294967292 // OFPP_ALL |
| 2495 | OFPPController = 4294967293 // OFPP_CONTROLLER |
| 2496 | OFPPLocal = 4294967294 // OFPP_LOCAL |
| 2497 | OFPPAny = 4294967295 // OFPP_ANY |
| 2498 | ) |
| 2499 | |
| 2500 | type Port uint32 |
| 2501 | |
| 2502 | func (self Port) MarshalJSON() ([]byte, error) { |
| 2503 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2504 | } |
| 2505 | |
| 2506 | const ( |
| 2507 | // Identifiers from group ofp_port_config |
| 2508 | OFPPCPortDown = 1 // OFPPC_PORT_DOWN |
| 2509 | OFPPCNoRecv = 4 // OFPPC_NO_RECV |
| 2510 | OFPPCNoFwd = 32 // OFPPC_NO_FWD |
| 2511 | OFPPCNoPacketIn = 64 // OFPPC_NO_PACKET_IN |
| 2512 | OFPPCBSNMirrorDest = 2147483648 // OFPPC_BSN_MIRROR_DEST |
| 2513 | ) |
| 2514 | |
| 2515 | type PortConfig uint32 |
| 2516 | |
| 2517 | func (self PortConfig) MarshalJSON() ([]byte, error) { |
| 2518 | var flags []string |
| 2519 | if self&OFPPCPortDown == OFPPCPortDown { |
| 2520 | flags = append(flags, "\"PortDown\": true") |
| 2521 | } |
| 2522 | if self&OFPPCNoRecv == OFPPCNoRecv { |
| 2523 | flags = append(flags, "\"NoRecv\": true") |
| 2524 | } |
| 2525 | if self&OFPPCNoFwd == OFPPCNoFwd { |
| 2526 | flags = append(flags, "\"NoFwd\": true") |
| 2527 | } |
| 2528 | if self&OFPPCNoPacketIn == OFPPCNoPacketIn { |
| 2529 | flags = append(flags, "\"NoPacketIn\": true") |
| 2530 | } |
| 2531 | if self&OFPPCBSNMirrorDest == OFPPCBSNMirrorDest { |
| 2532 | flags = append(flags, "\"BsnMirrorDest\": true") |
| 2533 | } |
| 2534 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2535 | } |
| 2536 | |
| 2537 | const ( |
| 2538 | // Identifiers from group ofp_port_features |
| 2539 | OFPPF10MbHd = 1 // OFPPF_10MB_HD |
| 2540 | OFPPF10MbFd = 2 // OFPPF_10MB_FD |
| 2541 | OFPPF100MbHd = 4 // OFPPF_100MB_HD |
| 2542 | OFPPF100MbFd = 8 // OFPPF_100MB_FD |
| 2543 | OFPPF1GbHd = 16 // OFPPF_1GB_HD |
| 2544 | OFPPF1GbFd = 32 // OFPPF_1GB_FD |
| 2545 | OFPPF10GbFd = 64 // OFPPF_10GB_FD |
| 2546 | OFPPF40GbFd = 128 // OFPPF_40GB_FD |
| 2547 | OFPPF100GbFd = 256 // OFPPF_100GB_FD |
| 2548 | OFPPF1TbFd = 512 // OFPPF_1TB_FD |
| 2549 | OFPPFOther = 1024 // OFPPF_OTHER |
| 2550 | OFPPFCopper = 2048 // OFPPF_COPPER |
| 2551 | OFPPFFiber = 4096 // OFPPF_FIBER |
| 2552 | OFPPFAutoneg = 8192 // OFPPF_AUTONEG |
| 2553 | OFPPFPause = 16384 // OFPPF_PAUSE |
| 2554 | OFPPFPauseAsym = 32768 // OFPPF_PAUSE_ASYM |
| 2555 | OFPPFBSNBreakoutCapable = 2147483648 // OFPPF_BSN_BREAKOUT_CAPABLE |
| 2556 | ) |
| 2557 | |
| 2558 | type PortFeatures uint32 |
| 2559 | |
| 2560 | func (self PortFeatures) MarshalJSON() ([]byte, error) { |
| 2561 | var flags []string |
| 2562 | if self&OFPPF10MbHd == OFPPF10MbHd { |
| 2563 | flags = append(flags, "\"10MbHd\": true") |
| 2564 | } |
| 2565 | if self&OFPPF10MbFd == OFPPF10MbFd { |
| 2566 | flags = append(flags, "\"10MbFd\": true") |
| 2567 | } |
| 2568 | if self&OFPPF100MbHd == OFPPF100MbHd { |
| 2569 | flags = append(flags, "\"100MbHd\": true") |
| 2570 | } |
| 2571 | if self&OFPPF100MbFd == OFPPF100MbFd { |
| 2572 | flags = append(flags, "\"100MbFd\": true") |
| 2573 | } |
| 2574 | if self&OFPPF1GbHd == OFPPF1GbHd { |
| 2575 | flags = append(flags, "\"1GbHd\": true") |
| 2576 | } |
| 2577 | if self&OFPPF1GbFd == OFPPF1GbFd { |
| 2578 | flags = append(flags, "\"1GbFd\": true") |
| 2579 | } |
| 2580 | if self&OFPPF10GbFd == OFPPF10GbFd { |
| 2581 | flags = append(flags, "\"10GbFd\": true") |
| 2582 | } |
| 2583 | if self&OFPPF40GbFd == OFPPF40GbFd { |
| 2584 | flags = append(flags, "\"40GbFd\": true") |
| 2585 | } |
| 2586 | if self&OFPPF100GbFd == OFPPF100GbFd { |
| 2587 | flags = append(flags, "\"100GbFd\": true") |
| 2588 | } |
| 2589 | if self&OFPPF1TbFd == OFPPF1TbFd { |
| 2590 | flags = append(flags, "\"1TbFd\": true") |
| 2591 | } |
| 2592 | if self&OFPPFOther == OFPPFOther { |
| 2593 | flags = append(flags, "\"Other\": true") |
| 2594 | } |
| 2595 | if self&OFPPFCopper == OFPPFCopper { |
| 2596 | flags = append(flags, "\"Copper\": true") |
| 2597 | } |
| 2598 | if self&OFPPFFiber == OFPPFFiber { |
| 2599 | flags = append(flags, "\"Fiber\": true") |
| 2600 | } |
| 2601 | if self&OFPPFAutoneg == OFPPFAutoneg { |
| 2602 | flags = append(flags, "\"Autoneg\": true") |
| 2603 | } |
| 2604 | if self&OFPPFPause == OFPPFPause { |
| 2605 | flags = append(flags, "\"Pause\": true") |
| 2606 | } |
| 2607 | if self&OFPPFPauseAsym == OFPPFPauseAsym { |
| 2608 | flags = append(flags, "\"PauseAsym\": true") |
| 2609 | } |
| 2610 | if self&OFPPFBSNBreakoutCapable == OFPPFBSNBreakoutCapable { |
| 2611 | flags = append(flags, "\"BsnBreakoutCapable\": true") |
| 2612 | } |
| 2613 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2614 | } |
| 2615 | |
| 2616 | const ( |
| 2617 | // Identifiers from group ofp_port_mod_failed_code |
| 2618 | OFPPMFCBadPort = 0 // OFPPMFC_BAD_PORT |
| 2619 | OFPPMFCBadHwAddr = 1 // OFPPMFC_BAD_HW_ADDR |
| 2620 | OFPPMFCBadConfig = 2 // OFPPMFC_BAD_CONFIG |
| 2621 | OFPPMFCBadAdvertise = 3 // OFPPMFC_BAD_ADVERTISE |
| 2622 | OFPPMFCEperm = 4 // OFPPMFC_EPERM |
| 2623 | ) |
| 2624 | |
| 2625 | type PortModFailedCode uint16 |
| 2626 | |
| 2627 | func (self PortModFailedCode) MarshalJSON() ([]byte, error) { |
| 2628 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2629 | } |
| 2630 | |
| 2631 | const ( |
| 2632 | // Identifiers from group ofp_port_reason |
| 2633 | OFPPRAdd = 0 // OFPPR_ADD |
| 2634 | OFPPRDelete = 1 // OFPPR_DELETE |
| 2635 | OFPPRModify = 2 // OFPPR_MODIFY |
| 2636 | ) |
| 2637 | |
| 2638 | type PortReason uint8 |
| 2639 | |
| 2640 | func (self PortReason) MarshalJSON() ([]byte, error) { |
| 2641 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2642 | } |
| 2643 | |
| 2644 | const ( |
| 2645 | // Identifiers from group ofp_port_state |
| 2646 | OFPPSLinkDown = 1 // OFPPS_LINK_DOWN |
| 2647 | OFPPSBlocked = 2 // OFPPS_BLOCKED |
| 2648 | OFPPSLive = 4 // OFPPS_LIVE |
| 2649 | ) |
| 2650 | |
| 2651 | type PortState uint32 |
| 2652 | |
| 2653 | func (self PortState) MarshalJSON() ([]byte, error) { |
| 2654 | var flags []string |
| 2655 | if self&OFPPSLinkDown == OFPPSLinkDown { |
| 2656 | flags = append(flags, "\"LinkDown\": true") |
| 2657 | } |
| 2658 | if self&OFPPSBlocked == OFPPSBlocked { |
| 2659 | flags = append(flags, "\"Blocked\": true") |
| 2660 | } |
| 2661 | if self&OFPPSLive == OFPPSLive { |
| 2662 | flags = append(flags, "\"Live\": true") |
| 2663 | } |
| 2664 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2665 | } |
| 2666 | |
| 2667 | const ( |
| 2668 | // Identifiers from group ofp_queue_op_failed_code |
| 2669 | OFPQOFCBadPort = 0 // OFPQOFC_BAD_PORT |
| 2670 | OFPQOFCBadQueue = 1 // OFPQOFC_BAD_QUEUE |
| 2671 | OFPQOFCEperm = 2 // OFPQOFC_EPERM |
| 2672 | ) |
| 2673 | |
| 2674 | type QueueOpFailedCode uint16 |
| 2675 | |
| 2676 | func (self QueueOpFailedCode) MarshalJSON() ([]byte, error) { |
| 2677 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2678 | } |
| 2679 | |
| 2680 | const ( |
| 2681 | // Identifiers from group ofp_queue_properties |
| 2682 | OFPQTMinRate = 1 // OFPQT_MIN_RATE |
| 2683 | OFPQTMaxRate = 2 // OFPQT_MAX_RATE |
| 2684 | OFPQTExperimenter = 65535 // OFPQT_EXPERIMENTER |
| 2685 | ) |
| 2686 | |
| 2687 | type QueueProperties uint16 |
| 2688 | |
| 2689 | func (self QueueProperties) MarshalJSON() ([]byte, error) { |
| 2690 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2691 | } |
| 2692 | |
| 2693 | const ( |
| 2694 | // Identifiers from group ofp_role_request_failed_code |
| 2695 | OFPRRFCStale = 0 // OFPRRFC_STALE |
| 2696 | OFPRRFCUnsup = 1 // OFPRRFC_UNSUP |
| 2697 | OFPRRFCBadRole = 2 // OFPRRFC_BAD_ROLE |
| 2698 | ) |
| 2699 | |
| 2700 | type RoleRequestFailedCode uint16 |
| 2701 | |
| 2702 | func (self RoleRequestFailedCode) MarshalJSON() ([]byte, error) { |
| 2703 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2704 | } |
| 2705 | |
| 2706 | const ( |
| 2707 | // Identifiers from group ofp_stats_reply_flags |
| 2708 | OFPSFReplyMore = 1 // OFPSF_REPLY_MORE |
| 2709 | ) |
| 2710 | |
| 2711 | type StatsReplyFlags uint16 |
| 2712 | |
| 2713 | func (self StatsReplyFlags) MarshalJSON() ([]byte, error) { |
| 2714 | var flags []string |
| 2715 | if self&OFPSFReplyMore == OFPSFReplyMore { |
| 2716 | flags = append(flags, "\"OFPSFReplyMore\": true") |
| 2717 | } |
| 2718 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2719 | } |
| 2720 | |
| 2721 | const ( |
| 2722 | // Identifiers from group ofp_stats_request_flags |
| 2723 | OFPSFReqMore = 1 // OFPSF_REQ_MORE |
| 2724 | ) |
| 2725 | |
| 2726 | type StatsRequestFlags uint16 |
| 2727 | |
| 2728 | func (self StatsRequestFlags) MarshalJSON() ([]byte, error) { |
| 2729 | var flags []string |
| 2730 | if self&OFPSFReqMore == OFPSFReqMore { |
| 2731 | flags = append(flags, "\"OFPSFReqMore\": true") |
| 2732 | } |
| 2733 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2734 | } |
| 2735 | |
| 2736 | const ( |
| 2737 | // Identifiers from group ofp_stats_type |
| 2738 | OFPSTDesc = 0 // OFPST_DESC |
| 2739 | OFPSTFlow = 1 // OFPST_FLOW |
| 2740 | OFPSTAggregate = 2 // OFPST_AGGREGATE |
| 2741 | OFPSTTable = 3 // OFPST_TABLE |
| 2742 | OFPSTPort = 4 // OFPST_PORT |
| 2743 | OFPSTQueue = 5 // OFPST_QUEUE |
| 2744 | OFPSTGroup = 6 // OFPST_GROUP |
| 2745 | OFPSTGroupDesc = 7 // OFPST_GROUP_DESC |
| 2746 | OFPSTGroupFeatures = 8 // OFPST_GROUP_FEATURES |
| 2747 | OFPSTMeter = 9 // OFPST_METER |
| 2748 | OFPSTMeterConfig = 10 // OFPST_METER_CONFIG |
| 2749 | OFPSTMeterFeatures = 11 // OFPST_METER_FEATURES |
| 2750 | OFPSTTableFeatures = 12 // OFPST_TABLE_FEATURES |
| 2751 | OFPSTPortDesc = 13 // OFPST_PORT_DESC |
| 2752 | OFPSTExperimenter = 65535 // OFPST_EXPERIMENTER |
| 2753 | ) |
| 2754 | |
| 2755 | type StatsType uint16 |
| 2756 | |
| 2757 | func (self StatsType) MarshalJSON() ([]byte, error) { |
| 2758 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2759 | } |
| 2760 | |
| 2761 | const ( |
| 2762 | // Identifiers from group ofp_switch_config_failed_code |
| 2763 | OFPSCFCBadFlags = 0 // OFPSCFC_BAD_FLAGS |
| 2764 | OFPSCFCBadLen = 1 // OFPSCFC_BAD_LEN |
| 2765 | OFPSCFCEperm = 2 // OFPSCFC_EPERM |
| 2766 | ) |
| 2767 | |
| 2768 | type SwitchConfigFailedCode uint16 |
| 2769 | |
| 2770 | func (self SwitchConfigFailedCode) MarshalJSON() ([]byte, error) { |
| 2771 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2772 | } |
| 2773 | |
| 2774 | const ( |
| 2775 | // Identifiers from group ofp_table |
| 2776 | OFPTTMax = 254 // OFPTT_MAX |
| 2777 | OFPTTAll = 255 // OFPTT_ALL |
| 2778 | ) |
| 2779 | |
| 2780 | type Table uint8 |
| 2781 | |
| 2782 | func (self Table) MarshalJSON() ([]byte, error) { |
| 2783 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2784 | } |
| 2785 | |
| 2786 | const ( |
| 2787 | // Identifiers from group ofp_table_config |
| 2788 | OFPTCDeprecatedMask = 3 // OFPTC_DEPRECATED_MASK |
| 2789 | ) |
| 2790 | |
| 2791 | type TableConfig uint32 |
| 2792 | |
| 2793 | func (self TableConfig) MarshalJSON() ([]byte, error) { |
| 2794 | var flags []string |
| 2795 | if self&OFPTCDeprecatedMask == OFPTCDeprecatedMask { |
| 2796 | flags = append(flags, "\"OFPTCDeprecatedMask\": true") |
| 2797 | } |
| 2798 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2799 | } |
| 2800 | |
| 2801 | const ( |
| 2802 | // Identifiers from group ofp_table_feature_prop_type |
| 2803 | OFPTFPTInstructions = 0 // OFPTFPT_INSTRUCTIONS |
| 2804 | OFPTFPTInstructionsMiss = 1 // OFPTFPT_INSTRUCTIONS_MISS |
| 2805 | OFPTFPTNextTables = 2 // OFPTFPT_NEXT_TABLES |
| 2806 | OFPTFPTNextTablesMiss = 3 // OFPTFPT_NEXT_TABLES_MISS |
| 2807 | OFPTFPTWriteActions = 4 // OFPTFPT_WRITE_ACTIONS |
| 2808 | OFPTFPTWriteActionsMiss = 5 // OFPTFPT_WRITE_ACTIONS_MISS |
| 2809 | OFPTFPTApplyActions = 6 // OFPTFPT_APPLY_ACTIONS |
| 2810 | OFPTFPTApplyActionsMiss = 7 // OFPTFPT_APPLY_ACTIONS_MISS |
| 2811 | OFPTFPTMatch = 8 // OFPTFPT_MATCH |
| 2812 | OFPTFPTWildcards = 10 // OFPTFPT_WILDCARDS |
| 2813 | OFPTFPTWriteSetfield = 12 // OFPTFPT_WRITE_SETFIELD |
| 2814 | OFPTFPTWriteSetfieldMiss = 13 // OFPTFPT_WRITE_SETFIELD_MISS |
| 2815 | OFPTFPTApplySetfield = 14 // OFPTFPT_APPLY_SETFIELD |
| 2816 | OFPTFPTApplySetfieldMiss = 15 // OFPTFPT_APPLY_SETFIELD_MISS |
| 2817 | OFPTFPTExperimenter = 65534 // OFPTFPT_EXPERIMENTER |
| 2818 | OFPTFPTExperimenterMiss = 65535 // OFPTFPT_EXPERIMENTER_MISS |
| 2819 | ) |
| 2820 | |
| 2821 | type TableFeaturePropType uint16 |
| 2822 | |
| 2823 | func (self TableFeaturePropType) MarshalJSON() ([]byte, error) { |
| 2824 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2825 | } |
| 2826 | |
| 2827 | const ( |
| 2828 | // Identifiers from group ofp_table_features_failed_code |
| 2829 | OFPTFFCBadTable = 0 // OFPTFFC_BAD_TABLE |
| 2830 | OFPTFFCBadMetadata = 1 // OFPTFFC_BAD_METADATA |
| 2831 | OFPTFFCBadType = 2 // OFPTFFC_BAD_TYPE |
| 2832 | OFPTFFCBadLen = 3 // OFPTFFC_BAD_LEN |
| 2833 | OFPTFFCBadArgument = 4 // OFPTFFC_BAD_ARGUMENT |
| 2834 | OFPTFFCEperm = 5 // OFPTFFC_EPERM |
| 2835 | ) |
| 2836 | |
| 2837 | type TableFeaturesFailedCode uint16 |
| 2838 | |
| 2839 | func (self TableFeaturesFailedCode) MarshalJSON() ([]byte, error) { |
| 2840 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2841 | } |
| 2842 | |
| 2843 | const ( |
| 2844 | // Identifiers from group ofp_table_mod_failed_code |
| 2845 | OFPTMFCBadTable = 0 // OFPTMFC_BAD_TABLE |
| 2846 | OFPTMFCBadConfig = 1 // OFPTMFC_BAD_CONFIG |
| 2847 | OFPTMFCEperm = 2 // OFPTMFC_EPERM |
| 2848 | ) |
| 2849 | |
| 2850 | type TableModFailedCode uint16 |
| 2851 | |
| 2852 | func (self TableModFailedCode) MarshalJSON() ([]byte, error) { |
| 2853 | return []byte(fmt.Sprintf("%d", self)), nil |
| 2854 | } |
| 2855 | |
| 2856 | const ( |
| 2857 | // Identifiers from group ofp_tcp_flags |
| 2858 | TcpFlagCwr = 128 // TCP_FLAG_CWR |
| 2859 | TcpFlagEce = 64 // TCP_FLAG_ECE |
| 2860 | TcpFlagUrg = 32 // TCP_FLAG_URG |
| 2861 | TcpFlagAck = 16 // TCP_FLAG_ACK |
| 2862 | TcpFlagPsh = 8 // TCP_FLAG_PSH |
| 2863 | TcpFlagRst = 4 // TCP_FLAG_RST |
| 2864 | TcpFlagSyn = 2 // TCP_FLAG_SYN |
| 2865 | TcpFlagFin = 1 // TCP_FLAG_FIN |
| 2866 | ) |
| 2867 | |
| 2868 | type TcpFlags uint16 |
| 2869 | |
| 2870 | func (self TcpFlags) MarshalJSON() ([]byte, error) { |
| 2871 | var flags []string |
| 2872 | if self&TcpFlagCwr == TcpFlagCwr { |
| 2873 | flags = append(flags, "\"Cwr\": true") |
| 2874 | } |
| 2875 | if self&TcpFlagEce == TcpFlagEce { |
| 2876 | flags = append(flags, "\"Ece\": true") |
| 2877 | } |
| 2878 | if self&TcpFlagUrg == TcpFlagUrg { |
| 2879 | flags = append(flags, "\"Urg\": true") |
| 2880 | } |
| 2881 | if self&TcpFlagAck == TcpFlagAck { |
| 2882 | flags = append(flags, "\"Ack\": true") |
| 2883 | } |
| 2884 | if self&TcpFlagPsh == TcpFlagPsh { |
| 2885 | flags = append(flags, "\"Psh\": true") |
| 2886 | } |
| 2887 | if self&TcpFlagRst == TcpFlagRst { |
| 2888 | flags = append(flags, "\"Rst\": true") |
| 2889 | } |
| 2890 | if self&TcpFlagSyn == TcpFlagSyn { |
| 2891 | flags = append(flags, "\"Syn\": true") |
| 2892 | } |
| 2893 | if self&TcpFlagFin == TcpFlagFin { |
| 2894 | flags = append(flags, "\"Fin\": true") |
| 2895 | } |
| 2896 | return []byte("{" + strings.Join(flags, ", ") + "}"), nil |
| 2897 | } |
| 2898 | |
| 2899 | const ( |
| 2900 | // Identifiers from group ofp_type |
| 2901 | OFPTHello = 0 // OFPT_HELLO |
| 2902 | OFPTError = 1 // OFPT_ERROR |
| 2903 | OFPTEchoRequest = 2 // OFPT_ECHO_REQUEST |
| 2904 | OFPTEchoReply = 3 // OFPT_ECHO_REPLY |
| 2905 | OFPTExperimenter = 4 // OFPT_EXPERIMENTER |
| 2906 | OFPTFeaturesRequest = 5 // OFPT_FEATURES_REQUEST |
| 2907 | OFPTFeaturesReply = 6 // OFPT_FEATURES_REPLY |
| 2908 | OFPTGetConfigRequest = 7 // OFPT_GET_CONFIG_REQUEST |
| 2909 | OFPTGetConfigReply = 8 // OFPT_GET_CONFIG_REPLY |
| 2910 | OFPTSetConfig = 9 // OFPT_SET_CONFIG |
| 2911 | OFPTPacketIn = 10 // OFPT_PACKET_IN |
| 2912 | OFPTFlowRemoved = 11 // OFPT_FLOW_REMOVED |
| 2913 | OFPTPortStatus = 12 // OFPT_PORT_STATUS |
| 2914 | OFPTPacketOut = 13 // OFPT_PACKET_OUT |
| 2915 | OFPTFlowMod = 14 // OFPT_FLOW_MOD |
| 2916 | OFPTGroupMod = 15 // OFPT_GROUP_MOD |
| 2917 | OFPTPortMod = 16 // OFPT_PORT_MOD |
| 2918 | OFPTTableMod = 17 // OFPT_TABLE_MOD |
| 2919 | OFPTStatsRequest = 18 // OFPT_STATS_REQUEST |
| 2920 | OFPTStatsReply = 19 // OFPT_STATS_REPLY |
| 2921 | OFPTBarrierRequest = 20 // OFPT_BARRIER_REQUEST |
| 2922 | OFPTBarrierReply = 21 // OFPT_BARRIER_REPLY |
| 2923 | OFPTQueueGetConfigRequest = 22 // OFPT_QUEUE_GET_CONFIG_REQUEST |
| 2924 | OFPTQueueGetConfigReply = 23 // OFPT_QUEUE_GET_CONFIG_REPLY |
| 2925 | OFPTRoleRequest = 24 // OFPT_ROLE_REQUEST |
| 2926 | OFPTRoleReply = 25 // OFPT_ROLE_REPLY |
| 2927 | OFPTGetAsyncRequest = 26 // OFPT_GET_ASYNC_REQUEST |
| 2928 | OFPTGetAsyncReply = 27 // OFPT_GET_ASYNC_REPLY |
| 2929 | OFPTSetAsync = 28 // OFPT_SET_ASYNC |
| 2930 | OFPTMeterMod = 29 // OFPT_METER_MOD |
| 2931 | ) |
| 2932 | |
| 2933 | type Type uint8 |
| 2934 | |
| 2935 | func (self Type) MarshalJSON() ([]byte, error) { |
| 2936 | return []byte(fmt.Sprintf("\"%s\"", self)), nil |
| 2937 | } |
| 2938 | |
| 2939 | func (self Type) String() string { |
| 2940 | switch self { |
| 2941 | case OFPTHello: |
| 2942 | return "hello" |
| 2943 | case OFPTError: |
| 2944 | return "error" |
| 2945 | case OFPTEchoRequest: |
| 2946 | return "echo_request" |
| 2947 | case OFPTEchoReply: |
| 2948 | return "echo_reply" |
| 2949 | case OFPTExperimenter: |
| 2950 | return "experimenter" |
| 2951 | case OFPTFeaturesRequest: |
| 2952 | return "features_request" |
| 2953 | case OFPTFeaturesReply: |
| 2954 | return "features_reply" |
| 2955 | case OFPTGetConfigRequest: |
| 2956 | return "get_config_request" |
| 2957 | case OFPTGetConfigReply: |
| 2958 | return "get_config_reply" |
| 2959 | case OFPTSetConfig: |
| 2960 | return "set_config" |
| 2961 | case OFPTPacketIn: |
| 2962 | return "packet_in" |
| 2963 | case OFPTFlowRemoved: |
| 2964 | return "flow_removed" |
| 2965 | case OFPTPortStatus: |
| 2966 | return "port_status" |
| 2967 | case OFPTPacketOut: |
| 2968 | return "packet_out" |
| 2969 | case OFPTFlowMod: |
| 2970 | return "flow_mod" |
| 2971 | case OFPTGroupMod: |
| 2972 | return "group_mod" |
| 2973 | case OFPTPortMod: |
| 2974 | return "port_mod" |
| 2975 | case OFPTTableMod: |
| 2976 | return "table_mod" |
| 2977 | case OFPTStatsRequest: |
| 2978 | return "stats_request" |
| 2979 | case OFPTStatsReply: |
| 2980 | return "stats_reply" |
| 2981 | case OFPTBarrierRequest: |
| 2982 | return "barrier_request" |
| 2983 | case OFPTBarrierReply: |
| 2984 | return "barrier_reply" |
| 2985 | case OFPTQueueGetConfigRequest: |
| 2986 | return "queue_get_config_request" |
| 2987 | case OFPTQueueGetConfigReply: |
| 2988 | return "queue_get_config_reply" |
| 2989 | case OFPTRoleRequest: |
| 2990 | return "role_request" |
| 2991 | case OFPTRoleReply: |
| 2992 | return "role_reply" |
| 2993 | case OFPTGetAsyncRequest: |
| 2994 | return "get_async_request" |
| 2995 | case OFPTGetAsyncReply: |
| 2996 | return "get_async_reply" |
| 2997 | case OFPTSetAsync: |
| 2998 | return "set_async" |
| 2999 | case OFPTMeterMod: |
| 3000 | return "meter_mod" |
| 3001 | default: |
| 3002 | return fmt.Sprintf("%d", self) |
| 3003 | } |
| 3004 | } |
| 3005 | |
| 3006 | const ( |
| 3007 | // Identifiers from group ofp_vlan_id |
| 3008 | OFPVIDNone = 0 // OFPVID_NONE |
| 3009 | OFPVIDPresent = 4096 // OFPVID_PRESENT |
| 3010 | ) |
| 3011 | |
| 3012 | type VlanId uint16 |
| 3013 | |
| 3014 | func (self VlanId) MarshalJSON() ([]byte, error) { |
| 3015 | return []byte(fmt.Sprintf("%d", self)), nil |
| 3016 | } |