diff --git a/CHANGELOG.md b/CHANGELOG.md
index 216b8ac..c201b9c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,71 +1,57 @@
-## Version 1.13.1
+## Version 1.13.2
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
Метод `ListNodes` в cloudbroker/image стал deprecated и в следующих версиях будет удалён
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
-Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/computeGetAudits и `GetAudits` в cloudbroker/compute стали deprecated и будут удалены в следующих версиях |
+Методы `ComputeCISet`, `ComputeCIUnset`, `GetAudits` в cloudbroker/computeGetAudits и `GetAudits` в cloudbroker/compute стали deprecated и будут удалены в следующих версиях
Все методы группы `.SDN()` находятся в альфа-версии.
### Добавлено
-#### account
+#### audit
| Идентификатор
задачи | Описание |
| --- | ---|
-| BGOS-686 | Поле `Policies` в структуры ответа `LimitsRG` в cloudapi/account и `Limits` в cloudbroker/account |
+| BGOS-706 | Поля `ResgroupID`, `AccountID`, `ComputeID` в структуру ответа `RecordAudit` в cloudbroker/audit |
-#### access groups
+#### compute
| Идентификатор
задачи | Описание |
| --- | --- |
-| BGOS-693 | Поле `OwnerDisplayName` в структуру запроса `ListGroupsRequest` и поле `Comment` в структуру ответа `AccessGroupItem` |
+| BGOS-703 | Опциональное поле `NetMask` в структуру запроса `NetAttachRequest` в cloudbroker/compute |
+| BGOS-704 | Поле `SepID` в структуру ответа `InfoDisk` в cloudapi/compute и cloudbroker/compute |
-#### backup
+#### kvmx86
| Идентификатор
задачи | Описание |
| --- | --- |
-| BGOS-688 | Опциональное поле `NodeID` в структуры запросов `RestoreDiskFromBackupRequest` и `RestoreDisksFromBackupRequest` в cloudbroker/backup |
+| BGOS-703 | Опциональное поле `NetMask` в структуры запросов `Interface` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
-#### node
+#### sep
| Идентификатор
задачи | Описание |
| --- | ---|
-| BGOS-691 | Поле `UsableCPUs` в структурах ответа `RecordNode` и `ItemNode` в cloudbroker/node |
+| BGOS-704 | Опциональное поле `SepIDs` в структуре запроса `ListRequest` в cloudbroker/sep |
#### storage policy
| Идентификатор
задачи | Описание |
| --- | ---|
-| BGOS-690 | Поле `SepTechStatus` в структуру `AccessSEPPool` в структуре ответа `ItemStoragePolicy` в cloudapi/stpolicy и в cloudbroker/stpolicy |
+| BGOS-708 | Поле `SepTechStatus` в структуру запроса `ListRequest` в cloudapi/stpolicy и в cloudbroker/stpolicy |
+| BGOS-710 | Обязательное поле `AccessSEPsPool` в структуру запроса `UpdateRequest` в cloudbroker/stpolicy |
-#### user
+#### trunk
| Идентификатор
задачи | Описание |
| --- | ---|
-| BGOS-692 | Поле `SortBy` в структуру запроса `GetAuditRequest` в cloudbroker/user |
+| BGOS-705 | Поле `MTU` в структуру ответа `ItemTrunk` в cloudapi/trunk и в cloudbroker/trunk |
+| BGOS-705 | Опциональное поле `MTU` в структуры запроса`CreateRequest` и `UpdateRequest` в cloudbroker/trunk |
### Изменено
-#### user
-| Идентификатор
задачи | Описание |
-| --- | ---|
-| BGOS-700 | Изменен тип поля `EmailAddress` с `[]string` на `string` в структуре запроса `CreateRequest` в cloudbroker/user |
-| BGOS-700 | Изменен тип возвращаемого значения метода `Create` с `bool` на `string` в cloudbroker/user |
-
-### Удалено
-
-#### account
-| Идентификатор
задачи | Описание |
-| --- | ---|
-| BGOS-686 | Поле `CUNP` из структуры ответа `ResourceLimits` в cloudapi/account и cloudbroker/account |
-| BGOS-686 | Поле `ExtTraffic` из структур ответа `Resource` и `LimitsRG` в cloudapi/account и `Resource` и `Limits` в cloudbroker/account |
-
-#### grid
+#### compute
| Идентификатор
задачи | Описание |
| --- | --- |
-| BGOS-686 | Поле `ExtTraffic` из структуры ответа `RecordResource` в cloudbroker/grid |
-
-#### rg
-| Идентификатор
задачи | Описание |
-| --- | ---|
-| BGOS-686 | Поле `ExtTraffic` из структур ответа `Resource` и `RecordResourceUsage` в cloudapi/rg и `Reservation` в cloudbroker/rg |
+| BGOS-707 | Поле `Value` стало обязательным в структурах запроса `AntiAffinityRuleAddRequest`, `AntiAffinityRuleRemoveRequest`, `AffinityRuleAddRequest` и `AffinityRuleRemoveRequest` в cloudapi/compute и в cloudbroker/compute |
+| BGOS-707 | Тип поля `StoragePolicyID` изменен с обязательного на опциональный в структуре запроса`CloneRequest` в cloudbroker/compute |
+| BGOS-707 | Тип поля `ComputeID` с `uint64` на `string` в структуре запроса `GetCloneStatusRequest` в cloudbroker/compute |
-#### user
+#### node
| Идентификатор
задачи | Описание |
| --- | --- |
-| BGOS-686 | Поле `ExtTraffic` из структуры ответа `Resources` в cloudapi/user |
+| BGOS-709 | Поле `VFNum` заменено на поле `FNID` в структуре `VFParam` в структуре запроса `SetVFsParamsRequest` в cloudbroker/node |
\ No newline at end of file
diff --git a/internal/validators/custom.go b/internal/validators/custom.go
index 287535d..12c255a 100644
--- a/internal/validators/custom.go
+++ b/internal/validators/custom.go
@@ -471,3 +471,10 @@ func addressPoolNetTypeValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, addressPoolNetTypeValues)
}
+
+// sepTechStatusValidator is used to validate SepTechStatus fields
+func sepTechStatusValidator(fe validator.FieldLevel) bool {
+ fieldValue := fe.Field().String()
+
+ return IsInSlice(fieldValue, sepTechStatusValues)
+}
diff --git a/internal/validators/messages.go b/internal/validators/messages.go
index 3ea36a1..7dd0fa2 100644
--- a/internal/validators/messages.go
+++ b/internal/validators/messages.go
@@ -366,6 +366,12 @@ func errorMessage(fe validator.FieldError) string {
prefix,
fe.Field(),
joinValues(ipTypeValues))
+
+ case "sepTechStatus":
+ return fmt.Sprintf("%s %s must be one of the following: %s",
+ prefix,
+ fe.Field(),
+ joinValues(sepTechStatusValues))
}
return fe.Error()
diff --git a/internal/validators/validator.go b/internal/validators/validator.go
index 330107f..e963c1e 100644
--- a/internal/validators/validator.go
+++ b/internal/validators/validator.go
@@ -311,5 +311,10 @@ func registerAllValidators(validate *validator.Validate) error {
return err
}
+ err = validate.RegisterValidation("sepTechStatus", sepTechStatusValidator)
+ if err != nil {
+ return err
+ }
+
return nil
}
diff --git a/internal/validators/values.go b/internal/validators/values.go
index ce30864..5bf829c 100644
--- a/internal/validators/values.go
+++ b/internal/validators/values.go
@@ -81,6 +81,8 @@ var (
addressPoolNetTypeValues = []string{"IPv4", "IPv6", "MAC"}
ipTypeValues = []string{"v4, v6"}
+
+ sepTechStatusValues = []string{"ENABLED", "DISABLED"}
)
const (
diff --git a/pkg/cloudapi/compute/affinity_rule_add.go b/pkg/cloudapi/compute/affinity_rule_add.go
index 1e0d08e..7d4de8a 100644
--- a/pkg/cloudapi/compute/affinity_rule_add.go
+++ b/pkg/cloudapi/compute/affinity_rule_add.go
@@ -38,9 +38,8 @@ type AffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AffinityRuleAdd add affinity rule
diff --git a/pkg/cloudapi/compute/affinity_rule_remove.go b/pkg/cloudapi/compute/affinity_rule_remove.go
index 6cf8fda..2a6f8cc 100644
--- a/pkg/cloudapi/compute/affinity_rule_remove.go
+++ b/pkg/cloudapi/compute/affinity_rule_remove.go
@@ -38,9 +38,8 @@ type AffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AffinityRuleRemove remove affinity rule
diff --git a/pkg/cloudapi/compute/anti_affinity_rule_add.go b/pkg/cloudapi/compute/anti_affinity_rule_add.go
index 9b817a7..0b46a2c 100644
--- a/pkg/cloudapi/compute/anti_affinity_rule_add.go
+++ b/pkg/cloudapi/compute/anti_affinity_rule_add.go
@@ -38,9 +38,8 @@ type AntiAffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AntiAffinityRuleAdd add anti affinity rule
diff --git a/pkg/cloudapi/compute/anti_affinity_rule_remove.go b/pkg/cloudapi/compute/anti_affinity_rule_remove.go
index 1c0adf1..71a103e 100644
--- a/pkg/cloudapi/compute/anti_affinity_rule_remove.go
+++ b/pkg/cloudapi/compute/anti_affinity_rule_remove.go
@@ -38,9 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AntiAffinityRuleRemove remove anti affinity rule
diff --git a/pkg/cloudapi/compute/models.go b/pkg/cloudapi/compute/models.go
index 6b1b5b5..c029268 100644
--- a/pkg/cloudapi/compute/models.go
+++ b/pkg/cloudapi/compute/models.go
@@ -1237,6 +1237,9 @@ type ListInfoDisks []InfoDisk
type InfoDisk struct {
// ID
ID uint64 `json:"id"`
+
+ // SEP ID
+ SepID int64 `json:"sepId"`
}
// List information about computes
diff --git a/pkg/cloudapi/kvmx86/create.go b/pkg/cloudapi/kvmx86/create.go
index 7da150b..02ed108 100644
--- a/pkg/cloudapi/kvmx86/create.go
+++ b/pkg/cloudapi/kvmx86/create.go
@@ -35,6 +35,11 @@ type Interface struct {
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
+ // Net mask
+ // Used only to DPDK or VFNIC net type
+ // Required: false
+ NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
+
// MAC address to assign to this VM when connecting to the specified network
// Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"`
diff --git a/pkg/cloudapi/stpolicy/list.go b/pkg/cloudapi/stpolicy/list.go
index a7ff931..3cb8c77 100644
--- a/pkg/cloudapi/stpolicy/list.go
+++ b/pkg/cloudapi/stpolicy/list.go
@@ -56,6 +56,10 @@ type ListRequest struct {
// Search by pool name
// Required: false
PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"`
+
+ // Filter SEP's by tech status (ENABLED, DISABLED)
+ // Required: false
+ SepTechStatus string `url:"sep_tech_status,omitempty" json:"sep_tech_status,omitempty" validate:"omitempty,sepTechStatus"`
}
// List gets list of storage policies as a ListStoragePolicies struct
diff --git a/pkg/cloudapi/trunk/models.go b/pkg/cloudapi/trunk/models.go
index de7742a..cc42a96 100644
--- a/pkg/cloudapi/trunk/models.go
+++ b/pkg/cloudapi/trunk/models.go
@@ -29,6 +29,9 @@ type ItemTrunk struct {
// MAC
MAC string `json:"mac"`
+ // MTU
+ MTU uint64 `json:"mtu"`
+
// Name of a trunk
Name string `json:"name"`
diff --git a/pkg/cloudbroker/audit/models.go b/pkg/cloudbroker/audit/models.go
index a8bffe2..f232bf5 100644
--- a/pkg/cloudbroker/audit/models.go
+++ b/pkg/cloudbroker/audit/models.go
@@ -95,6 +95,15 @@ type RecordAudit struct {
// TTL
TTL string `json:"_ttl"`
+
+ // Resgroup ID
+ ResgroupID uint64 `json:"resgroup_id"`
+
+ // Account ID
+ AccountID uint64 `json:"account_id"`
+
+ // Compute ID
+ ComputeID uint64 `json:"compute_id"`
}
// List of Linked Jobs
diff --git a/pkg/cloudbroker/compute/affinity_rule_add.go b/pkg/cloudbroker/compute/affinity_rule_add.go
index 78f2402..0addc87 100644
--- a/pkg/cloudbroker/compute/affinity_rule_add.go
+++ b/pkg/cloudbroker/compute/affinity_rule_add.go
@@ -40,9 +40,8 @@ type AffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AffinityRuleAdd adds affinity rule
diff --git a/pkg/cloudbroker/compute/affinity_rule_remove.go b/pkg/cloudbroker/compute/affinity_rule_remove.go
index 7f5057a..5d136db 100644
--- a/pkg/cloudbroker/compute/affinity_rule_remove.go
+++ b/pkg/cloudbroker/compute/affinity_rule_remove.go
@@ -38,9 +38,8 @@ type AffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AffinityRuleRemove remove affinity rule
diff --git a/pkg/cloudbroker/compute/anti_affinity_rule_add.go b/pkg/cloudbroker/compute/anti_affinity_rule_add.go
index b73b7de..d9007b7 100644
--- a/pkg/cloudbroker/compute/anti_affinity_rule_add.go
+++ b/pkg/cloudbroker/compute/anti_affinity_rule_add.go
@@ -38,9 +38,8 @@ type AntiAffinityRuleAddRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AntiAffinityRuleAdd adds anti affinity rule
diff --git a/pkg/cloudbroker/compute/anti_affinity_rule_remove.go b/pkg/cloudbroker/compute/anti_affinity_rule_remove.go
index 7589a78..c4decb0 100644
--- a/pkg/cloudbroker/compute/anti_affinity_rule_remove.go
+++ b/pkg/cloudbroker/compute/anti_affinity_rule_remove.go
@@ -38,9 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
Key string `url:"key" json:"key" validate:"required"`
// Value that must match the key to be taken into account when analyzing this rule
- // Required: false
- // Not required on purpose: despite required tag on platform, empty string is allowed
- Value string `url:"value" json:"value"`
+ // Required: true
+ Value string `url:"value" json:"value" validate:"required"`
}
// AntiAffinityRuleRemove removes anti affinity rule
diff --git a/pkg/cloudbroker/compute/clone.go b/pkg/cloudbroker/compute/clone.go
index bb10ae2..e2a0dcf 100644
--- a/pkg/cloudbroker/compute/clone.go
+++ b/pkg/cloudbroker/compute/clone.go
@@ -19,8 +19,8 @@ type CloneRequest struct {
Name string `url:"name" json:"name" validate:"required"`
// ID of the Storage Policy
- // Required: true
- StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
+ // Required: false
+ StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id"`
// Timestamp of the parent's snapshot to create clone from
// Required: false
diff --git a/pkg/cloudbroker/compute/clone_status.go b/pkg/cloudbroker/compute/clone_status.go
index 296d011..9b24a80 100644
--- a/pkg/cloudbroker/compute/clone_status.go
+++ b/pkg/cloudbroker/compute/clone_status.go
@@ -12,7 +12,7 @@ import (
type GetCloneStatusRequest struct {
// ID of compute instance
// Required: true
- ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
+ ComputeID string `url:"compute_id" json:"compute_id" validate:"required"`
}
// GetCloneStatus gets information about compute clone status as a RecordCloneStatus struct
diff --git a/pkg/cloudbroker/compute/models.go b/pkg/cloudbroker/compute/models.go
index d7395a8..76b9ff4 100644
--- a/pkg/cloudbroker/compute/models.go
+++ b/pkg/cloudbroker/compute/models.go
@@ -841,7 +841,7 @@ type InfoCompute struct {
SnapSets ListSnapshots `json:"snapSets"`
// Node ID
- NodeID uint64 `json:"nodeId"`
+ NodeID uint64 `json:"node_id"`
// Node name
NodeName string `json:"nodeName"`
@@ -1171,6 +1171,9 @@ type RecordCompute struct {
// Zone ID
ZoneID uint64 `json:"zoneId"`
+
+ //todo
+ _ uint64 `json:"nodeId"`
}
type LoaderMetaIso struct {
@@ -1280,6 +1283,9 @@ type ItemDeletedCompute struct {
type InfoDisk struct {
// ID
ID uint64 `json:"id"`
+
+ // SEP ID
+ SepID int64 `json:"sepId"`
}
// List computes
diff --git a/pkg/cloudbroker/compute/net_attach.go b/pkg/cloudbroker/compute/net_attach.go
index ae6529e..b8797e6 100644
--- a/pkg/cloudbroker/compute/net_attach.go
+++ b/pkg/cloudbroker/compute/net_attach.go
@@ -45,6 +45,11 @@ type NetAttachRequest struct {
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
+ // Net mask
+ // Used only to DPDK or VFNIC net type
+ // Required: false
+ NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
+
// Unique identifier of logical port on SDN side
// Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty" validate:"omitempty"`
diff --git a/pkg/cloudbroker/compute/start.go b/pkg/cloudbroker/compute/start.go
index c495428..804a79d 100644
--- a/pkg/cloudbroker/compute/start.go
+++ b/pkg/cloudbroker/compute/start.go
@@ -20,7 +20,7 @@ type StartRequest struct {
// ID of node to start compute
// Required: false
- NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
+ NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
}
// Start starts compute
diff --git a/pkg/cloudbroker/kvmx86/create.go b/pkg/cloudbroker/kvmx86/create.go
index 450ef9e..7da961f 100644
--- a/pkg/cloudbroker/kvmx86/create.go
+++ b/pkg/cloudbroker/kvmx86/create.go
@@ -37,6 +37,11 @@ type Interface struct {
// Required: false
MAC string `url:"mac,omitempty" json:"mac,omitempty" validate:"omitempty"`
+ // Net mask
+ // Used only to DPDK or VFNIC net type
+ // Required: false
+ NetMask uint64 `url:"netMask,omitempty" json:"netMask,omitempty"`
+
// SDN interface id
// Required: false
SDNInterfaceID string `url:"sdn_interface_id,omitempty" json:"sdn_interface_id,omitempty"`
diff --git a/pkg/cloudbroker/node/set_vfs_params.go b/pkg/cloudbroker/node/set_vfs_params.go
index 47812bc..c05728c 100644
--- a/pkg/cloudbroker/node/set_vfs_params.go
+++ b/pkg/cloudbroker/node/set_vfs_params.go
@@ -5,13 +5,14 @@ import (
"net/http"
"strconv"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
type VFParam struct {
- // Number of VF to assign
+ // ID of the FN
// Required: true
- VFNum uint64 `url:"vfNum" json:"vfNum" validate:"required"`
+ FNID uint64 `url:"fnId" json:"fnId" validate:"required"`
// Trust
// Required: true
@@ -46,7 +47,7 @@ func (n Node) SetVFsParams(ctx context.Context, req SetVFsParamsRequest) (bool,
url := "/cloudbroker/node/setVFsParams"
- res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ res, err := n.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
diff --git a/pkg/cloudbroker/sep/list.go b/pkg/cloudbroker/sep/list.go
index 4b87c2b..f0bca41 100644
--- a/pkg/cloudbroker/sep/list.go
+++ b/pkg/cloudbroker/sep/list.go
@@ -42,6 +42,9 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
+ // Sort by SEP IDs
+ SepIDs []uint64 `url:"sep_ids,omitempty" json:"sep_ids,omitempty"`
+
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
diff --git a/pkg/cloudbroker/stpolicy/list.go b/pkg/cloudbroker/stpolicy/list.go
index 0ced471..112aaba 100644
--- a/pkg/cloudbroker/stpolicy/list.go
+++ b/pkg/cloudbroker/stpolicy/list.go
@@ -56,6 +56,10 @@ type ListRequest struct {
// Search by pool name
// Required: false
PoolName string `url:"pool_name,omitempty" json:"pool_name,omitempty"`
+
+ // Filter SEP's by tech status (ENABLED, DISABLED)
+ // Required: false
+ SepTechStatus string `url:"sep_tech_status,omitempty" json:"sep_tech_status,omitempty" validate:"omitempty,sepTechStatus"`
}
// List gets list of storage policies as a ListStoragePolicies struct
diff --git a/pkg/cloudbroker/stpolicy/update.go b/pkg/cloudbroker/stpolicy/update.go
index 7494a77..392e1af 100644
--- a/pkg/cloudbroker/stpolicy/update.go
+++ b/pkg/cloudbroker/stpolicy/update.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -13,6 +14,10 @@ type UpdateRequest struct {
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
+ // List of storage endpoint access objects
+ // Required: true
+ AccessSEPsPools []AccessSEPsPool `url:"access_seps_pools" json:"access_seps_pools" validate:"required"`
+
// New name for the storage policy
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
@@ -51,6 +56,6 @@ func (sp StPolicy) UpdateRaw(ctx context.Context, req UpdateRequest) ([]byte, er
url := "/cloudbroker/storage_policy/update"
- res, err := sp.client.DecortApiCall(ctx, http.MethodPost, url, req)
+ res, err := sp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
return res, err
}
diff --git a/pkg/cloudbroker/trunk/create.go b/pkg/cloudbroker/trunk/create.go
index 4985187..95413b1 100644
--- a/pkg/cloudbroker/trunk/create.go
+++ b/pkg/cloudbroker/trunk/create.go
@@ -33,6 +33,11 @@ type CreateRequest struct {
// Native VLAN ID
// Required: false
NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"`
+
+ // MTU
+ // Default value: 1500
+ // Required: false
+ MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
}
// Create creates a user.
diff --git a/pkg/cloudbroker/trunk/models.go b/pkg/cloudbroker/trunk/models.go
index de7742a..cc42a96 100644
--- a/pkg/cloudbroker/trunk/models.go
+++ b/pkg/cloudbroker/trunk/models.go
@@ -29,6 +29,9 @@ type ItemTrunk struct {
// MAC
MAC string `json:"mac"`
+ // MTU
+ MTU uint64 `json:"mtu"`
+
// Name of a trunk
Name string `json:"name"`
diff --git a/pkg/cloudbroker/trunk/update.go b/pkg/cloudbroker/trunk/update.go
index 8258971..1d060ea 100644
--- a/pkg/cloudbroker/trunk/update.go
+++ b/pkg/cloudbroker/trunk/update.go
@@ -29,6 +29,11 @@ type UpdateRequest struct {
// New native VLAN ID
// Required: false
NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"`
+
+ // MTU
+ // Default value: 1500
+ // Required: false
+ MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
}
// Update updates a trunk
diff --git a/tests/platform_upgrade/README.md b/tests/platform_upgrade/README.md
index 6154d2e..a09d493 100644
--- a/tests/platform_upgrade/README.md
+++ b/tests/platform_upgrade/README.md
@@ -8,9 +8,11 @@
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
- [Cloudapi](#cloudapi)
- [Cloudbroker](#cloudbroker)
+ - [SDN](#sdn)
- [Тесты запросов](#тесты-запросов)
- [Cloudapi](#cloudapi-1)
- [Cloudbroker](#cloudbroker-1)
+ - [SDN](#sdn-1)
- [Тесты API методов](#тесты-api-методов)
## Подготовка к тестам
@@ -46,6 +48,13 @@
Запустить тест `TestGetListCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
+### SDN
+
+Запустить тест `TestGetListSDNAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
+При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
+
+Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
+
## Тесты запросов
### Cloudapi
@@ -89,6 +98,13 @@ FAIL
FAIL
```
+### SDN
+
+Запустить тест `TestRequestsSDN` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
+При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
+
+Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
+
## Тесты API методов
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
diff --git a/tests/platform_upgrade/request_map.go b/tests/platform_upgrade/request_map.go
index aafd93d..1b3c06e 100644
--- a/tests/platform_upgrade/request_map.go
+++ b/tests/platform_upgrade/request_map.go
@@ -135,7 +135,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/bservice/snapshotRollback": bservice.SnapshotRollbackRequest{},
"/restmachine/cloudapi/bservice/start": bservice.StartRequest{},
"/restmachine/cloudapi/bservice/stop": bservice.StopRequest{},
-
+ "/restmachine/cloudapi/bservice/migrateToZone": bservice.MigrateToZoneRequest{},
// compute
"/restmachine/cloudapi/compute/abort_shared_snapshot_merge": compute.AbortSharedSnapshotMergeRequest{},
"/restmachine/cloudapi/compute/shared_snapshot_merge_status": compute.SharedSnapshotMergeStatusRequest{},
@@ -194,7 +194,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/pfwDel": compute.PFWDelRequest{},
"/restmachine/cloudapi/compute/pfwList": compute.PFWListRequest{},
"/restmachine/cloudapi/compute/pause": compute.PauseRequest{},
- "/restmachine/cloudapi/compute/pinToNode": compute.PinToNodeRequest{},
+ "/restmachine/cloudapi/compute/pin_to_node": compute.PinToNodeRequest{},
"/restmachine/cloudapi/compute/powerCycle": compute.PowerCycleRequest{},
"/restmachine/cloudapi/compute/reboot": compute.RebootRequest{},
"/restmachine/cloudapi/compute/redeploy": compute.RedeployRequest{},
@@ -212,7 +212,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/stop": compute.StopRequest{},
"/restmachine/cloudapi/compute/tagAdd": compute.TagAddRequest{},
"/restmachine/cloudapi/compute/tagRemove": compute.TagRemoveRequest{},
- "/restmachine/cloudapi/compute/unpinFromNode": compute.UnpinFromNodeRequest{},
+ "/restmachine/cloudapi/compute/unpin_from_node": compute.UnpinFromNodeRequest{},
"/restmachine/cloudapi/compute/update": compute.UpdateRequest{},
"/restmachine/cloudapi/compute/userGrant": compute.UserGrantRequest{},
"/restmachine/cloudapi/compute/userList": compute.UserListRequest{},
@@ -225,6 +225,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/compute/guest_agent_execute": compute.GuestAgentExecuteRequest{},
"/restmachine/cloudapi/compute/guest_agent_feature_get": compute.GuestAgentFeatureGetRequest{},
"/restmachine/cloudapi/compute/guest_agent_feature_update": compute.GuestAgentFeatureUpdateRequest{},
+ "/restmachine/cloudapi/compute/migrateToZone": compute.MigrateToZoneRequest{},
// disks
"/restmachine/cloudapi/disks/change_disk_storage_policy": disks.ChangeDiskStoragePolicyRequest{},
@@ -314,6 +315,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/k8s/workersGroupGetByName": k8s.WorkersGroupGetByNameRequest{},
"/restmachine/cloudapi/k8s/workerReset": k8s.WorkerResetRequest{},
"/restmachine/cloudapi/k8s/workerRestart": k8s.WorkerRestartRequest{},
+ "/restmachine/cloudapi/k8s/migrateToZone": k8s.MigrateToZoneRequest{},
// kvmx86
"/restmachine/cloudapi/kvmx86/create": kvmx86.CreateRequest{},
@@ -346,6 +348,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/lb/stop": lb.StopRequest{},
"/restmachine/cloudapi/lb/update": lb.UpdateRequest{},
"/restmachine/cloudapi/lb/updateSysctlParams": lb.UpdateSysctParamsRequest{},
+ "/restmachine/cloudapi/lb/migrateToZone": lb.MigrateToZoneRequest{},
// locations
"/restmachine/cloudapi/locations/getUrl": EmptyStruct{},
@@ -465,6 +468,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
"/restmachine/cloudapi/vins/staticRouteList": vins.StaticRouteListRequest{},
"/restmachine/cloudapi/vins/vnfdevRedeploy": vins.VNFDevRedeployRequest{},
"/restmachine/cloudapi/vins/vnfdevRestart": vins.VNFDevRestartRequest{},
+ "/restmachine/cloudapi/vins/migrateToZone": vins.MigrateToZoneRequest{},
// zone
"/restmachine/cloudapi/zone/get": zone.GetRequest{},
@@ -508,6 +512,8 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/account/updateComputeFeatures": account_cb.UpdateComputeFeaturesRequest{},
"/restmachine/cloudbroker/account/updateResourceTypes": account_cb.UpdateResourceTypesRequest{},
"/restmachine/cloudbroker/account/updateUser": account_cb.UpdateUserRequest{},
+ "/restmachine/cloudbroker/account/addZone": account_cb.AddZoneRequest{},
+ "/restmachine/cloudbroker/account/removeZone": account_cb.RemoveZoneRequest{},
// apiaccess_cb
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
@@ -650,6 +656,10 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/compute/guest_agent_feature_get": compute_cb.GuestAgentFeatureGetRequest{},
"/restmachine/cloudbroker/compute/guest_agent_feature_update": compute_cb.GuestAgentFeatureUpdateRequest{},
"/restmachine/cloudbroker/compute/change_read_only": compute_cb.ChangeReadOnlyRequest{},
+ "/restmachine/cloudbroker/compute/migrateToZone": compute_cb.MigrateToZoneRequest{},
+ "/restmachine/cloudbroker/compute/migrate_abort": compute_cb.MigrateAbortRequest{},
+ "/restmachine/cloudbroker/compute/start_migration_out": compute_cb.StartMigrationOutRequest{},
+ "/restmachine/cloudbroker/compute/stop_migration_out": compute_cb.StopMigrationOutRequest{},
// disks
"/restmachine/cloudbroker/disks/change_disk_storage_policy": disks_cb.ChangeDiskStoragePolicyRequest{},
@@ -726,6 +736,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/extnet/staticRouteDel": extnet_cb.StaticRouteDelRequest{},
"/restmachine/cloudbroker/extnet/staticRouteList": extnet_cb.StaticRouteListRequest{},
"/restmachine/cloudbroker/extnet/update": extnet_cb.UpdateRequest{},
+ "/restmachine/cloudbroker/extnet/migrateToZone": extnet_cb.MigrateToZoneRequest{},
// flipgroup
"/restmachine/cloudbroker/flipgroup/computeAdd": flipgroup_cb.ComputeAddRequest{},
@@ -824,6 +835,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/k8s/workersGroupGetByName": k8s_cb.WorkersGroupGetByNameRequest{},
"/restmachine/cloudbroker/k8s/workerReset": k8s_cb.WorkerResetRequest{},
"/restmachine/cloudbroker/k8s/workerRestart": k8s_cb.WorkerRestartRequest{},
+ "/restmachine/cloudbroker/k8s/migrateToZone": k8s_cb.MigrateToZoneRequest{},
// kvmx86
"/restmachine/cloudbroker/kvmx86/create": kvmx86_cb.CreateRequest{},
@@ -857,6 +869,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/lb/stop": lb_cb.StopRequest{},
"/restmachine/cloudbroker/lb/update": lb_cb.UpdateRequest{},
"/restmachine/cloudbroker/lb/updateSysctlParams": lb_cb.UpdateSysctParamsRequest{},
+ "/restmachine/cloudbroker/lb/migrateToZone": lb_cb.MigrateToZoneRequest{},
// node
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
@@ -976,6 +989,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/sep/sharedLockStop": sep_cb.SharedLockStopRequest{},
"/restmachine/cloudbroker/sep/listAvailableSepAndPools": sep_cb.ListAvailableSEPAndPoolsRequest{},
"/restmachine/cloudbroker/sep/sharedLockStart": sep_cb.SharedLockStartRequest{},
+ "/restmachine/cloudbroker/sep/getTemplate": sep_cb.GetTemplateRequest{},
// storage_policy
"/restmachine/cloudbroker/storage_policy/get": stpolicy_cb.GetRequest{},
@@ -1074,6 +1088,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/vins/vnfdevReset": vins_cb.VNFDevResetRequest{},
"/restmachine/cloudbroker/vins/vnfdevStart": vins_cb.VNFDevStartRequest{},
"/restmachine/cloudbroker/vins/vnfdevStop": vins_cb.VNFDevStopRequest{},
+ "/restmachine/cloudbroker/vins/migrateToZone": vins_cb.MigrateToZoneRequest{},
// zone
"/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
diff --git a/tests/platform_upgrade/utils_requests.go b/tests/platform_upgrade/utils_requests.go
index 72cf31a..6367aac 100644
--- a/tests/platform_upgrade/utils_requests.go
+++ b/tests/platform_upgrade/utils_requests.go
@@ -33,57 +33,101 @@ func getParameters(input map[string]interface{}) []interface{} {
return emptySlice
}
- params, ok := parameters["parameters"]
- if !ok {
- return emptySlice
- }
+ var result []interface{}
- res, ok := params.([]interface{})
- if !ok {
- return emptySlice
- }
- // Check if there's a body parameter
- for _, p := range res {
- param, ok := p.(map[string]interface{})
- if !ok {
- continue
- }
- if param["name"] == "body" {
- schema, ok := param["schema"].(map[string]interface{})
- if !ok {
- continue
+ //Check for requestBody
+ if requestBody, ok := parameters["requestBody"].(map[string]interface{}); ok {
+ if content, ok := requestBody["content"].(map[string]interface{}); ok {
+ // Check for application/x-www-form-urlencoded, application/json, or multipart/form-data
+ var schemaData map[string]interface{}
+ var found bool
+
+ if formData, ok := content["application/x-www-form-urlencoded"].(map[string]interface{}); ok {
+ if schema, ok := formData["schema"].(map[string]interface{}); ok {
+ schemaData = schema
+ found = true
+ }
+ } else if jsonData, ok := content["application/json"].(map[string]interface{}); ok {
+ if schema, ok := jsonData["schema"].(map[string]interface{}); ok {
+ schemaData = schema
+ found = true
+ }
+ } else if multipartData, ok := content["multipart/form-data"].(map[string]interface{}); ok {
+ if schema, ok := multipartData["schema"].(map[string]interface{}); ok {
+ schemaData = schema
+ found = true
+ }
+ }
+
+ if found && schemaData != nil {
+ if properties, ok := schemaData["properties"].(map[string]interface{}); ok {
+ requiredFields := make(map[string]bool)
+ if req, ok := schemaData["required"].([]interface{}); ok {
+ for _, r := range req {
+ if reqStr, ok := r.(string); ok {
+ requiredFields[reqStr] = true
+ }
+ }
+ }
+ for name, prop := range properties {
+ propMap, ok := prop.(map[string]interface{})
+ if !ok {
+ continue
+ }
+ newParam := make(map[string]interface{})
+ newParam["name"] = name
+ if propType, ok := propMap["type"].(string); ok {
+ newParam["type"] = propType
+ }
+ newParam["required"] = requiredFields[name]
+ if propType, ok := propMap["type"].(string); ok && propType == "array" {
+ if items, ok := propMap["items"].(map[string]interface{}); ok {
+ newParam["items"] = items
+ }
+ }
+ result = append(result, newParam)
+ }
+ }
}
- properties, ok := schema["properties"].(map[string]interface{})
+ }
+ }
+
+ if params, ok := parameters["parameters"].([]interface{}); ok {
+ for _, p := range params {
+ param, ok := p.(map[string]interface{})
if !ok {
continue
}
- requiredFields := make(map[string]bool)
- if req, ok := schema["required"].([]interface{}); ok {
- for _, r := range req {
- requiredFields[r.(string)] = true
- }
+
+ newParam := make(map[string]interface{})
+ if name, ok := param["name"].(string); ok {
+ newParam["name"] = name
}
- var newParams []interface{}
- for name, prop := range properties {
- propMap, ok := prop.(map[string]interface{})
- if !ok {
- continue
+ if schema, ok := param["schema"].(map[string]interface{}); ok {
+ if paramType, ok := schema["type"].(string); ok {
+ newParam["type"] = paramType
}
- newParam := make(map[string]interface{})
- newParam["name"] = name
- newParam["type"] = propMap["type"]
- newParam["required"] = requiredFields[name]
- if propMap["type"] == "array" {
- if items, ok := propMap["items"].(map[string]interface{}); ok {
+ if paramType, ok := schema["type"].(string); ok && paramType == "array" {
+ if items, ok := schema["items"].(map[string]interface{}); ok {
newParam["items"] = items
}
}
- newParams = append(newParams, newParam)
}
- return newParams
+ // Handle required field
+ if required, ok := param["required"].(bool); ok {
+ newParam["required"] = required
+ } else {
+ newParam["required"] = false
+ }
+ result = append(result, newParam)
}
}
- return res
+
+ if len(result) > 0 {
+ return result
+ }
+
+ return emptySlice
}
func getBytesFromJSON(fileName string, t *testing.T) []byte {
diff --git a/tests/platform_upgrade/utils_urls.go b/tests/platform_upgrade/utils_urls.go
index 4353bec..c92f633 100644
--- a/tests/platform_upgrade/utils_urls.go
+++ b/tests/platform_upgrade/utils_urls.go
@@ -48,6 +48,7 @@ var DEPRECATED_GROUPS = []string{
"/cloudbroker/vins/staticRouteAccessGrant",
"/cloudbroker/vins/staticRouteAccessRevoke",
"/restmachine/cloudbroker/image/updateNodes",
+ "/restmachine/cloudbroker/image/uploadImageFile",
}
// getUrlsFromBytes converts bytes to array of urls strings