Skip to content

Commit

Permalink
fix: data policy nextHopIpv6 action set entry
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Nov 21, 2024
1 parent b174f42 commit 96ef2e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions catalystwan/models/policy/definition/traffic_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023 Cisco Systems, Inc. and its affiliates

from ipaddress import IPv4Address, IPv4Network, IPv6Network
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
from typing import List, Literal, Optional, Set, Tuple, Union, overload
from uuid import UUID

Expand Down Expand Up @@ -49,6 +49,7 @@
Match,
NATAction,
NextHopActionEntry,
NextHopIpv6ActionEntry,
NextHopLooseEntry,
PacketLengthEntry,
PLPEntry,
Expand Down Expand Up @@ -274,8 +275,11 @@ def associate_nat_action(
self._insert_action(nat_action)

@accept_action
def associate_next_hop_action(self, next_hop: IPv4Address, loose: bool = False) -> None:
self._insert_action_in_set(NextHopActionEntry(value=next_hop))
def associate_next_hop_action(self, next_hop: Union[IPv4Address, IPv6Address], loose: bool = False) -> None:
if isinstance(next_hop, IPv6Address):
self._insert_action_in_set(NextHopIpv6ActionEntry(value=next_hop))
else:
self._insert_action_in_set(NextHopActionEntry(value=next_hop))
self._insert_action_in_set(NextHopLooseEntry(value=loose))

@accept_action
Expand Down
6 changes: 6 additions & 0 deletions catalystwan/models/policy/policy_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ class NextHopActionEntry(BaseModel):
value: Union[IPv4Address, IPv6Address]


class NextHopIpv6ActionEntry(BaseModel):
field: Literal["nextHopIpv6"] = "nextHopIpv6"
value: IPv6Address


class NextHopMatchEntry(BaseModel):
field: Literal["nextHop"] = "nextHop"
ref: UUID
Expand Down Expand Up @@ -1205,6 +1210,7 @@ class CloudSaaSAction(BaseModel):
MetricEntry,
MetricTypeEntry,
NextHopActionEntry,
NextHopIpv6ActionEntry,
NextHopLooseEntry,
OMPTagEntry,
OriginatorEntry,
Expand Down

0 comments on commit 96ef2e3

Please sign in to comment.