This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add banner, add more template types, work on Basic
- Loading branch information
1 parent
c1bd2bb
commit 663b6a6
Showing
3 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
catalystwan/utils/config_migration/converters/feature_template/banner.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,15 @@ | ||
from catalystwan.models.configuration.feature_profile.sdwan.system import BannerParcel | ||
|
||
|
||
class BannerTemplateConverter: | ||
@staticmethod | ||
def create_parcel(name: str, description: str, template_values: dict) -> BannerParcel: | ||
""" | ||
Creates an AAA object based on the provided template values. | ||
Returns: | ||
AAA: An AAA object with the provided template values. | ||
""" | ||
template_values["name"] = name | ||
template_values["description"] = description | ||
return BannerParcel(**template_values) |
31 changes: 31 additions & 0 deletions
31
catalystwan/utils/config_migration/converters/feature_template/basic.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 @@ | ||
from catalystwan.api.configuration_groups.parcel import Global | ||
from catalystwan.models.configuration.feature_profile.sdwan.system import BasicParcel | ||
from catalystwan.models.configuration.feature_profile.sdwan.system.basic import ConsoleBaudRate | ||
|
||
|
||
class SystemToBasicTemplateConverter: | ||
@staticmethod | ||
def create_parcel(name: str, description: str, template_values: dict) -> BasicParcel: | ||
""" | ||
Creates an AAA object based on the provided template values. | ||
Returns: | ||
AAA: An AAA object with the provided template values. | ||
""" | ||
template_values["name"] = name | ||
template_values["parcel_description"] = description | ||
if template_values.get("console_baud_rate") is not None: | ||
value = template_values["console_baud_rate"].value | ||
if value == "": | ||
value = "9600" # Default value for console baud rate | ||
template_values["console_baud_rate"] = Global[ConsoleBaudRate](value=value) | ||
|
||
if template_values.get("site_id") is not None: | ||
del template_values["site_id"] | ||
if template_values.get("system_ip") is not None: | ||
del template_values["system_ip"] | ||
if template_values.get("host_name") is not None: | ||
del template_values["host_name"] | ||
if template_values.get("enable") is not None: | ||
del template_values["enable"] | ||
return BasicParcel(**template_values) |
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