-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: Add models - translation rule, translation profile (#4)
* Add models * Add models to init * Change ethernet field serializtion
- Loading branch information
1 parent
234cd1b
commit c3c514c
Showing
4 changed files
with
75 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
catalystwan/models/configuration/feature_profile/sdwan/uc_voice/translation_profile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
from typing import List, Literal, Optional, Union | ||
|
||
from pydantic import AliasPath, BaseModel, ConfigDict, Field | ||
|
||
from catalystwan.api.configuration_groups.parcel import Global, Variable, _ParcelBase | ||
from catalystwan.models.configuration.feature_profile.common import RefIdItem | ||
|
||
CallType = Literal[ | ||
"called", | ||
"calling", | ||
] | ||
|
||
|
||
class TranslationProfileSettings(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True, extra="forbid") | ||
call_type: Union[Variable, Global[CallType]] = Field(validation_alias="callType", serialization_alias="callType") | ||
translation_rule: Optional[RefIdItem] = Field( | ||
default=None, validation_alias="translationRule", serialization_alias="translationRule" | ||
) | ||
|
||
|
||
class TranslationProfileParcel(_ParcelBase): | ||
model_config = ConfigDict(populate_by_name=True, extra="forbid") | ||
type_: Literal["translation-profile"] = Field(default="translation-profile", exclude=True) | ||
translation_profile_settings: List[TranslationProfileSettings] = Field( | ||
validation_alias=AliasPath("data", "translationProfileSettings"), | ||
description="Translation Profile configuration", | ||
) |
31 changes: 31 additions & 0 deletions
31
catalystwan/models/configuration/feature_profile/sdwan/uc_voice/translation_rule.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
from typing import List, Literal, Optional | ||
|
||
from pydantic import AliasPath, BaseModel, ConfigDict, Field | ||
|
||
from catalystwan.api.configuration_groups.parcel import Global, _ParcelBase | ||
|
||
Action = Literal[ | ||
"reject", | ||
"replace", | ||
] | ||
|
||
|
||
class RuleSettings(BaseModel): | ||
model_config = ConfigDict(populate_by_name=True, extra="forbid") | ||
action: Optional[Global[Action]] = Field(default=None) | ||
match: Optional[Global[str]] = Field(default=None) | ||
replacement_pattern: Optional[Global[str]] = Field( | ||
default=None, validation_alias="replacementPattern", serialization_alias="replacementPattern" | ||
) | ||
rule_num: Optional[Global[int]] = Field(default=None, validation_alias="ruleNum", serialization_alias="ruleNum") | ||
|
||
|
||
class TranslationRuleParcel(_ParcelBase): | ||
model_config = ConfigDict(populate_by_name=True, extra="forbid") | ||
type_: Literal["translation-rule"] = Field(default="translation-rule", exclude=True) | ||
rule_settings: List[RuleSettings] = Field( | ||
validation_alias=AliasPath("data", "ruleSettings"), | ||
description="Translation Rule configuration", | ||
) | ||
rule_name: Optional[Global[int]] = Field(default=None, validation_alias="ruleName", serialization_alias="ruleName") |