[management] Add support for disabling resources and routing peers in networks (#3154)

* sync openapi changes

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add option to disable network resource(s)

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add network resource enabled state from api

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* add option to disable network router(s)

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* fix tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* Add tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

* migrate old network resources and routers

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>

---------

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
Bethuel Mmbaga
2025-01-08 19:35:57 +03:00
committed by GitHub
parent 9e6e34b42d
commit 409003b4f9
13 changed files with 188 additions and 14 deletions

View File

@@ -800,15 +800,18 @@ components:
items:
type: string
example: "ch8i4ug6lnn4g9hqv797"
sourceResource:
description: Policy rule source resource that the rule is applied to
$ref: '#/components/schemas/Resource'
destinations:
description: Policy rule destination group IDs
type: array
items:
type: string
example: "ch8i4ug6lnn4g9h7v7m0"
required:
- sources
- destinations
destinationResource:
description: Policy rule destination resource that the rule is applied to
$ref: '#/components/schemas/Resource'
PolicyRuleCreate:
allOf:
@@ -1325,9 +1328,14 @@ components:
description: Network resource address (either a direct host like 1.1.1.1 or 1.1.1.1/32, or a subnet like 192.168.178.0/24, or domains like example.com and *.example.com)
type: string
example: "1.1.1.1"
enabled:
description: Network resource status
type: boolean
example: true
required:
- name
- address
- enabled
NetworkResourceRequest:
allOf:
- $ref: '#/components/schemas/NetworkResourceMinimum'
@@ -1390,12 +1398,17 @@ components:
description: Indicate if peer should masquerade traffic to this route's prefix
type: boolean
example: true
enabled:
description: Network router status
type: boolean
example: true
required:
# Only one property has to be set
#- peer
#- peer_groups
- metric
- masquerade
- enabled
NetworkRouter:
allOf:
- type: object

View File

@@ -560,6 +560,9 @@ type NetworkResource struct {
// Description Network resource description
Description *string `json:"description,omitempty"`
// Enabled Network resource status
Enabled bool `json:"enabled"`
// Groups Groups that the resource belongs to
Groups []GroupMinimum `json:"groups"`
@@ -581,6 +584,9 @@ type NetworkResourceMinimum struct {
// Description Network resource description
Description *string `json:"description,omitempty"`
// Enabled Network resource status
Enabled bool `json:"enabled"`
// Name Network resource name
Name string `json:"name"`
}
@@ -593,6 +599,9 @@ type NetworkResourceRequest struct {
// Description Network resource description
Description *string `json:"description,omitempty"`
// Enabled Network resource status
Enabled bool `json:"enabled"`
// Groups Group IDs containing the resource
Groups []string `json:"groups"`
@@ -605,6 +614,9 @@ type NetworkResourceType string
// NetworkRouter defines model for NetworkRouter.
type NetworkRouter struct {
// Enabled Network router status
Enabled bool `json:"enabled"`
// Id Network Router Id
Id string `json:"id"`
@@ -623,6 +635,9 @@ type NetworkRouter struct {
// NetworkRouterRequest defines model for NetworkRouterRequest.
type NetworkRouterRequest struct {
// Enabled Network router status
Enabled bool `json:"enabled"`
// Masquerade Indicate if peer should masquerade traffic to this route's prefix
Masquerade bool `json:"masquerade"`