This commit is contained in:
asteam
2025-07-15 17:39:18 +03:00
parent 1f8637400f
commit 7dacf35cd6
163 changed files with 4322 additions and 504 deletions

View File

@@ -47,6 +47,11 @@ type CreateRequest struct {
// Required: false
DNS []string `url:"dns,omitempty" json:"dns,omitempty"`
// Maximum transmission unit
// Default: 1500
// Required: false
MTU uint `url:"mtu,omitempty" json:"mtu,omitempty"`
// List of NTP addresses
// Required: false
NTP []string `url:"ntp,omitempty" json:"ntp,omitempty"`
@@ -71,9 +76,13 @@ type CreateRequest struct {
// Required: false
EndIP string `url:"endIP,omitempty" json:"endIP,omitempty"`
// IP to create VNFDev with
// IP to create primary vnfdev with
// Required: false
VNFDevIP string `url:"vnfdevIP,omitempty" json:"vnfdevIP,omitempty"`
PriVNFDevIP string `url:"priVnfdevIP,omitempty" json:"priVnfdevIP,omitempty"`
// IP to create secondary vnfdev with
// Required: false
SecVNFDevIP string `url:"secVnfdevIP,omitempty" json:"secVnfdevIP,omitempty"`
// Number of pre created reservations
// Required: false
@@ -86,6 +95,15 @@ type CreateRequest struct {
// List of static routes, each item must have destination, netmask, and gateway fields
// Required: false
Routes []Route `url:"-" json:"routes,omitempty" validate:"omitempty,dive"`
// Zone ID
// Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// High Availability mode is enabled, default False
// Required: false
// Default: false
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
}
type wrapperCreateRequest struct {

View File

@@ -17,6 +17,11 @@ type DeviceMigrateRequest struct {
// Target stack ID to migrate to
// Required: false
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
// Target device to migrate
// Required: false
// Default: primary
Device string `url:"device,omitempty" json:"device,omitempty" validate:"omitempty,device"`
}
// DeviceMigrate migrates external network VNF device

View File

@@ -18,7 +18,7 @@ var extnets = ListExtNet{
IPCIDR: "176.118.164.0/24",
Milestones: 1355466,
Name: "176.118.164.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,
@@ -41,7 +41,7 @@ var extnets = ListExtNet{
IPCIDR: "45.134.255.0/24",
Milestones: 2135543,
Name: "45.134.255.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,
@@ -64,7 +64,7 @@ var extnets = ListExtNet{
IPCIDR: "88.218.249.0/24",
Milestones: 1232134,
Name: "88.218.249.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,

View File

@@ -0,0 +1,42 @@
package extnet
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// MigrateToZone struct to move extnet to another zone
type MigrateToZoneRequest struct {
// ID of external network
// Required: true
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
// ID of the zone to move
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}
// MoveToZone moves extnet to new zone
func (e ExtNet) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/migrateToZone"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -91,11 +91,14 @@ type ItemExtNet struct {
// Milestones
Milestones uint64 `json:"milestones"`
// MTU
MTU uint64 `json:"mtu"`
// Name
Name string `json:"name"`
// Network ID
NetworkID uint64 `json:"networkId"`
// Network IDs
NetworkIDs NetworkIDs `json:"networkIds"`
// OVSBridge
OVSBridge string `json:"ovsBridge"`
@@ -106,6 +109,12 @@ type ItemExtNet struct {
// PriVNFDevID
PriVNFDevID uint64 `json:"priVnfDevId"`
// Redundant
Redundant bool `json:"redundant"`
// SecVnfDevId
SecVNFDevID uint64 `json:"secVnfDevId"`
// List of shared with
SharedWith []interface{} `json:"sharedWith"`
@@ -117,6 +126,9 @@ type ItemExtNet struct {
// VNFs
VNFs VNFs `json:"vnfs"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
// List external networks
@@ -175,14 +187,17 @@ type RecordExtNet struct {
// Milestones
Milestones uint64 `json:"milestones"`
// MTU
MTU uint64 `json:"mtu"`
// Name
Name string `json:"name"`
// Network
Network string `json:"network"`
// Network ID
NetworkID uint64 `json:"networkId"`
// Network IDs
NetworkIDs NetworkIDs `json:"networkIds"`
// NTP
NTP []string `json:"ntp"`
@@ -199,9 +214,18 @@ type RecordExtNet struct {
// PriVNFDevID
PriVNFDevID uint64 `json:"priVnfDevId"`
// Redundant
Redundant bool `json:"redundant"`
// SecVnfDevId
SecVNFDevID uint64 `json:"secVnfDevId"`
// List reservations
Reservations ListReservations `json:"reservations"`
// List pre-reservations
PreReservations ListReservations `json:"pre-reservations"`
// List of shared with
SharedWith []interface{} `json:"sharedWith"`
@@ -213,6 +237,17 @@ type RecordExtNet struct {
// VNFs
VNFs VNFs `json:"vnfs"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
type NetworkIDs struct {
// Primary
Primary uint64 `json:"primary"`
// Secondary
Secondary uint64 `json:"secondary"`
}
// List of static routes

View File

@@ -0,0 +1,42 @@
package extnet
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// SetHAModeRequest struct to set HA mode for external network
type SetHAModeRequest struct {
// ID of external network
// Required: true
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
// HA Mode
// Required: true
HAMode bool `url:"highly_available" json:"highly_available" validate:"required"`
}
// SetHAMode set HA mode for external network
func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/set_highly_available"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -21,6 +21,11 @@ type UpdateRequest struct {
// New external network description
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
// Maximum transmission unit
// Default: 1500
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
}
// Update updates external network parameters