Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
[CG] Add AAA Parcel (#478)
Browse files Browse the repository at this point in the history
* Add model

* enchance readme

* add system endpoints

* update container

* fix parcel base

* remove aaa parcel from wrong dir

* enchance model

* fix parcel
  • Loading branch information
kagrski authored Feb 20, 2024
1 parent 95184f4 commit 58e0f2a
Show file tree
Hide file tree
Showing 6 changed files with 700 additions and 65 deletions.
10 changes: 7 additions & 3 deletions catalystwan/api/configuration_groups/parcel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Global(ParcelAttribute, Generic[T]):
value: T

def __len__(self) -> int:
if isinstance(self.value, str):
if isinstance(self.value, (str, list)):
return len(self.value)
return -1

Expand All @@ -81,12 +81,16 @@ def __le__(self, other: Any) -> bool:


class Variable(ParcelAttribute):
option_type: OptionType = OptionType.VARIABLE
option_type: OptionType = Field(
default=OptionType.VARIABLE, serialization_alias="optionType", validation_alias="optionType"
)
value: str = Field(pattern=r"^\{\{[.\/\[\]a-zA-Z0-9_-]+\}\}$", min_length=1, max_length=64)


class Default(ParcelAttribute, Generic[T]):
option_type: OptionType = OptionType.DEFAULT
option_type: OptionType = Field(
default=OptionType.DEFAULT, serialization_alias="optionType", validation_alias="optionType"
)
value: Any


Expand Down
62 changes: 0 additions & 62 deletions catalystwan/api/configuration_groups/parcels/aaa_parcel.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# mypy: disable-error-code="empty-body"
from typing import Optional

from catalystwan.api.configuration_groups.parcel import _ParcelBase
from catalystwan.endpoints import JSON, APIEndpoints, delete, get, post, put, versions
from catalystwan.models.configuration.feature_profile.common import (
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
ParcelId,
SchemaTypeQuery,
)
from catalystwan.typed_list import DataSequence


class SystemFeatureProfile(APIEndpoints):
@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/system/aaa/schema", resp_json_key="request")
def get_sdwan_system_aaa_parcel_schema(self, params: SchemaTypeQuery) -> JSON:
...

@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/system")
def get_sdwan_system_feature_profiles(
self, payload: Optional[GetFeatureProfilesPayload]
) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.9"), raises=False)
@post("/v1/feature-profile/sdwan/system")
def create_sdwan_system_feature_profile(
self, payload: FeatureProfileCreationPayload
) -> FeatureProfileCreationResponse:
...

@versions(supported_versions=(">=20.9"), raises=False)
@delete("/v1/feature-profile/sdwan/system/{system_id}")
def delete_sdwan_system_feature_profile(self, system_id: str) -> None:
...

@versions(supported_versions=(">=20.9"), raises=False)
@post("/v1/feature-profile/sdwan/system/{system_id}/aaa")
def create_aaa_profile_parcel_for_system(self, system_id: str, payload: _ParcelBase) -> ParcelId:
...

@versions(supported_versions=(">=20.9"), raises=False)
@put("/v1/feature-profile/sdwan/system/{system_id}/aaa/{parcel_id}")
def edit_aaa_profile_parcel_for_system(self, system_id: str, parcel_id: str, payload: _ParcelBase) -> ParcelId:
...
2 changes: 2 additions & 0 deletions catalystwan/endpoints/endpoints_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from catalystwan.endpoints.cluster_management import ClusterManagement
from catalystwan.endpoints.configuration.device.software_update import ConfigurationDeviceSoftwareUpdate
from catalystwan.endpoints.configuration.disaster_recovery import ConfigurationDisasterRecovery
from catalystwan.endpoints.configuration.feature_profile.sdwan.system import SystemFeatureProfile
from catalystwan.endpoints.configuration.feature_profile.sdwan.transport import TransportFeatureProfile
from catalystwan.endpoints.configuration.policy.definition.access_control_list import ConfigurationPolicyAclDefinition
from catalystwan.endpoints.configuration.policy.definition.access_control_list_ipv6 import (
Expand Down Expand Up @@ -156,6 +157,7 @@ def __init__(self, session: ManagerSession):
class ConfigurationSDWANFeatureProfileContainer:
def __init__(self, session: ManagerSession):
self.transport = TransportFeatureProfile(client=session)
self.system = SystemFeatureProfile(client=session)


class ConfigurationFeatureProfileContainer:
Expand Down
Loading

0 comments on commit 58e0f2a

Please sign in to comment.