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

Commit

Permalink
Move template types to coresponding converters
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrajewski committed Mar 6, 2024
1 parent 663b6a6 commit f1f2fb3
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


class AAATemplateConverter:
supported_template_types = ("cisco_aaa", "cedge_aaa", "aaa")

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> AAAParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


class BannerTemplateConverter:
supported_template_types = ("cisco_banner",)

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> BannerParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@


class SystemToBasicTemplateConverter:
supported_template_types = ("cisco_system", "system-vsmart", "system-vedge")

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> BasicParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


class BFDTemplateConverter:
supported_template_types = ("cisco_bfd",)

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> BFDParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@

logger = logging.getLogger(__name__)

# TODO: Move tuples inside of template converter classes then assamble them here
supported_parcel_converters: Dict[Any, FeatureTemplateConverter] = {
("cisco_aaa", "cedge_aaa", "aaa"): AAATemplateConverter, # type: ignore[dict-item]
("cisco_bfd",): BFDTemplateConverter, # type: ignore[dict-item]
("cisco_logging", "logging"): LoggingTemplateConverter, # type: ignore[dict-item]
(
"cisco_security",
"security",
"security-vsmart",
"security-vedge",
): SecurityTemplateConverter, # type: ignore[dict-item]
("cisco_omp", "omp-vedge", "omp-vsmart"): OMPTemplateConverter,
("cedge_global",): GlobalTemplateConverter,
("cisco_banner",): BannerTemplateConverter,
("cisco_system", "system-vsmart", "system-vedge"): SystemToBasicTemplateConverter,
available_converters = [
AAATemplateConverter,
BannerTemplateConverter,
SecurityTemplateConverter,
SystemToBasicTemplateConverter,
BFDTemplateConverter,
GlobalTemplateConverter,
LoggingTemplateConverter,
OMPTemplateConverter,
]


supported_parcel_converters: Dict[Any, Any] = {
converter.supported_template_types: converter for converter in available_converters # type: ignore
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


class GlobalTemplateConverter:
supported_template_types = ("cedge_global",)

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> GlobalParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@


class LoggingTemplateConverter:
supported_template_types = ("cisco_logging", "logging")

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> LoggingParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@


class OMPTemplateConverter:
supported_template_types = ("cisco_omp", "omp-vedge", "omp-vsmart")

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> OMPParcel:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@


class SecurityTemplateConverter:
supported_template_types = (
"cisco_security",
"security",
"security-vsmart",
"security-vedge",
)

@staticmethod
def create_parcel(name: str, description: str, template_values: dict) -> SecurityParcel:
"""
Expand Down

0 comments on commit f1f2fb3

Please sign in to comment.