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

Commit

Permalink
NG firewall conversion (#734)
Browse files Browse the repository at this point in the history
Adding NGFirewall Converter and fixing some ux1 models
  • Loading branch information
radkrawczyk authored Jun 26, 2024
1 parent 84eafda commit 43580a3
Show file tree
Hide file tree
Showing 14 changed files with 734 additions and 32 deletions.
2 changes: 2 additions & 0 deletions catalystwan/models/configuration/config_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from catalystwan.models.policy import AnyPolicyDefinitionInfo, AnyPolicyListInfo, URLAllowListInfo, URLBlockListInfo
from catalystwan.models.policy.centralized import CentralizedPolicyInfo
from catalystwan.models.policy.definition.ssl_decryption import NetworkDecryptionRuleSequence, UrlProfile
from catalystwan.models.policy.definition.zone_based_firewall import ZoneBasedFWPolicyEntry
from catalystwan.models.policy.localized import LocalizedPolicyInfo
from catalystwan.models.policy.security import AnySecurityPolicyInfo
from catalystwan.models.templates import FeatureTemplateInformation, TemplateInformation
Expand Down Expand Up @@ -567,6 +568,7 @@ class PolicyConvertContext:
ssl_decryption_residues: Dict[UUID, SslDecryptioneResidues] = field(default_factory=dict)
ssl_profile_residues: Dict[UUID, SslProfileResidues] = field(default_factory=dict)
url_filtering_target_vpns: Dict[UUID, List[VpnId]] = field(default_factory=dict)
zone_based_firewall_residues: Dict[UUID, List[ZoneBasedFWPolicyEntry]] = field(default_factory=dict)

def get_vpn_id_to_vpn_name_map(self) -> Dict[Union[str, int], List[str]]:
vpn_map: Dict[Union[str, int], List[str]] = {}
Expand Down
10 changes: 10 additions & 0 deletions catalystwan/models/configuration/feature_profile/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field, model_validator
from typing_extensions import Self

from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, as_default, as_global
from catalystwan.models.common import (
Expand Down Expand Up @@ -288,8 +289,17 @@ def from_uuid(cls, ref_id: UUID):


class RefIdList(BaseModel):
model_config = ConfigDict(
extra="forbid",
populate_by_name=True,
)

ref_id: Global[List[str]] = Field(..., serialization_alias="refId", validation_alias="refId")

@classmethod
def from_uuids(cls, uuids: List[UUID]) -> Self:
return cls(ref_id=as_global([str(uuid) for uuid in uuids]))


class MultiRegionFabric(BaseModel):
model_config = ConfigDict(
Expand Down
2 changes: 2 additions & 0 deletions catalystwan/models/configuration/feature_profile/parcel.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
"wirelesslan",
"cellular-profile",
"wan/vpn/interface/ethpppoe",
"unified/ngfirewall",
"policy",
]


Expand Down
Loading

0 comments on commit 43580a3

Please sign in to comment.