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

Commit

Permalink
fix issue with picking default-policy-opject-profile (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan authored May 28, 2024
1 parent 77f7244 commit 90a670e
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 69 deletions.
40 changes: 20 additions & 20 deletions ENDPOINTS.md

Large diffs are not rendered by default.

26 changes: 16 additions & 10 deletions catalystwan/api/feature_profile_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
GetReferenceCountFeatureProfilesPayload,
)
from catalystwan.models.configuration.feature_profile.parcel import (
Expand Down Expand Up @@ -216,7 +216,7 @@ def get_profiles(
"""
Get all Transport Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_transport_feature_profiles(payload)

Expand Down Expand Up @@ -322,7 +322,7 @@ def get_profiles(
"""
Get all Other Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_sdwan_other_feature_profiles(payload)

Expand Down Expand Up @@ -389,7 +389,7 @@ def get_profiles(
"""
Get all Service Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_sdwan_service_feature_profiles(payload)

Expand Down Expand Up @@ -445,7 +445,7 @@ def get_profiles(
"""
Get all System Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_sdwan_system_feature_profiles(payload)

Expand Down Expand Up @@ -813,6 +813,12 @@ def __init__(self, session: ManagerSession):
def get_profiles(self) -> DataSequence[FeatureProfileInfo]:
return self.endpoint.get_profiles()

def create_profile(self, profile: FeatureProfileCreationPayload) -> FeatureProfileCreationResponse:
return self.endpoint.create_profile()

def delete_profile(self, profile_id: UUID) -> None:
return self.endpoint.delete_profile(profile_id=profile_id)

@overload
def get(
self, profile_id: UUID, parcel_type: Type[AdvancedInspectionProfileParcel]
Expand Down Expand Up @@ -1202,7 +1208,7 @@ def get_profiles(
"""
Get all Embedded Security Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_embedded_security_feature_profiles(payload)

Expand Down Expand Up @@ -1312,7 +1318,7 @@ def get_profiles(
"""
Get all CLI Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_profiles(payload)

Expand Down Expand Up @@ -1373,7 +1379,7 @@ def get_profiles(
"""
Get all DNS Security Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_dns_security_feature_profiles(payload)

Expand Down Expand Up @@ -1486,7 +1492,7 @@ def get_profiles(
"""
Get all Application Priority Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit if limit else None, offset=offset if offset else None)
payload = GetFeatureProfilesParams(limit=limit if limit else None, offset=offset if offset else None)

return self.endpoint.get_application_priority_feature_profiles(payload)

Expand Down Expand Up @@ -1613,7 +1619,7 @@ def get_profiles(
"""
Get all Topology Feature Profiles
"""
payload = GetFeatureProfilesPayload(limit=limit, offset=offset)
payload = GetFeatureProfilesParams(limit=limit, offset=offset)
return self.endpoint.get_topology_feature_profiles(payload)

def create_profile(self, name: str, description: str) -> FeatureProfileCreationResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FeatureProfileDetail,
FeatureProfileEditPayload,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelCreationResponse
from catalystwan.models.configuration.feature_profile.sdwan.application_priority import AnyApplicationPriorityParcel
Expand All @@ -28,14 +28,14 @@ def create_application_priority_feature_profile(
@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/application-priority")
def get_application_priority_feature_profiles(
self, params: GetFeatureProfilesPayload
self, params: GetFeatureProfilesParams
) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/application-priority/{profile_id}")
def get_application_priority_feature_profile(
self, profile_id: str, params: GetFeatureProfilesPayload
self, profile_id: str, params: GetFeatureProfilesParams
) -> FeatureProfileDetail:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelId
from catalystwan.models.configuration.feature_profile.sdwan.cli import ConfigParcel
Expand All @@ -19,7 +19,7 @@
class CliFeatureProfile(APIEndpoints):
# @versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/cli")
def get_profiles(self, payload: Optional[GetFeatureProfilesPayload]) -> DataSequence[FeatureProfileInfo]:
def get_profiles(self, payload: Optional[GetFeatureProfilesParams]) -> DataSequence[FeatureProfileInfo]:
...

# @versions(supported_versions=(">=20.9"), raises=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FeatureProfileDetail,
FeatureProfileEditPayload,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelCreationResponse
from catalystwan.models.configuration.feature_profile.sdwan.dns_security import AnyDnsSecurityParcel
Expand All @@ -27,13 +27,13 @@ def create_dns_security_feature_profile(

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/dns-security")
def get_dns_security_feature_profiles(self, params: GetFeatureProfilesPayload) -> DataSequence[FeatureProfileInfo]:
def get_dns_security_feature_profiles(self, params: GetFeatureProfilesParams) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/dns-security/{profile_id}")
def get_dns_security_feature_profile(
self, profile_id: str, params: GetFeatureProfilesPayload
self, profile_id: str, params: GetFeatureProfilesParams
) -> FeatureProfileDetail:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FeatureProfileDetail,
FeatureProfileEditPayload,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelCreationResponse
from catalystwan.models.configuration.feature_profile.sdwan.embedded_security import (
Expand All @@ -31,14 +31,14 @@ def create_embedded_security_feature_profile(
@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/embedded-security")
def get_embedded_security_feature_profiles(
self, params: GetFeatureProfilesPayload
self, params: GetFeatureProfilesParams
) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/embedded-security/{profile_id}")
def get_embedded_security_feature_profile(
self, profile_id: str, params: GetFeatureProfilesPayload
self, profile_id: str, params: GetFeatureProfilesParams
) -> FeatureProfileDetail:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelId
from catalystwan.typed_list import DataSequence
Expand All @@ -20,7 +20,7 @@ class OtherFeatureProfile(APIEndpoints):
@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/other")
def get_sdwan_other_feature_profiles(
self, payload: Optional[GetFeatureProfilesPayload]
self, payload: Optional[GetFeatureProfilesParams]
) -> DataSequence[FeatureProfileInfo]:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
from uuid import UUID

from catalystwan.endpoints import APIEndpoints, delete, get, post, put, versions
from catalystwan.models.configuration.feature_profile.common import FeatureProfileInfo, GetFeatureProfilesPayload
from catalystwan.models.configuration.feature_profile.common import (
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelCreationResponse
from catalystwan.models.configuration.feature_profile.sdwan.policy_object import AnyPolicyObjectParcel
from catalystwan.typed_list import DataSequence
Expand All @@ -14,10 +19,20 @@ class PolicyObjectFeatureProfile(APIEndpoints):
@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/policy-object")
def get_profiles(
self, params: GetFeatureProfilesPayload = GetFeatureProfilesPayload()
self, params: GetFeatureProfilesParams = GetFeatureProfilesParams()
) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@post("/v1/feature-profile/sdwan/policy-object")
def create_profile(self, payload: FeatureProfileCreationPayload) -> FeatureProfileCreationResponse:
...

@versions(supported_versions=(">=20.12"), raises=False)
@delete("/v1/feature-profile/sdwan/policy-object/{profile_id}")
def delete_profile(self, profile_id: UUID) -> None:
...

@versions(supported_versions=(">=20.12"), raises=False)
@post("/v1/feature-profile/sdwan/policy-object/{profile_id}/{policy_object_list_type}")
def create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
)
from catalystwan.models.configuration.feature_profile.parcel import ParcelAssociationPayload, ParcelCreationResponse
from catalystwan.models.configuration.feature_profile.sdwan.service import (
Expand All @@ -23,7 +23,7 @@ class ServiceFeatureProfile(APIEndpoints):
@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/service")
def get_sdwan_service_feature_profiles(
self, payload: Optional[GetFeatureProfilesPayload]
self, payload: Optional[GetFeatureProfilesParams]
) -> DataSequence[FeatureProfileInfo]:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FeatureProfileCreationPayload,
FeatureProfileCreationResponse,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
SchemaTypeQuery,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelId
Expand Down Expand Up @@ -38,7 +38,7 @@ def get_schema(self, parcel_type: str, 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]
self, payload: Optional[GetFeatureProfilesParams]
) -> DataSequence[FeatureProfileInfo]:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
FeatureProfileDetail,
FeatureProfileEditPayload,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
SchemaTypeQuery,
)
from catalystwan.models.configuration.feature_profile.parcel import Parcel, ParcelCreationResponse
Expand All @@ -27,12 +27,12 @@ def create_topology_feature_profile(self, payload: FeatureProfileCreationPayload

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/topology")
def get_topology_feature_profiles(self, params: GetFeatureProfilesPayload) -> DataSequence[FeatureProfileInfo]:
def get_topology_feature_profiles(self, params: GetFeatureProfilesParams) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/topology/{profile_id}")
def get_topology_feature_profile(self, profile_id: str, params: GetFeatureProfilesPayload) -> FeatureProfileDetail:
def get_topology_feature_profile(self, profile_id: str, params: GetFeatureProfilesParams) -> FeatureProfileDetail:
...

@versions(supported_versions=(">=20.12"), raises=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
FeatureProfileDetail,
FeatureProfileEditPayload,
FeatureProfileInfo,
GetFeatureProfilesPayload,
GetFeatureProfilesParams,
SchemaTypeQuery,
)
from catalystwan.models.configuration.feature_profile.parcel import (
Expand All @@ -39,14 +39,12 @@ def create_transport_feature_profile(

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/transport")
def get_transport_feature_profiles(self, params: GetFeatureProfilesPayload) -> DataSequence[FeatureProfileInfo]:
def get_transport_feature_profiles(self, params: GetFeatureProfilesParams) -> DataSequence[FeatureProfileInfo]:
...

@versions(supported_versions=(">=20.12"), raises=False)
@get("/v1/feature-profile/sdwan/transport/{profile_id}")
def get_transport_feature_profile(
self, profile_id: UUID, params: GetFeatureProfilesPayload
) -> FeatureProfileDetail:
def get_transport_feature_profile(self, profile_id: UUID, params: GetFeatureProfilesParams) -> FeatureProfileDetail:
...

@versions(supported_versions=(">=20.12"), raises=False)
Expand Down Expand Up @@ -125,7 +123,7 @@ def delete_management_vpn_parcel(self, profile_id: UUID, parcel_id: str) -> None
@versions(supported_versions=(">=20.9"), raises=False)
@get("/v1/feature-profile/sdwan/transport")
def get_sdwan_transport_feature_profiles(
self, payload: Optional[GetFeatureProfilesPayload]
self, payload: Optional[GetFeatureProfilesParams]
) -> DataSequence[FeatureProfileInfo]:
...

Expand Down
1 change: 0 additions & 1 deletion catalystwan/models/configuration/config_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ class PolicyConvertContext:
def from_configs(
network_hierarchy: List[NodeInfo],
transformed_parcels: List[TransformedParcel],
policy_list_infos: List[AnyPolicyListInfo],
) -> "PolicyConvertContext":
context = PolicyConvertContext()
for node in network_hierarchy:
Expand Down
4 changes: 2 additions & 2 deletions catalystwan/models/configuration/feature_profile/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ class SchemaTypeQuery(BaseModel):
schema_type: SchemaType = Field(alias="schemaType")


class GetFeatureProfilesPayload(BaseModel):
class GetFeatureProfilesParams(BaseModel):
limit: Optional[int] = None
offset: Optional[int] = None


class GetReferenceCountFeatureProfilesPayload(GetFeatureProfilesPayload):
class GetReferenceCountFeatureProfilesPayload(GetFeatureProfilesParams):
model_config = ConfigDict(populate_by_name=True)

reference_count: Optional[bool] = Field(serialization_alias="referenceCount", validation_alias="referenceCount")
Expand Down
Loading

0 comments on commit 90a670e

Please sign in to comment.