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

Commit

Permalink
policy list: modempassthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Oct 25, 2024
1 parent 93b912c commit d123d63
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 0 deletions.
11 changes: 11 additions & 0 deletions catalystwan/api/policy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
from catalystwan.endpoints.configuration.policy.list.local_domain import ConfigurationPolicyLocalDomainList
from catalystwan.endpoints.configuration.policy.list.media_profile import ConfigurationPolicyMediaProfileList
from catalystwan.endpoints.configuration.policy.list.mirror import ConfigurationPolicyMirrorList, MirrorListInfo
from catalystwan.endpoints.configuration.policy.list.modem_pass_through import ConfigurationPolicyModemPassThroughList
from catalystwan.endpoints.configuration.policy.list.policer import ConfigurationPolicyPolicerClassList, PolicerListInfo
from catalystwan.endpoints.configuration.policy.list.port import ConfigurationPolicyPortList, PortListInfo
from catalystwan.endpoints.configuration.policy.list.preferred_color_group import (
Expand Down Expand Up @@ -197,6 +198,7 @@
from catalystwan.models.policy.list.ipv6_prefix import IPv6PrefixListInfo
from catalystwan.models.policy.list.local_domain import LocalDomainListInfo
from catalystwan.models.policy.list.media_profile import MediaProfileList, MediaProfileListInfo
from catalystwan.models.policy.list.modem_pass_through import ModemPassThroughList, ModemPassThroughListInfo
from catalystwan.models.policy.list.scalable_group_tag import ScalableGroupTagList, ScalableGroupTagListInfo
from catalystwan.models.policy.list.threat_grid_api_key import ThreatGridApiKeyList, ThreatGridApiKeyListInfo
from catalystwan.models.policy.list.translation_profile import TranslationProfileList, TranslationProfileListInfo
Expand Down Expand Up @@ -248,6 +250,7 @@
LocalDomainList: ConfigurationPolicyLocalDomainList,
MediaProfileList: ConfigurationPolicyMediaProfileList,
MirrorList: ConfigurationPolicyMirrorList,
ModemPassThroughList: ConfigurationPolicyModemPassThroughList,
PolicerList: ConfigurationPolicyPolicerClassList,
PortList: ConfigurationPolicyPortList,
PreferredColorGroupList: ConfigurationPreferredColorGroupList,
Expand Down Expand Up @@ -500,6 +503,10 @@ def get(self, type: Type[LocalDomainList]) -> DataSequence[LocalDomainListInfo]:
def get(self, type: Type[MediaProfileList]) -> DataSequence[MediaProfileListInfo]:
...

@overload
def get(self, type: Type[ModemPassThroughList]) -> DataSequence[ModemPassThroughListInfo]:
...

@overload
def get(self, type: Type[MirrorList]) -> DataSequence[MirrorListInfo]:
...
Expand Down Expand Up @@ -658,6 +665,10 @@ def get(self, type: Type[MediaProfileList], id: UUID) -> MediaProfileListInfo:
def get(self, type: Type[MirrorList], id: UUID) -> MirrorListInfo:
...

@overload
def get(self, type: Type[ModemPassThroughList], id: UUID) -> ModemPassThroughListInfo:
...

@overload
def get(self, type: Type[PolicerList], id: UUID) -> PolicerListInfo:
...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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 PolicyListEndpoints
from catalystwan.models.policy.list.modem_pass_through import (
ModemPassThroughList,
ModemPassThroughListEditPayload,
ModemPassThroughListInfo,
)
from catalystwan.models.policy.policy_list import InfoTag, PolicyListId, PolicyListPreview
from catalystwan.typed_list import DataSequence


class ConfigurationPolicyModemPassThroughList(APIEndpoints, PolicyListEndpoints):
@post("/template/policy/list/modempassthrough")
def create_policy_list(self, payload: ModemPassThroughList) -> PolicyListId:
...

@delete("/template/policy/list/modempassthrough/{id}")
def delete_policy_list(self, id: UUID) -> None:
...

@delete("/template/policy/list/modempassthrough")
def delete_policy_lists_with_info_tag(self, params: InfoTag) -> None:
...

@put("/template/policy/list/modempassthrough/{id}")
def edit_policy_list(self, id: UUID, payload: ModemPassThroughListEditPayload) -> None:
...

@get("/template/policy/list/modempassthrough/{id}")
def get_lists_by_id(self, id: UUID) -> ModemPassThroughListInfo:
...

@get("/template/policy/list/modempassthrough", "data")
def get_policy_lists(self) -> DataSequence[ModemPassThroughListInfo]:
...

@get("/template/policy/list/modempassthrough/filtered", "data")
def get_policy_lists_with_info_tag(self, params: InfoTag) -> DataSequence[ModemPassThroughListInfo]:
...

@post("/template/policy/list/modempassthrough/preview")
def preview_policy_list(self, payload: ModemPassThroughList) -> PolicyListPreview:
...

@get("/template/policy/list/modempassthrough/preview/{id}")
def preview_policy_list_by_id(self, id: UUID) -> PolicyListPreview:
...
2 changes: 2 additions & 0 deletions catalystwan/endpoints/endpoints_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from catalystwan.endpoints.configuration.policy.list.local_domain import ConfigurationPolicyLocalDomainList
from catalystwan.endpoints.configuration.policy.list.media_profile import ConfigurationPolicyMediaProfileList
from catalystwan.endpoints.configuration.policy.list.mirror import ConfigurationPolicyMirrorList
from catalystwan.endpoints.configuration.policy.list.modem_pass_through import ConfigurationPolicyModemPassThroughList
from catalystwan.endpoints.configuration.policy.list.policer import ConfigurationPolicyPolicerClassList
from catalystwan.endpoints.configuration.policy.list.port import ConfigurationPolicyPortList
from catalystwan.endpoints.configuration.policy.list.preferred_color_group import ConfigurationPreferredColorGroupList
Expand Down Expand Up @@ -136,6 +137,7 @@ def __init__(self, session: ManagerSession):
self.local_domain = ConfigurationPolicyLocalDomainList(session)
self.media_profile = ConfigurationPolicyMediaProfileList(session)
self.mirror = ConfigurationPolicyMirrorList(session)
self.modem_pass_through = ConfigurationPolicyModemPassThroughList(session)
self.policer = ConfigurationPolicyPolicerClassList(session)
self.port = ConfigurationPolicyPortList(session)
self.preferred_color_group = ConfigurationPreferredColorGroupList(session)
Expand Down
6 changes: 6 additions & 0 deletions catalystwan/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ def str_as_interface_list(val: Union[str, Sequence[InterfaceStr]]) -> Sequence[I
"ilbc",
]

ModemPassThroughCodec = Literal[
"none",
"g711ulaw",
"g711alaw",
]

MpDtmf = Literal[
"inband",
"rtp-nte",
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/models/policy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from catalystwan.models.policy.list.local_domain import LocalDomainList, LocalDomainListInfo
from catalystwan.models.policy.list.media_profile import MediaProfileList
from catalystwan.models.policy.list.mirror import MirrorList, MirrorListInfo
from catalystwan.models.policy.list.modem_pass_through import ModemPassThroughList
from catalystwan.models.policy.list.policer import PolicerList, PolicerListInfo
from catalystwan.models.policy.list.port import PortList, PortListInfo
from catalystwan.models.policy.list.preferred_color_group import PreferredColorGroupList, PreferredColorGroupListInfo
Expand Down Expand Up @@ -141,6 +142,7 @@
LocalDomainList,
MediaProfileList,
MirrorList,
ModemPassThroughList,
PolicerList,
PortList,
PreferredColorGroupList,
Expand Down
27 changes: 27 additions & 0 deletions catalystwan/models/policy/list/modem_pass_through.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Cisco Systems, Inc. and its affiliates

from typing import List, Literal

from pydantic import BaseModel, ConfigDict, Field

from catalystwan.models.common import ModemPassThroughCodec
from catalystwan.models.policy.policy_list import PolicyListBase, PolicyListId, PolicyListInfo


class ModemPassThroughListEntry(BaseModel):
model_config = ConfigDict(populate_by_name=True)
protocol: ModemPassThroughCodec


class ModemPassThroughList(PolicyListBase):
model_config = ConfigDict(populate_by_name=True)
type: Literal["modemPassthrough", "modempassthrough"] = "modemPassthrough"
entires: List[ModemPassThroughListEntry] = Field(default_factory=list, max_length=1)


class ModemPassThroughListEditPayload(ModemPassThroughList, PolicyListId):
pass


class ModemPassThroughListInfo(ModemPassThroughList, PolicyListInfo):
pass

0 comments on commit d123d63

Please sign in to comment.