From 034f7e3918e2a98b31f4c2de345eb96e8f6848af Mon Sep 17 00:00:00 2001 From: Piotr Banas Date: Wed, 24 Apr 2024 00:36:45 +0200 Subject: [PATCH 1/3] Mirror model --- .../sdwan/policy_object/__init__.py | 3 +++ .../sdwan/policy_object/policy/mirror.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py index a32092e7..5fe244ee 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/__init__.py @@ -14,6 +14,7 @@ from .policy.fowarding_class import FowardingClassParcel, FowardingClassQueueEntry from .policy.ipv6_data_prefix import IPv6DataPrefixEntry, IPv6DataPrefixParcel from .policy.ipv6_prefix_list import IPv6PrefixListEntry, IPv6PrefixListParcel +from .policy.mirror import MirrorParcel from .policy.policer import PolicerEntry, PolicerParcel from .policy.prefered_group_color import Preference, PreferredColorGroupEntry, PreferredColorGroupParcel from .policy.prefix_list import PrefixListEntry, PrefixListParcel @@ -55,6 +56,7 @@ IPv6DataPrefixParcel, IPv6PrefixListParcel, LocalDomainParcel, + MirrorParcel, PolicerParcel, PreferredColorGroupParcel, PrefixListParcel, @@ -102,6 +104,7 @@ "IPv6PrefixListParcel", "LocalDomainListEntry", "LocalDomainParcel", + "MirrorParcel", "PolicerEntry", "PolicerParcel", "Preference", diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py new file mode 100644 index 00000000..4af4c560 --- /dev/null +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py @@ -0,0 +1,18 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates + +from typing import List, Literal + +from pydantic import AliasPath, BaseModel, ConfigDict, Field + +from catalystwan.api.configuration_groups.parcel import Global, _ParcelBase + + +class MirrorEntry(BaseModel): + model_config = ConfigDict(populate_by_name=True) + remote_dest_ip: Global[str] = Field(validation_alias="remoteDestIp", serialization_alias="remoteDestIp") + source_ip: Global[str] = Field(validation_alias="sourceIp", serialization_alias="sourceIp") + + +class MirrorParcel(_ParcelBase): + type_: Literal["mirror"] = Field(default="mirror", exclude=True) + entries: List[MirrorEntry] = Field(validation_alias=AliasPath("data", "entries"), min_items=1, max_items=1) From fc39029ff7365f85f03b1f16d00929bf7a064015 Mon Sep 17 00:00:00 2001 From: Piotr Banas Date: Wed, 24 Apr 2024 22:40:27 +0200 Subject: [PATCH 2/3] add parcel type --- catalystwan/models/configuration/feature_profile/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/catalystwan/models/configuration/feature_profile/common.py b/catalystwan/models/configuration/feature_profile/common.py index 3bca973f..5f88b5c6 100644 --- a/catalystwan/models/configuration/feature_profile/common.py +++ b/catalystwan/models/configuration/feature_profile/common.py @@ -42,6 +42,7 @@ "class", "data-ipv6-prefix", "ipv6-prefix", + "mirror", "prefix", "policer", "preferred-color-group", From 37d332751b255e7f522c1f43d8272acf854a7778 Mon Sep 17 00:00:00 2001 From: pbanascisco <145477381+pbanascisco@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:24:16 +0200 Subject: [PATCH 3/3] Update catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py Co-authored-by: Jakub Krajewski <95274389+jpkrajewski@users.noreply.github.com> --- .../feature_profile/sdwan/policy_object/policy/mirror.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py index 4af4c560..f61c9c0e 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py @@ -15,4 +15,4 @@ class MirrorEntry(BaseModel): class MirrorParcel(_ParcelBase): type_: Literal["mirror"] = Field(default="mirror", exclude=True) - entries: List[MirrorEntry] = Field(validation_alias=AliasPath("data", "entries"), min_items=1, max_items=1) + entries: List[MirrorEntry] = Field(validation_alias=AliasPath("data", "entries"), min_length=1, max_length=1)