net_tap_flows.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package compute
  15. import "yunion.io/x/onecloud/pkg/apis"
  16. const (
  17. TapFlowVSwitch = "vswitch"
  18. TapFlowGuestNic = "vnic"
  19. TapFlowDirectionIn = "IN"
  20. TapFlowDirectionOut = "OUT"
  21. TapFlowDirectionBoth = "BOTH"
  22. TapFlowIdMin = 0x10
  23. TapFlowIdMax = 0x7fff
  24. )
  25. var (
  26. TapFlowDirections = []string{
  27. TapFlowDirectionIn,
  28. TapFlowDirectionOut,
  29. TapFlowDirectionBoth,
  30. }
  31. )
  32. type NetTapFlowListInput struct {
  33. apis.EnabledStatusStandaloneResourceListInput
  34. TapId string `json:"tap_id"`
  35. HostId string `json:"host_id" help:"filter by host id or name"`
  36. }
  37. type NetTapFlowDetails struct {
  38. apis.EnabledStatusStandaloneResourceDetails
  39. // 关联的tap服务名称
  40. Tap string `json:"tap"`
  41. Source string `json:"source"`
  42. SourceIps string `json:"source_ips"`
  43. Net string `json:"net"`
  44. }
  45. type NetTapFlowCreateInput struct {
  46. apis.EnabledStatusStandaloneResourceCreateInput
  47. TapId string `json:"tap_id" required:"true" help:"tap service id or name that this flow belongs to"`
  48. Type string `json:"type" required:"true" choices:"vswitch|vnic" help:"type of tap flow"`
  49. HostId string `json:"host_id" help:"id or name of host to tap with"`
  50. WireId string `json:"wire_id" help:"id or name of wire to tap with"`
  51. VlanId *int `json:"vlan_id" help:"vlan id of vswitch to tap with"`
  52. GuestId string `json:"guest_id" help:"id or name of vm to tap with"`
  53. // swagger:ignore
  54. NetId string `json:"net_id" ignore:"true"`
  55. MacAddr string `json:"mac_addr" help:"mac address of guest nic to tap with"`
  56. IpAddr string `json:"ip_addr" help:"ip address of guest nic to tap with"`
  57. // swagger:ignore
  58. SourceId string `json:"source_id" ignore:"true"`
  59. Direction string `json:"direction" help:"flow direction" choices:"IN|OUT|BOTH"`
  60. }