From 7a0463dcee0927cbdadf1f5158b40e5f5f5d9e36 Mon Sep 17 00:00:00 2001 From: Jakub Krajewski Date: Thu, 12 Sep 2024 20:34:58 +0200 Subject: [PATCH 1/2] Fix route policy fields --- .../feature_profile/sdwan/routing/ospf.py | 6 +++--- .../feature_profile/sdwan/routing/ospfv3.py | 19 +++++++++++-------- .../feature_profile/sdwan/service/eigrp.py | 6 ++++-- .../feature_profile/sdwan/service/lan/vpn.py | 16 +++++++++++----- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/routing/ospf.py b/catalystwan/models/configuration/feature_profile/sdwan/routing/ospf.py index a30c0c1c..3a898b99 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/routing/ospf.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/routing/ospf.py @@ -3,12 +3,12 @@ from ipaddress import IPv4Address from typing import List, Literal, Optional, Union -from uuid import UUID from pydantic import AliasPath, BaseModel, ConfigDict, Field from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, _ParcelBase, as_default from catalystwan.models.common import MetricType +from catalystwan.models.configuration.feature_profile.common import RefIdItem NetworkType = Literal[ "broadcast", @@ -112,7 +112,7 @@ class RedistributedRoute(BaseModel): protocol: Union[Global[RedistributeProtocolOspf], Variable] dia: Optional[Union[Global[bool], Variable, Default[bool]]] = None - route_policy: Optional[Union[Default[None], Global[str], Global[UUID]]] = Field( + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( serialization_alias="routePolicy", validation_alias="routePolicy", default=None ) @@ -164,7 +164,7 @@ class RoutingOspfParcel(_ParcelBase): validation_alias=AliasPath("data", "redistribute"), default=None ) router_lsa: Optional[List[RouterLsa]] = Field(validation_alias=AliasPath("data", "routerLsa"), default=None) - route_policy: Optional[Union[Default[None], Global[str], Global[UUID]]] = Field( + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( validation_alias=AliasPath("data", "routePolicy"), default=None ) area: Optional[List[OspfArea]] = Field(validation_alias=AliasPath("data", "area"), default=None) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/routing/ospfv3.py b/catalystwan/models/configuration/feature_profile/sdwan/routing/ospfv3.py index 0e9768b5..d4298503 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/routing/ospfv3.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/routing/ospfv3.py @@ -2,13 +2,12 @@ from ipaddress import IPv4Address, IPv6Interface from typing import List, Literal, Optional, Union -from uuid import UUID from pydantic import AliasPath, BaseModel, ConfigDict, Field from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, _ParcelBase, as_default from catalystwan.models.common import MetricType -from catalystwan.models.configuration.feature_profile.common import AddressWithMask +from catalystwan.models.configuration.feature_profile.common import AddressWithMask, RefIdItem NetworkType = Literal[ "broadcast", @@ -191,8 +190,10 @@ class RedistributedRoute(BaseModel): nat_dia: Optional[Union[Global[bool], Variable, Default[bool]]] = Field( serialization_alias="natDia", validation_alias="natDia", default=None ) - route_policy: Optional[Union[Default[None], Global[UUID]]] = Field( - serialization_alias="routePolicy", validation_alias="routePolicy", default=None + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( + default=Default[None](value=None), + serialization_alias="routePolicy", + validation_alias="routePolicy", ) @@ -200,8 +201,10 @@ class RedistributedRouteIPv6(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True, populate_by_name=True, extra="forbid") protocol: Union[Global[RedistributeProtocolIPv6], Variable] - route_policy: Optional[Union[Default[None], Global[UUID]]] = Field( - serialization_alias="routePolicy", validation_alias="routePolicy", default=None + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( + default=Default[None](value=None), + serialization_alias="routePolicy", + validation_alias="routePolicy", ) @@ -241,8 +244,8 @@ class AdvancedOspfv3Attributes(BaseModel): serialization_alias="defaultOriginate", validation_alias="defaultOriginate", default=None ) spf_timers: Optional[SpfTimers] = Field(serialization_alias="spfTimers", validation_alias="spfTimers", default=None) - policy_name: Optional[Union[Default[None], Global[UUID]]] = Field( - serialization_alias="policyName", validation_alias="policyName", default=None + policy_name: Optional[Union[Default[None], RefIdItem]] = Field( + default=Default[None](value=None), serialization_alias="policyName", validation_alias="policyName" ) filter: Optional[Union[Global[bool], Variable, Default[bool]]] = None diff --git a/catalystwan/models/configuration/feature_profile/sdwan/service/eigrp.py b/catalystwan/models/configuration/feature_profile/sdwan/service/eigrp.py index 8ea358da..0dc55d31 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/service/eigrp.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/service/eigrp.py @@ -6,7 +6,7 @@ from pydantic import AliasPath, BaseModel, ConfigDict, Field from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, _ParcelBase -from catalystwan.models.configuration.feature_profile.common import AddressWithMask +from catalystwan.models.configuration.feature_profile.common import AddressWithMask, RefIdItem EigrpAuthType = Literal[ "md5", @@ -71,7 +71,9 @@ class RedistributeIntoEigrp(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True, populate_by_name=True, extra="forbid") protocol: Union[Global[RedistributeProtocol], Variable] - route_policy: Optional[Union[Default[None], Global[UUID]]] = Default[None](value=None) + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( + default=Default[None](value=None), serialization_alias="routePolicy", validation_alias="routePolicy" + ) class AddressFamily(BaseModel): diff --git a/catalystwan/models/configuration/feature_profile/sdwan/service/lan/vpn.py b/catalystwan/models/configuration/feature_profile/sdwan/service/lan/vpn.py index aeadc7c1..3e45606f 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/service/lan/vpn.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/service/lan/vpn.py @@ -7,7 +7,13 @@ from pydantic import AliasPath, BaseModel, ConfigDict, Field, field_validator from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, _ParcelBase, as_default -from catalystwan.models.configuration.feature_profile.common import AddressWithMask, DNSIPv4, DNSIPv6, HostMapping +from catalystwan.models.configuration.feature_profile.common import ( + AddressWithMask, + DNSIPv4, + DNSIPv6, + HostMapping, + RefIdItem, +) ProtocolIPv4 = Literal[ "bgp", @@ -473,7 +479,7 @@ class RedistributeToService(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True, populate_by_name=True) protocol: Union[Variable, Global[RedistributeToServiceProtocol]] - policy: Union[Default[None], Global[UUID]] = Default[None](value=None) + policy: Union[Default[None], RefIdItem] = Default[None](value=None) class RedistributeToGlobal(BaseModel): @@ -489,7 +495,7 @@ class RouteLeakFromGlobal(BaseModel): route_protocol: Union[Variable, Global[RouteLeakFromGlobalProtocol]] = Field( serialization_alias="routeProtocol", validation_alias="routeProtocol" ) - route_policy: Optional[Union[Default[None], Global[UUID]]] = Field( + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( serialization_alias="routePolicy", validation_alias="routePolicy", default=None ) redistribute_to_protocol: Optional[List[RedistributeToService]] = Field( @@ -503,7 +509,7 @@ class RouteLeakFromService(BaseModel): route_protocol: Union[Variable, Global[RouteLeakFromServiceProtocol]] = Field( serialization_alias="routeProtocol", validation_alias="routeProtocol" ) - route_policy: Optional[Union[Default[None], Global[UUID]]] = Field( + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( serialization_alias="routePolicy", validation_alias="routePolicy", default=None ) redistribute_to_protocol: Optional[List[RedistributeToService]] = Field( @@ -518,7 +524,7 @@ class RouteLeakBetweenServices(BaseModel): route_protocol: Union[Variable, Global[RouteLeakFromServiceProtocol]] = Field( serialization_alias="routeProtocol", validation_alias="routeProtocol" ) - route_policy: Optional[Union[Default[None], Global[UUID]]] = Field( + route_policy: Optional[Union[Default[None], RefIdItem]] = Field( serialization_alias="routePolicy", validation_alias="routePolicy", default=None ) redistribute_to_protocol: Optional[List[RedistributeToService]] = Field( From fe11ee913b61117e4a39d3ea2ee3a8588d6ef3f5 Mon Sep 17 00:00:00 2001 From: Jakub Krajewski Date: Thu, 12 Sep 2024 20:38:55 +0200 Subject: [PATCH 2/2] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 185c64c4..57579a90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "catalystwan" -version = "0.35.3dev1" +version = "0.35.3dev2" description = "Cisco Catalyst WAN SDK for Python" authors = ["kagorski "] readme = "README.md"