diff --git a/catalystwan/api/policy_api.py b/catalystwan/api/policy_api.py index 99b5756b..9dc2f57c 100644 --- a/catalystwan/api/policy_api.py +++ b/catalystwan/api/policy_api.py @@ -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 ( @@ -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 @@ -248,6 +250,7 @@ LocalDomainList: ConfigurationPolicyLocalDomainList, MediaProfileList: ConfigurationPolicyMediaProfileList, MirrorList: ConfigurationPolicyMirrorList, + ModemPassThroughList: ConfigurationPolicyModemPassThroughList, PolicerList: ConfigurationPolicyPolicerClassList, PortList: ConfigurationPolicyPortList, PreferredColorGroupList: ConfigurationPreferredColorGroupList, @@ -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]: ... @@ -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: ... diff --git a/catalystwan/endpoints/configuration/policy/list/modem_pass_through.py b/catalystwan/endpoints/configuration/policy/list/modem_pass_through.py new file mode 100644 index 00000000..fd208aa9 --- /dev/null +++ b/catalystwan/endpoints/configuration/policy/list/modem_pass_through.py @@ -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: + ... diff --git a/catalystwan/endpoints/endpoints_container.py b/catalystwan/endpoints/endpoints_container.py index f3402c8d..392ac84c 100644 --- a/catalystwan/endpoints/endpoints_container.py +++ b/catalystwan/endpoints/endpoints_container.py @@ -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 @@ -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) diff --git a/catalystwan/models/common.py b/catalystwan/models/common.py index 7b645b61..1481ce4a 100644 --- a/catalystwan/models/common.py +++ b/catalystwan/models/common.py @@ -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", diff --git a/catalystwan/models/policy/__init__.py b/catalystwan/models/policy/__init__.py index 808682a2..3b125cf2 100644 --- a/catalystwan/models/policy/__init__.py +++ b/catalystwan/models/policy/__init__.py @@ -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 @@ -141,6 +142,7 @@ LocalDomainList, MediaProfileList, MirrorList, + ModemPassThroughList, PolicerList, PortList, PreferredColorGroupList, diff --git a/catalystwan/models/policy/list/modem_pass_through.py b/catalystwan/models/policy/list/modem_pass_through.py new file mode 100644 index 00000000..7fd92463 --- /dev/null +++ b/catalystwan/models/policy/list/modem_pass_through.py @@ -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