-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: vpnQosMap definition support (#13)
* add: vpnQosMap definition support * bump dev version
- Loading branch information
Showing
8 changed files
with
256 additions
and
135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
catalystwan/endpoints/configuration/policy/definition/vpn_qos_map.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
|
||
# mypy: disable-error-code="empty-body" | ||
|
||
from uuid import UUID | ||
|
||
from catalystwan.endpoints import APIEndpoints, delete, get, post, put | ||
from catalystwan.endpoints.configuration.policy.abstractions import PolicyDefinitionEndpoints | ||
from catalystwan.models.policy.definition.vpn_qos_map import ( | ||
VPNQoSMapPolicy, | ||
VPNQoSMapPolicyEditPayload, | ||
VPNQoSMapPolicyGetResponse, | ||
) | ||
from catalystwan.models.policy.policy_definition import ( | ||
PolicyDefinitionEditResponse, | ||
PolicyDefinitionId, | ||
PolicyDefinitionInfo, | ||
PolicyDefinitionPreview, | ||
) | ||
from catalystwan.typed_list import DataSequence | ||
|
||
|
||
class ConfigurationPolicyVPNQoSMapDefinition(APIEndpoints, PolicyDefinitionEndpoints): | ||
@post("/template/policy/definition/vpnqosmap") | ||
def create_policy_definition(self, payload: VPNQoSMapPolicy) -> PolicyDefinitionId: | ||
... | ||
|
||
@delete("/template/policy/definition/vpnqosmap/{id}") | ||
def delete_policy_definition(self, id: UUID) -> None: | ||
... | ||
|
||
@put("/template/policy/definition/vpnqosmap/{id}") | ||
def edit_policy_definition(self, id: UUID, payload: VPNQoSMapPolicyEditPayload) -> PolicyDefinitionEditResponse: | ||
... | ||
|
||
@get("/template/policy/definition/vpnqosmap", "data") | ||
def get_definitions(self) -> DataSequence[PolicyDefinitionInfo]: | ||
... | ||
|
||
@get("/template/policy/definition/vpnqosmap/{id}") | ||
def get_policy_definition(self, id: UUID) -> VPNQoSMapPolicyGetResponse: | ||
... | ||
|
||
@post("/template/policy/definition/vpnqosmap/preview") | ||
def preview_policy_definition(self, payload: VPNQoSMapPolicy) -> PolicyDefinitionPreview: | ||
... | ||
|
||
@get("/template/policy/definition/vpnqosmap/preview/{id}") | ||
def preview_policy_definition_by_id(self, id: UUID) -> PolicyDefinitionPreview: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
|
||
from typing import List, Literal, Optional | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel, ConfigDict, Field | ||
|
||
from catalystwan.models.common import IntStr | ||
from catalystwan.models.policy.policy_definition import ( | ||
PolicyDefinitionBase, | ||
PolicyDefinitionGetResponse, | ||
PolicyDefinitionId, | ||
) | ||
|
||
|
||
class VPNQoSScheduler(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
child_map_ref: UUID = Field(validation_alias="childMapRef", serialization_alias="childMapRef") | ||
vpn_list_ref: Optional[UUID] = Field(default=None, validation_alias="vpnListRef", serialization_alias="vpnListRef") | ||
bandwidth_rate: Optional[IntStr] = Field( | ||
default=None, validation_alias="bandwidthRate", serialization_alias="bandwidthRate", ge=8, le=100_000_000 | ||
) | ||
shaping_rate: Optional[IntStr] = Field( | ||
default=None, validation_alias="shapingRate", serialization_alias="shapingRate", ge=8, le=100_000_000 | ||
) | ||
|
||
|
||
class VPNQoSMapPolicyDefinition(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True) | ||
vpn_qos_schedulers: List[VPNQoSScheduler] = Field( | ||
validation_alias="vpnQosSchedulers", serialization_alias="vpnQosSchedulers" | ||
) | ||
|
||
|
||
class VPNQoSMapPolicy(PolicyDefinitionBase): | ||
model_config = ConfigDict(populate_by_name=True) | ||
type: Literal["vpnQosMap", "vpnQoSMap"] = "vpnQosMap" | ||
definition: VPNQoSMapPolicyDefinition | ||
|
||
|
||
class VPNQoSMapPolicyEditPayload(VPNQoSMapPolicy, PolicyDefinitionId): | ||
pass | ||
|
||
|
||
class VPNQoSMapPolicyGetResponse(VPNQoSMapPolicy, PolicyDefinitionGetResponse): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters