names.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 ovn
  15. import (
  16. "fmt"
  17. )
  18. func vpcLrName(vpcId string) string {
  19. return fmt.Sprintf("vpc-r/%s", vpcId)
  20. }
  21. // ext
  22. func vpcExtLrName(vpcId string) string {
  23. return fmt.Sprintf("vpc-ext-r/%s", vpcId)
  24. }
  25. func vpcExtLsName(vpcId string) string {
  26. return fmt.Sprintf("vpc-ext/%s", vpcId)
  27. }
  28. func vpcR1extpName(vpcId string) string {
  29. return fmt.Sprintf("vpc-r1ext/%s", vpcId)
  30. }
  31. func vpcExtr1pName(vpcId string) string {
  32. return fmt.Sprintf("vpc-extr1/%s", vpcId)
  33. }
  34. func vpcR2extpName(vpcId string) string {
  35. return fmt.Sprintf("vpc-r2ext/%s", vpcId)
  36. }
  37. func vpcExtr2pName(vpcId string) string {
  38. return fmt.Sprintf("vpc-extr2/%s", vpcId)
  39. }
  40. // distgw
  41. func vpcHostLsName(vpcId string) string {
  42. return fmt.Sprintf("vpc-h/%s", vpcId)
  43. }
  44. func vpcRhpName(vpcId string) string {
  45. return fmt.Sprintf("vpc-rh/%s", vpcId)
  46. }
  47. func vpcHrpName(vpcId string) string {
  48. return fmt.Sprintf("vpc-hr/%s", vpcId)
  49. }
  50. func vpcHostLspName(vpcId string, hostId string) string {
  51. return fmt.Sprintf("vpc-h/%s/%s", vpcId, hostId)
  52. }
  53. // eipgw
  54. func vpcEipLsName(vpcId string) string {
  55. return fmt.Sprintf("vpc-e/%s", vpcId)
  56. }
  57. func vpcRepName(vpcId string) string {
  58. return fmt.Sprintf("vpc-re/%s", vpcId)
  59. }
  60. func vpcErpName(vpcId string) string {
  61. return fmt.Sprintf("vpc-er/%s", vpcId)
  62. }
  63. func vpcEipLspName(vpcId string, eipgwId string) string {
  64. return fmt.Sprintf("vpc-ep/%s/%s", vpcId, eipgwId)
  65. }
  66. func netLsName(netId string) string {
  67. return fmt.Sprintf("subnet/%s", netId)
  68. }
  69. func netNrpName(netId string) string {
  70. return fmt.Sprintf("subnet-nr/%s", netId)
  71. }
  72. func netRnpName(netId string) string {
  73. return fmt.Sprintf("subnet-rn/%s", netId)
  74. }
  75. func netMdpName(netId string) string {
  76. return fmt.Sprintf("subnet-md/%s", netId)
  77. }
  78. // gnpName returns Logical_Switch_Port name for guestnetwork
  79. //
  80. // The name must match what's going to be set on each chassis
  81. func gnpName(netId string, ifname string) string {
  82. return fmt.Sprintf("iface-%s-%s", netId, ifname)
  83. }
  84. func vipName(netId string, groupId string, ipaddr string) string {
  85. return fmt.Sprintf("vip-%s-%s-%s", netId, groupId, ipaddr)
  86. }
  87. // lbpName returns Logical_Switch_Port name for loadbalancer
  88. //
  89. // The name must match what's going to be set on each chassis
  90. func lbpName(lbId string) string {
  91. return fmt.Sprintf("iface/lb/%s", lbId)
  92. }