Jonathan Hart | 44bdbfc | 2020-04-14 17:45:47 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 3 | * Copyright (c) 2011, 2012 Open Networking Foundation |
| 4 | * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler. |
| 5 | * Copyright 2018, Red Hat, Inc. |
| 6 | */ |
| 7 | // Automatically generated by LOXI from template module.go |
| 8 | // Do not modify |
| 9 | |
| 10 | package of10 |
| 11 | |
| 12 | import ( |
| 13 | "bytes" |
| 14 | "encoding/binary" |
| 15 | "encoding/json" |
| 16 | "fmt" |
| 17 | "net" |
| 18 | |
| 19 | "github.com/opencord/goloxi" |
| 20 | ) |
| 21 | |
| 22 | type Action struct { |
| 23 | Type uint16 |
| 24 | Len uint16 |
| 25 | } |
| 26 | |
| 27 | type IAction interface { |
| 28 | goloxi.Serializable |
| 29 | GetType() uint16 |
| 30 | GetLen() uint16 |
| 31 | GetActionName() string |
| 32 | GetActionFields() map[string]interface{} |
| 33 | } |
| 34 | |
| 35 | func (self *Action) GetType() uint16 { |
| 36 | return self.Type |
| 37 | } |
| 38 | |
| 39 | func (self *Action) SetType(v uint16) { |
| 40 | self.Type = v |
| 41 | } |
| 42 | |
| 43 | func (self *Action) GetLen() uint16 { |
| 44 | return self.Len |
| 45 | } |
| 46 | |
| 47 | func (self *Action) SetLen(v uint16) { |
| 48 | self.Len = v |
| 49 | } |
| 50 | |
| 51 | func (self *Action) Serialize(encoder *goloxi.Encoder) error { |
| 52 | |
| 53 | encoder.PutUint16(uint16(self.Type)) |
| 54 | encoder.PutUint16(uint16(self.Len)) |
| 55 | |
| 56 | return nil |
| 57 | } |
| 58 | |
| 59 | func DecodeAction(decoder *goloxi.Decoder) (goloxi.IAction, error) { |
| 60 | _action := &Action{} |
| 61 | if decoder.Length() < 4 { |
| 62 | return nil, fmt.Errorf("Action packet too short: %d < 4", decoder.Length()) |
| 63 | } |
| 64 | _action.Type = uint16(decoder.ReadUint16()) |
| 65 | _action.Len = uint16(decoder.ReadUint16()) |
| 66 | oldDecoder := decoder |
| 67 | defer func() { decoder = oldDecoder }() |
| 68 | decoder = decoder.SliceDecoder(int(_action.Len), 2+2) |
| 69 | |
| 70 | switch _action.Type { |
| 71 | case 0: |
| 72 | return DecodeActionOutput(_action, decoder) |
| 73 | case 1: |
| 74 | return DecodeActionSetVlanVid(_action, decoder) |
| 75 | case 2: |
| 76 | return DecodeActionSetVlanPcp(_action, decoder) |
| 77 | case 3: |
| 78 | return DecodeActionStripVlan(_action, decoder) |
| 79 | case 4: |
| 80 | return DecodeActionSetDlSrc(_action, decoder) |
| 81 | case 5: |
| 82 | return DecodeActionSetDlDst(_action, decoder) |
| 83 | case 6: |
| 84 | return DecodeActionSetNwSrc(_action, decoder) |
| 85 | case 7: |
| 86 | return DecodeActionSetNwDst(_action, decoder) |
| 87 | case 8: |
| 88 | return DecodeActionSetNwTos(_action, decoder) |
| 89 | case 9: |
| 90 | return DecodeActionSetTpSrc(_action, decoder) |
| 91 | case 10: |
| 92 | return DecodeActionSetTpDst(_action, decoder) |
| 93 | case 11: |
| 94 | return DecodeActionEnqueue(_action, decoder) |
| 95 | case 65535: |
| 96 | return DecodeActionExperimenter(_action, decoder) |
| 97 | default: |
| 98 | return nil, fmt.Errorf("Invalid type '%d' for 'Action'", _action.Type) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func NewAction(_type uint16) *Action { |
| 103 | obj := &Action{} |
| 104 | obj.Type = _type |
| 105 | return obj |
| 106 | } |
| 107 | |
| 108 | type ActionExperimenter struct { |
| 109 | *Action |
| 110 | Experimenter uint32 |
| 111 | } |
| 112 | |
| 113 | type IActionExperimenter interface { |
| 114 | goloxi.IAction |
| 115 | GetExperimenter() uint32 |
| 116 | } |
| 117 | |
| 118 | func (self *ActionExperimenter) GetExperimenter() uint32 { |
| 119 | return self.Experimenter |
| 120 | } |
| 121 | |
| 122 | func (self *ActionExperimenter) SetExperimenter(v uint32) { |
| 123 | self.Experimenter = v |
| 124 | } |
| 125 | |
| 126 | func (self *ActionExperimenter) Serialize(encoder *goloxi.Encoder) error { |
| 127 | if err := self.Action.Serialize(encoder); err != nil { |
| 128 | return err |
| 129 | } |
| 130 | |
| 131 | encoder.PutUint32(uint32(self.Experimenter)) |
| 132 | |
| 133 | return nil |
| 134 | } |
| 135 | |
| 136 | func DecodeActionExperimenter(parent *Action, decoder *goloxi.Decoder) (IActionExperimenter, error) { |
| 137 | _actionexperimenter := &ActionExperimenter{Action: parent} |
| 138 | if decoder.Length() < 4 { |
| 139 | return nil, fmt.Errorf("ActionExperimenter packet too short: %d < 4", decoder.Length()) |
| 140 | } |
| 141 | _actionexperimenter.Experimenter = uint32(decoder.ReadUint32()) |
| 142 | |
| 143 | switch _actionexperimenter.Experimenter { |
| 144 | case 8992: |
| 145 | return DecodeActionNicira(_actionexperimenter, decoder) |
| 146 | case 6035143: |
| 147 | return DecodeActionBsn(_actionexperimenter, decoder) |
| 148 | default: |
| 149 | return nil, fmt.Errorf("Invalid type '%d' for 'ActionExperimenter'", _actionexperimenter.Experimenter) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | func NewActionExperimenter(_experimenter uint32) *ActionExperimenter { |
| 154 | obj := &ActionExperimenter{ |
| 155 | Action: NewAction(65535), |
| 156 | } |
| 157 | obj.Experimenter = _experimenter |
| 158 | return obj |
| 159 | } |
| 160 | func (self *ActionExperimenter) GetActionName() string { |
| 161 | return "experimenter" |
| 162 | } |
| 163 | |
| 164 | func (self *ActionExperimenter) GetActionFields() map[string]interface{} { |
| 165 | return map[string]interface{}{ |
| 166 | "Experimenter": self.Experimenter, |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func (self *ActionExperimenter) MarshalJSON() ([]byte, error) { |
| 171 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 172 | if err != nil { |
| 173 | return nil, err |
| 174 | } |
| 175 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 176 | } |
| 177 | |
| 178 | type ActionBsn struct { |
| 179 | *ActionExperimenter |
| 180 | Subtype uint32 |
| 181 | } |
| 182 | |
| 183 | type IActionBsn interface { |
| 184 | IActionExperimenter |
| 185 | GetSubtype() uint32 |
| 186 | } |
| 187 | |
| 188 | func (self *ActionBsn) GetSubtype() uint32 { |
| 189 | return self.Subtype |
| 190 | } |
| 191 | |
| 192 | func (self *ActionBsn) SetSubtype(v uint32) { |
| 193 | self.Subtype = v |
| 194 | } |
| 195 | |
| 196 | func (self *ActionBsn) Serialize(encoder *goloxi.Encoder) error { |
| 197 | if err := self.ActionExperimenter.Serialize(encoder); err != nil { |
| 198 | return err |
| 199 | } |
| 200 | |
| 201 | encoder.PutUint32(uint32(self.Subtype)) |
| 202 | |
| 203 | return nil |
| 204 | } |
| 205 | |
| 206 | func DecodeActionBsn(parent *ActionExperimenter, decoder *goloxi.Decoder) (IActionBsn, error) { |
| 207 | _actionbsn := &ActionBsn{ActionExperimenter: parent} |
| 208 | if decoder.Length() < 4 { |
| 209 | return nil, fmt.Errorf("ActionBsn packet too short: %d < 4", decoder.Length()) |
| 210 | } |
| 211 | _actionbsn.Subtype = uint32(decoder.ReadUint32()) |
| 212 | |
| 213 | switch _actionbsn.Subtype { |
| 214 | case 1: |
| 215 | return DecodeActionBsnMirror(_actionbsn, decoder) |
| 216 | case 2: |
| 217 | return DecodeActionBsnSetTunnelDst(_actionbsn, decoder) |
| 218 | case 4: |
| 219 | return DecodeActionBsnChecksum(_actionbsn, decoder) |
| 220 | default: |
| 221 | return nil, fmt.Errorf("Invalid type '%d' for 'ActionBsn'", _actionbsn.Subtype) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func NewActionBsn(_subtype uint32) *ActionBsn { |
| 226 | obj := &ActionBsn{ |
| 227 | ActionExperimenter: NewActionExperimenter(6035143), |
| 228 | } |
| 229 | obj.Subtype = _subtype |
| 230 | return obj |
| 231 | } |
| 232 | func (self *ActionBsn) GetActionName() string { |
| 233 | return "bsn" |
| 234 | } |
| 235 | |
| 236 | func (self *ActionBsn) GetActionFields() map[string]interface{} { |
| 237 | return map[string]interface{}{ |
| 238 | "Subtype": self.Subtype, |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | func (self *ActionBsn) MarshalJSON() ([]byte, error) { |
| 243 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 244 | if err != nil { |
| 245 | return nil, err |
| 246 | } |
| 247 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 248 | } |
| 249 | |
| 250 | type ActionBsnChecksum struct { |
| 251 | *ActionBsn |
| 252 | Checksum Checksum128 |
| 253 | } |
| 254 | |
| 255 | type IActionBsnChecksum interface { |
| 256 | IActionBsn |
| 257 | GetChecksum() Checksum128 |
| 258 | } |
| 259 | |
| 260 | func (self *ActionBsnChecksum) GetChecksum() Checksum128 { |
| 261 | return self.Checksum |
| 262 | } |
| 263 | |
| 264 | func (self *ActionBsnChecksum) SetChecksum(v Checksum128) { |
| 265 | self.Checksum = v |
| 266 | } |
| 267 | |
| 268 | func (self *ActionBsnChecksum) Serialize(encoder *goloxi.Encoder) error { |
| 269 | startIndex := len(encoder.Bytes()) |
| 270 | if err := self.ActionBsn.Serialize(encoder); err != nil { |
| 271 | return err |
| 272 | } |
| 273 | |
| 274 | self.Checksum.Serialize(encoder) |
| 275 | length := len(encoder.Bytes()) - startIndex |
| 276 | |
| 277 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 278 | |
| 279 | return nil |
| 280 | } |
| 281 | |
| 282 | func DecodeActionBsnChecksum(parent *ActionBsn, decoder *goloxi.Decoder) (*ActionBsnChecksum, error) { |
| 283 | _actionbsnchecksum := &ActionBsnChecksum{ActionBsn: parent} |
| 284 | if decoder.Length() < 16 { |
| 285 | return nil, fmt.Errorf("ActionBsnChecksum packet too short: %d < 16", decoder.Length()) |
| 286 | } |
| 287 | _actionbsnchecksum.Checksum.Decode(decoder) |
| 288 | return _actionbsnchecksum, nil |
| 289 | } |
| 290 | |
| 291 | func NewActionBsnChecksum() *ActionBsnChecksum { |
| 292 | obj := &ActionBsnChecksum{ |
| 293 | ActionBsn: NewActionBsn(4), |
| 294 | } |
| 295 | return obj |
| 296 | } |
| 297 | func (self *ActionBsnChecksum) GetActionName() string { |
| 298 | return "bsn_checksum" |
| 299 | } |
| 300 | |
| 301 | func (self *ActionBsnChecksum) GetActionFields() map[string]interface{} { |
| 302 | return map[string]interface{}{ |
| 303 | "Checksum": self.Checksum, |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | func (self *ActionBsnChecksum) MarshalJSON() ([]byte, error) { |
| 308 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 309 | if err != nil { |
| 310 | return nil, err |
| 311 | } |
| 312 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 313 | } |
| 314 | |
| 315 | type ActionBsnMirror struct { |
| 316 | *ActionBsn |
| 317 | DestPort uint32 |
| 318 | VlanTag uint32 |
| 319 | CopyStage uint8 |
| 320 | } |
| 321 | |
| 322 | type IActionBsnMirror interface { |
| 323 | IActionBsn |
| 324 | GetDestPort() uint32 |
| 325 | GetVlanTag() uint32 |
| 326 | GetCopyStage() uint8 |
| 327 | } |
| 328 | |
| 329 | func (self *ActionBsnMirror) GetDestPort() uint32 { |
| 330 | return self.DestPort |
| 331 | } |
| 332 | |
| 333 | func (self *ActionBsnMirror) SetDestPort(v uint32) { |
| 334 | self.DestPort = v |
| 335 | } |
| 336 | |
| 337 | func (self *ActionBsnMirror) GetVlanTag() uint32 { |
| 338 | return self.VlanTag |
| 339 | } |
| 340 | |
| 341 | func (self *ActionBsnMirror) SetVlanTag(v uint32) { |
| 342 | self.VlanTag = v |
| 343 | } |
| 344 | |
| 345 | func (self *ActionBsnMirror) GetCopyStage() uint8 { |
| 346 | return self.CopyStage |
| 347 | } |
| 348 | |
| 349 | func (self *ActionBsnMirror) SetCopyStage(v uint8) { |
| 350 | self.CopyStage = v |
| 351 | } |
| 352 | |
| 353 | func (self *ActionBsnMirror) Serialize(encoder *goloxi.Encoder) error { |
| 354 | startIndex := len(encoder.Bytes()) |
| 355 | if err := self.ActionBsn.Serialize(encoder); err != nil { |
| 356 | return err |
| 357 | } |
| 358 | |
| 359 | encoder.PutUint32(uint32(self.DestPort)) |
| 360 | encoder.PutUint32(uint32(self.VlanTag)) |
| 361 | encoder.PutUint8(uint8(self.CopyStage)) |
| 362 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 363 | length := len(encoder.Bytes()) - startIndex |
| 364 | |
| 365 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 366 | |
| 367 | return nil |
| 368 | } |
| 369 | |
| 370 | func DecodeActionBsnMirror(parent *ActionBsn, decoder *goloxi.Decoder) (*ActionBsnMirror, error) { |
| 371 | _actionbsnmirror := &ActionBsnMirror{ActionBsn: parent} |
| 372 | if decoder.Length() < 12 { |
| 373 | return nil, fmt.Errorf("ActionBsnMirror packet too short: %d < 12", decoder.Length()) |
| 374 | } |
| 375 | _actionbsnmirror.DestPort = uint32(decoder.ReadUint32()) |
| 376 | _actionbsnmirror.VlanTag = uint32(decoder.ReadUint32()) |
| 377 | _actionbsnmirror.CopyStage = uint8(decoder.ReadByte()) |
| 378 | decoder.Skip(3) |
| 379 | return _actionbsnmirror, nil |
| 380 | } |
| 381 | |
| 382 | func NewActionBsnMirror() *ActionBsnMirror { |
| 383 | obj := &ActionBsnMirror{ |
| 384 | ActionBsn: NewActionBsn(1), |
| 385 | } |
| 386 | return obj |
| 387 | } |
| 388 | func (self *ActionBsnMirror) GetActionName() string { |
| 389 | return "bsn_mirror" |
| 390 | } |
| 391 | |
| 392 | func (self *ActionBsnMirror) GetActionFields() map[string]interface{} { |
| 393 | return map[string]interface{}{ |
| 394 | "DestPort": self.DestPort, |
| 395 | "VlanTag": self.VlanTag, |
| 396 | "CopyStage": self.CopyStage, |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | func (self *ActionBsnMirror) MarshalJSON() ([]byte, error) { |
| 401 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 402 | if err != nil { |
| 403 | return nil, err |
| 404 | } |
| 405 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 406 | } |
| 407 | |
| 408 | type ActionBsnSetTunnelDst struct { |
| 409 | *ActionBsn |
| 410 | Dst uint32 |
| 411 | } |
| 412 | |
| 413 | type IActionBsnSetTunnelDst interface { |
| 414 | IActionBsn |
| 415 | GetDst() uint32 |
| 416 | } |
| 417 | |
| 418 | func (self *ActionBsnSetTunnelDst) GetDst() uint32 { |
| 419 | return self.Dst |
| 420 | } |
| 421 | |
| 422 | func (self *ActionBsnSetTunnelDst) SetDst(v uint32) { |
| 423 | self.Dst = v |
| 424 | } |
| 425 | |
| 426 | func (self *ActionBsnSetTunnelDst) Serialize(encoder *goloxi.Encoder) error { |
| 427 | startIndex := len(encoder.Bytes()) |
| 428 | if err := self.ActionBsn.Serialize(encoder); err != nil { |
| 429 | return err |
| 430 | } |
| 431 | |
| 432 | encoder.PutUint32(uint32(self.Dst)) |
| 433 | length := len(encoder.Bytes()) - startIndex |
| 434 | |
| 435 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 436 | |
| 437 | return nil |
| 438 | } |
| 439 | |
| 440 | func DecodeActionBsnSetTunnelDst(parent *ActionBsn, decoder *goloxi.Decoder) (*ActionBsnSetTunnelDst, error) { |
| 441 | _actionbsnsettunneldst := &ActionBsnSetTunnelDst{ActionBsn: parent} |
| 442 | if decoder.Length() < 4 { |
| 443 | return nil, fmt.Errorf("ActionBsnSetTunnelDst packet too short: %d < 4", decoder.Length()) |
| 444 | } |
| 445 | _actionbsnsettunneldst.Dst = uint32(decoder.ReadUint32()) |
| 446 | return _actionbsnsettunneldst, nil |
| 447 | } |
| 448 | |
| 449 | func NewActionBsnSetTunnelDst() *ActionBsnSetTunnelDst { |
| 450 | obj := &ActionBsnSetTunnelDst{ |
| 451 | ActionBsn: NewActionBsn(2), |
| 452 | } |
| 453 | return obj |
| 454 | } |
| 455 | func (self *ActionBsnSetTunnelDst) GetActionName() string { |
| 456 | return "bsn_set_tunnel_dst" |
| 457 | } |
| 458 | |
| 459 | func (self *ActionBsnSetTunnelDst) GetActionFields() map[string]interface{} { |
| 460 | return map[string]interface{}{ |
| 461 | "Dst": self.Dst, |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | func (self *ActionBsnSetTunnelDst) MarshalJSON() ([]byte, error) { |
| 466 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 467 | if err != nil { |
| 468 | return nil, err |
| 469 | } |
| 470 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 471 | } |
| 472 | |
| 473 | type ActionEnqueue struct { |
| 474 | *Action |
| 475 | Port Port |
| 476 | QueueId uint32 |
| 477 | } |
| 478 | |
| 479 | type IActionEnqueue interface { |
| 480 | goloxi.IAction |
| 481 | GetPort() Port |
| 482 | GetQueueId() uint32 |
| 483 | } |
| 484 | |
| 485 | func (self *ActionEnqueue) GetPort() Port { |
| 486 | return self.Port |
| 487 | } |
| 488 | |
| 489 | func (self *ActionEnqueue) SetPort(v Port) { |
| 490 | self.Port = v |
| 491 | } |
| 492 | |
| 493 | func (self *ActionEnqueue) GetQueueId() uint32 { |
| 494 | return self.QueueId |
| 495 | } |
| 496 | |
| 497 | func (self *ActionEnqueue) SetQueueId(v uint32) { |
| 498 | self.QueueId = v |
| 499 | } |
| 500 | |
| 501 | func (self *ActionEnqueue) Serialize(encoder *goloxi.Encoder) error { |
| 502 | startIndex := len(encoder.Bytes()) |
| 503 | if err := self.Action.Serialize(encoder); err != nil { |
| 504 | return err |
| 505 | } |
| 506 | |
| 507 | self.Port.Serialize(encoder) |
| 508 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 509 | encoder.PutUint32(uint32(self.QueueId)) |
| 510 | length := len(encoder.Bytes()) - startIndex |
| 511 | |
| 512 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 513 | |
| 514 | return nil |
| 515 | } |
| 516 | |
| 517 | func DecodeActionEnqueue(parent *Action, decoder *goloxi.Decoder) (*ActionEnqueue, error) { |
| 518 | _actionenqueue := &ActionEnqueue{Action: parent} |
| 519 | if decoder.Length() < 12 { |
| 520 | return nil, fmt.Errorf("ActionEnqueue packet too short: %d < 12", decoder.Length()) |
| 521 | } |
| 522 | _actionenqueue.Port.Decode(decoder) |
| 523 | decoder.Skip(6) |
| 524 | _actionenqueue.QueueId = uint32(decoder.ReadUint32()) |
| 525 | return _actionenqueue, nil |
| 526 | } |
| 527 | |
| 528 | func NewActionEnqueue() *ActionEnqueue { |
| 529 | obj := &ActionEnqueue{ |
| 530 | Action: NewAction(11), |
| 531 | } |
| 532 | return obj |
| 533 | } |
| 534 | func (self *ActionEnqueue) GetActionName() string { |
| 535 | return "enqueue" |
| 536 | } |
| 537 | |
| 538 | func (self *ActionEnqueue) GetActionFields() map[string]interface{} { |
| 539 | return map[string]interface{}{ |
| 540 | "Port": self.Port, |
| 541 | "QueueId": self.QueueId, |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | func (self *ActionEnqueue) MarshalJSON() ([]byte, error) { |
| 546 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 547 | if err != nil { |
| 548 | return nil, err |
| 549 | } |
| 550 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 551 | } |
| 552 | |
| 553 | type ActionNicira struct { |
| 554 | *ActionExperimenter |
| 555 | Subtype uint16 |
| 556 | } |
| 557 | |
| 558 | type IActionNicira interface { |
| 559 | IActionExperimenter |
| 560 | GetSubtype() uint16 |
| 561 | } |
| 562 | |
| 563 | func (self *ActionNicira) GetSubtype() uint16 { |
| 564 | return self.Subtype |
| 565 | } |
| 566 | |
| 567 | func (self *ActionNicira) SetSubtype(v uint16) { |
| 568 | self.Subtype = v |
| 569 | } |
| 570 | |
| 571 | func (self *ActionNicira) Serialize(encoder *goloxi.Encoder) error { |
| 572 | if err := self.ActionExperimenter.Serialize(encoder); err != nil { |
| 573 | return err |
| 574 | } |
| 575 | |
| 576 | encoder.PutUint16(uint16(self.Subtype)) |
| 577 | |
| 578 | return nil |
| 579 | } |
| 580 | |
| 581 | func DecodeActionNicira(parent *ActionExperimenter, decoder *goloxi.Decoder) (IActionNicira, error) { |
| 582 | _actionnicira := &ActionNicira{ActionExperimenter: parent} |
| 583 | if decoder.Length() < 2 { |
| 584 | return nil, fmt.Errorf("ActionNicira packet too short: %d < 2", decoder.Length()) |
| 585 | } |
| 586 | _actionnicira.Subtype = uint16(decoder.ReadUint16()) |
| 587 | |
| 588 | switch _actionnicira.Subtype { |
| 589 | case 1: |
| 590 | return DecodeActionNxResubmit(_actionnicira, decoder) |
| 591 | case 2: |
| 592 | return DecodeActionNxSetTunnel(_actionnicira, decoder) |
| 593 | case 4: |
| 594 | return DecodeActionNxSetQueue(_actionnicira, decoder) |
| 595 | case 5: |
| 596 | return DecodeActionNxPopQueue(_actionnicira, decoder) |
| 597 | case 6: |
| 598 | return DecodeActionNxRegMove(_actionnicira, decoder) |
| 599 | case 7: |
| 600 | return DecodeActionNxRegLoad(_actionnicira, decoder) |
| 601 | case 8: |
| 602 | return DecodeActionNxNote(_actionnicira, decoder) |
| 603 | case 9: |
| 604 | return DecodeActionNxSetTunnel64(_actionnicira, decoder) |
| 605 | case 10: |
| 606 | return DecodeActionNxMultipath(_actionnicira, decoder) |
| 607 | case 12: |
| 608 | return DecodeActionNxBundle(_actionnicira, decoder) |
| 609 | case 13: |
| 610 | return DecodeActionNxBundleLoadInPort(_actionnicira, decoder) |
| 611 | case 14: |
| 612 | return DecodeActionResubmit(_actionnicira, decoder) |
| 613 | case 15: |
| 614 | return DecodeActionNxOutputReg(_actionnicira, decoder) |
| 615 | case 16: |
| 616 | return DecodeActionNxLearn(_actionnicira, decoder) |
| 617 | case 17: |
| 618 | return DecodeActionNxExit(_actionnicira, decoder) |
| 619 | case 18: |
| 620 | return DecodeActionNiciraDecTtl(_actionnicira, decoder) |
| 621 | case 19: |
| 622 | return DecodeActionNxFinTimeout(_actionnicira, decoder) |
| 623 | case 20: |
| 624 | return DecodeActionNxController(_actionnicira, decoder) |
| 625 | case 21: |
| 626 | return DecodeActionNxDecTtlCntIds(_actionnicira, decoder) |
| 627 | case 22: |
| 628 | return DecodeActionNxWriteMetadata(_actionnicira, decoder) |
| 629 | case 23: |
| 630 | return DecodeActionNxPushMpls(_actionnicira, decoder) |
| 631 | case 24: |
| 632 | return DecodeActionNxPopMpls(_actionnicira, decoder) |
| 633 | case 25: |
| 634 | return DecodeActionNxSetMplsTtl(_actionnicira, decoder) |
| 635 | case 26: |
| 636 | return DecodeActionNxDecMplsTtl(_actionnicira, decoder) |
| 637 | case 27: |
| 638 | return DecodeActionNxStackPush(_actionnicira, decoder) |
| 639 | case 28: |
| 640 | return DecodeActionNxStackPop(_actionnicira, decoder) |
| 641 | case 29: |
| 642 | return DecodeActionNxSample(_actionnicira, decoder) |
| 643 | case 30: |
| 644 | return DecodeActionNxSetMplsLabel(_actionnicira, decoder) |
| 645 | case 31: |
| 646 | return DecodeActionNxSetMplsTc(_actionnicira, decoder) |
| 647 | case 32: |
| 648 | return DecodeActionNxOutputReg2(_actionnicira, decoder) |
| 649 | case 33: |
| 650 | return DecodeActionNxRegLoad2(_actionnicira, decoder) |
| 651 | case 34: |
| 652 | return DecodeActionNxConjunction(_actionnicira, decoder) |
| 653 | case 35: |
| 654 | return DecodeActionNxCt(_actionnicira, decoder) |
| 655 | case 36: |
| 656 | return DecodeActionNxNat(_actionnicira, decoder) |
| 657 | case 37: |
| 658 | return DecodeActionNxController2(_actionnicira, decoder) |
| 659 | case 38: |
| 660 | return DecodeActionNxSample2(_actionnicira, decoder) |
| 661 | case 39: |
| 662 | return DecodeActionNxOutputTrunc(_actionnicira, decoder) |
| 663 | case 40: |
| 664 | return DecodeActionNxGroup(_actionnicira, decoder) |
| 665 | case 41: |
| 666 | return DecodeActionNxSample3(_actionnicira, decoder) |
| 667 | case 42: |
| 668 | return DecodeActionNxClone(_actionnicira, decoder) |
| 669 | case 43: |
| 670 | return DecodeActionNxCtClear(_actionnicira, decoder) |
| 671 | case 44: |
| 672 | return DecodeActionNxResubmitTableCt(_actionnicira, decoder) |
| 673 | case 45: |
| 674 | return DecodeActionNxLearn2(_actionnicira, decoder) |
| 675 | case 46: |
| 676 | return DecodeActionNxEncap(_actionnicira, decoder) |
| 677 | case 47: |
| 678 | return DecodeActionNxDecap(_actionnicira, decoder) |
| 679 | case 48: |
| 680 | return DecodeActionNxDecNshTtl(_actionnicira, decoder) |
| 681 | case 254: |
| 682 | return DecodeActionNxDebugSlow(_actionnicira, decoder) |
| 683 | case 255: |
| 684 | return DecodeActionNxDebugRecirc(_actionnicira, decoder) |
| 685 | default: |
| 686 | return nil, fmt.Errorf("Invalid type '%d' for 'ActionNicira'", _actionnicira.Subtype) |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | func NewActionNicira(_subtype uint16) *ActionNicira { |
| 691 | obj := &ActionNicira{ |
| 692 | ActionExperimenter: NewActionExperimenter(8992), |
| 693 | } |
| 694 | obj.Subtype = _subtype |
| 695 | return obj |
| 696 | } |
| 697 | func (self *ActionNicira) GetActionName() string { |
| 698 | return "nicira" |
| 699 | } |
| 700 | |
| 701 | func (self *ActionNicira) GetActionFields() map[string]interface{} { |
| 702 | return map[string]interface{}{ |
| 703 | "Subtype": self.Subtype, |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | func (self *ActionNicira) MarshalJSON() ([]byte, error) { |
| 708 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 709 | if err != nil { |
| 710 | return nil, err |
| 711 | } |
| 712 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 713 | } |
| 714 | |
| 715 | type ActionNiciraDecTtl struct { |
| 716 | *ActionNicira |
| 717 | } |
| 718 | |
| 719 | type IActionNiciraDecTtl interface { |
| 720 | IActionNicira |
| 721 | } |
| 722 | |
| 723 | func (self *ActionNiciraDecTtl) Serialize(encoder *goloxi.Encoder) error { |
| 724 | startIndex := len(encoder.Bytes()) |
| 725 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 726 | return err |
| 727 | } |
| 728 | |
| 729 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 730 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 731 | length := len(encoder.Bytes()) - startIndex |
| 732 | |
| 733 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 734 | |
| 735 | return nil |
| 736 | } |
| 737 | |
| 738 | func DecodeActionNiciraDecTtl(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNiciraDecTtl, error) { |
| 739 | _actionniciradecttl := &ActionNiciraDecTtl{ActionNicira: parent} |
| 740 | if decoder.Length() < 6 { |
| 741 | return nil, fmt.Errorf("ActionNiciraDecTtl packet too short: %d < 6", decoder.Length()) |
| 742 | } |
| 743 | decoder.Skip(2) |
| 744 | decoder.Skip(4) |
| 745 | return _actionniciradecttl, nil |
| 746 | } |
| 747 | |
| 748 | func NewActionNiciraDecTtl() *ActionNiciraDecTtl { |
| 749 | obj := &ActionNiciraDecTtl{ |
| 750 | ActionNicira: NewActionNicira(18), |
| 751 | } |
| 752 | return obj |
| 753 | } |
| 754 | func (self *ActionNiciraDecTtl) GetActionName() string { |
| 755 | return "nicira_dec_ttl" |
| 756 | } |
| 757 | |
| 758 | func (self *ActionNiciraDecTtl) GetActionFields() map[string]interface{} { |
| 759 | return map[string]interface{}{} |
| 760 | } |
| 761 | |
| 762 | func (self *ActionNiciraDecTtl) MarshalJSON() ([]byte, error) { |
| 763 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 764 | if err != nil { |
| 765 | return nil, err |
| 766 | } |
| 767 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 768 | } |
| 769 | |
| 770 | type ActionNxBundle struct { |
| 771 | *ActionNicira |
| 772 | Algorithm uint16 |
| 773 | Fields NxHashFields |
| 774 | Basis uint16 |
| 775 | SlaveType ActionNxBundleSlaveType |
| 776 | NSlaves uint16 |
| 777 | OfsNbits uint16 |
| 778 | Dst goloxi.IOxmId |
| 779 | } |
| 780 | |
| 781 | type IActionNxBundle interface { |
| 782 | IActionNicira |
| 783 | GetAlgorithm() uint16 |
| 784 | GetFields() NxHashFields |
| 785 | GetBasis() uint16 |
| 786 | GetSlaveType() ActionNxBundleSlaveType |
| 787 | GetNSlaves() uint16 |
| 788 | GetOfsNbits() uint16 |
| 789 | GetDst() goloxi.IOxmId |
| 790 | } |
| 791 | |
| 792 | func (self *ActionNxBundle) GetAlgorithm() uint16 { |
| 793 | return self.Algorithm |
| 794 | } |
| 795 | |
| 796 | func (self *ActionNxBundle) SetAlgorithm(v uint16) { |
| 797 | self.Algorithm = v |
| 798 | } |
| 799 | |
| 800 | func (self *ActionNxBundle) GetFields() NxHashFields { |
| 801 | return self.Fields |
| 802 | } |
| 803 | |
| 804 | func (self *ActionNxBundle) SetFields(v NxHashFields) { |
| 805 | self.Fields = v |
| 806 | } |
| 807 | |
| 808 | func (self *ActionNxBundle) GetBasis() uint16 { |
| 809 | return self.Basis |
| 810 | } |
| 811 | |
| 812 | func (self *ActionNxBundle) SetBasis(v uint16) { |
| 813 | self.Basis = v |
| 814 | } |
| 815 | |
| 816 | func (self *ActionNxBundle) GetSlaveType() ActionNxBundleSlaveType { |
| 817 | return self.SlaveType |
| 818 | } |
| 819 | |
| 820 | func (self *ActionNxBundle) SetSlaveType(v ActionNxBundleSlaveType) { |
| 821 | self.SlaveType = v |
| 822 | } |
| 823 | |
| 824 | func (self *ActionNxBundle) GetNSlaves() uint16 { |
| 825 | return self.NSlaves |
| 826 | } |
| 827 | |
| 828 | func (self *ActionNxBundle) SetNSlaves(v uint16) { |
| 829 | self.NSlaves = v |
| 830 | } |
| 831 | |
| 832 | func (self *ActionNxBundle) GetOfsNbits() uint16 { |
| 833 | return self.OfsNbits |
| 834 | } |
| 835 | |
| 836 | func (self *ActionNxBundle) SetOfsNbits(v uint16) { |
| 837 | self.OfsNbits = v |
| 838 | } |
| 839 | |
| 840 | func (self *ActionNxBundle) GetDst() goloxi.IOxmId { |
| 841 | return self.Dst |
| 842 | } |
| 843 | |
| 844 | func (self *ActionNxBundle) SetDst(v goloxi.IOxmId) { |
| 845 | self.Dst = v |
| 846 | } |
| 847 | |
| 848 | func (self *ActionNxBundle) Serialize(encoder *goloxi.Encoder) error { |
| 849 | startIndex := len(encoder.Bytes()) |
| 850 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 851 | return err |
| 852 | } |
| 853 | |
| 854 | encoder.PutUint16(uint16(self.Algorithm)) |
| 855 | encoder.PutUint16(uint16(self.Fields)) |
| 856 | encoder.PutUint16(uint16(self.Basis)) |
| 857 | encoder.PutUint32(uint32(self.SlaveType)) |
| 858 | encoder.PutUint16(uint16(self.NSlaves)) |
| 859 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 860 | self.Dst.Serialize(encoder) |
| 861 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 862 | length := len(encoder.Bytes()) - startIndex |
| 863 | |
| 864 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 865 | |
| 866 | return nil |
| 867 | } |
| 868 | |
| 869 | func DecodeActionNxBundle(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxBundle, error) { |
| 870 | _actionnxbundle := &ActionNxBundle{ActionNicira: parent} |
| 871 | if decoder.Length() < 22 { |
| 872 | return nil, fmt.Errorf("ActionNxBundle packet too short: %d < 22", decoder.Length()) |
| 873 | } |
| 874 | _actionnxbundle.Algorithm = uint16(decoder.ReadUint16()) |
| 875 | _actionnxbundle.Fields = NxHashFields(decoder.ReadUint16()) |
| 876 | _actionnxbundle.Basis = uint16(decoder.ReadUint16()) |
| 877 | _actionnxbundle.SlaveType = ActionNxBundleSlaveType(decoder.ReadUint32()) |
| 878 | _actionnxbundle.NSlaves = uint16(decoder.ReadUint16()) |
| 879 | _actionnxbundle.OfsNbits = uint16(decoder.ReadUint16()) |
| 880 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 881 | return nil, err |
| 882 | } else { |
| 883 | _actionnxbundle.Dst = obj |
| 884 | } |
| 885 | |
| 886 | decoder.Skip(4) |
| 887 | return _actionnxbundle, nil |
| 888 | } |
| 889 | |
| 890 | func NewActionNxBundle() *ActionNxBundle { |
| 891 | obj := &ActionNxBundle{ |
| 892 | ActionNicira: NewActionNicira(12), |
| 893 | } |
| 894 | return obj |
| 895 | } |
| 896 | func (self *ActionNxBundle) GetActionName() string { |
| 897 | return "nx_bundle" |
| 898 | } |
| 899 | |
| 900 | func (self *ActionNxBundle) GetActionFields() map[string]interface{} { |
| 901 | return map[string]interface{}{ |
| 902 | "Algorithm": self.Algorithm, |
| 903 | "Fields": self.Fields, |
| 904 | "Basis": self.Basis, |
| 905 | "SlaveType": self.SlaveType, |
| 906 | "NSlaves": self.NSlaves, |
| 907 | "OfsNbits": self.OfsNbits, |
| 908 | "Dst": self.Dst, |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | func (self *ActionNxBundle) MarshalJSON() ([]byte, error) { |
| 913 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 914 | if err != nil { |
| 915 | return nil, err |
| 916 | } |
| 917 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 918 | } |
| 919 | |
| 920 | type ActionNxBundleLoad struct { |
| 921 | *ActionNicira |
| 922 | Algorithm NxBdAlgorithms |
| 923 | Fields NxHashFields |
| 924 | Basis uint16 |
| 925 | SlaveType ActionNxBundleSlaveType |
| 926 | NSlaves uint16 |
| 927 | OfsNbits uint16 |
| 928 | Dst goloxi.IOxmId |
| 929 | } |
| 930 | |
| 931 | type IActionNxBundleLoad interface { |
| 932 | IActionNicira |
| 933 | GetAlgorithm() NxBdAlgorithms |
| 934 | GetFields() NxHashFields |
| 935 | GetBasis() uint16 |
| 936 | GetSlaveType() ActionNxBundleSlaveType |
| 937 | GetNSlaves() uint16 |
| 938 | GetOfsNbits() uint16 |
| 939 | GetDst() goloxi.IOxmId |
| 940 | } |
| 941 | |
| 942 | func (self *ActionNxBundleLoad) GetAlgorithm() NxBdAlgorithms { |
| 943 | return self.Algorithm |
| 944 | } |
| 945 | |
| 946 | func (self *ActionNxBundleLoad) SetAlgorithm(v NxBdAlgorithms) { |
| 947 | self.Algorithm = v |
| 948 | } |
| 949 | |
| 950 | func (self *ActionNxBundleLoad) GetFields() NxHashFields { |
| 951 | return self.Fields |
| 952 | } |
| 953 | |
| 954 | func (self *ActionNxBundleLoad) SetFields(v NxHashFields) { |
| 955 | self.Fields = v |
| 956 | } |
| 957 | |
| 958 | func (self *ActionNxBundleLoad) GetBasis() uint16 { |
| 959 | return self.Basis |
| 960 | } |
| 961 | |
| 962 | func (self *ActionNxBundleLoad) SetBasis(v uint16) { |
| 963 | self.Basis = v |
| 964 | } |
| 965 | |
| 966 | func (self *ActionNxBundleLoad) GetSlaveType() ActionNxBundleSlaveType { |
| 967 | return self.SlaveType |
| 968 | } |
| 969 | |
| 970 | func (self *ActionNxBundleLoad) SetSlaveType(v ActionNxBundleSlaveType) { |
| 971 | self.SlaveType = v |
| 972 | } |
| 973 | |
| 974 | func (self *ActionNxBundleLoad) GetNSlaves() uint16 { |
| 975 | return self.NSlaves |
| 976 | } |
| 977 | |
| 978 | func (self *ActionNxBundleLoad) SetNSlaves(v uint16) { |
| 979 | self.NSlaves = v |
| 980 | } |
| 981 | |
| 982 | func (self *ActionNxBundleLoad) GetOfsNbits() uint16 { |
| 983 | return self.OfsNbits |
| 984 | } |
| 985 | |
| 986 | func (self *ActionNxBundleLoad) SetOfsNbits(v uint16) { |
| 987 | self.OfsNbits = v |
| 988 | } |
| 989 | |
| 990 | func (self *ActionNxBundleLoad) GetDst() goloxi.IOxmId { |
| 991 | return self.Dst |
| 992 | } |
| 993 | |
| 994 | func (self *ActionNxBundleLoad) SetDst(v goloxi.IOxmId) { |
| 995 | self.Dst = v |
| 996 | } |
| 997 | |
| 998 | func (self *ActionNxBundleLoad) Serialize(encoder *goloxi.Encoder) error { |
| 999 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1000 | return err |
| 1001 | } |
| 1002 | |
| 1003 | encoder.PutUint16(uint16(self.Algorithm)) |
| 1004 | encoder.PutUint16(uint16(self.Fields)) |
| 1005 | encoder.PutUint16(uint16(self.Basis)) |
| 1006 | encoder.PutUint32(uint32(self.SlaveType)) |
| 1007 | encoder.PutUint16(uint16(self.NSlaves)) |
| 1008 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 1009 | self.Dst.Serialize(encoder) |
| 1010 | |
| 1011 | return nil |
| 1012 | } |
| 1013 | |
| 1014 | func DecodeActionNxBundleLoad(parent *ActionNicira, decoder *goloxi.Decoder) (IActionNxBundleLoad, error) { |
| 1015 | _actionnxbundleload := &ActionNxBundleLoad{ActionNicira: parent} |
| 1016 | if decoder.Length() < 18 { |
| 1017 | return nil, fmt.Errorf("ActionNxBundleLoad packet too short: %d < 18", decoder.Length()) |
| 1018 | } |
| 1019 | _actionnxbundleload.Algorithm = NxBdAlgorithms(decoder.ReadUint16()) |
| 1020 | _actionnxbundleload.Fields = NxHashFields(decoder.ReadUint16()) |
| 1021 | _actionnxbundleload.Basis = uint16(decoder.ReadUint16()) |
| 1022 | _actionnxbundleload.SlaveType = ActionNxBundleSlaveType(decoder.ReadUint32()) |
| 1023 | _actionnxbundleload.NSlaves = uint16(decoder.ReadUint16()) |
| 1024 | _actionnxbundleload.OfsNbits = uint16(decoder.ReadUint16()) |
| 1025 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 1026 | return nil, err |
| 1027 | } else { |
| 1028 | _actionnxbundleload.Dst = obj |
| 1029 | } |
| 1030 | |
| 1031 | return _actionnxbundleload, nil |
| 1032 | } |
| 1033 | |
| 1034 | func NewActionNxBundleLoad(_slave_type ActionNxBundleSlaveType) *ActionNxBundleLoad { |
| 1035 | obj := &ActionNxBundleLoad{ |
| 1036 | ActionNicira: NewActionNicira(13), |
| 1037 | } |
| 1038 | obj.SlaveType = _slave_type |
| 1039 | return obj |
| 1040 | } |
| 1041 | func (self *ActionNxBundleLoad) GetActionName() string { |
| 1042 | return "nx_bundle_load" |
| 1043 | } |
| 1044 | |
| 1045 | func (self *ActionNxBundleLoad) GetActionFields() map[string]interface{} { |
| 1046 | return map[string]interface{}{ |
| 1047 | "Algorithm": self.Algorithm, |
| 1048 | "Fields": self.Fields, |
| 1049 | "Basis": self.Basis, |
| 1050 | "SlaveType": self.SlaveType, |
| 1051 | "NSlaves": self.NSlaves, |
| 1052 | "OfsNbits": self.OfsNbits, |
| 1053 | "Dst": self.Dst, |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | func (self *ActionNxBundleLoad) MarshalJSON() ([]byte, error) { |
| 1058 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1059 | if err != nil { |
| 1060 | return nil, err |
| 1061 | } |
| 1062 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1063 | } |
| 1064 | |
| 1065 | type ActionNxBundleLoadInPort struct { |
| 1066 | *ActionNicira |
| 1067 | Algorithm NxBdAlgorithms |
| 1068 | Fields NxHashFields |
| 1069 | Basis uint16 |
| 1070 | SlaveType ActionNxBundleSlaveType |
| 1071 | NSlaves uint16 |
| 1072 | OfsNbits uint16 |
| 1073 | Dst goloxi.IOxmId |
| 1074 | InPorts []*ActionNxBundleLoadSlave |
| 1075 | } |
| 1076 | |
| 1077 | type IActionNxBundleLoadInPort interface { |
| 1078 | IActionNicira |
| 1079 | GetAlgorithm() NxBdAlgorithms |
| 1080 | GetFields() NxHashFields |
| 1081 | GetBasis() uint16 |
| 1082 | GetSlaveType() ActionNxBundleSlaveType |
| 1083 | GetNSlaves() uint16 |
| 1084 | GetOfsNbits() uint16 |
| 1085 | GetDst() goloxi.IOxmId |
| 1086 | GetInPorts() []*ActionNxBundleLoadSlave |
| 1087 | } |
| 1088 | |
| 1089 | func (self *ActionNxBundleLoadInPort) GetAlgorithm() NxBdAlgorithms { |
| 1090 | return self.Algorithm |
| 1091 | } |
| 1092 | |
| 1093 | func (self *ActionNxBundleLoadInPort) SetAlgorithm(v NxBdAlgorithms) { |
| 1094 | self.Algorithm = v |
| 1095 | } |
| 1096 | |
| 1097 | func (self *ActionNxBundleLoadInPort) GetFields() NxHashFields { |
| 1098 | return self.Fields |
| 1099 | } |
| 1100 | |
| 1101 | func (self *ActionNxBundleLoadInPort) SetFields(v NxHashFields) { |
| 1102 | self.Fields = v |
| 1103 | } |
| 1104 | |
| 1105 | func (self *ActionNxBundleLoadInPort) GetBasis() uint16 { |
| 1106 | return self.Basis |
| 1107 | } |
| 1108 | |
| 1109 | func (self *ActionNxBundleLoadInPort) SetBasis(v uint16) { |
| 1110 | self.Basis = v |
| 1111 | } |
| 1112 | |
| 1113 | func (self *ActionNxBundleLoadInPort) GetSlaveType() ActionNxBundleSlaveType { |
| 1114 | return self.SlaveType |
| 1115 | } |
| 1116 | |
| 1117 | func (self *ActionNxBundleLoadInPort) SetSlaveType(v ActionNxBundleSlaveType) { |
| 1118 | self.SlaveType = v |
| 1119 | } |
| 1120 | |
| 1121 | func (self *ActionNxBundleLoadInPort) GetNSlaves() uint16 { |
| 1122 | return self.NSlaves |
| 1123 | } |
| 1124 | |
| 1125 | func (self *ActionNxBundleLoadInPort) SetNSlaves(v uint16) { |
| 1126 | self.NSlaves = v |
| 1127 | } |
| 1128 | |
| 1129 | func (self *ActionNxBundleLoadInPort) GetOfsNbits() uint16 { |
| 1130 | return self.OfsNbits |
| 1131 | } |
| 1132 | |
| 1133 | func (self *ActionNxBundleLoadInPort) SetOfsNbits(v uint16) { |
| 1134 | self.OfsNbits = v |
| 1135 | } |
| 1136 | |
| 1137 | func (self *ActionNxBundleLoadInPort) GetDst() goloxi.IOxmId { |
| 1138 | return self.Dst |
| 1139 | } |
| 1140 | |
| 1141 | func (self *ActionNxBundleLoadInPort) SetDst(v goloxi.IOxmId) { |
| 1142 | self.Dst = v |
| 1143 | } |
| 1144 | |
| 1145 | func (self *ActionNxBundleLoadInPort) GetInPorts() []*ActionNxBundleLoadSlave { |
| 1146 | return self.InPorts |
| 1147 | } |
| 1148 | |
| 1149 | func (self *ActionNxBundleLoadInPort) SetInPorts(v []*ActionNxBundleLoadSlave) { |
| 1150 | self.InPorts = v |
| 1151 | } |
| 1152 | |
| 1153 | func (self *ActionNxBundleLoadInPort) Serialize(encoder *goloxi.Encoder) error { |
| 1154 | startIndex := len(encoder.Bytes()) |
| 1155 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1156 | return err |
| 1157 | } |
| 1158 | |
| 1159 | encoder.PutUint16(uint16(self.Algorithm)) |
| 1160 | encoder.PutUint16(uint16(self.Fields)) |
| 1161 | encoder.PutUint16(uint16(self.Basis)) |
| 1162 | encoder.PutUint32(uint32(self.SlaveType)) |
| 1163 | encoder.PutUint16(uint16(self.NSlaves)) |
| 1164 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 1165 | self.Dst.Serialize(encoder) |
| 1166 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 1167 | for _, obj := range self.InPorts { |
| 1168 | if err := obj.Serialize(encoder); err != nil { |
| 1169 | return err |
| 1170 | } |
| 1171 | } |
| 1172 | length := len(encoder.Bytes()) - startIndex |
| 1173 | |
| 1174 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1175 | |
| 1176 | return nil |
| 1177 | } |
| 1178 | |
| 1179 | func DecodeActionNxBundleLoadInPort(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxBundleLoadInPort, error) { |
| 1180 | _actionnxbundleloadinport := &ActionNxBundleLoadInPort{ActionNicira: parent} |
| 1181 | if decoder.Length() < 22 { |
| 1182 | return nil, fmt.Errorf("ActionNxBundleLoadInPort packet too short: %d < 22", decoder.Length()) |
| 1183 | } |
| 1184 | _actionnxbundleloadinport.Algorithm = NxBdAlgorithms(decoder.ReadUint16()) |
| 1185 | _actionnxbundleloadinport.Fields = NxHashFields(decoder.ReadUint16()) |
| 1186 | _actionnxbundleloadinport.Basis = uint16(decoder.ReadUint16()) |
| 1187 | _actionnxbundleloadinport.SlaveType = ActionNxBundleSlaveType(decoder.ReadUint32()) |
| 1188 | _actionnxbundleloadinport.NSlaves = uint16(decoder.ReadUint16()) |
| 1189 | _actionnxbundleloadinport.OfsNbits = uint16(decoder.ReadUint16()) |
| 1190 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 1191 | return nil, err |
| 1192 | } else { |
| 1193 | _actionnxbundleloadinport.Dst = obj |
| 1194 | } |
| 1195 | |
| 1196 | decoder.Skip(4) |
| 1197 | |
| 1198 | end := decoder.Offset() + int(_actionnxbundleloadinport.NSlaves) |
| 1199 | for decoder.Offset() < end { |
| 1200 | item, err := DecodeActionNxBundleLoadSlave(decoder) |
| 1201 | if err != nil { |
| 1202 | return nil, err |
| 1203 | } |
| 1204 | if item != nil { |
| 1205 | _actionnxbundleloadinport.InPorts = append(_actionnxbundleloadinport.InPorts, item) |
| 1206 | } |
| 1207 | } |
| 1208 | return _actionnxbundleloadinport, nil |
| 1209 | } |
| 1210 | |
| 1211 | func NewActionNxBundleLoadInPort() *ActionNxBundleLoadInPort { |
| 1212 | obj := &ActionNxBundleLoadInPort{ |
| 1213 | ActionNicira: NewActionNicira(13), |
| 1214 | } |
| 1215 | return obj |
| 1216 | } |
| 1217 | func (self *ActionNxBundleLoadInPort) GetActionName() string { |
| 1218 | return "nx_bundle_load_in_port" |
| 1219 | } |
| 1220 | |
| 1221 | func (self *ActionNxBundleLoadInPort) GetActionFields() map[string]interface{} { |
| 1222 | return map[string]interface{}{ |
| 1223 | "Algorithm": self.Algorithm, |
| 1224 | "Fields": self.Fields, |
| 1225 | "Basis": self.Basis, |
| 1226 | "SlaveType": self.SlaveType, |
| 1227 | "NSlaves": self.NSlaves, |
| 1228 | "OfsNbits": self.OfsNbits, |
| 1229 | "Dst": self.Dst, |
| 1230 | "InPorts": self.InPorts, |
| 1231 | } |
| 1232 | } |
| 1233 | |
| 1234 | func (self *ActionNxBundleLoadInPort) MarshalJSON() ([]byte, error) { |
| 1235 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1236 | if err != nil { |
| 1237 | return nil, err |
| 1238 | } |
| 1239 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1240 | } |
| 1241 | |
| 1242 | type ActionNxClone struct { |
| 1243 | *ActionNicira |
| 1244 | Actions []goloxi.IAction |
| 1245 | } |
| 1246 | |
| 1247 | type IActionNxClone interface { |
| 1248 | IActionNicira |
| 1249 | GetActions() []goloxi.IAction |
| 1250 | } |
| 1251 | |
| 1252 | func (self *ActionNxClone) GetActions() []goloxi.IAction { |
| 1253 | return self.Actions |
| 1254 | } |
| 1255 | |
| 1256 | func (self *ActionNxClone) SetActions(v []goloxi.IAction) { |
| 1257 | self.Actions = v |
| 1258 | } |
| 1259 | |
| 1260 | func (self *ActionNxClone) Serialize(encoder *goloxi.Encoder) error { |
| 1261 | startIndex := len(encoder.Bytes()) |
| 1262 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1263 | return err |
| 1264 | } |
| 1265 | |
| 1266 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 1267 | for _, obj := range self.Actions { |
| 1268 | if err := obj.Serialize(encoder); err != nil { |
| 1269 | return err |
| 1270 | } |
| 1271 | } |
| 1272 | length := len(encoder.Bytes()) - startIndex |
| 1273 | |
| 1274 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1275 | |
| 1276 | return nil |
| 1277 | } |
| 1278 | |
| 1279 | func DecodeActionNxClone(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxClone, error) { |
| 1280 | _actionnxclone := &ActionNxClone{ActionNicira: parent} |
| 1281 | if decoder.Length() < 6 { |
| 1282 | return nil, fmt.Errorf("ActionNxClone packet too short: %d < 6", decoder.Length()) |
| 1283 | } |
| 1284 | decoder.Skip(6) |
| 1285 | |
| 1286 | for decoder.Length() >= 8 { |
| 1287 | item, err := DecodeAction(decoder) |
| 1288 | if err != nil { |
| 1289 | return nil, err |
| 1290 | } |
| 1291 | if item != nil { |
| 1292 | _actionnxclone.Actions = append(_actionnxclone.Actions, item) |
| 1293 | } |
| 1294 | } |
| 1295 | return _actionnxclone, nil |
| 1296 | } |
| 1297 | |
| 1298 | func NewActionNxClone() *ActionNxClone { |
| 1299 | obj := &ActionNxClone{ |
| 1300 | ActionNicira: NewActionNicira(42), |
| 1301 | } |
| 1302 | return obj |
| 1303 | } |
| 1304 | func (self *ActionNxClone) GetActionName() string { |
| 1305 | return "nx_clone" |
| 1306 | } |
| 1307 | |
| 1308 | func (self *ActionNxClone) GetActionFields() map[string]interface{} { |
| 1309 | return map[string]interface{}{ |
| 1310 | "Actions": self.Actions, |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | func (self *ActionNxClone) MarshalJSON() ([]byte, error) { |
| 1315 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1316 | if err != nil { |
| 1317 | return nil, err |
| 1318 | } |
| 1319 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1320 | } |
| 1321 | |
| 1322 | type ActionNxConjunction struct { |
| 1323 | *ActionNicira |
| 1324 | Clause uint8 |
| 1325 | NClauses uint8 |
| 1326 | Id uint32 |
| 1327 | } |
| 1328 | |
| 1329 | type IActionNxConjunction interface { |
| 1330 | IActionNicira |
| 1331 | GetClause() uint8 |
| 1332 | GetNClauses() uint8 |
| 1333 | GetId() uint32 |
| 1334 | } |
| 1335 | |
| 1336 | func (self *ActionNxConjunction) GetClause() uint8 { |
| 1337 | return self.Clause |
| 1338 | } |
| 1339 | |
| 1340 | func (self *ActionNxConjunction) SetClause(v uint8) { |
| 1341 | self.Clause = v |
| 1342 | } |
| 1343 | |
| 1344 | func (self *ActionNxConjunction) GetNClauses() uint8 { |
| 1345 | return self.NClauses |
| 1346 | } |
| 1347 | |
| 1348 | func (self *ActionNxConjunction) SetNClauses(v uint8) { |
| 1349 | self.NClauses = v |
| 1350 | } |
| 1351 | |
| 1352 | func (self *ActionNxConjunction) GetId() uint32 { |
| 1353 | return self.Id |
| 1354 | } |
| 1355 | |
| 1356 | func (self *ActionNxConjunction) SetId(v uint32) { |
| 1357 | self.Id = v |
| 1358 | } |
| 1359 | |
| 1360 | func (self *ActionNxConjunction) Serialize(encoder *goloxi.Encoder) error { |
| 1361 | startIndex := len(encoder.Bytes()) |
| 1362 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1363 | return err |
| 1364 | } |
| 1365 | |
| 1366 | encoder.PutUint8(uint8(self.Clause)) |
| 1367 | encoder.PutUint8(uint8(self.NClauses)) |
| 1368 | encoder.PutUint32(uint32(self.Id)) |
| 1369 | length := len(encoder.Bytes()) - startIndex |
| 1370 | |
| 1371 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1372 | |
| 1373 | return nil |
| 1374 | } |
| 1375 | |
| 1376 | func DecodeActionNxConjunction(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxConjunction, error) { |
| 1377 | _actionnxconjunction := &ActionNxConjunction{ActionNicira: parent} |
| 1378 | if decoder.Length() < 6 { |
| 1379 | return nil, fmt.Errorf("ActionNxConjunction packet too short: %d < 6", decoder.Length()) |
| 1380 | } |
| 1381 | _actionnxconjunction.Clause = uint8(decoder.ReadByte()) |
| 1382 | _actionnxconjunction.NClauses = uint8(decoder.ReadByte()) |
| 1383 | _actionnxconjunction.Id = uint32(decoder.ReadUint32()) |
| 1384 | return _actionnxconjunction, nil |
| 1385 | } |
| 1386 | |
| 1387 | func NewActionNxConjunction() *ActionNxConjunction { |
| 1388 | obj := &ActionNxConjunction{ |
| 1389 | ActionNicira: NewActionNicira(34), |
| 1390 | } |
| 1391 | return obj |
| 1392 | } |
| 1393 | func (self *ActionNxConjunction) GetActionName() string { |
| 1394 | return "nx_conjunction" |
| 1395 | } |
| 1396 | |
| 1397 | func (self *ActionNxConjunction) GetActionFields() map[string]interface{} { |
| 1398 | return map[string]interface{}{ |
| 1399 | "Clause": self.Clause, |
| 1400 | "NClauses": self.NClauses, |
| 1401 | "Id": self.Id, |
| 1402 | } |
| 1403 | } |
| 1404 | |
| 1405 | func (self *ActionNxConjunction) MarshalJSON() ([]byte, error) { |
| 1406 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1407 | if err != nil { |
| 1408 | return nil, err |
| 1409 | } |
| 1410 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1411 | } |
| 1412 | |
| 1413 | type ActionNxController struct { |
| 1414 | *ActionNicira |
| 1415 | MaxLen uint16 |
| 1416 | ControllerId uint16 |
| 1417 | Reason uint8 |
| 1418 | } |
| 1419 | |
| 1420 | type IActionNxController interface { |
| 1421 | IActionNicira |
| 1422 | GetMaxLen() uint16 |
| 1423 | GetControllerId() uint16 |
| 1424 | GetReason() uint8 |
| 1425 | } |
| 1426 | |
| 1427 | func (self *ActionNxController) GetMaxLen() uint16 { |
| 1428 | return self.MaxLen |
| 1429 | } |
| 1430 | |
| 1431 | func (self *ActionNxController) SetMaxLen(v uint16) { |
| 1432 | self.MaxLen = v |
| 1433 | } |
| 1434 | |
| 1435 | func (self *ActionNxController) GetControllerId() uint16 { |
| 1436 | return self.ControllerId |
| 1437 | } |
| 1438 | |
| 1439 | func (self *ActionNxController) SetControllerId(v uint16) { |
| 1440 | self.ControllerId = v |
| 1441 | } |
| 1442 | |
| 1443 | func (self *ActionNxController) GetReason() uint8 { |
| 1444 | return self.Reason |
| 1445 | } |
| 1446 | |
| 1447 | func (self *ActionNxController) SetReason(v uint8) { |
| 1448 | self.Reason = v |
| 1449 | } |
| 1450 | |
| 1451 | func (self *ActionNxController) Serialize(encoder *goloxi.Encoder) error { |
| 1452 | startIndex := len(encoder.Bytes()) |
| 1453 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1454 | return err |
| 1455 | } |
| 1456 | |
| 1457 | encoder.PutUint16(uint16(self.MaxLen)) |
| 1458 | encoder.PutUint16(uint16(self.ControllerId)) |
| 1459 | encoder.PutUint8(uint8(self.Reason)) |
| 1460 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 1461 | length := len(encoder.Bytes()) - startIndex |
| 1462 | |
| 1463 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1464 | |
| 1465 | return nil |
| 1466 | } |
| 1467 | |
| 1468 | func DecodeActionNxController(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxController, error) { |
| 1469 | _actionnxcontroller := &ActionNxController{ActionNicira: parent} |
| 1470 | if decoder.Length() < 6 { |
| 1471 | return nil, fmt.Errorf("ActionNxController packet too short: %d < 6", decoder.Length()) |
| 1472 | } |
| 1473 | _actionnxcontroller.MaxLen = uint16(decoder.ReadUint16()) |
| 1474 | _actionnxcontroller.ControllerId = uint16(decoder.ReadUint16()) |
| 1475 | _actionnxcontroller.Reason = uint8(decoder.ReadByte()) |
| 1476 | decoder.Skip(1) |
| 1477 | return _actionnxcontroller, nil |
| 1478 | } |
| 1479 | |
| 1480 | func NewActionNxController() *ActionNxController { |
| 1481 | obj := &ActionNxController{ |
| 1482 | ActionNicira: NewActionNicira(20), |
| 1483 | } |
| 1484 | return obj |
| 1485 | } |
| 1486 | func (self *ActionNxController) GetActionName() string { |
| 1487 | return "nx_controller" |
| 1488 | } |
| 1489 | |
| 1490 | func (self *ActionNxController) GetActionFields() map[string]interface{} { |
| 1491 | return map[string]interface{}{ |
| 1492 | "MaxLen": self.MaxLen, |
| 1493 | "ControllerId": self.ControllerId, |
| 1494 | "Reason": self.Reason, |
| 1495 | } |
| 1496 | } |
| 1497 | |
| 1498 | func (self *ActionNxController) MarshalJSON() ([]byte, error) { |
| 1499 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1500 | if err != nil { |
| 1501 | return nil, err |
| 1502 | } |
| 1503 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1504 | } |
| 1505 | |
| 1506 | type ActionNxController2 struct { |
| 1507 | *ActionNicira |
| 1508 | Properties []IActionNxController2Property |
| 1509 | } |
| 1510 | |
| 1511 | type IActionNxController2 interface { |
| 1512 | IActionNicira |
| 1513 | GetProperties() []IActionNxController2Property |
| 1514 | } |
| 1515 | |
| 1516 | func (self *ActionNxController2) GetProperties() []IActionNxController2Property { |
| 1517 | return self.Properties |
| 1518 | } |
| 1519 | |
| 1520 | func (self *ActionNxController2) SetProperties(v []IActionNxController2Property) { |
| 1521 | self.Properties = v |
| 1522 | } |
| 1523 | |
| 1524 | func (self *ActionNxController2) Serialize(encoder *goloxi.Encoder) error { |
| 1525 | startIndex := len(encoder.Bytes()) |
| 1526 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1527 | return err |
| 1528 | } |
| 1529 | |
| 1530 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 1531 | for _, obj := range self.Properties { |
| 1532 | if err := obj.Serialize(encoder); err != nil { |
| 1533 | return err |
| 1534 | } |
| 1535 | } |
| 1536 | length := len(encoder.Bytes()) - startIndex |
| 1537 | |
| 1538 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1539 | |
| 1540 | return nil |
| 1541 | } |
| 1542 | |
| 1543 | func DecodeActionNxController2(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxController2, error) { |
| 1544 | _actionnxcontroller2 := &ActionNxController2{ActionNicira: parent} |
| 1545 | if decoder.Length() < 6 { |
| 1546 | return nil, fmt.Errorf("ActionNxController2 packet too short: %d < 6", decoder.Length()) |
| 1547 | } |
| 1548 | decoder.Skip(6) |
| 1549 | |
| 1550 | for decoder.Length() >= 2 { |
| 1551 | item, err := DecodeActionNxController2Property(decoder) |
| 1552 | if err != nil { |
| 1553 | return nil, err |
| 1554 | } |
| 1555 | if item != nil { |
| 1556 | _actionnxcontroller2.Properties = append(_actionnxcontroller2.Properties, item) |
| 1557 | } |
| 1558 | } |
| 1559 | return _actionnxcontroller2, nil |
| 1560 | } |
| 1561 | |
| 1562 | func NewActionNxController2() *ActionNxController2 { |
| 1563 | obj := &ActionNxController2{ |
| 1564 | ActionNicira: NewActionNicira(37), |
| 1565 | } |
| 1566 | return obj |
| 1567 | } |
| 1568 | func (self *ActionNxController2) GetActionName() string { |
| 1569 | return "nx_controller2" |
| 1570 | } |
| 1571 | |
| 1572 | func (self *ActionNxController2) GetActionFields() map[string]interface{} { |
| 1573 | return map[string]interface{}{ |
| 1574 | "Properties": self.Properties, |
| 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | func (self *ActionNxController2) MarshalJSON() ([]byte, error) { |
| 1579 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1580 | if err != nil { |
| 1581 | return nil, err |
| 1582 | } |
| 1583 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1584 | } |
| 1585 | |
| 1586 | type ActionNxCt struct { |
| 1587 | *ActionNicira |
| 1588 | Flags NxConntrackFlags |
| 1589 | ZoneSrc goloxi.IOxmId |
| 1590 | Value uint16 |
| 1591 | RecircTable uint8 |
| 1592 | Alg uint16 |
| 1593 | Actions []goloxi.IAction |
| 1594 | } |
| 1595 | |
| 1596 | type IActionNxCt interface { |
| 1597 | IActionNicira |
| 1598 | GetFlags() NxConntrackFlags |
| 1599 | GetZoneSrc() goloxi.IOxmId |
| 1600 | GetValue() uint16 |
| 1601 | GetRecircTable() uint8 |
| 1602 | GetAlg() uint16 |
| 1603 | GetActions() []goloxi.IAction |
| 1604 | } |
| 1605 | |
| 1606 | func (self *ActionNxCt) GetFlags() NxConntrackFlags { |
| 1607 | return self.Flags |
| 1608 | } |
| 1609 | |
| 1610 | func (self *ActionNxCt) SetFlags(v NxConntrackFlags) { |
| 1611 | self.Flags = v |
| 1612 | } |
| 1613 | |
| 1614 | func (self *ActionNxCt) GetZoneSrc() goloxi.IOxmId { |
| 1615 | return self.ZoneSrc |
| 1616 | } |
| 1617 | |
| 1618 | func (self *ActionNxCt) SetZoneSrc(v goloxi.IOxmId) { |
| 1619 | self.ZoneSrc = v |
| 1620 | } |
| 1621 | |
| 1622 | func (self *ActionNxCt) GetValue() uint16 { |
| 1623 | return self.Value |
| 1624 | } |
| 1625 | |
| 1626 | func (self *ActionNxCt) SetValue(v uint16) { |
| 1627 | self.Value = v |
| 1628 | } |
| 1629 | |
| 1630 | func (self *ActionNxCt) GetRecircTable() uint8 { |
| 1631 | return self.RecircTable |
| 1632 | } |
| 1633 | |
| 1634 | func (self *ActionNxCt) SetRecircTable(v uint8) { |
| 1635 | self.RecircTable = v |
| 1636 | } |
| 1637 | |
| 1638 | func (self *ActionNxCt) GetAlg() uint16 { |
| 1639 | return self.Alg |
| 1640 | } |
| 1641 | |
| 1642 | func (self *ActionNxCt) SetAlg(v uint16) { |
| 1643 | self.Alg = v |
| 1644 | } |
| 1645 | |
| 1646 | func (self *ActionNxCt) GetActions() []goloxi.IAction { |
| 1647 | return self.Actions |
| 1648 | } |
| 1649 | |
| 1650 | func (self *ActionNxCt) SetActions(v []goloxi.IAction) { |
| 1651 | self.Actions = v |
| 1652 | } |
| 1653 | |
| 1654 | func (self *ActionNxCt) Serialize(encoder *goloxi.Encoder) error { |
| 1655 | startIndex := len(encoder.Bytes()) |
| 1656 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1657 | return err |
| 1658 | } |
| 1659 | |
| 1660 | encoder.PutUint16(uint16(self.Flags)) |
| 1661 | self.ZoneSrc.Serialize(encoder) |
| 1662 | encoder.PutUint16(uint16(self.Value)) |
| 1663 | encoder.PutUint8(uint8(self.RecircTable)) |
| 1664 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 1665 | encoder.PutUint16(uint16(self.Alg)) |
| 1666 | for _, obj := range self.Actions { |
| 1667 | if err := obj.Serialize(encoder); err != nil { |
| 1668 | return err |
| 1669 | } |
| 1670 | } |
| 1671 | length := len(encoder.Bytes()) - startIndex |
| 1672 | |
| 1673 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1674 | |
| 1675 | return nil |
| 1676 | } |
| 1677 | |
| 1678 | func DecodeActionNxCt(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxCt, error) { |
| 1679 | _actionnxct := &ActionNxCt{ActionNicira: parent} |
| 1680 | if decoder.Length() < 14 { |
| 1681 | return nil, fmt.Errorf("ActionNxCt packet too short: %d < 14", decoder.Length()) |
| 1682 | } |
| 1683 | _actionnxct.Flags = NxConntrackFlags(decoder.ReadUint16()) |
| 1684 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 1685 | return nil, err |
| 1686 | } else { |
| 1687 | _actionnxct.ZoneSrc = obj |
| 1688 | } |
| 1689 | |
| 1690 | _actionnxct.Value = uint16(decoder.ReadUint16()) |
| 1691 | _actionnxct.RecircTable = uint8(decoder.ReadByte()) |
| 1692 | decoder.Skip(3) |
| 1693 | _actionnxct.Alg = uint16(decoder.ReadUint16()) |
| 1694 | |
| 1695 | for decoder.Length() >= 8 { |
| 1696 | item, err := DecodeAction(decoder) |
| 1697 | if err != nil { |
| 1698 | return nil, err |
| 1699 | } |
| 1700 | if item != nil { |
| 1701 | _actionnxct.Actions = append(_actionnxct.Actions, item) |
| 1702 | } |
| 1703 | } |
| 1704 | return _actionnxct, nil |
| 1705 | } |
| 1706 | |
| 1707 | func NewActionNxCt() *ActionNxCt { |
| 1708 | obj := &ActionNxCt{ |
| 1709 | ActionNicira: NewActionNicira(35), |
| 1710 | } |
| 1711 | return obj |
| 1712 | } |
| 1713 | func (self *ActionNxCt) GetActionName() string { |
| 1714 | return "nx_ct" |
| 1715 | } |
| 1716 | |
| 1717 | func (self *ActionNxCt) GetActionFields() map[string]interface{} { |
| 1718 | return map[string]interface{}{ |
| 1719 | "Flags": self.Flags, |
| 1720 | "ZoneSrc": self.ZoneSrc, |
| 1721 | "Value": self.Value, |
| 1722 | "RecircTable": self.RecircTable, |
| 1723 | "Alg": self.Alg, |
| 1724 | "Actions": self.Actions, |
| 1725 | } |
| 1726 | } |
| 1727 | |
| 1728 | func (self *ActionNxCt) MarshalJSON() ([]byte, error) { |
| 1729 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1730 | if err != nil { |
| 1731 | return nil, err |
| 1732 | } |
| 1733 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1734 | } |
| 1735 | |
| 1736 | type ActionNxCtClear struct { |
| 1737 | *ActionNicira |
| 1738 | } |
| 1739 | |
| 1740 | type IActionNxCtClear interface { |
| 1741 | IActionNicira |
| 1742 | } |
| 1743 | |
| 1744 | func (self *ActionNxCtClear) Serialize(encoder *goloxi.Encoder) error { |
| 1745 | startIndex := len(encoder.Bytes()) |
| 1746 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1747 | return err |
| 1748 | } |
| 1749 | length := len(encoder.Bytes()) - startIndex |
| 1750 | |
| 1751 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1752 | |
| 1753 | return nil |
| 1754 | } |
| 1755 | |
| 1756 | func DecodeActionNxCtClear(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxCtClear, error) { |
| 1757 | _actionnxctclear := &ActionNxCtClear{ActionNicira: parent} |
| 1758 | return _actionnxctclear, nil |
| 1759 | } |
| 1760 | |
| 1761 | func NewActionNxCtClear() *ActionNxCtClear { |
| 1762 | obj := &ActionNxCtClear{ |
| 1763 | ActionNicira: NewActionNicira(43), |
| 1764 | } |
| 1765 | return obj |
| 1766 | } |
| 1767 | func (self *ActionNxCtClear) GetActionName() string { |
| 1768 | return "nx_ct_clear" |
| 1769 | } |
| 1770 | |
| 1771 | func (self *ActionNxCtClear) GetActionFields() map[string]interface{} { |
| 1772 | return map[string]interface{}{} |
| 1773 | } |
| 1774 | |
| 1775 | func (self *ActionNxCtClear) MarshalJSON() ([]byte, error) { |
| 1776 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1777 | if err != nil { |
| 1778 | return nil, err |
| 1779 | } |
| 1780 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1781 | } |
| 1782 | |
| 1783 | type ActionNxDebugRecirc struct { |
| 1784 | *ActionNicira |
| 1785 | } |
| 1786 | |
| 1787 | type IActionNxDebugRecirc interface { |
| 1788 | IActionNicira |
| 1789 | } |
| 1790 | |
| 1791 | func (self *ActionNxDebugRecirc) Serialize(encoder *goloxi.Encoder) error { |
| 1792 | startIndex := len(encoder.Bytes()) |
| 1793 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1794 | return err |
| 1795 | } |
| 1796 | length := len(encoder.Bytes()) - startIndex |
| 1797 | |
| 1798 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1799 | |
| 1800 | return nil |
| 1801 | } |
| 1802 | |
| 1803 | func DecodeActionNxDebugRecirc(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDebugRecirc, error) { |
| 1804 | _actionnxdebugrecirc := &ActionNxDebugRecirc{ActionNicira: parent} |
| 1805 | return _actionnxdebugrecirc, nil |
| 1806 | } |
| 1807 | |
| 1808 | func NewActionNxDebugRecirc() *ActionNxDebugRecirc { |
| 1809 | obj := &ActionNxDebugRecirc{ |
| 1810 | ActionNicira: NewActionNicira(255), |
| 1811 | } |
| 1812 | return obj |
| 1813 | } |
| 1814 | func (self *ActionNxDebugRecirc) GetActionName() string { |
| 1815 | return "nx_debug_recirc" |
| 1816 | } |
| 1817 | |
| 1818 | func (self *ActionNxDebugRecirc) GetActionFields() map[string]interface{} { |
| 1819 | return map[string]interface{}{} |
| 1820 | } |
| 1821 | |
| 1822 | func (self *ActionNxDebugRecirc) MarshalJSON() ([]byte, error) { |
| 1823 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1824 | if err != nil { |
| 1825 | return nil, err |
| 1826 | } |
| 1827 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1828 | } |
| 1829 | |
| 1830 | type ActionNxDebugSlow struct { |
| 1831 | *ActionNicira |
| 1832 | } |
| 1833 | |
| 1834 | type IActionNxDebugSlow interface { |
| 1835 | IActionNicira |
| 1836 | } |
| 1837 | |
| 1838 | func (self *ActionNxDebugSlow) Serialize(encoder *goloxi.Encoder) error { |
| 1839 | startIndex := len(encoder.Bytes()) |
| 1840 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1841 | return err |
| 1842 | } |
| 1843 | length := len(encoder.Bytes()) - startIndex |
| 1844 | |
| 1845 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1846 | |
| 1847 | return nil |
| 1848 | } |
| 1849 | |
| 1850 | func DecodeActionNxDebugSlow(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDebugSlow, error) { |
| 1851 | _actionnxdebugslow := &ActionNxDebugSlow{ActionNicira: parent} |
| 1852 | return _actionnxdebugslow, nil |
| 1853 | } |
| 1854 | |
| 1855 | func NewActionNxDebugSlow() *ActionNxDebugSlow { |
| 1856 | obj := &ActionNxDebugSlow{ |
| 1857 | ActionNicira: NewActionNicira(254), |
| 1858 | } |
| 1859 | return obj |
| 1860 | } |
| 1861 | func (self *ActionNxDebugSlow) GetActionName() string { |
| 1862 | return "nx_debug_slow" |
| 1863 | } |
| 1864 | |
| 1865 | func (self *ActionNxDebugSlow) GetActionFields() map[string]interface{} { |
| 1866 | return map[string]interface{}{} |
| 1867 | } |
| 1868 | |
| 1869 | func (self *ActionNxDebugSlow) MarshalJSON() ([]byte, error) { |
| 1870 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1871 | if err != nil { |
| 1872 | return nil, err |
| 1873 | } |
| 1874 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1875 | } |
| 1876 | |
| 1877 | type ActionNxDecMplsTtl struct { |
| 1878 | *ActionNicira |
| 1879 | } |
| 1880 | |
| 1881 | type IActionNxDecMplsTtl interface { |
| 1882 | IActionNicira |
| 1883 | } |
| 1884 | |
| 1885 | func (self *ActionNxDecMplsTtl) Serialize(encoder *goloxi.Encoder) error { |
| 1886 | startIndex := len(encoder.Bytes()) |
| 1887 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1888 | return err |
| 1889 | } |
| 1890 | length := len(encoder.Bytes()) - startIndex |
| 1891 | |
| 1892 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1893 | |
| 1894 | return nil |
| 1895 | } |
| 1896 | |
| 1897 | func DecodeActionNxDecMplsTtl(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDecMplsTtl, error) { |
| 1898 | _actionnxdecmplsttl := &ActionNxDecMplsTtl{ActionNicira: parent} |
| 1899 | return _actionnxdecmplsttl, nil |
| 1900 | } |
| 1901 | |
| 1902 | func NewActionNxDecMplsTtl() *ActionNxDecMplsTtl { |
| 1903 | obj := &ActionNxDecMplsTtl{ |
| 1904 | ActionNicira: NewActionNicira(26), |
| 1905 | } |
| 1906 | return obj |
| 1907 | } |
| 1908 | func (self *ActionNxDecMplsTtl) GetActionName() string { |
| 1909 | return "nx_dec_mpls_ttl" |
| 1910 | } |
| 1911 | |
| 1912 | func (self *ActionNxDecMplsTtl) GetActionFields() map[string]interface{} { |
| 1913 | return map[string]interface{}{} |
| 1914 | } |
| 1915 | |
| 1916 | func (self *ActionNxDecMplsTtl) MarshalJSON() ([]byte, error) { |
| 1917 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1918 | if err != nil { |
| 1919 | return nil, err |
| 1920 | } |
| 1921 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1922 | } |
| 1923 | |
| 1924 | type ActionNxDecNshTtl struct { |
| 1925 | *ActionNicira |
| 1926 | } |
| 1927 | |
| 1928 | type IActionNxDecNshTtl interface { |
| 1929 | IActionNicira |
| 1930 | } |
| 1931 | |
| 1932 | func (self *ActionNxDecNshTtl) Serialize(encoder *goloxi.Encoder) error { |
| 1933 | startIndex := len(encoder.Bytes()) |
| 1934 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1935 | return err |
| 1936 | } |
| 1937 | length := len(encoder.Bytes()) - startIndex |
| 1938 | |
| 1939 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 1940 | |
| 1941 | return nil |
| 1942 | } |
| 1943 | |
| 1944 | func DecodeActionNxDecNshTtl(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDecNshTtl, error) { |
| 1945 | _actionnxdecnshttl := &ActionNxDecNshTtl{ActionNicira: parent} |
| 1946 | return _actionnxdecnshttl, nil |
| 1947 | } |
| 1948 | |
| 1949 | func NewActionNxDecNshTtl() *ActionNxDecNshTtl { |
| 1950 | obj := &ActionNxDecNshTtl{ |
| 1951 | ActionNicira: NewActionNicira(48), |
| 1952 | } |
| 1953 | return obj |
| 1954 | } |
| 1955 | func (self *ActionNxDecNshTtl) GetActionName() string { |
| 1956 | return "nx_dec_nsh_ttl" |
| 1957 | } |
| 1958 | |
| 1959 | func (self *ActionNxDecNshTtl) GetActionFields() map[string]interface{} { |
| 1960 | return map[string]interface{}{} |
| 1961 | } |
| 1962 | |
| 1963 | func (self *ActionNxDecNshTtl) MarshalJSON() ([]byte, error) { |
| 1964 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 1965 | if err != nil { |
| 1966 | return nil, err |
| 1967 | } |
| 1968 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 1969 | } |
| 1970 | |
| 1971 | type ActionNxDecTtlCntIds struct { |
| 1972 | *ActionNicira |
| 1973 | NControllers uint16 |
| 1974 | } |
| 1975 | |
| 1976 | type IActionNxDecTtlCntIds interface { |
| 1977 | IActionNicira |
| 1978 | GetNControllers() uint16 |
| 1979 | } |
| 1980 | |
| 1981 | func (self *ActionNxDecTtlCntIds) GetNControllers() uint16 { |
| 1982 | return self.NControllers |
| 1983 | } |
| 1984 | |
| 1985 | func (self *ActionNxDecTtlCntIds) SetNControllers(v uint16) { |
| 1986 | self.NControllers = v |
| 1987 | } |
| 1988 | |
| 1989 | func (self *ActionNxDecTtlCntIds) Serialize(encoder *goloxi.Encoder) error { |
| 1990 | startIndex := len(encoder.Bytes()) |
| 1991 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 1992 | return err |
| 1993 | } |
| 1994 | |
| 1995 | encoder.PutUint16(uint16(self.NControllers)) |
| 1996 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 1997 | length := len(encoder.Bytes()) - startIndex |
| 1998 | |
| 1999 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2000 | |
| 2001 | return nil |
| 2002 | } |
| 2003 | |
| 2004 | func DecodeActionNxDecTtlCntIds(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDecTtlCntIds, error) { |
| 2005 | _actionnxdecttlcntids := &ActionNxDecTtlCntIds{ActionNicira: parent} |
| 2006 | if decoder.Length() < 6 { |
| 2007 | return nil, fmt.Errorf("ActionNxDecTtlCntIds packet too short: %d < 6", decoder.Length()) |
| 2008 | } |
| 2009 | _actionnxdecttlcntids.NControllers = uint16(decoder.ReadUint16()) |
| 2010 | decoder.Skip(4) |
| 2011 | return _actionnxdecttlcntids, nil |
| 2012 | } |
| 2013 | |
| 2014 | func NewActionNxDecTtlCntIds() *ActionNxDecTtlCntIds { |
| 2015 | obj := &ActionNxDecTtlCntIds{ |
| 2016 | ActionNicira: NewActionNicira(21), |
| 2017 | } |
| 2018 | return obj |
| 2019 | } |
| 2020 | func (self *ActionNxDecTtlCntIds) GetActionName() string { |
| 2021 | return "nx_dec_ttl_cnt_ids" |
| 2022 | } |
| 2023 | |
| 2024 | func (self *ActionNxDecTtlCntIds) GetActionFields() map[string]interface{} { |
| 2025 | return map[string]interface{}{ |
| 2026 | "NControllers": self.NControllers, |
| 2027 | } |
| 2028 | } |
| 2029 | |
| 2030 | func (self *ActionNxDecTtlCntIds) MarshalJSON() ([]byte, error) { |
| 2031 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2032 | if err != nil { |
| 2033 | return nil, err |
| 2034 | } |
| 2035 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2036 | } |
| 2037 | |
| 2038 | type ActionNxDecap struct { |
| 2039 | *ActionNicira |
| 2040 | NewPktType uint32 |
| 2041 | } |
| 2042 | |
| 2043 | type IActionNxDecap interface { |
| 2044 | IActionNicira |
| 2045 | GetNewPktType() uint32 |
| 2046 | } |
| 2047 | |
| 2048 | func (self *ActionNxDecap) GetNewPktType() uint32 { |
| 2049 | return self.NewPktType |
| 2050 | } |
| 2051 | |
| 2052 | func (self *ActionNxDecap) SetNewPktType(v uint32) { |
| 2053 | self.NewPktType = v |
| 2054 | } |
| 2055 | |
| 2056 | func (self *ActionNxDecap) Serialize(encoder *goloxi.Encoder) error { |
| 2057 | startIndex := len(encoder.Bytes()) |
| 2058 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2059 | return err |
| 2060 | } |
| 2061 | |
| 2062 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 2063 | encoder.PutUint32(uint32(self.NewPktType)) |
| 2064 | length := len(encoder.Bytes()) - startIndex |
| 2065 | |
| 2066 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2067 | |
| 2068 | return nil |
| 2069 | } |
| 2070 | |
| 2071 | func DecodeActionNxDecap(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxDecap, error) { |
| 2072 | _actionnxdecap := &ActionNxDecap{ActionNicira: parent} |
| 2073 | if decoder.Length() < 6 { |
| 2074 | return nil, fmt.Errorf("ActionNxDecap packet too short: %d < 6", decoder.Length()) |
| 2075 | } |
| 2076 | decoder.Skip(2) |
| 2077 | _actionnxdecap.NewPktType = uint32(decoder.ReadUint32()) |
| 2078 | return _actionnxdecap, nil |
| 2079 | } |
| 2080 | |
| 2081 | func NewActionNxDecap() *ActionNxDecap { |
| 2082 | obj := &ActionNxDecap{ |
| 2083 | ActionNicira: NewActionNicira(47), |
| 2084 | } |
| 2085 | return obj |
| 2086 | } |
| 2087 | func (self *ActionNxDecap) GetActionName() string { |
| 2088 | return "nx_decap" |
| 2089 | } |
| 2090 | |
| 2091 | func (self *ActionNxDecap) GetActionFields() map[string]interface{} { |
| 2092 | return map[string]interface{}{ |
| 2093 | "NewPktType": self.NewPktType, |
| 2094 | } |
| 2095 | } |
| 2096 | |
| 2097 | func (self *ActionNxDecap) MarshalJSON() ([]byte, error) { |
| 2098 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2099 | if err != nil { |
| 2100 | return nil, err |
| 2101 | } |
| 2102 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2103 | } |
| 2104 | |
| 2105 | type ActionNxEncap struct { |
| 2106 | *ActionNicira |
| 2107 | HdrSize uint16 |
| 2108 | PacketType PacketType |
| 2109 | Props []IEdPropHeader |
| 2110 | } |
| 2111 | |
| 2112 | type IActionNxEncap interface { |
| 2113 | IActionNicira |
| 2114 | GetHdrSize() uint16 |
| 2115 | GetPacketType() PacketType |
| 2116 | GetProps() []IEdPropHeader |
| 2117 | } |
| 2118 | |
| 2119 | func (self *ActionNxEncap) GetHdrSize() uint16 { |
| 2120 | return self.HdrSize |
| 2121 | } |
| 2122 | |
| 2123 | func (self *ActionNxEncap) SetHdrSize(v uint16) { |
| 2124 | self.HdrSize = v |
| 2125 | } |
| 2126 | |
| 2127 | func (self *ActionNxEncap) GetPacketType() PacketType { |
| 2128 | return self.PacketType |
| 2129 | } |
| 2130 | |
| 2131 | func (self *ActionNxEncap) SetPacketType(v PacketType) { |
| 2132 | self.PacketType = v |
| 2133 | } |
| 2134 | |
| 2135 | func (self *ActionNxEncap) GetProps() []IEdPropHeader { |
| 2136 | return self.Props |
| 2137 | } |
| 2138 | |
| 2139 | func (self *ActionNxEncap) SetProps(v []IEdPropHeader) { |
| 2140 | self.Props = v |
| 2141 | } |
| 2142 | |
| 2143 | func (self *ActionNxEncap) Serialize(encoder *goloxi.Encoder) error { |
| 2144 | startIndex := len(encoder.Bytes()) |
| 2145 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2146 | return err |
| 2147 | } |
| 2148 | |
| 2149 | encoder.PutUint16(uint16(self.HdrSize)) |
| 2150 | encoder.PutUint32(uint32(self.PacketType)) |
| 2151 | for _, obj := range self.Props { |
| 2152 | if err := obj.Serialize(encoder); err != nil { |
| 2153 | return err |
| 2154 | } |
| 2155 | } |
| 2156 | length := len(encoder.Bytes()) - startIndex |
| 2157 | |
| 2158 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2159 | |
| 2160 | return nil |
| 2161 | } |
| 2162 | |
| 2163 | func DecodeActionNxEncap(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxEncap, error) { |
| 2164 | _actionnxencap := &ActionNxEncap{ActionNicira: parent} |
| 2165 | if decoder.Length() < 6 { |
| 2166 | return nil, fmt.Errorf("ActionNxEncap packet too short: %d < 6", decoder.Length()) |
| 2167 | } |
| 2168 | _actionnxencap.HdrSize = uint16(decoder.ReadUint16()) |
| 2169 | _actionnxencap.PacketType = PacketType(decoder.ReadUint32()) |
| 2170 | |
| 2171 | for decoder.Length() >= 4 { |
| 2172 | item, err := DecodeEdPropHeader(decoder) |
| 2173 | if err != nil { |
| 2174 | return nil, err |
| 2175 | } |
| 2176 | if item != nil { |
| 2177 | _actionnxencap.Props = append(_actionnxencap.Props, item) |
| 2178 | } |
| 2179 | } |
| 2180 | return _actionnxencap, nil |
| 2181 | } |
| 2182 | |
| 2183 | func NewActionNxEncap() *ActionNxEncap { |
| 2184 | obj := &ActionNxEncap{ |
| 2185 | ActionNicira: NewActionNicira(46), |
| 2186 | } |
| 2187 | return obj |
| 2188 | } |
| 2189 | func (self *ActionNxEncap) GetActionName() string { |
| 2190 | return "nx_encap" |
| 2191 | } |
| 2192 | |
| 2193 | func (self *ActionNxEncap) GetActionFields() map[string]interface{} { |
| 2194 | return map[string]interface{}{ |
| 2195 | "HdrSize": self.HdrSize, |
| 2196 | "PacketType": self.PacketType, |
| 2197 | "Props": self.Props, |
| 2198 | } |
| 2199 | } |
| 2200 | |
| 2201 | func (self *ActionNxEncap) MarshalJSON() ([]byte, error) { |
| 2202 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2203 | if err != nil { |
| 2204 | return nil, err |
| 2205 | } |
| 2206 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2207 | } |
| 2208 | |
| 2209 | type ActionNxExit struct { |
| 2210 | *ActionNicira |
| 2211 | } |
| 2212 | |
| 2213 | type IActionNxExit interface { |
| 2214 | IActionNicira |
| 2215 | } |
| 2216 | |
| 2217 | func (self *ActionNxExit) Serialize(encoder *goloxi.Encoder) error { |
| 2218 | startIndex := len(encoder.Bytes()) |
| 2219 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2220 | return err |
| 2221 | } |
| 2222 | length := len(encoder.Bytes()) - startIndex |
| 2223 | |
| 2224 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2225 | |
| 2226 | return nil |
| 2227 | } |
| 2228 | |
| 2229 | func DecodeActionNxExit(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxExit, error) { |
| 2230 | _actionnxexit := &ActionNxExit{ActionNicira: parent} |
| 2231 | return _actionnxexit, nil |
| 2232 | } |
| 2233 | |
| 2234 | func NewActionNxExit() *ActionNxExit { |
| 2235 | obj := &ActionNxExit{ |
| 2236 | ActionNicira: NewActionNicira(17), |
| 2237 | } |
| 2238 | return obj |
| 2239 | } |
| 2240 | func (self *ActionNxExit) GetActionName() string { |
| 2241 | return "nx_exit" |
| 2242 | } |
| 2243 | |
| 2244 | func (self *ActionNxExit) GetActionFields() map[string]interface{} { |
| 2245 | return map[string]interface{}{} |
| 2246 | } |
| 2247 | |
| 2248 | func (self *ActionNxExit) MarshalJSON() ([]byte, error) { |
| 2249 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2250 | if err != nil { |
| 2251 | return nil, err |
| 2252 | } |
| 2253 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2254 | } |
| 2255 | |
| 2256 | type ActionNxFinTimeout struct { |
| 2257 | *ActionNicira |
| 2258 | FinIdleTimeout uint16 |
| 2259 | FinHardTimeout uint16 |
| 2260 | } |
| 2261 | |
| 2262 | type IActionNxFinTimeout interface { |
| 2263 | IActionNicira |
| 2264 | GetFinIdleTimeout() uint16 |
| 2265 | GetFinHardTimeout() uint16 |
| 2266 | } |
| 2267 | |
| 2268 | func (self *ActionNxFinTimeout) GetFinIdleTimeout() uint16 { |
| 2269 | return self.FinIdleTimeout |
| 2270 | } |
| 2271 | |
| 2272 | func (self *ActionNxFinTimeout) SetFinIdleTimeout(v uint16) { |
| 2273 | self.FinIdleTimeout = v |
| 2274 | } |
| 2275 | |
| 2276 | func (self *ActionNxFinTimeout) GetFinHardTimeout() uint16 { |
| 2277 | return self.FinHardTimeout |
| 2278 | } |
| 2279 | |
| 2280 | func (self *ActionNxFinTimeout) SetFinHardTimeout(v uint16) { |
| 2281 | self.FinHardTimeout = v |
| 2282 | } |
| 2283 | |
| 2284 | func (self *ActionNxFinTimeout) Serialize(encoder *goloxi.Encoder) error { |
| 2285 | startIndex := len(encoder.Bytes()) |
| 2286 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2287 | return err |
| 2288 | } |
| 2289 | |
| 2290 | encoder.PutUint16(uint16(self.FinIdleTimeout)) |
| 2291 | encoder.PutUint16(uint16(self.FinHardTimeout)) |
| 2292 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 2293 | length := len(encoder.Bytes()) - startIndex |
| 2294 | |
| 2295 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2296 | |
| 2297 | return nil |
| 2298 | } |
| 2299 | |
| 2300 | func DecodeActionNxFinTimeout(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxFinTimeout, error) { |
| 2301 | _actionnxfintimeout := &ActionNxFinTimeout{ActionNicira: parent} |
| 2302 | if decoder.Length() < 6 { |
| 2303 | return nil, fmt.Errorf("ActionNxFinTimeout packet too short: %d < 6", decoder.Length()) |
| 2304 | } |
| 2305 | _actionnxfintimeout.FinIdleTimeout = uint16(decoder.ReadUint16()) |
| 2306 | _actionnxfintimeout.FinHardTimeout = uint16(decoder.ReadUint16()) |
| 2307 | decoder.Skip(2) |
| 2308 | return _actionnxfintimeout, nil |
| 2309 | } |
| 2310 | |
| 2311 | func NewActionNxFinTimeout() *ActionNxFinTimeout { |
| 2312 | obj := &ActionNxFinTimeout{ |
| 2313 | ActionNicira: NewActionNicira(19), |
| 2314 | } |
| 2315 | return obj |
| 2316 | } |
| 2317 | func (self *ActionNxFinTimeout) GetActionName() string { |
| 2318 | return "nx_fin_timeout" |
| 2319 | } |
| 2320 | |
| 2321 | func (self *ActionNxFinTimeout) GetActionFields() map[string]interface{} { |
| 2322 | return map[string]interface{}{ |
| 2323 | "FinIdleTimeout": self.FinIdleTimeout, |
| 2324 | "FinHardTimeout": self.FinHardTimeout, |
| 2325 | } |
| 2326 | } |
| 2327 | |
| 2328 | func (self *ActionNxFinTimeout) MarshalJSON() ([]byte, error) { |
| 2329 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2330 | if err != nil { |
| 2331 | return nil, err |
| 2332 | } |
| 2333 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2334 | } |
| 2335 | |
| 2336 | type ActionNxGroup struct { |
| 2337 | *ActionNicira |
| 2338 | Value uint32 |
| 2339 | } |
| 2340 | |
| 2341 | type IActionNxGroup interface { |
| 2342 | IActionNicira |
| 2343 | GetValue() uint32 |
| 2344 | } |
| 2345 | |
| 2346 | func (self *ActionNxGroup) GetValue() uint32 { |
| 2347 | return self.Value |
| 2348 | } |
| 2349 | |
| 2350 | func (self *ActionNxGroup) SetValue(v uint32) { |
| 2351 | self.Value = v |
| 2352 | } |
| 2353 | |
| 2354 | func (self *ActionNxGroup) Serialize(encoder *goloxi.Encoder) error { |
| 2355 | startIndex := len(encoder.Bytes()) |
| 2356 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2357 | return err |
| 2358 | } |
| 2359 | |
| 2360 | encoder.PutUint32(uint32(self.Value)) |
| 2361 | length := len(encoder.Bytes()) - startIndex |
| 2362 | |
| 2363 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2364 | |
| 2365 | return nil |
| 2366 | } |
| 2367 | |
| 2368 | func DecodeActionNxGroup(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxGroup, error) { |
| 2369 | _actionnxgroup := &ActionNxGroup{ActionNicira: parent} |
| 2370 | if decoder.Length() < 4 { |
| 2371 | return nil, fmt.Errorf("ActionNxGroup packet too short: %d < 4", decoder.Length()) |
| 2372 | } |
| 2373 | _actionnxgroup.Value = uint32(decoder.ReadUint32()) |
| 2374 | return _actionnxgroup, nil |
| 2375 | } |
| 2376 | |
| 2377 | func NewActionNxGroup() *ActionNxGroup { |
| 2378 | obj := &ActionNxGroup{ |
| 2379 | ActionNicira: NewActionNicira(40), |
| 2380 | } |
| 2381 | return obj |
| 2382 | } |
| 2383 | func (self *ActionNxGroup) GetActionName() string { |
| 2384 | return "nx_group" |
| 2385 | } |
| 2386 | |
| 2387 | func (self *ActionNxGroup) GetActionFields() map[string]interface{} { |
| 2388 | return map[string]interface{}{ |
| 2389 | "Value": self.Value, |
| 2390 | } |
| 2391 | } |
| 2392 | |
| 2393 | func (self *ActionNxGroup) MarshalJSON() ([]byte, error) { |
| 2394 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2395 | if err != nil { |
| 2396 | return nil, err |
| 2397 | } |
| 2398 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2399 | } |
| 2400 | |
| 2401 | type ActionNxLearn struct { |
| 2402 | *ActionNicira |
| 2403 | IdleTimeout uint16 |
| 2404 | HardTimeout uint16 |
| 2405 | Priority uint16 |
| 2406 | Cookie uint64 |
| 2407 | Flags uint16 |
| 2408 | TableId uint8 |
| 2409 | FinIdleTimeout uint16 |
| 2410 | FinHardTimeout uint16 |
| 2411 | FlowMods []IFlowModSpec |
| 2412 | } |
| 2413 | |
| 2414 | type IActionNxLearn interface { |
| 2415 | IActionNicira |
| 2416 | GetIdleTimeout() uint16 |
| 2417 | GetHardTimeout() uint16 |
| 2418 | GetPriority() uint16 |
| 2419 | GetCookie() uint64 |
| 2420 | GetFlags() uint16 |
| 2421 | GetTableId() uint8 |
| 2422 | GetFinIdleTimeout() uint16 |
| 2423 | GetFinHardTimeout() uint16 |
| 2424 | GetFlowMods() []IFlowModSpec |
| 2425 | } |
| 2426 | |
| 2427 | func (self *ActionNxLearn) GetIdleTimeout() uint16 { |
| 2428 | return self.IdleTimeout |
| 2429 | } |
| 2430 | |
| 2431 | func (self *ActionNxLearn) SetIdleTimeout(v uint16) { |
| 2432 | self.IdleTimeout = v |
| 2433 | } |
| 2434 | |
| 2435 | func (self *ActionNxLearn) GetHardTimeout() uint16 { |
| 2436 | return self.HardTimeout |
| 2437 | } |
| 2438 | |
| 2439 | func (self *ActionNxLearn) SetHardTimeout(v uint16) { |
| 2440 | self.HardTimeout = v |
| 2441 | } |
| 2442 | |
| 2443 | func (self *ActionNxLearn) GetPriority() uint16 { |
| 2444 | return self.Priority |
| 2445 | } |
| 2446 | |
| 2447 | func (self *ActionNxLearn) SetPriority(v uint16) { |
| 2448 | self.Priority = v |
| 2449 | } |
| 2450 | |
| 2451 | func (self *ActionNxLearn) GetCookie() uint64 { |
| 2452 | return self.Cookie |
| 2453 | } |
| 2454 | |
| 2455 | func (self *ActionNxLearn) SetCookie(v uint64) { |
| 2456 | self.Cookie = v |
| 2457 | } |
| 2458 | |
| 2459 | func (self *ActionNxLearn) GetFlags() uint16 { |
| 2460 | return self.Flags |
| 2461 | } |
| 2462 | |
| 2463 | func (self *ActionNxLearn) SetFlags(v uint16) { |
| 2464 | self.Flags = v |
| 2465 | } |
| 2466 | |
| 2467 | func (self *ActionNxLearn) GetTableId() uint8 { |
| 2468 | return self.TableId |
| 2469 | } |
| 2470 | |
| 2471 | func (self *ActionNxLearn) SetTableId(v uint8) { |
| 2472 | self.TableId = v |
| 2473 | } |
| 2474 | |
| 2475 | func (self *ActionNxLearn) GetFinIdleTimeout() uint16 { |
| 2476 | return self.FinIdleTimeout |
| 2477 | } |
| 2478 | |
| 2479 | func (self *ActionNxLearn) SetFinIdleTimeout(v uint16) { |
| 2480 | self.FinIdleTimeout = v |
| 2481 | } |
| 2482 | |
| 2483 | func (self *ActionNxLearn) GetFinHardTimeout() uint16 { |
| 2484 | return self.FinHardTimeout |
| 2485 | } |
| 2486 | |
| 2487 | func (self *ActionNxLearn) SetFinHardTimeout(v uint16) { |
| 2488 | self.FinHardTimeout = v |
| 2489 | } |
| 2490 | |
| 2491 | func (self *ActionNxLearn) GetFlowMods() []IFlowModSpec { |
| 2492 | return self.FlowMods |
| 2493 | } |
| 2494 | |
| 2495 | func (self *ActionNxLearn) SetFlowMods(v []IFlowModSpec) { |
| 2496 | self.FlowMods = v |
| 2497 | } |
| 2498 | |
| 2499 | func (self *ActionNxLearn) Serialize(encoder *goloxi.Encoder) error { |
| 2500 | startIndex := len(encoder.Bytes()) |
| 2501 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2502 | return err |
| 2503 | } |
| 2504 | |
| 2505 | encoder.PutUint16(uint16(self.IdleTimeout)) |
| 2506 | encoder.PutUint16(uint16(self.HardTimeout)) |
| 2507 | encoder.PutUint16(uint16(self.Priority)) |
| 2508 | encoder.PutUint64(uint64(self.Cookie)) |
| 2509 | encoder.PutUint16(uint16(self.Flags)) |
| 2510 | encoder.PutUint8(uint8(self.TableId)) |
| 2511 | encoder.Write(bytes.Repeat([]byte{0}, 1)) |
| 2512 | encoder.PutUint16(uint16(self.FinIdleTimeout)) |
| 2513 | encoder.PutUint16(uint16(self.FinHardTimeout)) |
| 2514 | for _, obj := range self.FlowMods { |
| 2515 | if err := obj.Serialize(encoder); err != nil { |
| 2516 | return err |
| 2517 | } |
| 2518 | } |
| 2519 | length := len(encoder.Bytes()) - startIndex |
| 2520 | |
| 2521 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2522 | |
| 2523 | return nil |
| 2524 | } |
| 2525 | |
| 2526 | func DecodeActionNxLearn(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxLearn, error) { |
| 2527 | _actionnxlearn := &ActionNxLearn{ActionNicira: parent} |
| 2528 | if decoder.Length() < 22 { |
| 2529 | return nil, fmt.Errorf("ActionNxLearn packet too short: %d < 22", decoder.Length()) |
| 2530 | } |
| 2531 | _actionnxlearn.IdleTimeout = uint16(decoder.ReadUint16()) |
| 2532 | _actionnxlearn.HardTimeout = uint16(decoder.ReadUint16()) |
| 2533 | _actionnxlearn.Priority = uint16(decoder.ReadUint16()) |
| 2534 | _actionnxlearn.Cookie = uint64(decoder.ReadUint64()) |
| 2535 | _actionnxlearn.Flags = uint16(decoder.ReadUint16()) |
| 2536 | _actionnxlearn.TableId = uint8(decoder.ReadByte()) |
| 2537 | decoder.Skip(1) |
| 2538 | _actionnxlearn.FinIdleTimeout = uint16(decoder.ReadUint16()) |
| 2539 | _actionnxlearn.FinHardTimeout = uint16(decoder.ReadUint16()) |
| 2540 | |
| 2541 | for decoder.Length() >= 2 { |
| 2542 | item, err := DecodeFlowModSpec(decoder) |
| 2543 | if err != nil { |
| 2544 | return nil, err |
| 2545 | } |
| 2546 | if item != nil { |
| 2547 | _actionnxlearn.FlowMods = append(_actionnxlearn.FlowMods, item) |
| 2548 | } |
| 2549 | } |
| 2550 | return _actionnxlearn, nil |
| 2551 | } |
| 2552 | |
| 2553 | func NewActionNxLearn() *ActionNxLearn { |
| 2554 | obj := &ActionNxLearn{ |
| 2555 | ActionNicira: NewActionNicira(16), |
| 2556 | } |
| 2557 | return obj |
| 2558 | } |
| 2559 | func (self *ActionNxLearn) GetActionName() string { |
| 2560 | return "nx_learn" |
| 2561 | } |
| 2562 | |
| 2563 | func (self *ActionNxLearn) GetActionFields() map[string]interface{} { |
| 2564 | return map[string]interface{}{ |
| 2565 | "IdleTimeout": self.IdleTimeout, |
| 2566 | "HardTimeout": self.HardTimeout, |
| 2567 | "Priority": self.Priority, |
| 2568 | "Cookie": self.Cookie, |
| 2569 | "Flags": self.Flags, |
| 2570 | "TableId": self.TableId, |
| 2571 | "FinIdleTimeout": self.FinIdleTimeout, |
| 2572 | "FinHardTimeout": self.FinHardTimeout, |
| 2573 | "FlowMods": self.FlowMods, |
| 2574 | } |
| 2575 | } |
| 2576 | |
| 2577 | func (self *ActionNxLearn) MarshalJSON() ([]byte, error) { |
| 2578 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2579 | if err != nil { |
| 2580 | return nil, err |
| 2581 | } |
| 2582 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2583 | } |
| 2584 | |
| 2585 | type ActionNxLearn2 struct { |
| 2586 | *ActionNicira |
| 2587 | } |
| 2588 | |
| 2589 | type IActionNxLearn2 interface { |
| 2590 | IActionNicira |
| 2591 | } |
| 2592 | |
| 2593 | func (self *ActionNxLearn2) Serialize(encoder *goloxi.Encoder) error { |
| 2594 | startIndex := len(encoder.Bytes()) |
| 2595 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2596 | return err |
| 2597 | } |
| 2598 | length := len(encoder.Bytes()) - startIndex |
| 2599 | |
| 2600 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2601 | |
| 2602 | return nil |
| 2603 | } |
| 2604 | |
| 2605 | func DecodeActionNxLearn2(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxLearn2, error) { |
| 2606 | _actionnxlearn2 := &ActionNxLearn2{ActionNicira: parent} |
| 2607 | return _actionnxlearn2, nil |
| 2608 | } |
| 2609 | |
| 2610 | func NewActionNxLearn2() *ActionNxLearn2 { |
| 2611 | obj := &ActionNxLearn2{ |
| 2612 | ActionNicira: NewActionNicira(45), |
| 2613 | } |
| 2614 | return obj |
| 2615 | } |
| 2616 | func (self *ActionNxLearn2) GetActionName() string { |
| 2617 | return "nx_learn2" |
| 2618 | } |
| 2619 | |
| 2620 | func (self *ActionNxLearn2) GetActionFields() map[string]interface{} { |
| 2621 | return map[string]interface{}{} |
| 2622 | } |
| 2623 | |
| 2624 | func (self *ActionNxLearn2) MarshalJSON() ([]byte, error) { |
| 2625 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2626 | if err != nil { |
| 2627 | return nil, err |
| 2628 | } |
| 2629 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2630 | } |
| 2631 | |
| 2632 | type ActionNxMultipath struct { |
| 2633 | *ActionNicira |
| 2634 | Fields NxHashFields |
| 2635 | Basis uint16 |
| 2636 | Algorithm NxMpAlgorithm |
| 2637 | MaxLink uint16 |
| 2638 | Arg uint32 |
| 2639 | OfsNbits uint16 |
| 2640 | Dst goloxi.IOxmId |
| 2641 | } |
| 2642 | |
| 2643 | type IActionNxMultipath interface { |
| 2644 | IActionNicira |
| 2645 | GetFields() NxHashFields |
| 2646 | GetBasis() uint16 |
| 2647 | GetAlgorithm() NxMpAlgorithm |
| 2648 | GetMaxLink() uint16 |
| 2649 | GetArg() uint32 |
| 2650 | GetOfsNbits() uint16 |
| 2651 | GetDst() goloxi.IOxmId |
| 2652 | } |
| 2653 | |
| 2654 | func (self *ActionNxMultipath) GetFields() NxHashFields { |
| 2655 | return self.Fields |
| 2656 | } |
| 2657 | |
| 2658 | func (self *ActionNxMultipath) SetFields(v NxHashFields) { |
| 2659 | self.Fields = v |
| 2660 | } |
| 2661 | |
| 2662 | func (self *ActionNxMultipath) GetBasis() uint16 { |
| 2663 | return self.Basis |
| 2664 | } |
| 2665 | |
| 2666 | func (self *ActionNxMultipath) SetBasis(v uint16) { |
| 2667 | self.Basis = v |
| 2668 | } |
| 2669 | |
| 2670 | func (self *ActionNxMultipath) GetAlgorithm() NxMpAlgorithm { |
| 2671 | return self.Algorithm |
| 2672 | } |
| 2673 | |
| 2674 | func (self *ActionNxMultipath) SetAlgorithm(v NxMpAlgorithm) { |
| 2675 | self.Algorithm = v |
| 2676 | } |
| 2677 | |
| 2678 | func (self *ActionNxMultipath) GetMaxLink() uint16 { |
| 2679 | return self.MaxLink |
| 2680 | } |
| 2681 | |
| 2682 | func (self *ActionNxMultipath) SetMaxLink(v uint16) { |
| 2683 | self.MaxLink = v |
| 2684 | } |
| 2685 | |
| 2686 | func (self *ActionNxMultipath) GetArg() uint32 { |
| 2687 | return self.Arg |
| 2688 | } |
| 2689 | |
| 2690 | func (self *ActionNxMultipath) SetArg(v uint32) { |
| 2691 | self.Arg = v |
| 2692 | } |
| 2693 | |
| 2694 | func (self *ActionNxMultipath) GetOfsNbits() uint16 { |
| 2695 | return self.OfsNbits |
| 2696 | } |
| 2697 | |
| 2698 | func (self *ActionNxMultipath) SetOfsNbits(v uint16) { |
| 2699 | self.OfsNbits = v |
| 2700 | } |
| 2701 | |
| 2702 | func (self *ActionNxMultipath) GetDst() goloxi.IOxmId { |
| 2703 | return self.Dst |
| 2704 | } |
| 2705 | |
| 2706 | func (self *ActionNxMultipath) SetDst(v goloxi.IOxmId) { |
| 2707 | self.Dst = v |
| 2708 | } |
| 2709 | |
| 2710 | func (self *ActionNxMultipath) Serialize(encoder *goloxi.Encoder) error { |
| 2711 | startIndex := len(encoder.Bytes()) |
| 2712 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2713 | return err |
| 2714 | } |
| 2715 | |
| 2716 | encoder.PutUint16(uint16(self.Fields)) |
| 2717 | encoder.PutUint16(uint16(self.Basis)) |
| 2718 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 2719 | encoder.PutUint16(uint16(self.Algorithm)) |
| 2720 | encoder.PutUint16(uint16(self.MaxLink)) |
| 2721 | encoder.PutUint32(uint32(self.Arg)) |
| 2722 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 2723 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 2724 | self.Dst.Serialize(encoder) |
| 2725 | length := len(encoder.Bytes()) - startIndex |
| 2726 | |
| 2727 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2728 | |
| 2729 | return nil |
| 2730 | } |
| 2731 | |
| 2732 | func DecodeActionNxMultipath(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxMultipath, error) { |
| 2733 | _actionnxmultipath := &ActionNxMultipath{ActionNicira: parent} |
| 2734 | if decoder.Length() < 22 { |
| 2735 | return nil, fmt.Errorf("ActionNxMultipath packet too short: %d < 22", decoder.Length()) |
| 2736 | } |
| 2737 | _actionnxmultipath.Fields = NxHashFields(decoder.ReadUint16()) |
| 2738 | _actionnxmultipath.Basis = uint16(decoder.ReadUint16()) |
| 2739 | decoder.Skip(2) |
| 2740 | _actionnxmultipath.Algorithm = NxMpAlgorithm(decoder.ReadUint16()) |
| 2741 | _actionnxmultipath.MaxLink = uint16(decoder.ReadUint16()) |
| 2742 | _actionnxmultipath.Arg = uint32(decoder.ReadUint32()) |
| 2743 | decoder.Skip(2) |
| 2744 | _actionnxmultipath.OfsNbits = uint16(decoder.ReadUint16()) |
| 2745 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 2746 | return nil, err |
| 2747 | } else { |
| 2748 | _actionnxmultipath.Dst = obj |
| 2749 | } |
| 2750 | |
| 2751 | return _actionnxmultipath, nil |
| 2752 | } |
| 2753 | |
| 2754 | func NewActionNxMultipath() *ActionNxMultipath { |
| 2755 | obj := &ActionNxMultipath{ |
| 2756 | ActionNicira: NewActionNicira(10), |
| 2757 | } |
| 2758 | return obj |
| 2759 | } |
| 2760 | func (self *ActionNxMultipath) GetActionName() string { |
| 2761 | return "nx_multipath" |
| 2762 | } |
| 2763 | |
| 2764 | func (self *ActionNxMultipath) GetActionFields() map[string]interface{} { |
| 2765 | return map[string]interface{}{ |
| 2766 | "Fields": self.Fields, |
| 2767 | "Basis": self.Basis, |
| 2768 | "Algorithm": self.Algorithm, |
| 2769 | "MaxLink": self.MaxLink, |
| 2770 | "Arg": self.Arg, |
| 2771 | "OfsNbits": self.OfsNbits, |
| 2772 | "Dst": self.Dst, |
| 2773 | } |
| 2774 | } |
| 2775 | |
| 2776 | func (self *ActionNxMultipath) MarshalJSON() ([]byte, error) { |
| 2777 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2778 | if err != nil { |
| 2779 | return nil, err |
| 2780 | } |
| 2781 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2782 | } |
| 2783 | |
| 2784 | type ActionNxNat struct { |
| 2785 | *ActionNicira |
| 2786 | Flags uint16 |
| 2787 | RangePresent NxNatRange |
| 2788 | Ipv4Min net.IP |
| 2789 | Ipv4Max net.IP |
| 2790 | Ipv6Min net.IP |
| 2791 | Ipv6Max net.IP |
| 2792 | ProtoMin uint32 |
| 2793 | ProtoMax uint32 |
| 2794 | } |
| 2795 | |
| 2796 | type IActionNxNat interface { |
| 2797 | IActionNicira |
| 2798 | GetFlags() uint16 |
| 2799 | GetRangePresent() NxNatRange |
| 2800 | GetIpv4Min() net.IP |
| 2801 | GetIpv4Max() net.IP |
| 2802 | GetIpv6Min() net.IP |
| 2803 | GetIpv6Max() net.IP |
| 2804 | GetProtoMin() uint32 |
| 2805 | GetProtoMax() uint32 |
| 2806 | } |
| 2807 | |
| 2808 | func (self *ActionNxNat) GetFlags() uint16 { |
| 2809 | return self.Flags |
| 2810 | } |
| 2811 | |
| 2812 | func (self *ActionNxNat) SetFlags(v uint16) { |
| 2813 | self.Flags = v |
| 2814 | } |
| 2815 | |
| 2816 | func (self *ActionNxNat) GetRangePresent() NxNatRange { |
| 2817 | return self.RangePresent |
| 2818 | } |
| 2819 | |
| 2820 | func (self *ActionNxNat) SetRangePresent(v NxNatRange) { |
| 2821 | self.RangePresent = v |
| 2822 | } |
| 2823 | |
| 2824 | func (self *ActionNxNat) GetIpv4Min() net.IP { |
| 2825 | return self.Ipv4Min |
| 2826 | } |
| 2827 | |
| 2828 | func (self *ActionNxNat) SetIpv4Min(v net.IP) { |
| 2829 | self.Ipv4Min = v |
| 2830 | } |
| 2831 | |
| 2832 | func (self *ActionNxNat) GetIpv4Max() net.IP { |
| 2833 | return self.Ipv4Max |
| 2834 | } |
| 2835 | |
| 2836 | func (self *ActionNxNat) SetIpv4Max(v net.IP) { |
| 2837 | self.Ipv4Max = v |
| 2838 | } |
| 2839 | |
| 2840 | func (self *ActionNxNat) GetIpv6Min() net.IP { |
| 2841 | return self.Ipv6Min |
| 2842 | } |
| 2843 | |
| 2844 | func (self *ActionNxNat) SetIpv6Min(v net.IP) { |
| 2845 | self.Ipv6Min = v |
| 2846 | } |
| 2847 | |
| 2848 | func (self *ActionNxNat) GetIpv6Max() net.IP { |
| 2849 | return self.Ipv6Max |
| 2850 | } |
| 2851 | |
| 2852 | func (self *ActionNxNat) SetIpv6Max(v net.IP) { |
| 2853 | self.Ipv6Max = v |
| 2854 | } |
| 2855 | |
| 2856 | func (self *ActionNxNat) GetProtoMin() uint32 { |
| 2857 | return self.ProtoMin |
| 2858 | } |
| 2859 | |
| 2860 | func (self *ActionNxNat) SetProtoMin(v uint32) { |
| 2861 | self.ProtoMin = v |
| 2862 | } |
| 2863 | |
| 2864 | func (self *ActionNxNat) GetProtoMax() uint32 { |
| 2865 | return self.ProtoMax |
| 2866 | } |
| 2867 | |
| 2868 | func (self *ActionNxNat) SetProtoMax(v uint32) { |
| 2869 | self.ProtoMax = v |
| 2870 | } |
| 2871 | |
| 2872 | func (self *ActionNxNat) Serialize(encoder *goloxi.Encoder) error { |
| 2873 | startIndex := len(encoder.Bytes()) |
| 2874 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2875 | return err |
| 2876 | } |
| 2877 | |
| 2878 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 2879 | encoder.PutUint16(uint16(self.Flags)) |
| 2880 | encoder.PutUint16(uint16(self.RangePresent)) |
| 2881 | encoder.Write(self.Ipv4Min.To4()) |
| 2882 | encoder.Write(self.Ipv4Max.To4()) |
| 2883 | encoder.Write(self.Ipv6Min.To16()) |
| 2884 | encoder.Write(self.Ipv6Max.To16()) |
| 2885 | encoder.PutUint32(uint32(self.ProtoMin)) |
| 2886 | encoder.PutUint32(uint32(self.ProtoMax)) |
| 2887 | length := len(encoder.Bytes()) - startIndex |
| 2888 | |
| 2889 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2890 | |
| 2891 | return nil |
| 2892 | } |
| 2893 | |
| 2894 | func DecodeActionNxNat(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxNat, error) { |
| 2895 | _actionnxnat := &ActionNxNat{ActionNicira: parent} |
| 2896 | if decoder.Length() < 6 { |
| 2897 | return nil, fmt.Errorf("ActionNxNat packet too short: %d < 6", decoder.Length()) |
| 2898 | } |
| 2899 | decoder.Skip(2) |
| 2900 | _actionnxnat.Flags = uint16(decoder.ReadUint16()) |
| 2901 | _actionnxnat.RangePresent = NxNatRange(decoder.ReadUint16()) |
| 2902 | if _actionnxnat.RangePresent&1 == 1 { |
| 2903 | _actionnxnat.Ipv4Min = net.IP(decoder.Read(4)) |
| 2904 | } |
| 2905 | if _actionnxnat.RangePresent&2 == 2 { |
| 2906 | _actionnxnat.Ipv4Max = net.IP(decoder.Read(4)) |
| 2907 | } |
| 2908 | if _actionnxnat.RangePresent&4 == 4 { |
| 2909 | _actionnxnat.Ipv6Min = net.IP(decoder.Read(16)) |
| 2910 | } |
| 2911 | if _actionnxnat.RangePresent&8 == 8 { |
| 2912 | _actionnxnat.Ipv6Max = net.IP(decoder.Read(16)) |
| 2913 | } |
| 2914 | if _actionnxnat.RangePresent&16 == 16 { |
| 2915 | _actionnxnat.ProtoMin = uint32(decoder.ReadUint32()) |
| 2916 | } |
| 2917 | if _actionnxnat.RangePresent&32 == 32 { |
| 2918 | _actionnxnat.ProtoMax = uint32(decoder.ReadUint32()) |
| 2919 | } |
| 2920 | return _actionnxnat, nil |
| 2921 | } |
| 2922 | |
| 2923 | func NewActionNxNat() *ActionNxNat { |
| 2924 | obj := &ActionNxNat{ |
| 2925 | ActionNicira: NewActionNicira(36), |
| 2926 | } |
| 2927 | return obj |
| 2928 | } |
| 2929 | func (self *ActionNxNat) GetActionName() string { |
| 2930 | return "nx_nat" |
| 2931 | } |
| 2932 | |
| 2933 | func (self *ActionNxNat) GetActionFields() map[string]interface{} { |
| 2934 | return map[string]interface{}{ |
| 2935 | "Flags": self.Flags, |
| 2936 | "RangePresent": self.RangePresent, |
| 2937 | "Ipv4Min": self.Ipv4Min, |
| 2938 | "Ipv4Max": self.Ipv4Max, |
| 2939 | "Ipv6Min": self.Ipv6Min, |
| 2940 | "Ipv6Max": self.Ipv6Max, |
| 2941 | "ProtoMin": self.ProtoMin, |
| 2942 | "ProtoMax": self.ProtoMax, |
| 2943 | } |
| 2944 | } |
| 2945 | |
| 2946 | func (self *ActionNxNat) MarshalJSON() ([]byte, error) { |
| 2947 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 2948 | if err != nil { |
| 2949 | return nil, err |
| 2950 | } |
| 2951 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 2952 | } |
| 2953 | |
| 2954 | type ActionNxNote struct { |
| 2955 | *ActionNicira |
| 2956 | Note []byte |
| 2957 | } |
| 2958 | |
| 2959 | type IActionNxNote interface { |
| 2960 | IActionNicira |
| 2961 | GetNote() []byte |
| 2962 | } |
| 2963 | |
| 2964 | func (self *ActionNxNote) GetNote() []byte { |
| 2965 | return self.Note |
| 2966 | } |
| 2967 | |
| 2968 | func (self *ActionNxNote) SetNote(v []byte) { |
| 2969 | self.Note = v |
| 2970 | } |
| 2971 | |
| 2972 | func (self *ActionNxNote) Serialize(encoder *goloxi.Encoder) error { |
| 2973 | startIndex := len(encoder.Bytes()) |
| 2974 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 2975 | return err |
| 2976 | } |
| 2977 | |
| 2978 | encoder.Write(self.Note) |
| 2979 | length := len(encoder.Bytes()) - startIndex |
| 2980 | |
| 2981 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 2982 | |
| 2983 | return nil |
| 2984 | } |
| 2985 | |
| 2986 | func DecodeActionNxNote(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxNote, error) { |
| 2987 | _actionnxnote := &ActionNxNote{ActionNicira: parent} |
| 2988 | _actionnxnote.Note = decoder.Read(int(decoder.Length())) |
| 2989 | return _actionnxnote, nil |
| 2990 | } |
| 2991 | |
| 2992 | func NewActionNxNote() *ActionNxNote { |
| 2993 | obj := &ActionNxNote{ |
| 2994 | ActionNicira: NewActionNicira(8), |
| 2995 | } |
| 2996 | return obj |
| 2997 | } |
| 2998 | func (self *ActionNxNote) GetActionName() string { |
| 2999 | return "nx_note" |
| 3000 | } |
| 3001 | |
| 3002 | func (self *ActionNxNote) GetActionFields() map[string]interface{} { |
| 3003 | return map[string]interface{}{ |
| 3004 | "Note": self.Note, |
| 3005 | } |
| 3006 | } |
| 3007 | |
| 3008 | func (self *ActionNxNote) MarshalJSON() ([]byte, error) { |
| 3009 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3010 | if err != nil { |
| 3011 | return nil, err |
| 3012 | } |
| 3013 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3014 | } |
| 3015 | |
| 3016 | type ActionNxOutputReg struct { |
| 3017 | *ActionNicira |
| 3018 | OfsNbits uint16 |
| 3019 | Src uint32 |
| 3020 | MaxLen uint16 |
| 3021 | } |
| 3022 | |
| 3023 | type IActionNxOutputReg interface { |
| 3024 | IActionNicira |
| 3025 | GetOfsNbits() uint16 |
| 3026 | GetSrc() uint32 |
| 3027 | GetMaxLen() uint16 |
| 3028 | } |
| 3029 | |
| 3030 | func (self *ActionNxOutputReg) GetOfsNbits() uint16 { |
| 3031 | return self.OfsNbits |
| 3032 | } |
| 3033 | |
| 3034 | func (self *ActionNxOutputReg) SetOfsNbits(v uint16) { |
| 3035 | self.OfsNbits = v |
| 3036 | } |
| 3037 | |
| 3038 | func (self *ActionNxOutputReg) GetSrc() uint32 { |
| 3039 | return self.Src |
| 3040 | } |
| 3041 | |
| 3042 | func (self *ActionNxOutputReg) SetSrc(v uint32) { |
| 3043 | self.Src = v |
| 3044 | } |
| 3045 | |
| 3046 | func (self *ActionNxOutputReg) GetMaxLen() uint16 { |
| 3047 | return self.MaxLen |
| 3048 | } |
| 3049 | |
| 3050 | func (self *ActionNxOutputReg) SetMaxLen(v uint16) { |
| 3051 | self.MaxLen = v |
| 3052 | } |
| 3053 | |
| 3054 | func (self *ActionNxOutputReg) Serialize(encoder *goloxi.Encoder) error { |
| 3055 | startIndex := len(encoder.Bytes()) |
| 3056 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3057 | return err |
| 3058 | } |
| 3059 | |
| 3060 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 3061 | encoder.PutUint32(uint32(self.Src)) |
| 3062 | encoder.PutUint16(uint16(self.MaxLen)) |
| 3063 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 3064 | length := len(encoder.Bytes()) - startIndex |
| 3065 | |
| 3066 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3067 | |
| 3068 | return nil |
| 3069 | } |
| 3070 | |
| 3071 | func DecodeActionNxOutputReg(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxOutputReg, error) { |
| 3072 | _actionnxoutputreg := &ActionNxOutputReg{ActionNicira: parent} |
| 3073 | if decoder.Length() < 14 { |
| 3074 | return nil, fmt.Errorf("ActionNxOutputReg packet too short: %d < 14", decoder.Length()) |
| 3075 | } |
| 3076 | _actionnxoutputreg.OfsNbits = uint16(decoder.ReadUint16()) |
| 3077 | _actionnxoutputreg.Src = uint32(decoder.ReadUint32()) |
| 3078 | _actionnxoutputreg.MaxLen = uint16(decoder.ReadUint16()) |
| 3079 | decoder.Skip(6) |
| 3080 | return _actionnxoutputreg, nil |
| 3081 | } |
| 3082 | |
| 3083 | func NewActionNxOutputReg() *ActionNxOutputReg { |
| 3084 | obj := &ActionNxOutputReg{ |
| 3085 | ActionNicira: NewActionNicira(15), |
| 3086 | } |
| 3087 | return obj |
| 3088 | } |
| 3089 | func (self *ActionNxOutputReg) GetActionName() string { |
| 3090 | return "nx_output_reg" |
| 3091 | } |
| 3092 | |
| 3093 | func (self *ActionNxOutputReg) GetActionFields() map[string]interface{} { |
| 3094 | return map[string]interface{}{ |
| 3095 | "OfsNbits": self.OfsNbits, |
| 3096 | "Src": self.Src, |
| 3097 | "MaxLen": self.MaxLen, |
| 3098 | } |
| 3099 | } |
| 3100 | |
| 3101 | func (self *ActionNxOutputReg) MarshalJSON() ([]byte, error) { |
| 3102 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3103 | if err != nil { |
| 3104 | return nil, err |
| 3105 | } |
| 3106 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3107 | } |
| 3108 | |
| 3109 | type ActionNxOutputReg2 struct { |
| 3110 | *ActionNicira |
| 3111 | OfsNbits uint16 |
| 3112 | MaxLen uint16 |
| 3113 | } |
| 3114 | |
| 3115 | type IActionNxOutputReg2 interface { |
| 3116 | IActionNicira |
| 3117 | GetOfsNbits() uint16 |
| 3118 | GetMaxLen() uint16 |
| 3119 | } |
| 3120 | |
| 3121 | func (self *ActionNxOutputReg2) GetOfsNbits() uint16 { |
| 3122 | return self.OfsNbits |
| 3123 | } |
| 3124 | |
| 3125 | func (self *ActionNxOutputReg2) SetOfsNbits(v uint16) { |
| 3126 | self.OfsNbits = v |
| 3127 | } |
| 3128 | |
| 3129 | func (self *ActionNxOutputReg2) GetMaxLen() uint16 { |
| 3130 | return self.MaxLen |
| 3131 | } |
| 3132 | |
| 3133 | func (self *ActionNxOutputReg2) SetMaxLen(v uint16) { |
| 3134 | self.MaxLen = v |
| 3135 | } |
| 3136 | |
| 3137 | func (self *ActionNxOutputReg2) Serialize(encoder *goloxi.Encoder) error { |
| 3138 | startIndex := len(encoder.Bytes()) |
| 3139 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3140 | return err |
| 3141 | } |
| 3142 | |
| 3143 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 3144 | encoder.PutUint16(uint16(self.MaxLen)) |
| 3145 | encoder.Write(bytes.Repeat([]byte{0}, 10)) |
| 3146 | length := len(encoder.Bytes()) - startIndex |
| 3147 | |
| 3148 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3149 | |
| 3150 | return nil |
| 3151 | } |
| 3152 | |
| 3153 | func DecodeActionNxOutputReg2(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxOutputReg2, error) { |
| 3154 | _actionnxoutputreg2 := &ActionNxOutputReg2{ActionNicira: parent} |
| 3155 | if decoder.Length() < 14 { |
| 3156 | return nil, fmt.Errorf("ActionNxOutputReg2 packet too short: %d < 14", decoder.Length()) |
| 3157 | } |
| 3158 | _actionnxoutputreg2.OfsNbits = uint16(decoder.ReadUint16()) |
| 3159 | _actionnxoutputreg2.MaxLen = uint16(decoder.ReadUint16()) |
| 3160 | decoder.Skip(10) |
| 3161 | return _actionnxoutputreg2, nil |
| 3162 | } |
| 3163 | |
| 3164 | func NewActionNxOutputReg2() *ActionNxOutputReg2 { |
| 3165 | obj := &ActionNxOutputReg2{ |
| 3166 | ActionNicira: NewActionNicira(32), |
| 3167 | } |
| 3168 | return obj |
| 3169 | } |
| 3170 | func (self *ActionNxOutputReg2) GetActionName() string { |
| 3171 | return "nx_output_reg2" |
| 3172 | } |
| 3173 | |
| 3174 | func (self *ActionNxOutputReg2) GetActionFields() map[string]interface{} { |
| 3175 | return map[string]interface{}{ |
| 3176 | "OfsNbits": self.OfsNbits, |
| 3177 | "MaxLen": self.MaxLen, |
| 3178 | } |
| 3179 | } |
| 3180 | |
| 3181 | func (self *ActionNxOutputReg2) MarshalJSON() ([]byte, error) { |
| 3182 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3183 | if err != nil { |
| 3184 | return nil, err |
| 3185 | } |
| 3186 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3187 | } |
| 3188 | |
| 3189 | type ActionNxOutputTrunc struct { |
| 3190 | *ActionNicira |
| 3191 | Port uint16 |
| 3192 | MaxLen uint32 |
| 3193 | } |
| 3194 | |
| 3195 | type IActionNxOutputTrunc interface { |
| 3196 | IActionNicira |
| 3197 | GetPort() uint16 |
| 3198 | GetMaxLen() uint32 |
| 3199 | } |
| 3200 | |
| 3201 | func (self *ActionNxOutputTrunc) GetPort() uint16 { |
| 3202 | return self.Port |
| 3203 | } |
| 3204 | |
| 3205 | func (self *ActionNxOutputTrunc) SetPort(v uint16) { |
| 3206 | self.Port = v |
| 3207 | } |
| 3208 | |
| 3209 | func (self *ActionNxOutputTrunc) GetMaxLen() uint32 { |
| 3210 | return self.MaxLen |
| 3211 | } |
| 3212 | |
| 3213 | func (self *ActionNxOutputTrunc) SetMaxLen(v uint32) { |
| 3214 | self.MaxLen = v |
| 3215 | } |
| 3216 | |
| 3217 | func (self *ActionNxOutputTrunc) Serialize(encoder *goloxi.Encoder) error { |
| 3218 | startIndex := len(encoder.Bytes()) |
| 3219 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3220 | return err |
| 3221 | } |
| 3222 | |
| 3223 | encoder.PutUint16(uint16(self.Port)) |
| 3224 | encoder.PutUint32(uint32(self.MaxLen)) |
| 3225 | length := len(encoder.Bytes()) - startIndex |
| 3226 | |
| 3227 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3228 | |
| 3229 | return nil |
| 3230 | } |
| 3231 | |
| 3232 | func DecodeActionNxOutputTrunc(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxOutputTrunc, error) { |
| 3233 | _actionnxoutputtrunc := &ActionNxOutputTrunc{ActionNicira: parent} |
| 3234 | if decoder.Length() < 6 { |
| 3235 | return nil, fmt.Errorf("ActionNxOutputTrunc packet too short: %d < 6", decoder.Length()) |
| 3236 | } |
| 3237 | _actionnxoutputtrunc.Port = uint16(decoder.ReadUint16()) |
| 3238 | _actionnxoutputtrunc.MaxLen = uint32(decoder.ReadUint32()) |
| 3239 | return _actionnxoutputtrunc, nil |
| 3240 | } |
| 3241 | |
| 3242 | func NewActionNxOutputTrunc() *ActionNxOutputTrunc { |
| 3243 | obj := &ActionNxOutputTrunc{ |
| 3244 | ActionNicira: NewActionNicira(39), |
| 3245 | } |
| 3246 | return obj |
| 3247 | } |
| 3248 | func (self *ActionNxOutputTrunc) GetActionName() string { |
| 3249 | return "nx_output_trunc" |
| 3250 | } |
| 3251 | |
| 3252 | func (self *ActionNxOutputTrunc) GetActionFields() map[string]interface{} { |
| 3253 | return map[string]interface{}{ |
| 3254 | "Port": self.Port, |
| 3255 | "MaxLen": self.MaxLen, |
| 3256 | } |
| 3257 | } |
| 3258 | |
| 3259 | func (self *ActionNxOutputTrunc) MarshalJSON() ([]byte, error) { |
| 3260 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3261 | if err != nil { |
| 3262 | return nil, err |
| 3263 | } |
| 3264 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3265 | } |
| 3266 | |
| 3267 | type ActionNxPopMpls struct { |
| 3268 | *ActionNicira |
| 3269 | Value uint16 |
| 3270 | } |
| 3271 | |
| 3272 | type IActionNxPopMpls interface { |
| 3273 | IActionNicira |
| 3274 | GetValue() uint16 |
| 3275 | } |
| 3276 | |
| 3277 | func (self *ActionNxPopMpls) GetValue() uint16 { |
| 3278 | return self.Value |
| 3279 | } |
| 3280 | |
| 3281 | func (self *ActionNxPopMpls) SetValue(v uint16) { |
| 3282 | self.Value = v |
| 3283 | } |
| 3284 | |
| 3285 | func (self *ActionNxPopMpls) Serialize(encoder *goloxi.Encoder) error { |
| 3286 | startIndex := len(encoder.Bytes()) |
| 3287 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3288 | return err |
| 3289 | } |
| 3290 | |
| 3291 | encoder.PutUint16(uint16(self.Value)) |
| 3292 | length := len(encoder.Bytes()) - startIndex |
| 3293 | |
| 3294 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3295 | |
| 3296 | return nil |
| 3297 | } |
| 3298 | |
| 3299 | func DecodeActionNxPopMpls(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxPopMpls, error) { |
| 3300 | _actionnxpopmpls := &ActionNxPopMpls{ActionNicira: parent} |
| 3301 | if decoder.Length() < 2 { |
| 3302 | return nil, fmt.Errorf("ActionNxPopMpls packet too short: %d < 2", decoder.Length()) |
| 3303 | } |
| 3304 | _actionnxpopmpls.Value = uint16(decoder.ReadUint16()) |
| 3305 | return _actionnxpopmpls, nil |
| 3306 | } |
| 3307 | |
| 3308 | func NewActionNxPopMpls() *ActionNxPopMpls { |
| 3309 | obj := &ActionNxPopMpls{ |
| 3310 | ActionNicira: NewActionNicira(24), |
| 3311 | } |
| 3312 | return obj |
| 3313 | } |
| 3314 | func (self *ActionNxPopMpls) GetActionName() string { |
| 3315 | return "nx_pop_mpls" |
| 3316 | } |
| 3317 | |
| 3318 | func (self *ActionNxPopMpls) GetActionFields() map[string]interface{} { |
| 3319 | return map[string]interface{}{ |
| 3320 | "Value": self.Value, |
| 3321 | } |
| 3322 | } |
| 3323 | |
| 3324 | func (self *ActionNxPopMpls) MarshalJSON() ([]byte, error) { |
| 3325 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3326 | if err != nil { |
| 3327 | return nil, err |
| 3328 | } |
| 3329 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3330 | } |
| 3331 | |
| 3332 | type ActionNxPopQueue struct { |
| 3333 | *ActionNicira |
| 3334 | } |
| 3335 | |
| 3336 | type IActionNxPopQueue interface { |
| 3337 | IActionNicira |
| 3338 | } |
| 3339 | |
| 3340 | func (self *ActionNxPopQueue) Serialize(encoder *goloxi.Encoder) error { |
| 3341 | startIndex := len(encoder.Bytes()) |
| 3342 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3343 | return err |
| 3344 | } |
| 3345 | length := len(encoder.Bytes()) - startIndex |
| 3346 | |
| 3347 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3348 | |
| 3349 | return nil |
| 3350 | } |
| 3351 | |
| 3352 | func DecodeActionNxPopQueue(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxPopQueue, error) { |
| 3353 | _actionnxpopqueue := &ActionNxPopQueue{ActionNicira: parent} |
| 3354 | return _actionnxpopqueue, nil |
| 3355 | } |
| 3356 | |
| 3357 | func NewActionNxPopQueue() *ActionNxPopQueue { |
| 3358 | obj := &ActionNxPopQueue{ |
| 3359 | ActionNicira: NewActionNicira(5), |
| 3360 | } |
| 3361 | return obj |
| 3362 | } |
| 3363 | func (self *ActionNxPopQueue) GetActionName() string { |
| 3364 | return "nx_pop_queue" |
| 3365 | } |
| 3366 | |
| 3367 | func (self *ActionNxPopQueue) GetActionFields() map[string]interface{} { |
| 3368 | return map[string]interface{}{} |
| 3369 | } |
| 3370 | |
| 3371 | func (self *ActionNxPopQueue) MarshalJSON() ([]byte, error) { |
| 3372 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3373 | if err != nil { |
| 3374 | return nil, err |
| 3375 | } |
| 3376 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3377 | } |
| 3378 | |
| 3379 | type ActionNxPushMpls struct { |
| 3380 | *ActionNicira |
| 3381 | Value uint16 |
| 3382 | } |
| 3383 | |
| 3384 | type IActionNxPushMpls interface { |
| 3385 | IActionNicira |
| 3386 | GetValue() uint16 |
| 3387 | } |
| 3388 | |
| 3389 | func (self *ActionNxPushMpls) GetValue() uint16 { |
| 3390 | return self.Value |
| 3391 | } |
| 3392 | |
| 3393 | func (self *ActionNxPushMpls) SetValue(v uint16) { |
| 3394 | self.Value = v |
| 3395 | } |
| 3396 | |
| 3397 | func (self *ActionNxPushMpls) Serialize(encoder *goloxi.Encoder) error { |
| 3398 | startIndex := len(encoder.Bytes()) |
| 3399 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3400 | return err |
| 3401 | } |
| 3402 | |
| 3403 | encoder.PutUint16(uint16(self.Value)) |
| 3404 | length := len(encoder.Bytes()) - startIndex |
| 3405 | |
| 3406 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3407 | |
| 3408 | return nil |
| 3409 | } |
| 3410 | |
| 3411 | func DecodeActionNxPushMpls(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxPushMpls, error) { |
| 3412 | _actionnxpushmpls := &ActionNxPushMpls{ActionNicira: parent} |
| 3413 | if decoder.Length() < 2 { |
| 3414 | return nil, fmt.Errorf("ActionNxPushMpls packet too short: %d < 2", decoder.Length()) |
| 3415 | } |
| 3416 | _actionnxpushmpls.Value = uint16(decoder.ReadUint16()) |
| 3417 | return _actionnxpushmpls, nil |
| 3418 | } |
| 3419 | |
| 3420 | func NewActionNxPushMpls() *ActionNxPushMpls { |
| 3421 | obj := &ActionNxPushMpls{ |
| 3422 | ActionNicira: NewActionNicira(23), |
| 3423 | } |
| 3424 | return obj |
| 3425 | } |
| 3426 | func (self *ActionNxPushMpls) GetActionName() string { |
| 3427 | return "nx_push_mpls" |
| 3428 | } |
| 3429 | |
| 3430 | func (self *ActionNxPushMpls) GetActionFields() map[string]interface{} { |
| 3431 | return map[string]interface{}{ |
| 3432 | "Value": self.Value, |
| 3433 | } |
| 3434 | } |
| 3435 | |
| 3436 | func (self *ActionNxPushMpls) MarshalJSON() ([]byte, error) { |
| 3437 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3438 | if err != nil { |
| 3439 | return nil, err |
| 3440 | } |
| 3441 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3442 | } |
| 3443 | |
| 3444 | type ActionNxRegLoad struct { |
| 3445 | *ActionNicira |
| 3446 | OfsNbits uint16 |
| 3447 | SrcField goloxi.IOxmId |
| 3448 | Value uint64 |
| 3449 | } |
| 3450 | |
| 3451 | type IActionNxRegLoad interface { |
| 3452 | IActionNicira |
| 3453 | GetOfsNbits() uint16 |
| 3454 | GetSrcField() goloxi.IOxmId |
| 3455 | GetValue() uint64 |
| 3456 | } |
| 3457 | |
| 3458 | func (self *ActionNxRegLoad) GetOfsNbits() uint16 { |
| 3459 | return self.OfsNbits |
| 3460 | } |
| 3461 | |
| 3462 | func (self *ActionNxRegLoad) SetOfsNbits(v uint16) { |
| 3463 | self.OfsNbits = v |
| 3464 | } |
| 3465 | |
| 3466 | func (self *ActionNxRegLoad) GetSrcField() goloxi.IOxmId { |
| 3467 | return self.SrcField |
| 3468 | } |
| 3469 | |
| 3470 | func (self *ActionNxRegLoad) SetSrcField(v goloxi.IOxmId) { |
| 3471 | self.SrcField = v |
| 3472 | } |
| 3473 | |
| 3474 | func (self *ActionNxRegLoad) GetValue() uint64 { |
| 3475 | return self.Value |
| 3476 | } |
| 3477 | |
| 3478 | func (self *ActionNxRegLoad) SetValue(v uint64) { |
| 3479 | self.Value = v |
| 3480 | } |
| 3481 | |
| 3482 | func (self *ActionNxRegLoad) Serialize(encoder *goloxi.Encoder) error { |
| 3483 | startIndex := len(encoder.Bytes()) |
| 3484 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3485 | return err |
| 3486 | } |
| 3487 | |
| 3488 | encoder.PutUint16(uint16(self.OfsNbits)) |
| 3489 | self.SrcField.Serialize(encoder) |
| 3490 | encoder.PutUint64(uint64(self.Value)) |
| 3491 | length := len(encoder.Bytes()) - startIndex |
| 3492 | |
| 3493 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3494 | |
| 3495 | return nil |
| 3496 | } |
| 3497 | |
| 3498 | func DecodeActionNxRegLoad(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxRegLoad, error) { |
| 3499 | _actionnxregload := &ActionNxRegLoad{ActionNicira: parent} |
| 3500 | if decoder.Length() < 14 { |
| 3501 | return nil, fmt.Errorf("ActionNxRegLoad packet too short: %d < 14", decoder.Length()) |
| 3502 | } |
| 3503 | _actionnxregload.OfsNbits = uint16(decoder.ReadUint16()) |
| 3504 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 3505 | return nil, err |
| 3506 | } else { |
| 3507 | _actionnxregload.SrcField = obj |
| 3508 | } |
| 3509 | |
| 3510 | _actionnxregload.Value = uint64(decoder.ReadUint64()) |
| 3511 | return _actionnxregload, nil |
| 3512 | } |
| 3513 | |
| 3514 | func NewActionNxRegLoad() *ActionNxRegLoad { |
| 3515 | obj := &ActionNxRegLoad{ |
| 3516 | ActionNicira: NewActionNicira(7), |
| 3517 | } |
| 3518 | return obj |
| 3519 | } |
| 3520 | func (self *ActionNxRegLoad) GetActionName() string { |
| 3521 | return "nx_reg_load" |
| 3522 | } |
| 3523 | |
| 3524 | func (self *ActionNxRegLoad) GetActionFields() map[string]interface{} { |
| 3525 | return map[string]interface{}{ |
| 3526 | "OfsNbits": self.OfsNbits, |
| 3527 | "SrcField": self.SrcField, |
| 3528 | "Value": self.Value, |
| 3529 | } |
| 3530 | } |
| 3531 | |
| 3532 | func (self *ActionNxRegLoad) MarshalJSON() ([]byte, error) { |
| 3533 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3534 | if err != nil { |
| 3535 | return nil, err |
| 3536 | } |
| 3537 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3538 | } |
| 3539 | |
| 3540 | type ActionNxRegLoad2 struct { |
| 3541 | *ActionNicira |
| 3542 | } |
| 3543 | |
| 3544 | type IActionNxRegLoad2 interface { |
| 3545 | IActionNicira |
| 3546 | } |
| 3547 | |
| 3548 | func (self *ActionNxRegLoad2) Serialize(encoder *goloxi.Encoder) error { |
| 3549 | startIndex := len(encoder.Bytes()) |
| 3550 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3551 | return err |
| 3552 | } |
| 3553 | |
| 3554 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 3555 | length := len(encoder.Bytes()) - startIndex |
| 3556 | |
| 3557 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3558 | |
| 3559 | return nil |
| 3560 | } |
| 3561 | |
| 3562 | func DecodeActionNxRegLoad2(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxRegLoad2, error) { |
| 3563 | _actionnxregload2 := &ActionNxRegLoad2{ActionNicira: parent} |
| 3564 | if decoder.Length() < 6 { |
| 3565 | return nil, fmt.Errorf("ActionNxRegLoad2 packet too short: %d < 6", decoder.Length()) |
| 3566 | } |
| 3567 | decoder.Skip(6) |
| 3568 | return _actionnxregload2, nil |
| 3569 | } |
| 3570 | |
| 3571 | func NewActionNxRegLoad2() *ActionNxRegLoad2 { |
| 3572 | obj := &ActionNxRegLoad2{ |
| 3573 | ActionNicira: NewActionNicira(33), |
| 3574 | } |
| 3575 | return obj |
| 3576 | } |
| 3577 | func (self *ActionNxRegLoad2) GetActionName() string { |
| 3578 | return "nx_reg_load2" |
| 3579 | } |
| 3580 | |
| 3581 | func (self *ActionNxRegLoad2) GetActionFields() map[string]interface{} { |
| 3582 | return map[string]interface{}{} |
| 3583 | } |
| 3584 | |
| 3585 | func (self *ActionNxRegLoad2) MarshalJSON() ([]byte, error) { |
| 3586 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3587 | if err != nil { |
| 3588 | return nil, err |
| 3589 | } |
| 3590 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3591 | } |
| 3592 | |
| 3593 | type ActionNxRegMove struct { |
| 3594 | *ActionNicira |
| 3595 | NBits uint16 |
| 3596 | SrcOfs uint16 |
| 3597 | DstOfs uint16 |
| 3598 | Src goloxi.IOxmId |
| 3599 | Dst goloxi.IOxmId |
| 3600 | } |
| 3601 | |
| 3602 | type IActionNxRegMove interface { |
| 3603 | IActionNicira |
| 3604 | GetNBits() uint16 |
| 3605 | GetSrcOfs() uint16 |
| 3606 | GetDstOfs() uint16 |
| 3607 | GetSrc() goloxi.IOxmId |
| 3608 | GetDst() goloxi.IOxmId |
| 3609 | } |
| 3610 | |
| 3611 | func (self *ActionNxRegMove) GetNBits() uint16 { |
| 3612 | return self.NBits |
| 3613 | } |
| 3614 | |
| 3615 | func (self *ActionNxRegMove) SetNBits(v uint16) { |
| 3616 | self.NBits = v |
| 3617 | } |
| 3618 | |
| 3619 | func (self *ActionNxRegMove) GetSrcOfs() uint16 { |
| 3620 | return self.SrcOfs |
| 3621 | } |
| 3622 | |
| 3623 | func (self *ActionNxRegMove) SetSrcOfs(v uint16) { |
| 3624 | self.SrcOfs = v |
| 3625 | } |
| 3626 | |
| 3627 | func (self *ActionNxRegMove) GetDstOfs() uint16 { |
| 3628 | return self.DstOfs |
| 3629 | } |
| 3630 | |
| 3631 | func (self *ActionNxRegMove) SetDstOfs(v uint16) { |
| 3632 | self.DstOfs = v |
| 3633 | } |
| 3634 | |
| 3635 | func (self *ActionNxRegMove) GetSrc() goloxi.IOxmId { |
| 3636 | return self.Src |
| 3637 | } |
| 3638 | |
| 3639 | func (self *ActionNxRegMove) SetSrc(v goloxi.IOxmId) { |
| 3640 | self.Src = v |
| 3641 | } |
| 3642 | |
| 3643 | func (self *ActionNxRegMove) GetDst() goloxi.IOxmId { |
| 3644 | return self.Dst |
| 3645 | } |
| 3646 | |
| 3647 | func (self *ActionNxRegMove) SetDst(v goloxi.IOxmId) { |
| 3648 | self.Dst = v |
| 3649 | } |
| 3650 | |
| 3651 | func (self *ActionNxRegMove) Serialize(encoder *goloxi.Encoder) error { |
| 3652 | startIndex := len(encoder.Bytes()) |
| 3653 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3654 | return err |
| 3655 | } |
| 3656 | |
| 3657 | encoder.PutUint16(uint16(self.NBits)) |
| 3658 | encoder.PutUint16(uint16(self.SrcOfs)) |
| 3659 | encoder.PutUint16(uint16(self.DstOfs)) |
| 3660 | self.Src.Serialize(encoder) |
| 3661 | self.Dst.Serialize(encoder) |
| 3662 | length := len(encoder.Bytes()) - startIndex |
| 3663 | alignedLength := ((length + 7) / 8 * 8) |
| 3664 | |
| 3665 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3666 | |
| 3667 | encoder.Write(bytes.Repeat([]byte{0}, alignedLength-length)) |
| 3668 | |
| 3669 | return nil |
| 3670 | } |
| 3671 | |
| 3672 | func DecodeActionNxRegMove(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxRegMove, error) { |
| 3673 | _actionnxregmove := &ActionNxRegMove{ActionNicira: parent} |
| 3674 | if decoder.Length() < 14 { |
| 3675 | return nil, fmt.Errorf("ActionNxRegMove packet too short: %d < 14", decoder.Length()) |
| 3676 | } |
| 3677 | _actionnxregmove.NBits = uint16(decoder.ReadUint16()) |
| 3678 | _actionnxregmove.SrcOfs = uint16(decoder.ReadUint16()) |
| 3679 | _actionnxregmove.DstOfs = uint16(decoder.ReadUint16()) |
| 3680 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 3681 | return nil, err |
| 3682 | } else { |
| 3683 | _actionnxregmove.Src = obj |
| 3684 | } |
| 3685 | |
| 3686 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 3687 | return nil, err |
| 3688 | } else { |
| 3689 | _actionnxregmove.Dst = obj |
| 3690 | } |
| 3691 | |
| 3692 | return _actionnxregmove, nil |
| 3693 | } |
| 3694 | |
| 3695 | func NewActionNxRegMove() *ActionNxRegMove { |
| 3696 | obj := &ActionNxRegMove{ |
| 3697 | ActionNicira: NewActionNicira(6), |
| 3698 | } |
| 3699 | return obj |
| 3700 | } |
| 3701 | func (self *ActionNxRegMove) GetActionName() string { |
| 3702 | return "nx_reg_move" |
| 3703 | } |
| 3704 | |
| 3705 | func (self *ActionNxRegMove) GetActionFields() map[string]interface{} { |
| 3706 | return map[string]interface{}{ |
| 3707 | "NBits": self.NBits, |
| 3708 | "SrcOfs": self.SrcOfs, |
| 3709 | "DstOfs": self.DstOfs, |
| 3710 | "Src": self.Src, |
| 3711 | "Dst": self.Dst, |
| 3712 | } |
| 3713 | } |
| 3714 | |
| 3715 | func (self *ActionNxRegMove) MarshalJSON() ([]byte, error) { |
| 3716 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3717 | if err != nil { |
| 3718 | return nil, err |
| 3719 | } |
| 3720 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3721 | } |
| 3722 | |
| 3723 | type ActionNxResubmit struct { |
| 3724 | *ActionNicira |
| 3725 | Value uint16 |
| 3726 | } |
| 3727 | |
| 3728 | type IActionNxResubmit interface { |
| 3729 | IActionNicira |
| 3730 | GetValue() uint16 |
| 3731 | } |
| 3732 | |
| 3733 | func (self *ActionNxResubmit) GetValue() uint16 { |
| 3734 | return self.Value |
| 3735 | } |
| 3736 | |
| 3737 | func (self *ActionNxResubmit) SetValue(v uint16) { |
| 3738 | self.Value = v |
| 3739 | } |
| 3740 | |
| 3741 | func (self *ActionNxResubmit) Serialize(encoder *goloxi.Encoder) error { |
| 3742 | startIndex := len(encoder.Bytes()) |
| 3743 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3744 | return err |
| 3745 | } |
| 3746 | |
| 3747 | encoder.PutUint16(uint16(self.Value)) |
| 3748 | length := len(encoder.Bytes()) - startIndex |
| 3749 | |
| 3750 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3751 | |
| 3752 | return nil |
| 3753 | } |
| 3754 | |
| 3755 | func DecodeActionNxResubmit(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxResubmit, error) { |
| 3756 | _actionnxresubmit := &ActionNxResubmit{ActionNicira: parent} |
| 3757 | if decoder.Length() < 2 { |
| 3758 | return nil, fmt.Errorf("ActionNxResubmit packet too short: %d < 2", decoder.Length()) |
| 3759 | } |
| 3760 | _actionnxresubmit.Value = uint16(decoder.ReadUint16()) |
| 3761 | return _actionnxresubmit, nil |
| 3762 | } |
| 3763 | |
| 3764 | func NewActionNxResubmit() *ActionNxResubmit { |
| 3765 | obj := &ActionNxResubmit{ |
| 3766 | ActionNicira: NewActionNicira(1), |
| 3767 | } |
| 3768 | return obj |
| 3769 | } |
| 3770 | func (self *ActionNxResubmit) GetActionName() string { |
| 3771 | return "nx_resubmit" |
| 3772 | } |
| 3773 | |
| 3774 | func (self *ActionNxResubmit) GetActionFields() map[string]interface{} { |
| 3775 | return map[string]interface{}{ |
| 3776 | "Value": self.Value, |
| 3777 | } |
| 3778 | } |
| 3779 | |
| 3780 | func (self *ActionNxResubmit) MarshalJSON() ([]byte, error) { |
| 3781 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3782 | if err != nil { |
| 3783 | return nil, err |
| 3784 | } |
| 3785 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3786 | } |
| 3787 | |
| 3788 | type ActionNxResubmitTable struct { |
| 3789 | *ActionNicira |
| 3790 | InPort uint16 |
| 3791 | Table uint8 |
| 3792 | } |
| 3793 | |
| 3794 | type IActionNxResubmitTable interface { |
| 3795 | IActionNicira |
| 3796 | GetInPort() uint16 |
| 3797 | GetTable() uint8 |
| 3798 | } |
| 3799 | |
| 3800 | func (self *ActionNxResubmitTable) GetInPort() uint16 { |
| 3801 | return self.InPort |
| 3802 | } |
| 3803 | |
| 3804 | func (self *ActionNxResubmitTable) SetInPort(v uint16) { |
| 3805 | self.InPort = v |
| 3806 | } |
| 3807 | |
| 3808 | func (self *ActionNxResubmitTable) GetTable() uint8 { |
| 3809 | return self.Table |
| 3810 | } |
| 3811 | |
| 3812 | func (self *ActionNxResubmitTable) SetTable(v uint8) { |
| 3813 | self.Table = v |
| 3814 | } |
| 3815 | |
| 3816 | func (self *ActionNxResubmitTable) Serialize(encoder *goloxi.Encoder) error { |
| 3817 | startIndex := len(encoder.Bytes()) |
| 3818 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3819 | return err |
| 3820 | } |
| 3821 | |
| 3822 | encoder.PutUint16(uint16(self.InPort)) |
| 3823 | encoder.PutUint8(uint8(self.Table)) |
| 3824 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 3825 | length := len(encoder.Bytes()) - startIndex |
| 3826 | |
| 3827 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3828 | |
| 3829 | return nil |
| 3830 | } |
| 3831 | |
| 3832 | func DecodeActionNxResubmitTable(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxResubmitTable, error) { |
| 3833 | _actionnxresubmittable := &ActionNxResubmitTable{ActionNicira: parent} |
| 3834 | if decoder.Length() < 6 { |
| 3835 | return nil, fmt.Errorf("ActionNxResubmitTable packet too short: %d < 6", decoder.Length()) |
| 3836 | } |
| 3837 | _actionnxresubmittable.InPort = uint16(decoder.ReadUint16()) |
| 3838 | _actionnxresubmittable.Table = uint8(decoder.ReadByte()) |
| 3839 | decoder.Skip(3) |
| 3840 | return _actionnxresubmittable, nil |
| 3841 | } |
| 3842 | |
| 3843 | func NewActionNxResubmitTable() *ActionNxResubmitTable { |
| 3844 | obj := &ActionNxResubmitTable{ |
| 3845 | ActionNicira: NewActionNicira(14), |
| 3846 | } |
| 3847 | return obj |
| 3848 | } |
| 3849 | func (self *ActionNxResubmitTable) GetActionName() string { |
| 3850 | return "nx_resubmit_table" |
| 3851 | } |
| 3852 | |
| 3853 | func (self *ActionNxResubmitTable) GetActionFields() map[string]interface{} { |
| 3854 | return map[string]interface{}{ |
| 3855 | "InPort": self.InPort, |
| 3856 | "Table": self.Table, |
| 3857 | } |
| 3858 | } |
| 3859 | |
| 3860 | func (self *ActionNxResubmitTable) MarshalJSON() ([]byte, error) { |
| 3861 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3862 | if err != nil { |
| 3863 | return nil, err |
| 3864 | } |
| 3865 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3866 | } |
| 3867 | |
| 3868 | type ActionNxResubmitTableCt struct { |
| 3869 | *ActionNicira |
| 3870 | InPort uint16 |
| 3871 | Table uint8 |
| 3872 | } |
| 3873 | |
| 3874 | type IActionNxResubmitTableCt interface { |
| 3875 | IActionNicira |
| 3876 | GetInPort() uint16 |
| 3877 | GetTable() uint8 |
| 3878 | } |
| 3879 | |
| 3880 | func (self *ActionNxResubmitTableCt) GetInPort() uint16 { |
| 3881 | return self.InPort |
| 3882 | } |
| 3883 | |
| 3884 | func (self *ActionNxResubmitTableCt) SetInPort(v uint16) { |
| 3885 | self.InPort = v |
| 3886 | } |
| 3887 | |
| 3888 | func (self *ActionNxResubmitTableCt) GetTable() uint8 { |
| 3889 | return self.Table |
| 3890 | } |
| 3891 | |
| 3892 | func (self *ActionNxResubmitTableCt) SetTable(v uint8) { |
| 3893 | self.Table = v |
| 3894 | } |
| 3895 | |
| 3896 | func (self *ActionNxResubmitTableCt) Serialize(encoder *goloxi.Encoder) error { |
| 3897 | startIndex := len(encoder.Bytes()) |
| 3898 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3899 | return err |
| 3900 | } |
| 3901 | |
| 3902 | encoder.PutUint16(uint16(self.InPort)) |
| 3903 | encoder.PutUint8(uint8(self.Table)) |
| 3904 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 3905 | length := len(encoder.Bytes()) - startIndex |
| 3906 | |
| 3907 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 3908 | |
| 3909 | return nil |
| 3910 | } |
| 3911 | |
| 3912 | func DecodeActionNxResubmitTableCt(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxResubmitTableCt, error) { |
| 3913 | _actionnxresubmittablect := &ActionNxResubmitTableCt{ActionNicira: parent} |
| 3914 | if decoder.Length() < 6 { |
| 3915 | return nil, fmt.Errorf("ActionNxResubmitTableCt packet too short: %d < 6", decoder.Length()) |
| 3916 | } |
| 3917 | _actionnxresubmittablect.InPort = uint16(decoder.ReadUint16()) |
| 3918 | _actionnxresubmittablect.Table = uint8(decoder.ReadByte()) |
| 3919 | decoder.Skip(3) |
| 3920 | return _actionnxresubmittablect, nil |
| 3921 | } |
| 3922 | |
| 3923 | func NewActionNxResubmitTableCt() *ActionNxResubmitTableCt { |
| 3924 | obj := &ActionNxResubmitTableCt{ |
| 3925 | ActionNicira: NewActionNicira(44), |
| 3926 | } |
| 3927 | return obj |
| 3928 | } |
| 3929 | func (self *ActionNxResubmitTableCt) GetActionName() string { |
| 3930 | return "nx_resubmit_table_ct" |
| 3931 | } |
| 3932 | |
| 3933 | func (self *ActionNxResubmitTableCt) GetActionFields() map[string]interface{} { |
| 3934 | return map[string]interface{}{ |
| 3935 | "InPort": self.InPort, |
| 3936 | "Table": self.Table, |
| 3937 | } |
| 3938 | } |
| 3939 | |
| 3940 | func (self *ActionNxResubmitTableCt) MarshalJSON() ([]byte, error) { |
| 3941 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 3942 | if err != nil { |
| 3943 | return nil, err |
| 3944 | } |
| 3945 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 3946 | } |
| 3947 | |
| 3948 | type ActionNxSample struct { |
| 3949 | *ActionNicira |
| 3950 | Probability uint16 |
| 3951 | CollectorSetId uint32 |
| 3952 | ObsDomainId uint32 |
| 3953 | ObsPointId uint32 |
| 3954 | } |
| 3955 | |
| 3956 | type IActionNxSample interface { |
| 3957 | IActionNicira |
| 3958 | GetProbability() uint16 |
| 3959 | GetCollectorSetId() uint32 |
| 3960 | GetObsDomainId() uint32 |
| 3961 | GetObsPointId() uint32 |
| 3962 | } |
| 3963 | |
| 3964 | func (self *ActionNxSample) GetProbability() uint16 { |
| 3965 | return self.Probability |
| 3966 | } |
| 3967 | |
| 3968 | func (self *ActionNxSample) SetProbability(v uint16) { |
| 3969 | self.Probability = v |
| 3970 | } |
| 3971 | |
| 3972 | func (self *ActionNxSample) GetCollectorSetId() uint32 { |
| 3973 | return self.CollectorSetId |
| 3974 | } |
| 3975 | |
| 3976 | func (self *ActionNxSample) SetCollectorSetId(v uint32) { |
| 3977 | self.CollectorSetId = v |
| 3978 | } |
| 3979 | |
| 3980 | func (self *ActionNxSample) GetObsDomainId() uint32 { |
| 3981 | return self.ObsDomainId |
| 3982 | } |
| 3983 | |
| 3984 | func (self *ActionNxSample) SetObsDomainId(v uint32) { |
| 3985 | self.ObsDomainId = v |
| 3986 | } |
| 3987 | |
| 3988 | func (self *ActionNxSample) GetObsPointId() uint32 { |
| 3989 | return self.ObsPointId |
| 3990 | } |
| 3991 | |
| 3992 | func (self *ActionNxSample) SetObsPointId(v uint32) { |
| 3993 | self.ObsPointId = v |
| 3994 | } |
| 3995 | |
| 3996 | func (self *ActionNxSample) Serialize(encoder *goloxi.Encoder) error { |
| 3997 | startIndex := len(encoder.Bytes()) |
| 3998 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 3999 | return err |
| 4000 | } |
| 4001 | |
| 4002 | encoder.PutUint16(uint16(self.Probability)) |
| 4003 | encoder.PutUint32(uint32(self.CollectorSetId)) |
| 4004 | encoder.PutUint32(uint32(self.ObsDomainId)) |
| 4005 | encoder.PutUint32(uint32(self.ObsPointId)) |
| 4006 | length := len(encoder.Bytes()) - startIndex |
| 4007 | |
| 4008 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4009 | |
| 4010 | return nil |
| 4011 | } |
| 4012 | |
| 4013 | func DecodeActionNxSample(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSample, error) { |
| 4014 | _actionnxsample := &ActionNxSample{ActionNicira: parent} |
| 4015 | if decoder.Length() < 14 { |
| 4016 | return nil, fmt.Errorf("ActionNxSample packet too short: %d < 14", decoder.Length()) |
| 4017 | } |
| 4018 | _actionnxsample.Probability = uint16(decoder.ReadUint16()) |
| 4019 | _actionnxsample.CollectorSetId = uint32(decoder.ReadUint32()) |
| 4020 | _actionnxsample.ObsDomainId = uint32(decoder.ReadUint32()) |
| 4021 | _actionnxsample.ObsPointId = uint32(decoder.ReadUint32()) |
| 4022 | return _actionnxsample, nil |
| 4023 | } |
| 4024 | |
| 4025 | func NewActionNxSample() *ActionNxSample { |
| 4026 | obj := &ActionNxSample{ |
| 4027 | ActionNicira: NewActionNicira(29), |
| 4028 | } |
| 4029 | return obj |
| 4030 | } |
| 4031 | func (self *ActionNxSample) GetActionName() string { |
| 4032 | return "nx_sample" |
| 4033 | } |
| 4034 | |
| 4035 | func (self *ActionNxSample) GetActionFields() map[string]interface{} { |
| 4036 | return map[string]interface{}{ |
| 4037 | "Probability": self.Probability, |
| 4038 | "CollectorSetId": self.CollectorSetId, |
| 4039 | "ObsDomainId": self.ObsDomainId, |
| 4040 | "ObsPointId": self.ObsPointId, |
| 4041 | } |
| 4042 | } |
| 4043 | |
| 4044 | func (self *ActionNxSample) MarshalJSON() ([]byte, error) { |
| 4045 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4046 | if err != nil { |
| 4047 | return nil, err |
| 4048 | } |
| 4049 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4050 | } |
| 4051 | |
| 4052 | type ActionNxSample2 struct { |
| 4053 | *ActionNicira |
| 4054 | Probability uint16 |
| 4055 | CollectorSetId uint32 |
| 4056 | ObsDomainId uint32 |
| 4057 | ObsPointId uint32 |
| 4058 | SamplingPort uint16 |
| 4059 | Direction uint8 |
| 4060 | } |
| 4061 | |
| 4062 | type IActionNxSample2 interface { |
| 4063 | IActionNicira |
| 4064 | GetProbability() uint16 |
| 4065 | GetCollectorSetId() uint32 |
| 4066 | GetObsDomainId() uint32 |
| 4067 | GetObsPointId() uint32 |
| 4068 | GetSamplingPort() uint16 |
| 4069 | GetDirection() uint8 |
| 4070 | } |
| 4071 | |
| 4072 | func (self *ActionNxSample2) GetProbability() uint16 { |
| 4073 | return self.Probability |
| 4074 | } |
| 4075 | |
| 4076 | func (self *ActionNxSample2) SetProbability(v uint16) { |
| 4077 | self.Probability = v |
| 4078 | } |
| 4079 | |
| 4080 | func (self *ActionNxSample2) GetCollectorSetId() uint32 { |
| 4081 | return self.CollectorSetId |
| 4082 | } |
| 4083 | |
| 4084 | func (self *ActionNxSample2) SetCollectorSetId(v uint32) { |
| 4085 | self.CollectorSetId = v |
| 4086 | } |
| 4087 | |
| 4088 | func (self *ActionNxSample2) GetObsDomainId() uint32 { |
| 4089 | return self.ObsDomainId |
| 4090 | } |
| 4091 | |
| 4092 | func (self *ActionNxSample2) SetObsDomainId(v uint32) { |
| 4093 | self.ObsDomainId = v |
| 4094 | } |
| 4095 | |
| 4096 | func (self *ActionNxSample2) GetObsPointId() uint32 { |
| 4097 | return self.ObsPointId |
| 4098 | } |
| 4099 | |
| 4100 | func (self *ActionNxSample2) SetObsPointId(v uint32) { |
| 4101 | self.ObsPointId = v |
| 4102 | } |
| 4103 | |
| 4104 | func (self *ActionNxSample2) GetSamplingPort() uint16 { |
| 4105 | return self.SamplingPort |
| 4106 | } |
| 4107 | |
| 4108 | func (self *ActionNxSample2) SetSamplingPort(v uint16) { |
| 4109 | self.SamplingPort = v |
| 4110 | } |
| 4111 | |
| 4112 | func (self *ActionNxSample2) GetDirection() uint8 { |
| 4113 | return self.Direction |
| 4114 | } |
| 4115 | |
| 4116 | func (self *ActionNxSample2) SetDirection(v uint8) { |
| 4117 | self.Direction = v |
| 4118 | } |
| 4119 | |
| 4120 | func (self *ActionNxSample2) Serialize(encoder *goloxi.Encoder) error { |
| 4121 | startIndex := len(encoder.Bytes()) |
| 4122 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4123 | return err |
| 4124 | } |
| 4125 | |
| 4126 | encoder.PutUint16(uint16(self.Probability)) |
| 4127 | encoder.PutUint32(uint32(self.CollectorSetId)) |
| 4128 | encoder.PutUint32(uint32(self.ObsDomainId)) |
| 4129 | encoder.PutUint32(uint32(self.ObsPointId)) |
| 4130 | encoder.PutUint16(uint16(self.SamplingPort)) |
| 4131 | encoder.PutUint8(uint8(self.Direction)) |
| 4132 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 4133 | length := len(encoder.Bytes()) - startIndex |
| 4134 | |
| 4135 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4136 | |
| 4137 | return nil |
| 4138 | } |
| 4139 | |
| 4140 | func DecodeActionNxSample2(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSample2, error) { |
| 4141 | _actionnxsample2 := &ActionNxSample2{ActionNicira: parent} |
| 4142 | if decoder.Length() < 22 { |
| 4143 | return nil, fmt.Errorf("ActionNxSample2 packet too short: %d < 22", decoder.Length()) |
| 4144 | } |
| 4145 | _actionnxsample2.Probability = uint16(decoder.ReadUint16()) |
| 4146 | _actionnxsample2.CollectorSetId = uint32(decoder.ReadUint32()) |
| 4147 | _actionnxsample2.ObsDomainId = uint32(decoder.ReadUint32()) |
| 4148 | _actionnxsample2.ObsPointId = uint32(decoder.ReadUint32()) |
| 4149 | _actionnxsample2.SamplingPort = uint16(decoder.ReadUint16()) |
| 4150 | _actionnxsample2.Direction = uint8(decoder.ReadByte()) |
| 4151 | decoder.Skip(5) |
| 4152 | return _actionnxsample2, nil |
| 4153 | } |
| 4154 | |
| 4155 | func NewActionNxSample2() *ActionNxSample2 { |
| 4156 | obj := &ActionNxSample2{ |
| 4157 | ActionNicira: NewActionNicira(38), |
| 4158 | } |
| 4159 | return obj |
| 4160 | } |
| 4161 | func (self *ActionNxSample2) GetActionName() string { |
| 4162 | return "nx_sample2" |
| 4163 | } |
| 4164 | |
| 4165 | func (self *ActionNxSample2) GetActionFields() map[string]interface{} { |
| 4166 | return map[string]interface{}{ |
| 4167 | "Probability": self.Probability, |
| 4168 | "CollectorSetId": self.CollectorSetId, |
| 4169 | "ObsDomainId": self.ObsDomainId, |
| 4170 | "ObsPointId": self.ObsPointId, |
| 4171 | "SamplingPort": self.SamplingPort, |
| 4172 | "Direction": self.Direction, |
| 4173 | } |
| 4174 | } |
| 4175 | |
| 4176 | func (self *ActionNxSample2) MarshalJSON() ([]byte, error) { |
| 4177 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4178 | if err != nil { |
| 4179 | return nil, err |
| 4180 | } |
| 4181 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4182 | } |
| 4183 | |
| 4184 | type ActionNxSample3 struct { |
| 4185 | *ActionNicira |
| 4186 | Probability uint16 |
| 4187 | CollectorSetId uint32 |
| 4188 | ObsDomainId uint32 |
| 4189 | ObsPointId uint32 |
| 4190 | SamplingPort uint16 |
| 4191 | Direction uint8 |
| 4192 | } |
| 4193 | |
| 4194 | type IActionNxSample3 interface { |
| 4195 | IActionNicira |
| 4196 | GetProbability() uint16 |
| 4197 | GetCollectorSetId() uint32 |
| 4198 | GetObsDomainId() uint32 |
| 4199 | GetObsPointId() uint32 |
| 4200 | GetSamplingPort() uint16 |
| 4201 | GetDirection() uint8 |
| 4202 | } |
| 4203 | |
| 4204 | func (self *ActionNxSample3) GetProbability() uint16 { |
| 4205 | return self.Probability |
| 4206 | } |
| 4207 | |
| 4208 | func (self *ActionNxSample3) SetProbability(v uint16) { |
| 4209 | self.Probability = v |
| 4210 | } |
| 4211 | |
| 4212 | func (self *ActionNxSample3) GetCollectorSetId() uint32 { |
| 4213 | return self.CollectorSetId |
| 4214 | } |
| 4215 | |
| 4216 | func (self *ActionNxSample3) SetCollectorSetId(v uint32) { |
| 4217 | self.CollectorSetId = v |
| 4218 | } |
| 4219 | |
| 4220 | func (self *ActionNxSample3) GetObsDomainId() uint32 { |
| 4221 | return self.ObsDomainId |
| 4222 | } |
| 4223 | |
| 4224 | func (self *ActionNxSample3) SetObsDomainId(v uint32) { |
| 4225 | self.ObsDomainId = v |
| 4226 | } |
| 4227 | |
| 4228 | func (self *ActionNxSample3) GetObsPointId() uint32 { |
| 4229 | return self.ObsPointId |
| 4230 | } |
| 4231 | |
| 4232 | func (self *ActionNxSample3) SetObsPointId(v uint32) { |
| 4233 | self.ObsPointId = v |
| 4234 | } |
| 4235 | |
| 4236 | func (self *ActionNxSample3) GetSamplingPort() uint16 { |
| 4237 | return self.SamplingPort |
| 4238 | } |
| 4239 | |
| 4240 | func (self *ActionNxSample3) SetSamplingPort(v uint16) { |
| 4241 | self.SamplingPort = v |
| 4242 | } |
| 4243 | |
| 4244 | func (self *ActionNxSample3) GetDirection() uint8 { |
| 4245 | return self.Direction |
| 4246 | } |
| 4247 | |
| 4248 | func (self *ActionNxSample3) SetDirection(v uint8) { |
| 4249 | self.Direction = v |
| 4250 | } |
| 4251 | |
| 4252 | func (self *ActionNxSample3) Serialize(encoder *goloxi.Encoder) error { |
| 4253 | startIndex := len(encoder.Bytes()) |
| 4254 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4255 | return err |
| 4256 | } |
| 4257 | |
| 4258 | encoder.PutUint16(uint16(self.Probability)) |
| 4259 | encoder.PutUint32(uint32(self.CollectorSetId)) |
| 4260 | encoder.PutUint32(uint32(self.ObsDomainId)) |
| 4261 | encoder.PutUint32(uint32(self.ObsPointId)) |
| 4262 | encoder.PutUint16(uint16(self.SamplingPort)) |
| 4263 | encoder.PutUint8(uint8(self.Direction)) |
| 4264 | encoder.Write(bytes.Repeat([]byte{0}, 5)) |
| 4265 | length := len(encoder.Bytes()) - startIndex |
| 4266 | |
| 4267 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4268 | |
| 4269 | return nil |
| 4270 | } |
| 4271 | |
| 4272 | func DecodeActionNxSample3(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSample3, error) { |
| 4273 | _actionnxsample3 := &ActionNxSample3{ActionNicira: parent} |
| 4274 | if decoder.Length() < 22 { |
| 4275 | return nil, fmt.Errorf("ActionNxSample3 packet too short: %d < 22", decoder.Length()) |
| 4276 | } |
| 4277 | _actionnxsample3.Probability = uint16(decoder.ReadUint16()) |
| 4278 | _actionnxsample3.CollectorSetId = uint32(decoder.ReadUint32()) |
| 4279 | _actionnxsample3.ObsDomainId = uint32(decoder.ReadUint32()) |
| 4280 | _actionnxsample3.ObsPointId = uint32(decoder.ReadUint32()) |
| 4281 | _actionnxsample3.SamplingPort = uint16(decoder.ReadUint16()) |
| 4282 | _actionnxsample3.Direction = uint8(decoder.ReadByte()) |
| 4283 | decoder.Skip(5) |
| 4284 | return _actionnxsample3, nil |
| 4285 | } |
| 4286 | |
| 4287 | func NewActionNxSample3() *ActionNxSample3 { |
| 4288 | obj := &ActionNxSample3{ |
| 4289 | ActionNicira: NewActionNicira(41), |
| 4290 | } |
| 4291 | return obj |
| 4292 | } |
| 4293 | func (self *ActionNxSample3) GetActionName() string { |
| 4294 | return "nx_sample3" |
| 4295 | } |
| 4296 | |
| 4297 | func (self *ActionNxSample3) GetActionFields() map[string]interface{} { |
| 4298 | return map[string]interface{}{ |
| 4299 | "Probability": self.Probability, |
| 4300 | "CollectorSetId": self.CollectorSetId, |
| 4301 | "ObsDomainId": self.ObsDomainId, |
| 4302 | "ObsPointId": self.ObsPointId, |
| 4303 | "SamplingPort": self.SamplingPort, |
| 4304 | "Direction": self.Direction, |
| 4305 | } |
| 4306 | } |
| 4307 | |
| 4308 | func (self *ActionNxSample3) MarshalJSON() ([]byte, error) { |
| 4309 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4310 | if err != nil { |
| 4311 | return nil, err |
| 4312 | } |
| 4313 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4314 | } |
| 4315 | |
| 4316 | type ActionNxSetMplsLabel struct { |
| 4317 | *ActionNicira |
| 4318 | Value uint32 |
| 4319 | } |
| 4320 | |
| 4321 | type IActionNxSetMplsLabel interface { |
| 4322 | IActionNicira |
| 4323 | GetValue() uint32 |
| 4324 | } |
| 4325 | |
| 4326 | func (self *ActionNxSetMplsLabel) GetValue() uint32 { |
| 4327 | return self.Value |
| 4328 | } |
| 4329 | |
| 4330 | func (self *ActionNxSetMplsLabel) SetValue(v uint32) { |
| 4331 | self.Value = v |
| 4332 | } |
| 4333 | |
| 4334 | func (self *ActionNxSetMplsLabel) Serialize(encoder *goloxi.Encoder) error { |
| 4335 | startIndex := len(encoder.Bytes()) |
| 4336 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4337 | return err |
| 4338 | } |
| 4339 | |
| 4340 | encoder.PutUint32(uint32(self.Value)) |
| 4341 | length := len(encoder.Bytes()) - startIndex |
| 4342 | |
| 4343 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4344 | |
| 4345 | return nil |
| 4346 | } |
| 4347 | |
| 4348 | func DecodeActionNxSetMplsLabel(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetMplsLabel, error) { |
| 4349 | _actionnxsetmplslabel := &ActionNxSetMplsLabel{ActionNicira: parent} |
| 4350 | if decoder.Length() < 4 { |
| 4351 | return nil, fmt.Errorf("ActionNxSetMplsLabel packet too short: %d < 4", decoder.Length()) |
| 4352 | } |
| 4353 | _actionnxsetmplslabel.Value = uint32(decoder.ReadUint32()) |
| 4354 | return _actionnxsetmplslabel, nil |
| 4355 | } |
| 4356 | |
| 4357 | func NewActionNxSetMplsLabel() *ActionNxSetMplsLabel { |
| 4358 | obj := &ActionNxSetMplsLabel{ |
| 4359 | ActionNicira: NewActionNicira(30), |
| 4360 | } |
| 4361 | return obj |
| 4362 | } |
| 4363 | func (self *ActionNxSetMplsLabel) GetActionName() string { |
| 4364 | return "nx_set_mpls_label" |
| 4365 | } |
| 4366 | |
| 4367 | func (self *ActionNxSetMplsLabel) GetActionFields() map[string]interface{} { |
| 4368 | return map[string]interface{}{ |
| 4369 | "Value": self.Value, |
| 4370 | } |
| 4371 | } |
| 4372 | |
| 4373 | func (self *ActionNxSetMplsLabel) MarshalJSON() ([]byte, error) { |
| 4374 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4375 | if err != nil { |
| 4376 | return nil, err |
| 4377 | } |
| 4378 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4379 | } |
| 4380 | |
| 4381 | type ActionNxSetMplsTc struct { |
| 4382 | *ActionNicira |
| 4383 | Value uint8 |
| 4384 | } |
| 4385 | |
| 4386 | type IActionNxSetMplsTc interface { |
| 4387 | IActionNicira |
| 4388 | GetValue() uint8 |
| 4389 | } |
| 4390 | |
| 4391 | func (self *ActionNxSetMplsTc) GetValue() uint8 { |
| 4392 | return self.Value |
| 4393 | } |
| 4394 | |
| 4395 | func (self *ActionNxSetMplsTc) SetValue(v uint8) { |
| 4396 | self.Value = v |
| 4397 | } |
| 4398 | |
| 4399 | func (self *ActionNxSetMplsTc) Serialize(encoder *goloxi.Encoder) error { |
| 4400 | startIndex := len(encoder.Bytes()) |
| 4401 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4402 | return err |
| 4403 | } |
| 4404 | |
| 4405 | encoder.PutUint8(uint8(self.Value)) |
| 4406 | length := len(encoder.Bytes()) - startIndex |
| 4407 | |
| 4408 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4409 | |
| 4410 | return nil |
| 4411 | } |
| 4412 | |
| 4413 | func DecodeActionNxSetMplsTc(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetMplsTc, error) { |
| 4414 | _actionnxsetmplstc := &ActionNxSetMplsTc{ActionNicira: parent} |
| 4415 | if decoder.Length() < 1 { |
| 4416 | return nil, fmt.Errorf("ActionNxSetMplsTc packet too short: %d < 1", decoder.Length()) |
| 4417 | } |
| 4418 | _actionnxsetmplstc.Value = uint8(decoder.ReadByte()) |
| 4419 | return _actionnxsetmplstc, nil |
| 4420 | } |
| 4421 | |
| 4422 | func NewActionNxSetMplsTc() *ActionNxSetMplsTc { |
| 4423 | obj := &ActionNxSetMplsTc{ |
| 4424 | ActionNicira: NewActionNicira(31), |
| 4425 | } |
| 4426 | return obj |
| 4427 | } |
| 4428 | func (self *ActionNxSetMplsTc) GetActionName() string { |
| 4429 | return "nx_set_mpls_tc" |
| 4430 | } |
| 4431 | |
| 4432 | func (self *ActionNxSetMplsTc) GetActionFields() map[string]interface{} { |
| 4433 | return map[string]interface{}{ |
| 4434 | "Value": self.Value, |
| 4435 | } |
| 4436 | } |
| 4437 | |
| 4438 | func (self *ActionNxSetMplsTc) MarshalJSON() ([]byte, error) { |
| 4439 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4440 | if err != nil { |
| 4441 | return nil, err |
| 4442 | } |
| 4443 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4444 | } |
| 4445 | |
| 4446 | type ActionNxSetMplsTtl struct { |
| 4447 | *ActionNicira |
| 4448 | Value uint8 |
| 4449 | } |
| 4450 | |
| 4451 | type IActionNxSetMplsTtl interface { |
| 4452 | IActionNicira |
| 4453 | GetValue() uint8 |
| 4454 | } |
| 4455 | |
| 4456 | func (self *ActionNxSetMplsTtl) GetValue() uint8 { |
| 4457 | return self.Value |
| 4458 | } |
| 4459 | |
| 4460 | func (self *ActionNxSetMplsTtl) SetValue(v uint8) { |
| 4461 | self.Value = v |
| 4462 | } |
| 4463 | |
| 4464 | func (self *ActionNxSetMplsTtl) Serialize(encoder *goloxi.Encoder) error { |
| 4465 | startIndex := len(encoder.Bytes()) |
| 4466 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4467 | return err |
| 4468 | } |
| 4469 | |
| 4470 | encoder.PutUint8(uint8(self.Value)) |
| 4471 | length := len(encoder.Bytes()) - startIndex |
| 4472 | |
| 4473 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4474 | |
| 4475 | return nil |
| 4476 | } |
| 4477 | |
| 4478 | func DecodeActionNxSetMplsTtl(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetMplsTtl, error) { |
| 4479 | _actionnxsetmplsttl := &ActionNxSetMplsTtl{ActionNicira: parent} |
| 4480 | if decoder.Length() < 1 { |
| 4481 | return nil, fmt.Errorf("ActionNxSetMplsTtl packet too short: %d < 1", decoder.Length()) |
| 4482 | } |
| 4483 | _actionnxsetmplsttl.Value = uint8(decoder.ReadByte()) |
| 4484 | return _actionnxsetmplsttl, nil |
| 4485 | } |
| 4486 | |
| 4487 | func NewActionNxSetMplsTtl() *ActionNxSetMplsTtl { |
| 4488 | obj := &ActionNxSetMplsTtl{ |
| 4489 | ActionNicira: NewActionNicira(25), |
| 4490 | } |
| 4491 | return obj |
| 4492 | } |
| 4493 | func (self *ActionNxSetMplsTtl) GetActionName() string { |
| 4494 | return "nx_set_mpls_ttl" |
| 4495 | } |
| 4496 | |
| 4497 | func (self *ActionNxSetMplsTtl) GetActionFields() map[string]interface{} { |
| 4498 | return map[string]interface{}{ |
| 4499 | "Value": self.Value, |
| 4500 | } |
| 4501 | } |
| 4502 | |
| 4503 | func (self *ActionNxSetMplsTtl) MarshalJSON() ([]byte, error) { |
| 4504 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4505 | if err != nil { |
| 4506 | return nil, err |
| 4507 | } |
| 4508 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4509 | } |
| 4510 | |
| 4511 | type ActionNxSetQueue struct { |
| 4512 | *ActionNicira |
| 4513 | Value uint32 |
| 4514 | } |
| 4515 | |
| 4516 | type IActionNxSetQueue interface { |
| 4517 | IActionNicira |
| 4518 | GetValue() uint32 |
| 4519 | } |
| 4520 | |
| 4521 | func (self *ActionNxSetQueue) GetValue() uint32 { |
| 4522 | return self.Value |
| 4523 | } |
| 4524 | |
| 4525 | func (self *ActionNxSetQueue) SetValue(v uint32) { |
| 4526 | self.Value = v |
| 4527 | } |
| 4528 | |
| 4529 | func (self *ActionNxSetQueue) Serialize(encoder *goloxi.Encoder) error { |
| 4530 | startIndex := len(encoder.Bytes()) |
| 4531 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4532 | return err |
| 4533 | } |
| 4534 | |
| 4535 | encoder.PutUint32(uint32(self.Value)) |
| 4536 | length := len(encoder.Bytes()) - startIndex |
| 4537 | |
| 4538 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4539 | |
| 4540 | return nil |
| 4541 | } |
| 4542 | |
| 4543 | func DecodeActionNxSetQueue(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetQueue, error) { |
| 4544 | _actionnxsetqueue := &ActionNxSetQueue{ActionNicira: parent} |
| 4545 | if decoder.Length() < 4 { |
| 4546 | return nil, fmt.Errorf("ActionNxSetQueue packet too short: %d < 4", decoder.Length()) |
| 4547 | } |
| 4548 | _actionnxsetqueue.Value = uint32(decoder.ReadUint32()) |
| 4549 | return _actionnxsetqueue, nil |
| 4550 | } |
| 4551 | |
| 4552 | func NewActionNxSetQueue() *ActionNxSetQueue { |
| 4553 | obj := &ActionNxSetQueue{ |
| 4554 | ActionNicira: NewActionNicira(4), |
| 4555 | } |
| 4556 | return obj |
| 4557 | } |
| 4558 | func (self *ActionNxSetQueue) GetActionName() string { |
| 4559 | return "nx_set_queue" |
| 4560 | } |
| 4561 | |
| 4562 | func (self *ActionNxSetQueue) GetActionFields() map[string]interface{} { |
| 4563 | return map[string]interface{}{ |
| 4564 | "Value": self.Value, |
| 4565 | } |
| 4566 | } |
| 4567 | |
| 4568 | func (self *ActionNxSetQueue) MarshalJSON() ([]byte, error) { |
| 4569 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4570 | if err != nil { |
| 4571 | return nil, err |
| 4572 | } |
| 4573 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4574 | } |
| 4575 | |
| 4576 | type ActionNxSetTunnel struct { |
| 4577 | *ActionNicira |
| 4578 | Value uint32 |
| 4579 | } |
| 4580 | |
| 4581 | type IActionNxSetTunnel interface { |
| 4582 | IActionNicira |
| 4583 | GetValue() uint32 |
| 4584 | } |
| 4585 | |
| 4586 | func (self *ActionNxSetTunnel) GetValue() uint32 { |
| 4587 | return self.Value |
| 4588 | } |
| 4589 | |
| 4590 | func (self *ActionNxSetTunnel) SetValue(v uint32) { |
| 4591 | self.Value = v |
| 4592 | } |
| 4593 | |
| 4594 | func (self *ActionNxSetTunnel) Serialize(encoder *goloxi.Encoder) error { |
| 4595 | startIndex := len(encoder.Bytes()) |
| 4596 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4597 | return err |
| 4598 | } |
| 4599 | |
| 4600 | encoder.PutUint32(uint32(self.Value)) |
| 4601 | length := len(encoder.Bytes()) - startIndex |
| 4602 | |
| 4603 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4604 | |
| 4605 | return nil |
| 4606 | } |
| 4607 | |
| 4608 | func DecodeActionNxSetTunnel(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetTunnel, error) { |
| 4609 | _actionnxsettunnel := &ActionNxSetTunnel{ActionNicira: parent} |
| 4610 | if decoder.Length() < 4 { |
| 4611 | return nil, fmt.Errorf("ActionNxSetTunnel packet too short: %d < 4", decoder.Length()) |
| 4612 | } |
| 4613 | _actionnxsettunnel.Value = uint32(decoder.ReadUint32()) |
| 4614 | return _actionnxsettunnel, nil |
| 4615 | } |
| 4616 | |
| 4617 | func NewActionNxSetTunnel() *ActionNxSetTunnel { |
| 4618 | obj := &ActionNxSetTunnel{ |
| 4619 | ActionNicira: NewActionNicira(2), |
| 4620 | } |
| 4621 | return obj |
| 4622 | } |
| 4623 | func (self *ActionNxSetTunnel) GetActionName() string { |
| 4624 | return "nx_set_tunnel" |
| 4625 | } |
| 4626 | |
| 4627 | func (self *ActionNxSetTunnel) GetActionFields() map[string]interface{} { |
| 4628 | return map[string]interface{}{ |
| 4629 | "Value": self.Value, |
| 4630 | } |
| 4631 | } |
| 4632 | |
| 4633 | func (self *ActionNxSetTunnel) MarshalJSON() ([]byte, error) { |
| 4634 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4635 | if err != nil { |
| 4636 | return nil, err |
| 4637 | } |
| 4638 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4639 | } |
| 4640 | |
| 4641 | type ActionNxSetTunnel64 struct { |
| 4642 | *ActionNicira |
| 4643 | Value uint64 |
| 4644 | } |
| 4645 | |
| 4646 | type IActionNxSetTunnel64 interface { |
| 4647 | IActionNicira |
| 4648 | GetValue() uint64 |
| 4649 | } |
| 4650 | |
| 4651 | func (self *ActionNxSetTunnel64) GetValue() uint64 { |
| 4652 | return self.Value |
| 4653 | } |
| 4654 | |
| 4655 | func (self *ActionNxSetTunnel64) SetValue(v uint64) { |
| 4656 | self.Value = v |
| 4657 | } |
| 4658 | |
| 4659 | func (self *ActionNxSetTunnel64) Serialize(encoder *goloxi.Encoder) error { |
| 4660 | startIndex := len(encoder.Bytes()) |
| 4661 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4662 | return err |
| 4663 | } |
| 4664 | |
| 4665 | encoder.PutUint64(uint64(self.Value)) |
| 4666 | length := len(encoder.Bytes()) - startIndex |
| 4667 | |
| 4668 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4669 | |
| 4670 | return nil |
| 4671 | } |
| 4672 | |
| 4673 | func DecodeActionNxSetTunnel64(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxSetTunnel64, error) { |
| 4674 | _actionnxsettunnel64 := &ActionNxSetTunnel64{ActionNicira: parent} |
| 4675 | if decoder.Length() < 8 { |
| 4676 | return nil, fmt.Errorf("ActionNxSetTunnel64 packet too short: %d < 8", decoder.Length()) |
| 4677 | } |
| 4678 | _actionnxsettunnel64.Value = uint64(decoder.ReadUint64()) |
| 4679 | return _actionnxsettunnel64, nil |
| 4680 | } |
| 4681 | |
| 4682 | func NewActionNxSetTunnel64() *ActionNxSetTunnel64 { |
| 4683 | obj := &ActionNxSetTunnel64{ |
| 4684 | ActionNicira: NewActionNicira(9), |
| 4685 | } |
| 4686 | return obj |
| 4687 | } |
| 4688 | func (self *ActionNxSetTunnel64) GetActionName() string { |
| 4689 | return "nx_set_tunnel64" |
| 4690 | } |
| 4691 | |
| 4692 | func (self *ActionNxSetTunnel64) GetActionFields() map[string]interface{} { |
| 4693 | return map[string]interface{}{ |
| 4694 | "Value": self.Value, |
| 4695 | } |
| 4696 | } |
| 4697 | |
| 4698 | func (self *ActionNxSetTunnel64) MarshalJSON() ([]byte, error) { |
| 4699 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4700 | if err != nil { |
| 4701 | return nil, err |
| 4702 | } |
| 4703 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4704 | } |
| 4705 | |
| 4706 | type ActionNxStackPop struct { |
| 4707 | *ActionNicira |
| 4708 | Offset uint16 |
| 4709 | Field goloxi.IOxmId |
| 4710 | NBits uint16 |
| 4711 | } |
| 4712 | |
| 4713 | type IActionNxStackPop interface { |
| 4714 | IActionNicira |
| 4715 | GetOffset() uint16 |
| 4716 | GetField() goloxi.IOxmId |
| 4717 | GetNBits() uint16 |
| 4718 | } |
| 4719 | |
| 4720 | func (self *ActionNxStackPop) GetOffset() uint16 { |
| 4721 | return self.Offset |
| 4722 | } |
| 4723 | |
| 4724 | func (self *ActionNxStackPop) SetOffset(v uint16) { |
| 4725 | self.Offset = v |
| 4726 | } |
| 4727 | |
| 4728 | func (self *ActionNxStackPop) GetField() goloxi.IOxmId { |
| 4729 | return self.Field |
| 4730 | } |
| 4731 | |
| 4732 | func (self *ActionNxStackPop) SetField(v goloxi.IOxmId) { |
| 4733 | self.Field = v |
| 4734 | } |
| 4735 | |
| 4736 | func (self *ActionNxStackPop) GetNBits() uint16 { |
| 4737 | return self.NBits |
| 4738 | } |
| 4739 | |
| 4740 | func (self *ActionNxStackPop) SetNBits(v uint16) { |
| 4741 | self.NBits = v |
| 4742 | } |
| 4743 | |
| 4744 | func (self *ActionNxStackPop) Serialize(encoder *goloxi.Encoder) error { |
| 4745 | startIndex := len(encoder.Bytes()) |
| 4746 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4747 | return err |
| 4748 | } |
| 4749 | |
| 4750 | encoder.PutUint16(uint16(self.Offset)) |
| 4751 | self.Field.Serialize(encoder) |
| 4752 | encoder.PutUint16(uint16(self.NBits)) |
| 4753 | length := len(encoder.Bytes()) - startIndex |
| 4754 | |
| 4755 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4756 | |
| 4757 | return nil |
| 4758 | } |
| 4759 | |
| 4760 | func DecodeActionNxStackPop(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxStackPop, error) { |
| 4761 | _actionnxstackpop := &ActionNxStackPop{ActionNicira: parent} |
| 4762 | if decoder.Length() < 8 { |
| 4763 | return nil, fmt.Errorf("ActionNxStackPop packet too short: %d < 8", decoder.Length()) |
| 4764 | } |
| 4765 | _actionnxstackpop.Offset = uint16(decoder.ReadUint16()) |
| 4766 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 4767 | return nil, err |
| 4768 | } else { |
| 4769 | _actionnxstackpop.Field = obj |
| 4770 | } |
| 4771 | |
| 4772 | _actionnxstackpop.NBits = uint16(decoder.ReadUint16()) |
| 4773 | return _actionnxstackpop, nil |
| 4774 | } |
| 4775 | |
| 4776 | func NewActionNxStackPop() *ActionNxStackPop { |
| 4777 | obj := &ActionNxStackPop{ |
| 4778 | ActionNicira: NewActionNicira(28), |
| 4779 | } |
| 4780 | return obj |
| 4781 | } |
| 4782 | func (self *ActionNxStackPop) GetActionName() string { |
| 4783 | return "nx_stack_pop" |
| 4784 | } |
| 4785 | |
| 4786 | func (self *ActionNxStackPop) GetActionFields() map[string]interface{} { |
| 4787 | return map[string]interface{}{ |
| 4788 | "Offset": self.Offset, |
| 4789 | "Field": self.Field, |
| 4790 | "NBits": self.NBits, |
| 4791 | } |
| 4792 | } |
| 4793 | |
| 4794 | func (self *ActionNxStackPop) MarshalJSON() ([]byte, error) { |
| 4795 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4796 | if err != nil { |
| 4797 | return nil, err |
| 4798 | } |
| 4799 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4800 | } |
| 4801 | |
| 4802 | type ActionNxStackPush struct { |
| 4803 | *ActionNicira |
| 4804 | Offset uint16 |
| 4805 | Field goloxi.IOxmId |
| 4806 | NBits uint16 |
| 4807 | } |
| 4808 | |
| 4809 | type IActionNxStackPush interface { |
| 4810 | IActionNicira |
| 4811 | GetOffset() uint16 |
| 4812 | GetField() goloxi.IOxmId |
| 4813 | GetNBits() uint16 |
| 4814 | } |
| 4815 | |
| 4816 | func (self *ActionNxStackPush) GetOffset() uint16 { |
| 4817 | return self.Offset |
| 4818 | } |
| 4819 | |
| 4820 | func (self *ActionNxStackPush) SetOffset(v uint16) { |
| 4821 | self.Offset = v |
| 4822 | } |
| 4823 | |
| 4824 | func (self *ActionNxStackPush) GetField() goloxi.IOxmId { |
| 4825 | return self.Field |
| 4826 | } |
| 4827 | |
| 4828 | func (self *ActionNxStackPush) SetField(v goloxi.IOxmId) { |
| 4829 | self.Field = v |
| 4830 | } |
| 4831 | |
| 4832 | func (self *ActionNxStackPush) GetNBits() uint16 { |
| 4833 | return self.NBits |
| 4834 | } |
| 4835 | |
| 4836 | func (self *ActionNxStackPush) SetNBits(v uint16) { |
| 4837 | self.NBits = v |
| 4838 | } |
| 4839 | |
| 4840 | func (self *ActionNxStackPush) Serialize(encoder *goloxi.Encoder) error { |
| 4841 | startIndex := len(encoder.Bytes()) |
| 4842 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4843 | return err |
| 4844 | } |
| 4845 | |
| 4846 | encoder.PutUint16(uint16(self.Offset)) |
| 4847 | self.Field.Serialize(encoder) |
| 4848 | encoder.PutUint16(uint16(self.NBits)) |
| 4849 | length := len(encoder.Bytes()) - startIndex |
| 4850 | alignedLength := ((length + 23) / 24 * 24) |
| 4851 | |
| 4852 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4853 | |
| 4854 | encoder.Write(bytes.Repeat([]byte{0}, alignedLength-length)) |
| 4855 | |
| 4856 | return nil |
| 4857 | } |
| 4858 | |
| 4859 | func DecodeActionNxStackPush(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxStackPush, error) { |
| 4860 | _actionnxstackpush := &ActionNxStackPush{ActionNicira: parent} |
| 4861 | if decoder.Length() < 8 { |
| 4862 | return nil, fmt.Errorf("ActionNxStackPush packet too short: %d < 8", decoder.Length()) |
| 4863 | } |
| 4864 | _actionnxstackpush.Offset = uint16(decoder.ReadUint16()) |
| 4865 | if obj, err := DecodeOxmId(decoder); err != nil { |
| 4866 | return nil, err |
| 4867 | } else { |
| 4868 | _actionnxstackpush.Field = obj |
| 4869 | } |
| 4870 | |
| 4871 | _actionnxstackpush.NBits = uint16(decoder.ReadUint16()) |
| 4872 | return _actionnxstackpush, nil |
| 4873 | } |
| 4874 | |
| 4875 | func NewActionNxStackPush() *ActionNxStackPush { |
| 4876 | obj := &ActionNxStackPush{ |
| 4877 | ActionNicira: NewActionNicira(27), |
| 4878 | } |
| 4879 | return obj |
| 4880 | } |
| 4881 | func (self *ActionNxStackPush) GetActionName() string { |
| 4882 | return "nx_stack_push" |
| 4883 | } |
| 4884 | |
| 4885 | func (self *ActionNxStackPush) GetActionFields() map[string]interface{} { |
| 4886 | return map[string]interface{}{ |
| 4887 | "Offset": self.Offset, |
| 4888 | "Field": self.Field, |
| 4889 | "NBits": self.NBits, |
| 4890 | } |
| 4891 | } |
| 4892 | |
| 4893 | func (self *ActionNxStackPush) MarshalJSON() ([]byte, error) { |
| 4894 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4895 | if err != nil { |
| 4896 | return nil, err |
| 4897 | } |
| 4898 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4899 | } |
| 4900 | |
| 4901 | type ActionNxWriteMetadata struct { |
| 4902 | *ActionNicira |
| 4903 | Metadata uint64 |
| 4904 | Mask uint64 |
| 4905 | } |
| 4906 | |
| 4907 | type IActionNxWriteMetadata interface { |
| 4908 | IActionNicira |
| 4909 | GetMetadata() uint64 |
| 4910 | GetMask() uint64 |
| 4911 | } |
| 4912 | |
| 4913 | func (self *ActionNxWriteMetadata) GetMetadata() uint64 { |
| 4914 | return self.Metadata |
| 4915 | } |
| 4916 | |
| 4917 | func (self *ActionNxWriteMetadata) SetMetadata(v uint64) { |
| 4918 | self.Metadata = v |
| 4919 | } |
| 4920 | |
| 4921 | func (self *ActionNxWriteMetadata) GetMask() uint64 { |
| 4922 | return self.Mask |
| 4923 | } |
| 4924 | |
| 4925 | func (self *ActionNxWriteMetadata) SetMask(v uint64) { |
| 4926 | self.Mask = v |
| 4927 | } |
| 4928 | |
| 4929 | func (self *ActionNxWriteMetadata) Serialize(encoder *goloxi.Encoder) error { |
| 4930 | startIndex := len(encoder.Bytes()) |
| 4931 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 4932 | return err |
| 4933 | } |
| 4934 | |
| 4935 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 4936 | encoder.PutUint64(uint64(self.Metadata)) |
| 4937 | encoder.PutUint64(uint64(self.Mask)) |
| 4938 | length := len(encoder.Bytes()) - startIndex |
| 4939 | |
| 4940 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 4941 | |
| 4942 | return nil |
| 4943 | } |
| 4944 | |
| 4945 | func DecodeActionNxWriteMetadata(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionNxWriteMetadata, error) { |
| 4946 | _actionnxwritemetadata := &ActionNxWriteMetadata{ActionNicira: parent} |
| 4947 | if decoder.Length() < 22 { |
| 4948 | return nil, fmt.Errorf("ActionNxWriteMetadata packet too short: %d < 22", decoder.Length()) |
| 4949 | } |
| 4950 | decoder.Skip(6) |
| 4951 | _actionnxwritemetadata.Metadata = uint64(decoder.ReadUint64()) |
| 4952 | _actionnxwritemetadata.Mask = uint64(decoder.ReadUint64()) |
| 4953 | return _actionnxwritemetadata, nil |
| 4954 | } |
| 4955 | |
| 4956 | func NewActionNxWriteMetadata() *ActionNxWriteMetadata { |
| 4957 | obj := &ActionNxWriteMetadata{ |
| 4958 | ActionNicira: NewActionNicira(22), |
| 4959 | } |
| 4960 | return obj |
| 4961 | } |
| 4962 | func (self *ActionNxWriteMetadata) GetActionName() string { |
| 4963 | return "nx_write_metadata" |
| 4964 | } |
| 4965 | |
| 4966 | func (self *ActionNxWriteMetadata) GetActionFields() map[string]interface{} { |
| 4967 | return map[string]interface{}{ |
| 4968 | "Metadata": self.Metadata, |
| 4969 | "Mask": self.Mask, |
| 4970 | } |
| 4971 | } |
| 4972 | |
| 4973 | func (self *ActionNxWriteMetadata) MarshalJSON() ([]byte, error) { |
| 4974 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 4975 | if err != nil { |
| 4976 | return nil, err |
| 4977 | } |
| 4978 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 4979 | } |
| 4980 | |
| 4981 | type ActionOutput struct { |
| 4982 | *Action |
| 4983 | Port Port |
| 4984 | MaxLen uint16 |
| 4985 | } |
| 4986 | |
| 4987 | type IActionOutput interface { |
| 4988 | goloxi.IAction |
| 4989 | GetPort() Port |
| 4990 | GetMaxLen() uint16 |
| 4991 | } |
| 4992 | |
| 4993 | func (self *ActionOutput) GetPort() Port { |
| 4994 | return self.Port |
| 4995 | } |
| 4996 | |
| 4997 | func (self *ActionOutput) SetPort(v Port) { |
| 4998 | self.Port = v |
| 4999 | } |
| 5000 | |
| 5001 | func (self *ActionOutput) GetMaxLen() uint16 { |
| 5002 | return self.MaxLen |
| 5003 | } |
| 5004 | |
| 5005 | func (self *ActionOutput) SetMaxLen(v uint16) { |
| 5006 | self.MaxLen = v |
| 5007 | } |
| 5008 | |
| 5009 | func (self *ActionOutput) Serialize(encoder *goloxi.Encoder) error { |
| 5010 | startIndex := len(encoder.Bytes()) |
| 5011 | if err := self.Action.Serialize(encoder); err != nil { |
| 5012 | return err |
| 5013 | } |
| 5014 | |
| 5015 | self.Port.Serialize(encoder) |
| 5016 | encoder.PutUint16(uint16(self.MaxLen)) |
| 5017 | length := len(encoder.Bytes()) - startIndex |
| 5018 | |
| 5019 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5020 | |
| 5021 | return nil |
| 5022 | } |
| 5023 | |
| 5024 | func DecodeActionOutput(parent *Action, decoder *goloxi.Decoder) (*ActionOutput, error) { |
| 5025 | _actionoutput := &ActionOutput{Action: parent} |
| 5026 | if decoder.Length() < 4 { |
| 5027 | return nil, fmt.Errorf("ActionOutput packet too short: %d < 4", decoder.Length()) |
| 5028 | } |
| 5029 | _actionoutput.Port.Decode(decoder) |
| 5030 | _actionoutput.MaxLen = uint16(decoder.ReadUint16()) |
| 5031 | return _actionoutput, nil |
| 5032 | } |
| 5033 | |
| 5034 | func NewActionOutput() *ActionOutput { |
| 5035 | obj := &ActionOutput{ |
| 5036 | Action: NewAction(0), |
| 5037 | } |
| 5038 | return obj |
| 5039 | } |
| 5040 | func (self *ActionOutput) GetActionName() string { |
| 5041 | return "output" |
| 5042 | } |
| 5043 | |
| 5044 | func (self *ActionOutput) GetActionFields() map[string]interface{} { |
| 5045 | return map[string]interface{}{ |
| 5046 | "Port": self.Port, |
| 5047 | "MaxLen": self.MaxLen, |
| 5048 | } |
| 5049 | } |
| 5050 | |
| 5051 | func (self *ActionOutput) MarshalJSON() ([]byte, error) { |
| 5052 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5053 | if err != nil { |
| 5054 | return nil, err |
| 5055 | } |
| 5056 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5057 | } |
| 5058 | |
| 5059 | type ActionResubmit struct { |
| 5060 | *ActionNicira |
| 5061 | InPort uint16 |
| 5062 | Table uint8 |
| 5063 | } |
| 5064 | |
| 5065 | type IActionResubmit interface { |
| 5066 | IActionNicira |
| 5067 | GetInPort() uint16 |
| 5068 | GetTable() uint8 |
| 5069 | } |
| 5070 | |
| 5071 | func (self *ActionResubmit) GetInPort() uint16 { |
| 5072 | return self.InPort |
| 5073 | } |
| 5074 | |
| 5075 | func (self *ActionResubmit) SetInPort(v uint16) { |
| 5076 | self.InPort = v |
| 5077 | } |
| 5078 | |
| 5079 | func (self *ActionResubmit) GetTable() uint8 { |
| 5080 | return self.Table |
| 5081 | } |
| 5082 | |
| 5083 | func (self *ActionResubmit) SetTable(v uint8) { |
| 5084 | self.Table = v |
| 5085 | } |
| 5086 | |
| 5087 | func (self *ActionResubmit) Serialize(encoder *goloxi.Encoder) error { |
| 5088 | startIndex := len(encoder.Bytes()) |
| 5089 | if err := self.ActionNicira.Serialize(encoder); err != nil { |
| 5090 | return err |
| 5091 | } |
| 5092 | |
| 5093 | encoder.PutUint16(uint16(self.InPort)) |
| 5094 | encoder.PutUint8(uint8(self.Table)) |
| 5095 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5096 | length := len(encoder.Bytes()) - startIndex |
| 5097 | |
| 5098 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5099 | |
| 5100 | return nil |
| 5101 | } |
| 5102 | |
| 5103 | func DecodeActionResubmit(parent *ActionNicira, decoder *goloxi.Decoder) (*ActionResubmit, error) { |
| 5104 | _actionresubmit := &ActionResubmit{ActionNicira: parent} |
| 5105 | if decoder.Length() < 6 { |
| 5106 | return nil, fmt.Errorf("ActionResubmit packet too short: %d < 6", decoder.Length()) |
| 5107 | } |
| 5108 | _actionresubmit.InPort = uint16(decoder.ReadUint16()) |
| 5109 | _actionresubmit.Table = uint8(decoder.ReadByte()) |
| 5110 | decoder.Skip(3) |
| 5111 | return _actionresubmit, nil |
| 5112 | } |
| 5113 | |
| 5114 | func NewActionResubmit() *ActionResubmit { |
| 5115 | obj := &ActionResubmit{ |
| 5116 | ActionNicira: NewActionNicira(14), |
| 5117 | } |
| 5118 | return obj |
| 5119 | } |
| 5120 | func (self *ActionResubmit) GetActionName() string { |
| 5121 | return "resubmit" |
| 5122 | } |
| 5123 | |
| 5124 | func (self *ActionResubmit) GetActionFields() map[string]interface{} { |
| 5125 | return map[string]interface{}{ |
| 5126 | "InPort": self.InPort, |
| 5127 | "Table": self.Table, |
| 5128 | } |
| 5129 | } |
| 5130 | |
| 5131 | func (self *ActionResubmit) MarshalJSON() ([]byte, error) { |
| 5132 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5133 | if err != nil { |
| 5134 | return nil, err |
| 5135 | } |
| 5136 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5137 | } |
| 5138 | |
| 5139 | type ActionSetDlDst struct { |
| 5140 | *Action |
| 5141 | DlAddr net.HardwareAddr |
| 5142 | } |
| 5143 | |
| 5144 | type IActionSetDlDst interface { |
| 5145 | goloxi.IAction |
| 5146 | GetDlAddr() net.HardwareAddr |
| 5147 | } |
| 5148 | |
| 5149 | func (self *ActionSetDlDst) GetDlAddr() net.HardwareAddr { |
| 5150 | return self.DlAddr |
| 5151 | } |
| 5152 | |
| 5153 | func (self *ActionSetDlDst) SetDlAddr(v net.HardwareAddr) { |
| 5154 | self.DlAddr = v |
| 5155 | } |
| 5156 | |
| 5157 | func (self *ActionSetDlDst) Serialize(encoder *goloxi.Encoder) error { |
| 5158 | startIndex := len(encoder.Bytes()) |
| 5159 | if err := self.Action.Serialize(encoder); err != nil { |
| 5160 | return err |
| 5161 | } |
| 5162 | |
| 5163 | encoder.Write(self.DlAddr) |
| 5164 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 5165 | length := len(encoder.Bytes()) - startIndex |
| 5166 | |
| 5167 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5168 | |
| 5169 | return nil |
| 5170 | } |
| 5171 | |
| 5172 | func DecodeActionSetDlDst(parent *Action, decoder *goloxi.Decoder) (*ActionSetDlDst, error) { |
| 5173 | _actionsetdldst := &ActionSetDlDst{Action: parent} |
| 5174 | if decoder.Length() < 12 { |
| 5175 | return nil, fmt.Errorf("ActionSetDlDst packet too short: %d < 12", decoder.Length()) |
| 5176 | } |
| 5177 | _actionsetdldst.DlAddr = net.HardwareAddr(decoder.Read(6)) |
| 5178 | decoder.Skip(6) |
| 5179 | return _actionsetdldst, nil |
| 5180 | } |
| 5181 | |
| 5182 | func NewActionSetDlDst() *ActionSetDlDst { |
| 5183 | obj := &ActionSetDlDst{ |
| 5184 | Action: NewAction(5), |
| 5185 | } |
| 5186 | return obj |
| 5187 | } |
| 5188 | func (self *ActionSetDlDst) GetActionName() string { |
| 5189 | return "set_dl_dst" |
| 5190 | } |
| 5191 | |
| 5192 | func (self *ActionSetDlDst) GetActionFields() map[string]interface{} { |
| 5193 | return map[string]interface{}{ |
| 5194 | "DlAddr": self.DlAddr, |
| 5195 | } |
| 5196 | } |
| 5197 | |
| 5198 | func (self *ActionSetDlDst) MarshalJSON() ([]byte, error) { |
| 5199 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5200 | if err != nil { |
| 5201 | return nil, err |
| 5202 | } |
| 5203 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5204 | } |
| 5205 | |
| 5206 | type ActionSetDlSrc struct { |
| 5207 | *Action |
| 5208 | DlAddr net.HardwareAddr |
| 5209 | } |
| 5210 | |
| 5211 | type IActionSetDlSrc interface { |
| 5212 | goloxi.IAction |
| 5213 | GetDlAddr() net.HardwareAddr |
| 5214 | } |
| 5215 | |
| 5216 | func (self *ActionSetDlSrc) GetDlAddr() net.HardwareAddr { |
| 5217 | return self.DlAddr |
| 5218 | } |
| 5219 | |
| 5220 | func (self *ActionSetDlSrc) SetDlAddr(v net.HardwareAddr) { |
| 5221 | self.DlAddr = v |
| 5222 | } |
| 5223 | |
| 5224 | func (self *ActionSetDlSrc) Serialize(encoder *goloxi.Encoder) error { |
| 5225 | startIndex := len(encoder.Bytes()) |
| 5226 | if err := self.Action.Serialize(encoder); err != nil { |
| 5227 | return err |
| 5228 | } |
| 5229 | |
| 5230 | encoder.Write(self.DlAddr) |
| 5231 | encoder.Write(bytes.Repeat([]byte{0}, 6)) |
| 5232 | length := len(encoder.Bytes()) - startIndex |
| 5233 | |
| 5234 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5235 | |
| 5236 | return nil |
| 5237 | } |
| 5238 | |
| 5239 | func DecodeActionSetDlSrc(parent *Action, decoder *goloxi.Decoder) (*ActionSetDlSrc, error) { |
| 5240 | _actionsetdlsrc := &ActionSetDlSrc{Action: parent} |
| 5241 | if decoder.Length() < 12 { |
| 5242 | return nil, fmt.Errorf("ActionSetDlSrc packet too short: %d < 12", decoder.Length()) |
| 5243 | } |
| 5244 | _actionsetdlsrc.DlAddr = net.HardwareAddr(decoder.Read(6)) |
| 5245 | decoder.Skip(6) |
| 5246 | return _actionsetdlsrc, nil |
| 5247 | } |
| 5248 | |
| 5249 | func NewActionSetDlSrc() *ActionSetDlSrc { |
| 5250 | obj := &ActionSetDlSrc{ |
| 5251 | Action: NewAction(4), |
| 5252 | } |
| 5253 | return obj |
| 5254 | } |
| 5255 | func (self *ActionSetDlSrc) GetActionName() string { |
| 5256 | return "set_dl_src" |
| 5257 | } |
| 5258 | |
| 5259 | func (self *ActionSetDlSrc) GetActionFields() map[string]interface{} { |
| 5260 | return map[string]interface{}{ |
| 5261 | "DlAddr": self.DlAddr, |
| 5262 | } |
| 5263 | } |
| 5264 | |
| 5265 | func (self *ActionSetDlSrc) MarshalJSON() ([]byte, error) { |
| 5266 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5267 | if err != nil { |
| 5268 | return nil, err |
| 5269 | } |
| 5270 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5271 | } |
| 5272 | |
| 5273 | type ActionSetNwDst struct { |
| 5274 | *Action |
| 5275 | NwAddr uint32 |
| 5276 | } |
| 5277 | |
| 5278 | type IActionSetNwDst interface { |
| 5279 | goloxi.IAction |
| 5280 | GetNwAddr() uint32 |
| 5281 | } |
| 5282 | |
| 5283 | func (self *ActionSetNwDst) GetNwAddr() uint32 { |
| 5284 | return self.NwAddr |
| 5285 | } |
| 5286 | |
| 5287 | func (self *ActionSetNwDst) SetNwAddr(v uint32) { |
| 5288 | self.NwAddr = v |
| 5289 | } |
| 5290 | |
| 5291 | func (self *ActionSetNwDst) Serialize(encoder *goloxi.Encoder) error { |
| 5292 | startIndex := len(encoder.Bytes()) |
| 5293 | if err := self.Action.Serialize(encoder); err != nil { |
| 5294 | return err |
| 5295 | } |
| 5296 | |
| 5297 | encoder.PutUint32(uint32(self.NwAddr)) |
| 5298 | length := len(encoder.Bytes()) - startIndex |
| 5299 | |
| 5300 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5301 | |
| 5302 | return nil |
| 5303 | } |
| 5304 | |
| 5305 | func DecodeActionSetNwDst(parent *Action, decoder *goloxi.Decoder) (*ActionSetNwDst, error) { |
| 5306 | _actionsetnwdst := &ActionSetNwDst{Action: parent} |
| 5307 | if decoder.Length() < 4 { |
| 5308 | return nil, fmt.Errorf("ActionSetNwDst packet too short: %d < 4", decoder.Length()) |
| 5309 | } |
| 5310 | _actionsetnwdst.NwAddr = uint32(decoder.ReadUint32()) |
| 5311 | return _actionsetnwdst, nil |
| 5312 | } |
| 5313 | |
| 5314 | func NewActionSetNwDst() *ActionSetNwDst { |
| 5315 | obj := &ActionSetNwDst{ |
| 5316 | Action: NewAction(7), |
| 5317 | } |
| 5318 | return obj |
| 5319 | } |
| 5320 | func (self *ActionSetNwDst) GetActionName() string { |
| 5321 | return "set_nw_dst" |
| 5322 | } |
| 5323 | |
| 5324 | func (self *ActionSetNwDst) GetActionFields() map[string]interface{} { |
| 5325 | return map[string]interface{}{ |
| 5326 | "NwAddr": self.NwAddr, |
| 5327 | } |
| 5328 | } |
| 5329 | |
| 5330 | func (self *ActionSetNwDst) MarshalJSON() ([]byte, error) { |
| 5331 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5332 | if err != nil { |
| 5333 | return nil, err |
| 5334 | } |
| 5335 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5336 | } |
| 5337 | |
| 5338 | type ActionSetNwSrc struct { |
| 5339 | *Action |
| 5340 | NwAddr uint32 |
| 5341 | } |
| 5342 | |
| 5343 | type IActionSetNwSrc interface { |
| 5344 | goloxi.IAction |
| 5345 | GetNwAddr() uint32 |
| 5346 | } |
| 5347 | |
| 5348 | func (self *ActionSetNwSrc) GetNwAddr() uint32 { |
| 5349 | return self.NwAddr |
| 5350 | } |
| 5351 | |
| 5352 | func (self *ActionSetNwSrc) SetNwAddr(v uint32) { |
| 5353 | self.NwAddr = v |
| 5354 | } |
| 5355 | |
| 5356 | func (self *ActionSetNwSrc) Serialize(encoder *goloxi.Encoder) error { |
| 5357 | startIndex := len(encoder.Bytes()) |
| 5358 | if err := self.Action.Serialize(encoder); err != nil { |
| 5359 | return err |
| 5360 | } |
| 5361 | |
| 5362 | encoder.PutUint32(uint32(self.NwAddr)) |
| 5363 | length := len(encoder.Bytes()) - startIndex |
| 5364 | |
| 5365 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5366 | |
| 5367 | return nil |
| 5368 | } |
| 5369 | |
| 5370 | func DecodeActionSetNwSrc(parent *Action, decoder *goloxi.Decoder) (*ActionSetNwSrc, error) { |
| 5371 | _actionsetnwsrc := &ActionSetNwSrc{Action: parent} |
| 5372 | if decoder.Length() < 4 { |
| 5373 | return nil, fmt.Errorf("ActionSetNwSrc packet too short: %d < 4", decoder.Length()) |
| 5374 | } |
| 5375 | _actionsetnwsrc.NwAddr = uint32(decoder.ReadUint32()) |
| 5376 | return _actionsetnwsrc, nil |
| 5377 | } |
| 5378 | |
| 5379 | func NewActionSetNwSrc() *ActionSetNwSrc { |
| 5380 | obj := &ActionSetNwSrc{ |
| 5381 | Action: NewAction(6), |
| 5382 | } |
| 5383 | return obj |
| 5384 | } |
| 5385 | func (self *ActionSetNwSrc) GetActionName() string { |
| 5386 | return "set_nw_src" |
| 5387 | } |
| 5388 | |
| 5389 | func (self *ActionSetNwSrc) GetActionFields() map[string]interface{} { |
| 5390 | return map[string]interface{}{ |
| 5391 | "NwAddr": self.NwAddr, |
| 5392 | } |
| 5393 | } |
| 5394 | |
| 5395 | func (self *ActionSetNwSrc) MarshalJSON() ([]byte, error) { |
| 5396 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5397 | if err != nil { |
| 5398 | return nil, err |
| 5399 | } |
| 5400 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5401 | } |
| 5402 | |
| 5403 | type ActionSetNwTos struct { |
| 5404 | *Action |
| 5405 | NwTos uint8 |
| 5406 | } |
| 5407 | |
| 5408 | type IActionSetNwTos interface { |
| 5409 | goloxi.IAction |
| 5410 | GetNwTos() uint8 |
| 5411 | } |
| 5412 | |
| 5413 | func (self *ActionSetNwTos) GetNwTos() uint8 { |
| 5414 | return self.NwTos |
| 5415 | } |
| 5416 | |
| 5417 | func (self *ActionSetNwTos) SetNwTos(v uint8) { |
| 5418 | self.NwTos = v |
| 5419 | } |
| 5420 | |
| 5421 | func (self *ActionSetNwTos) Serialize(encoder *goloxi.Encoder) error { |
| 5422 | startIndex := len(encoder.Bytes()) |
| 5423 | if err := self.Action.Serialize(encoder); err != nil { |
| 5424 | return err |
| 5425 | } |
| 5426 | |
| 5427 | encoder.PutUint8(uint8(self.NwTos)) |
| 5428 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5429 | length := len(encoder.Bytes()) - startIndex |
| 5430 | |
| 5431 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5432 | |
| 5433 | return nil |
| 5434 | } |
| 5435 | |
| 5436 | func DecodeActionSetNwTos(parent *Action, decoder *goloxi.Decoder) (*ActionSetNwTos, error) { |
| 5437 | _actionsetnwtos := &ActionSetNwTos{Action: parent} |
| 5438 | if decoder.Length() < 4 { |
| 5439 | return nil, fmt.Errorf("ActionSetNwTos packet too short: %d < 4", decoder.Length()) |
| 5440 | } |
| 5441 | _actionsetnwtos.NwTos = uint8(decoder.ReadByte()) |
| 5442 | decoder.Skip(3) |
| 5443 | return _actionsetnwtos, nil |
| 5444 | } |
| 5445 | |
| 5446 | func NewActionSetNwTos() *ActionSetNwTos { |
| 5447 | obj := &ActionSetNwTos{ |
| 5448 | Action: NewAction(8), |
| 5449 | } |
| 5450 | return obj |
| 5451 | } |
| 5452 | func (self *ActionSetNwTos) GetActionName() string { |
| 5453 | return "set_nw_tos" |
| 5454 | } |
| 5455 | |
| 5456 | func (self *ActionSetNwTos) GetActionFields() map[string]interface{} { |
| 5457 | return map[string]interface{}{ |
| 5458 | "NwTos": self.NwTos, |
| 5459 | } |
| 5460 | } |
| 5461 | |
| 5462 | func (self *ActionSetNwTos) MarshalJSON() ([]byte, error) { |
| 5463 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5464 | if err != nil { |
| 5465 | return nil, err |
| 5466 | } |
| 5467 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5468 | } |
| 5469 | |
| 5470 | type ActionSetTpDst struct { |
| 5471 | *Action |
| 5472 | TpPort uint16 |
| 5473 | } |
| 5474 | |
| 5475 | type IActionSetTpDst interface { |
| 5476 | goloxi.IAction |
| 5477 | GetTpPort() uint16 |
| 5478 | } |
| 5479 | |
| 5480 | func (self *ActionSetTpDst) GetTpPort() uint16 { |
| 5481 | return self.TpPort |
| 5482 | } |
| 5483 | |
| 5484 | func (self *ActionSetTpDst) SetTpPort(v uint16) { |
| 5485 | self.TpPort = v |
| 5486 | } |
| 5487 | |
| 5488 | func (self *ActionSetTpDst) Serialize(encoder *goloxi.Encoder) error { |
| 5489 | startIndex := len(encoder.Bytes()) |
| 5490 | if err := self.Action.Serialize(encoder); err != nil { |
| 5491 | return err |
| 5492 | } |
| 5493 | |
| 5494 | encoder.PutUint16(uint16(self.TpPort)) |
| 5495 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 5496 | length := len(encoder.Bytes()) - startIndex |
| 5497 | |
| 5498 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5499 | |
| 5500 | return nil |
| 5501 | } |
| 5502 | |
| 5503 | func DecodeActionSetTpDst(parent *Action, decoder *goloxi.Decoder) (*ActionSetTpDst, error) { |
| 5504 | _actionsettpdst := &ActionSetTpDst{Action: parent} |
| 5505 | if decoder.Length() < 4 { |
| 5506 | return nil, fmt.Errorf("ActionSetTpDst packet too short: %d < 4", decoder.Length()) |
| 5507 | } |
| 5508 | _actionsettpdst.TpPort = uint16(decoder.ReadUint16()) |
| 5509 | decoder.Skip(2) |
| 5510 | return _actionsettpdst, nil |
| 5511 | } |
| 5512 | |
| 5513 | func NewActionSetTpDst() *ActionSetTpDst { |
| 5514 | obj := &ActionSetTpDst{ |
| 5515 | Action: NewAction(10), |
| 5516 | } |
| 5517 | return obj |
| 5518 | } |
| 5519 | func (self *ActionSetTpDst) GetActionName() string { |
| 5520 | return "set_tp_dst" |
| 5521 | } |
| 5522 | |
| 5523 | func (self *ActionSetTpDst) GetActionFields() map[string]interface{} { |
| 5524 | return map[string]interface{}{ |
| 5525 | "TpPort": self.TpPort, |
| 5526 | } |
| 5527 | } |
| 5528 | |
| 5529 | func (self *ActionSetTpDst) MarshalJSON() ([]byte, error) { |
| 5530 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5531 | if err != nil { |
| 5532 | return nil, err |
| 5533 | } |
| 5534 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5535 | } |
| 5536 | |
| 5537 | type ActionSetTpSrc struct { |
| 5538 | *Action |
| 5539 | TpPort uint16 |
| 5540 | } |
| 5541 | |
| 5542 | type IActionSetTpSrc interface { |
| 5543 | goloxi.IAction |
| 5544 | GetTpPort() uint16 |
| 5545 | } |
| 5546 | |
| 5547 | func (self *ActionSetTpSrc) GetTpPort() uint16 { |
| 5548 | return self.TpPort |
| 5549 | } |
| 5550 | |
| 5551 | func (self *ActionSetTpSrc) SetTpPort(v uint16) { |
| 5552 | self.TpPort = v |
| 5553 | } |
| 5554 | |
| 5555 | func (self *ActionSetTpSrc) Serialize(encoder *goloxi.Encoder) error { |
| 5556 | startIndex := len(encoder.Bytes()) |
| 5557 | if err := self.Action.Serialize(encoder); err != nil { |
| 5558 | return err |
| 5559 | } |
| 5560 | |
| 5561 | encoder.PutUint16(uint16(self.TpPort)) |
| 5562 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 5563 | length := len(encoder.Bytes()) - startIndex |
| 5564 | |
| 5565 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5566 | |
| 5567 | return nil |
| 5568 | } |
| 5569 | |
| 5570 | func DecodeActionSetTpSrc(parent *Action, decoder *goloxi.Decoder) (*ActionSetTpSrc, error) { |
| 5571 | _actionsettpsrc := &ActionSetTpSrc{Action: parent} |
| 5572 | if decoder.Length() < 4 { |
| 5573 | return nil, fmt.Errorf("ActionSetTpSrc packet too short: %d < 4", decoder.Length()) |
| 5574 | } |
| 5575 | _actionsettpsrc.TpPort = uint16(decoder.ReadUint16()) |
| 5576 | decoder.Skip(2) |
| 5577 | return _actionsettpsrc, nil |
| 5578 | } |
| 5579 | |
| 5580 | func NewActionSetTpSrc() *ActionSetTpSrc { |
| 5581 | obj := &ActionSetTpSrc{ |
| 5582 | Action: NewAction(9), |
| 5583 | } |
| 5584 | return obj |
| 5585 | } |
| 5586 | func (self *ActionSetTpSrc) GetActionName() string { |
| 5587 | return "set_tp_src" |
| 5588 | } |
| 5589 | |
| 5590 | func (self *ActionSetTpSrc) GetActionFields() map[string]interface{} { |
| 5591 | return map[string]interface{}{ |
| 5592 | "TpPort": self.TpPort, |
| 5593 | } |
| 5594 | } |
| 5595 | |
| 5596 | func (self *ActionSetTpSrc) MarshalJSON() ([]byte, error) { |
| 5597 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5598 | if err != nil { |
| 5599 | return nil, err |
| 5600 | } |
| 5601 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5602 | } |
| 5603 | |
| 5604 | type ActionSetVlanPcp struct { |
| 5605 | *Action |
| 5606 | VlanPcp uint8 |
| 5607 | } |
| 5608 | |
| 5609 | type IActionSetVlanPcp interface { |
| 5610 | goloxi.IAction |
| 5611 | GetVlanPcp() uint8 |
| 5612 | } |
| 5613 | |
| 5614 | func (self *ActionSetVlanPcp) GetVlanPcp() uint8 { |
| 5615 | return self.VlanPcp |
| 5616 | } |
| 5617 | |
| 5618 | func (self *ActionSetVlanPcp) SetVlanPcp(v uint8) { |
| 5619 | self.VlanPcp = v |
| 5620 | } |
| 5621 | |
| 5622 | func (self *ActionSetVlanPcp) Serialize(encoder *goloxi.Encoder) error { |
| 5623 | startIndex := len(encoder.Bytes()) |
| 5624 | if err := self.Action.Serialize(encoder); err != nil { |
| 5625 | return err |
| 5626 | } |
| 5627 | |
| 5628 | encoder.PutUint8(uint8(self.VlanPcp)) |
| 5629 | encoder.Write(bytes.Repeat([]byte{0}, 3)) |
| 5630 | length := len(encoder.Bytes()) - startIndex |
| 5631 | |
| 5632 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5633 | |
| 5634 | return nil |
| 5635 | } |
| 5636 | |
| 5637 | func DecodeActionSetVlanPcp(parent *Action, decoder *goloxi.Decoder) (*ActionSetVlanPcp, error) { |
| 5638 | _actionsetvlanpcp := &ActionSetVlanPcp{Action: parent} |
| 5639 | if decoder.Length() < 4 { |
| 5640 | return nil, fmt.Errorf("ActionSetVlanPcp packet too short: %d < 4", decoder.Length()) |
| 5641 | } |
| 5642 | _actionsetvlanpcp.VlanPcp = uint8(decoder.ReadByte()) |
| 5643 | decoder.Skip(3) |
| 5644 | return _actionsetvlanpcp, nil |
| 5645 | } |
| 5646 | |
| 5647 | func NewActionSetVlanPcp() *ActionSetVlanPcp { |
| 5648 | obj := &ActionSetVlanPcp{ |
| 5649 | Action: NewAction(2), |
| 5650 | } |
| 5651 | return obj |
| 5652 | } |
| 5653 | func (self *ActionSetVlanPcp) GetActionName() string { |
| 5654 | return "set_vlan_pcp" |
| 5655 | } |
| 5656 | |
| 5657 | func (self *ActionSetVlanPcp) GetActionFields() map[string]interface{} { |
| 5658 | return map[string]interface{}{ |
| 5659 | "VlanPcp": self.VlanPcp, |
| 5660 | } |
| 5661 | } |
| 5662 | |
| 5663 | func (self *ActionSetVlanPcp) MarshalJSON() ([]byte, error) { |
| 5664 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5665 | if err != nil { |
| 5666 | return nil, err |
| 5667 | } |
| 5668 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5669 | } |
| 5670 | |
| 5671 | type ActionSetVlanVid struct { |
| 5672 | *Action |
| 5673 | VlanVid uint16 |
| 5674 | } |
| 5675 | |
| 5676 | type IActionSetVlanVid interface { |
| 5677 | goloxi.IAction |
| 5678 | GetVlanVid() uint16 |
| 5679 | } |
| 5680 | |
| 5681 | func (self *ActionSetVlanVid) GetVlanVid() uint16 { |
| 5682 | return self.VlanVid |
| 5683 | } |
| 5684 | |
| 5685 | func (self *ActionSetVlanVid) SetVlanVid(v uint16) { |
| 5686 | self.VlanVid = v |
| 5687 | } |
| 5688 | |
| 5689 | func (self *ActionSetVlanVid) Serialize(encoder *goloxi.Encoder) error { |
| 5690 | startIndex := len(encoder.Bytes()) |
| 5691 | if err := self.Action.Serialize(encoder); err != nil { |
| 5692 | return err |
| 5693 | } |
| 5694 | |
| 5695 | encoder.PutUint16(uint16(self.VlanVid)) |
| 5696 | encoder.Write(bytes.Repeat([]byte{0}, 2)) |
| 5697 | length := len(encoder.Bytes()) - startIndex |
| 5698 | |
| 5699 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5700 | |
| 5701 | return nil |
| 5702 | } |
| 5703 | |
| 5704 | func DecodeActionSetVlanVid(parent *Action, decoder *goloxi.Decoder) (*ActionSetVlanVid, error) { |
| 5705 | _actionsetvlanvid := &ActionSetVlanVid{Action: parent} |
| 5706 | if decoder.Length() < 4 { |
| 5707 | return nil, fmt.Errorf("ActionSetVlanVid packet too short: %d < 4", decoder.Length()) |
| 5708 | } |
| 5709 | _actionsetvlanvid.VlanVid = uint16(decoder.ReadUint16()) |
| 5710 | decoder.Skip(2) |
| 5711 | return _actionsetvlanvid, nil |
| 5712 | } |
| 5713 | |
| 5714 | func NewActionSetVlanVid() *ActionSetVlanVid { |
| 5715 | obj := &ActionSetVlanVid{ |
| 5716 | Action: NewAction(1), |
| 5717 | } |
| 5718 | return obj |
| 5719 | } |
| 5720 | func (self *ActionSetVlanVid) GetActionName() string { |
| 5721 | return "set_vlan_vid" |
| 5722 | } |
| 5723 | |
| 5724 | func (self *ActionSetVlanVid) GetActionFields() map[string]interface{} { |
| 5725 | return map[string]interface{}{ |
| 5726 | "VlanVid": self.VlanVid, |
| 5727 | } |
| 5728 | } |
| 5729 | |
| 5730 | func (self *ActionSetVlanVid) MarshalJSON() ([]byte, error) { |
| 5731 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5732 | if err != nil { |
| 5733 | return nil, err |
| 5734 | } |
| 5735 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5736 | } |
| 5737 | |
| 5738 | type ActionStripVlan struct { |
| 5739 | *Action |
| 5740 | } |
| 5741 | |
| 5742 | type IActionStripVlan interface { |
| 5743 | goloxi.IAction |
| 5744 | } |
| 5745 | |
| 5746 | func (self *ActionStripVlan) Serialize(encoder *goloxi.Encoder) error { |
| 5747 | startIndex := len(encoder.Bytes()) |
| 5748 | if err := self.Action.Serialize(encoder); err != nil { |
| 5749 | return err |
| 5750 | } |
| 5751 | |
| 5752 | encoder.Write(bytes.Repeat([]byte{0}, 4)) |
| 5753 | length := len(encoder.Bytes()) - startIndex |
| 5754 | |
| 5755 | binary.BigEndian.PutUint16(encoder.Bytes()[startIndex+2:startIndex+4], uint16(length)) |
| 5756 | |
| 5757 | return nil |
| 5758 | } |
| 5759 | |
| 5760 | func DecodeActionStripVlan(parent *Action, decoder *goloxi.Decoder) (*ActionStripVlan, error) { |
| 5761 | _actionstripvlan := &ActionStripVlan{Action: parent} |
| 5762 | if decoder.Length() < 4 { |
| 5763 | return nil, fmt.Errorf("ActionStripVlan packet too short: %d < 4", decoder.Length()) |
| 5764 | } |
| 5765 | decoder.Skip(4) |
| 5766 | return _actionstripvlan, nil |
| 5767 | } |
| 5768 | |
| 5769 | func NewActionStripVlan() *ActionStripVlan { |
| 5770 | obj := &ActionStripVlan{ |
| 5771 | Action: NewAction(3), |
| 5772 | } |
| 5773 | return obj |
| 5774 | } |
| 5775 | func (self *ActionStripVlan) GetActionName() string { |
| 5776 | return "strip_vlan" |
| 5777 | } |
| 5778 | |
| 5779 | func (self *ActionStripVlan) GetActionFields() map[string]interface{} { |
| 5780 | return map[string]interface{}{} |
| 5781 | } |
| 5782 | |
| 5783 | func (self *ActionStripVlan) MarshalJSON() ([]byte, error) { |
| 5784 | jsonValue, err := json.Marshal(self.GetActionFields()) |
| 5785 | if err != nil { |
| 5786 | return nil, err |
| 5787 | } |
| 5788 | return []byte(fmt.Sprintf("{\"Type\":\"%s\",\"Arguments\":%s}", self.GetActionName(), string(jsonValue))), nil |
| 5789 | } |