Skip to content

Commit

Permalink
Add Subnet handing id generated by CSP to vNet info
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored May 22, 2024
2 parents ca7f202 + 31920b7 commit c941b8e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10139,6 +10139,9 @@ const docTemplate = `{
"id": {
"type": "string"
},
"idFromCsp": {
"type": "string"
},
"ipv4_CIDR": {
"type": "string"
},
Expand All @@ -10163,6 +10166,9 @@ const docTemplate = `{
"description": {
"type": "string"
},
"idFromCsp": {
"type": "string"
},
"ipv4_CIDR": {
"type": "string"
},
Expand Down
6 changes: 6 additions & 0 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10132,6 +10132,9 @@
"id": {
"type": "string"
},
"idFromCsp": {
"type": "string"
},
"ipv4_CIDR": {
"type": "string"
},
Expand All @@ -10156,6 +10159,9 @@
"description": {
"type": "string"
},
"idFromCsp": {
"type": "string"
},
"ipv4_CIDR": {
"type": "string"
},
Expand Down
4 changes: 4 additions & 0 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,8 @@ definitions:
type: string
id:
type: string
idFromCsp:
type: string
ipv4_CIDR:
type: string
keyValueList:
Expand All @@ -1067,6 +1069,8 @@ definitions:
properties:
description:
type: string
idFromCsp:
type: string
ipv4_CIDR:
type: string
keyValueList:
Expand Down
1 change: 1 addition & 0 deletions src/core/mcir/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func CreateSubnet(nsId string, vNetId string, req TbSubnetReq, objectOnly bool)
}
tbSubnetInfo.Id = req.Name
tbSubnetInfo.Name = req.Name
tbSubnetInfo.IdFromCsp = req.IdFromCsp

newVNet.SubnetInfoList = append(newVNet.SubnetInfoList, tbSubnetInfo)
Val, _ = json.Marshal(newVNet)
Expand Down
3 changes: 3 additions & 0 deletions src/core/mcir/vnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type TbVNetInfo struct { // Tumblebug
// TbSubnetReq is a struct that represents TB subnet object.
type TbSubnetReq struct { // Tumblebug
Name string `validate:"required"`
IdFromCsp string
IPv4_CIDR string `validate:"required"`
KeyValueList []common.KeyValue
Description string
Expand All @@ -137,6 +138,7 @@ func TbSubnetReqStructLevelValidation(sl validator.StructLevel) {
type TbSubnetInfo struct { // Tumblebug
Id string
Name string `validate:"required"`
IdFromCsp string
IPv4_CIDR string `validate:"required"`
BastionNodes []BastionNode
KeyValueList []common.KeyValue
Expand Down Expand Up @@ -274,6 +276,7 @@ func CreateVNet(nsId string, u *TbVNetReq, option string) (TbVNetInfo, error) {
log.Error().Err(err).Msg("")
}
tbSubnetReq.Name = v.IId.NameId
tbSubnetReq.IdFromCsp = v.IId.SystemId

_, err = CreateSubnet(nsId, content.Id, tbSubnetReq, true)
if err != nil {
Expand Down

0 comments on commit c941b8e

Please sign in to comment.