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

Commit

Permalink
Merge pull request #823 from cisco-open/fix/route-policy-fields
Browse files Browse the repository at this point in the history
dev: Fix/route policy fields
  • Loading branch information
jpkrajewski authored Sep 13, 2024
2 parents 6c6b225 + fe11ee9 commit 907da38
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -191,17 +190,21 @@ 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",
)


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",
)


Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <kagorski@cisco.com>"]
readme = "README.md"
Expand Down

0 comments on commit 907da38

Please sign in to comment.