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

Commit

Permalink
trunkgroup common model
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Oct 24, 2024
1 parent 3268700 commit b0c4ffc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
20 changes: 20 additions & 0 deletions catalystwan/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,26 @@ def str_as_interface_list(val: Union[str, Sequence[InterfaceStr]]) -> Sequence[I
"sip-notify sip-kpml rtp-nte",
]

HuntSchemeMethod = Literal[
"least-idle",
"least-used",
"longest-idle",
"random",
"round-robin",
"sequential",
]

HuntSchemeChannel = Literal[
"both",
"even",
"odd",
]

HuntSchemeDirection = Literal[
"down",
"up",
]

SpaceSeparatedTLOCColorStr = Annotated[
List[TLOCColor],
PlainSerializer(lambda x: " ".join(map(str, x)), return_type=str, when_used="json-unless-none"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,7 @@
from pydantic import AliasPath, ConfigDict, Field

from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, _ParcelBase

HuntSchemeMethod = Literal[
"least-idle",
"least-used",
"longest-idle",
"random",
"round-robin",
"sequential",
]

HuntSchemeChannel = Literal[
"both",
"even",
"odd",
]

HuntSchemeDirection = Literal[
"down",
"up",
]
from catalystwan.models.common import HuntSchemeChannel, HuntSchemeDirection, HuntSchemeMethod


class TrunkGroupParcel(_ParcelBase):
Expand Down
13 changes: 6 additions & 7 deletions catalystwan/models/policy/list/trunkgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@

from pydantic import BaseModel, ConfigDict, Field

from catalystwan.models.common import HuntSchemeChannel as HuntSchemeMethodPrecedence
from catalystwan.models.common import HuntSchemeMethod
from catalystwan.models.policy.policy_list import PolicyListBase, PolicyListId, PolicyListInfo

HuntSchemeMethods = Literal["least-idle", "least-used", "longest-idle", "round-robin", "sequential", "random"]
HuntSchemeMethodPrecedences = Literal["even", "odd", "both"]


class TrunkGroupListEntry(BaseModel):
model_config = ConfigDict(populate_by_name=True)
hunt_scheme_method: HuntSchemeMethods = Field(
hunt_scheme_method: HuntSchemeMethod = Field(
validation_alias="huntSchemeMethod", serialization_alias="huntSchemeMethod"
)
hunt_scheme_precedence: Optional[HuntSchemeMethodPrecedences] = Field(
hunt_scheme_precedence: Optional[HuntSchemeMethodPrecedence] = Field(
default=None, validation_alias="huntSchemePrecedence", serialization_alias="huntSchemePrecedence"
)
max_calls_in: Optional[int] = Field(
Expand All @@ -33,8 +32,8 @@ class TrunkGroupList(PolicyListBase):

def add_entry(
self,
hunt_scheme_method: HuntSchemeMethods,
hunt_scheme_precedence: Optional[HuntSchemeMethodPrecedences],
hunt_scheme_method: HuntSchemeMethod,
hunt_scheme_precedence: Optional[HuntSchemeMethodPrecedence],
max_retries: int,
max_calls_in: Optional[int] = None,
max_calls_out: Optional[int] = None,
Expand Down

0 comments on commit b0c4ffc

Please sign in to comment.