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

Commit

Permalink
Added Multilink model and converter (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzeG authored May 16, 2024
1 parent c8638c0 commit 6d0bb94
Show file tree
Hide file tree
Showing 19 changed files with 1,656 additions and 101 deletions.
124 changes: 120 additions & 4 deletions catalystwan/integration_tests/feature_profile/sdwan/test_service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
from ipaddress import IPv4Address
from ipaddress import IPv4Address, IPv6Interface
from typing import Literal
from uuid import UUID

from catalystwan.api.configuration_groups.parcel import Global, as_global, as_variable
from catalystwan.api.configuration_groups.parcel import Default, Global, as_global, as_variable
from catalystwan.integration_tests.feature_profile.sdwan.base import TestFeatureProfileModels
from catalystwan.models.common import SubnetMask
from catalystwan.models.configuration.feature_profile.common import AddressWithMask
from catalystwan.models.common import (
CableLengthLongValue,
ClockRate,
E1Framing,
E1Linecode,
LineMode,
SubnetMask,
T1Framing,
T1Linecode,
)
from catalystwan.models.configuration.feature_profile.common import (
AddressWithMask,
ChannelGroup,
MultilinkAuthenticationType,
MultilinkClockSource,
MultilinkControllerTxExList,
MultilinkControllerType,
MultilinkMethod,
MultilinkNimList,
MultilinkTxExName,
)
from catalystwan.models.configuration.feature_profile.sdwan.service.acl import Ipv4AclParcel, Ipv6AclParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.dhcp_server import (
AddressPool,
Expand All @@ -18,6 +38,7 @@
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.ethernet import InterfaceEthernetParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.gre import BasicGre, InterfaceGreParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.ipsec import InterfaceIpsecParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.multilink import InterfaceMultilinkParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.svi import InterfaceSviParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.vpn import LanVpnParcel
from catalystwan.models.configuration.feature_profile.sdwan.service.multicast import (
Expand Down Expand Up @@ -538,6 +559,101 @@ def test_when_routing_parcel_and_vpn_uuid_present_expect_create_then_assign_to_v
# Assert
assert parcel_id

def test_when_fully_specified_multilink_interface_parcel_expect_successful_post(self):
nim_list = [
MultilinkNimList(
if_name=Global[str](value="Serial1"),
bandwidth=Global[int](value=10),
clock_rate=Global[ClockRate](value="1200"),
description=Global[str](value="desc"),
),
MultilinkNimList(
if_name=Global[str](value="Serial2"),
bandwidth=Global[int](value=12),
clock_rate=Global[ClockRate](value="115200"),
description=None,
),
]
controller_tx_ex_list = [
MultilinkControllerTxExList(
channel_group=[
ChannelGroup(
number=Global[int](value=12),
timeslots=Global[str](value="12"),
)
],
number=Global[str](value="1/1/1"),
clock_source=Global[MultilinkClockSource](value="internal"),
description=Global[str](value="desc"),
e1_framing=Global[E1Framing](value="crc4"),
e1_linecode=Global[E1Linecode](value="ami"),
line_mode=Global[LineMode](value="primary"),
long=None,
name=Global[MultilinkTxExName](value="E1"),
short=None,
t1_framing=None,
t1_linecode=None,
),
MultilinkControllerTxExList(
channel_group=[
ChannelGroup(
number=Global[int](value=13),
timeslots=Global[str](value="13"),
)
],
number=Global[str](value="2/2/2"),
clock_source=Global[MultilinkClockSource](value="loop-timed"),
description=Global[str](value="desc"),
e1_framing=None,
e1_linecode=None,
line_mode=Global[LineMode](value="secondary"),
long=Global[CableLengthLongValue](value="-15db"),
name=Global[MultilinkTxExName](value="T1"),
short=None,
t1_framing=Global[T1Framing](value="esf"),
t1_linecode=Global[T1Linecode](value="ami"),
),
]

multilink_parcel = InterfaceMultilinkParcel(
parcel_name="Test",
parcel_description="Description",
group_number=Global[int](value=299),
if_name=Global[str](value="Multilink1"),
method=Global[Literal[MultilinkMethod]](value="CHAP"),
address_ipv4=Global[IPv4Address](value=IPv4Address("192.175.48.4")),
address_ipv6=Global[IPv6Interface](value=IPv6Interface("::3e46/100")),
authentication_type=Default[Literal[MultilinkAuthenticationType]](value="unidirectional"),
bandwidth_upstream=Global[int](value=21),
clear_dont_fragment_sdwan_tunnel=Global[bool](value=True),
control_connections=Global[bool](value=False),
controller_tx_ex_list=controller_tx_ex_list,
controller_type=Global[Literal[MultilinkControllerType]](value="T1/E1"),
delay_value=Global[int](value=99),
disable=Global[bool](value=True),
hostname=Global[str](value="oitSeZBfw"),
interleave=Global[bool](value=False),
ip_directed_broadcast=Global[bool](value=True),
ipv4_acl_egress=None,
ipv4_acl_ingress=None,
ipv6_acl_egress=None,
ipv6_acl_ingress=None,
mask_ipv4=Global[SubnetMask](value="255.255.255.254"),
mtu=Global[int](value=5266),
nim_list=nim_list,
password=Global[str](value="hyBBiuDgO"),
ppp_auth_password=Global[str](value="aCBBBxnzsw"),
shaping_rate=Global[int](value=294),
shutdown=Global[bool](value=False),
tcp_mss_adjust=Global[int](value=1267),
tloc_extension=Global[str](value="ATM"),
username_string=Global[str](value="ONBBAAB"),
)

parcel_id = self.api.create_parcel(self.profile_uuid, multilink_parcel, self.vpn_parcel_uuid).id

assert parcel_id

@classmethod
def tearDownClass(cls) -> None:
cls.api.delete_profile(cls.profile_uuid)
Expand Down
164 changes: 156 additions & 8 deletions catalystwan/integration_tests/feature_profile/sdwan/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,35 @@
from catalystwan.api.configuration_groups.parcel import Default, Global, Variable, as_global
from catalystwan.integration_tests.feature_profile.sdwan.base import TestFeatureProfileModels
from catalystwan.models.common import (
CableLengthLongValue,
Carrier,
ClockRate,
CoreRegion,
E1Framing,
E1Linecode,
EncapType,
IkeCiphersuite,
IkeGroup,
IpsecCiphersuite,
LineMode,
SecondaryRegion,
T1Framing,
T1Linecode,
TLOCColor,
)
from catalystwan.models.configuration.feature_profile.common import AclQos
from catalystwan.models.configuration.feature_profile.common import AddressWithMask as CommonPrefix
from catalystwan.models.configuration.feature_profile.common import (
AdvancedGre,
AllowService,
ChannelGroup,
MultilinkAuthenticationType,
MultilinkClockSource,
MultilinkControllerTxExList,
MultilinkControllerType,
MultilinkMethod,
MultilinkNimList,
MultilinkTxExName,
MultiRegionFabric,
ShapingRateDownstreamConfig,
ShapingRateUpstreamConfig,
Expand All @@ -41,20 +56,13 @@
E1,
T1,
CableLengthLong,
ChannelGroup,
ClockSource,
ControllerTxExList,
ControllerType,
E1Basic,
E1Framing,
E1Linecode,
LengthLong,
LineMode,
Long,
T1Basic,
T1E1ControllerParcel,
T1Framing,
T1Linecode,
)
from catalystwan.models.configuration.feature_profile.sdwan.transport.vpn import (
Address64V4PoolItem,
Expand Down Expand Up @@ -88,6 +96,9 @@
InterfaceIpsecParcel,
PerfectForwardSecrecy,
)
from catalystwan.models.configuration.feature_profile.sdwan.transport.wan.interface.multilink import (
InterfaceMultilinkParcel,
)
from catalystwan.models.configuration.feature_profile.sdwan.transport.wan.interface.protocol_over import (
AclQos as AclQosPPPoE,
)
Expand Down Expand Up @@ -232,7 +243,7 @@ def test_when_fully_specified_t1e1controller_type_t1_parcel_expect_successful_po
),
cable=CableLengthLong(
cable_length=as_global("long", Long),
length_long=as_global("-15db", LengthLong),
length_long=as_global("-15db", CableLengthLongValue),
),
channel_group=[
ChannelGroup(
Expand Down Expand Up @@ -916,6 +927,143 @@ def test_when_fully_specified_cellular_interface_parcel_expect_successful_post(s
# Assert
assert parcel_id

def test_when_fully_specified_multilink_interface_parcel_expect_successful_post(self):
nim_list = [
MultilinkNimList(
if_name=Global[str](value="Serial1"),
bandwidth=Global[int](value=10),
clock_rate=Global[ClockRate](value="1200"),
description=Global[str](value="desc"),
),
MultilinkNimList(
if_name=Global[str](value="Serial2"),
bandwidth=Global[int](value=12),
clock_rate=Global[ClockRate](value="115200"),
description=None,
),
]
controller_tx_ex_list = [
MultilinkControllerTxExList(
channel_group=[
ChannelGroup(
number=Global[int](value=12),
timeslots=Global[str](value="12"),
)
],
number=Global[str](value="1/1/1"),
clock_source=Global[MultilinkClockSource](value="internal"),
description=Global[str](value="desc"),
e1_framing=Global[E1Framing](value="crc4"),
e1_linecode=Global[E1Linecode](value="ami"),
line_mode=Global[LineMode](value="primary"),
long=None,
name=Global[MultilinkTxExName](value="E1"),
short=None,
t1_framing=None,
t1_linecode=None,
),
MultilinkControllerTxExList(
channel_group=[
ChannelGroup(
number=Global[int](value=13),
timeslots=Global[str](value="13"),
)
],
number=Global[str](value="2/2/2"),
clock_source=Global[MultilinkClockSource](value="loop-timed"),
description=Global[str](value="desc"),
e1_framing=None,
e1_linecode=None,
line_mode=Global[LineMode](value="secondary"),
long=Global[CableLengthLongValue](value="-15db"),
name=Global[MultilinkTxExName](value="T1"),
short=None,
t1_framing=Global[T1Framing](value="esf"),
t1_linecode=Global[T1Linecode](value="ami"),
),
]
multilink_parcel = InterfaceMultilinkParcel(
parcel_name="Test",
parcel_description="Description",
group_number=Global[int](value=299),
if_name=Global[str](value="Multilink1"),
method=Global[Literal[MultilinkMethod]](value="CHAP"),
address_ipv4=Global[IPv4Address](value=IPv4Address("192.175.48.4")),
address_ipv6=Global[IPv6Interface](value=IPv6Interface("::3e46/100")),
all=Global[bool](value=True),
authentication_type=Default[Literal[MultilinkAuthenticationType]](value="unidirectional"),
bandwidth_upstream=Global[int](value=21),
bgp=Global[bool](value=True),
bind=Global[str](value="JmwcJz"),
border=Global[bool](value=True),
carrier=Global[Literal[Carrier]](value="carrier8"),
clear_dont_fragment_sdwan_tunnel=Global[bool](value=True),
control_connections=Global[bool](value=False),
controller_tx_ex_list=controller_tx_ex_list,
controller_type=Global[Literal[MultilinkControllerType]](value="T1/E1"),
delay_value=Global[int](value=99),
dhcp=Global[bool](value=False),
disable=Global[bool](value=True),
dns=Global[bool](value=False),
exclude_controller_group_list=Global[str](value="12 13 14"),
gre_encap=Global[bool](value=True),
gre_preference=Global[int](value=91),
gre_weight=Global[int](value=48),
groups=Global[int](value=363),
hello_interval=Global[int](value=224),
hello_tolerance=Global[int](value=214),
hostname=Global[str](value="oitSeZBfw"),
https=Global[bool](value=False),
icmp=Global[bool](value=True),
interleave=Global[bool](value=False),
ip_directed_broadcast=Global[bool](value=True),
ipsec_encap=Global[bool](value=False),
ipsec_preference=Global[int](value=498),
ipsec_weight=Global[int](value=135),
ipv4_acl_egress=None,
ipv4_acl_ingress=None,
ipv6_acl_egress=None,
ipv6_acl_ingress=None,
last_resort_circuit=Global[bool](value=True),
low_bandwidth_link=Global[bool](value=False),
mask_ipv4=Global[SubnetMask](value="255.255.255.254"),
max_control_connections=Global[int](value=50),
mtu=Global[int](value=5266),
multi_region_fabric=MultiRegionFabric(
core_region=None,
enable_core_region=None,
enable_secondary_region=None,
secondary_region=None,
),
nat_refresh_interval=Global[int](value=33),
netconf=Global[bool](value=False),
network_broadcast=Global[bool](value=False),
nim_list=nim_list,
ntp=Global[bool](value=True),
ospf=Global[bool](value=True),
password=Global[str](value="hyBBiuDgO"),
port_hop=Global[bool](value=False),
ppp_auth_password=Global[str](value="aCBBBxnzsw"),
restrict=Global[bool](value=False),
shaping_rate=Global[int](value=294),
shutdown=Global[bool](value=False),
snmp=Global[bool](value=False),
sshd=Global[bool](value=False),
stun=Global[bool](value=False),
tcp_mss_adjust=Global[int](value=1267),
tloc_extension=Global[str](value="ATM"),
tunnel_interface=Global[bool](value=True),
tunnel_tcp_mss_adjust=Global[int](value=1269),
username_string=Global[str](value="ONBBAAB"),
value=Global[Literal[TLOCColor]](value="silver"),
vbond_as_stun_server=Global[bool](value=False),
vmanage_connection_preference=Global[int](value=7),
)

parcel_id = self.api.create_parcel(self.profile_uuid, multilink_parcel, self.wan_uuid).id

assert parcel_id

@classmethod
def tearDownClass(cls) -> None:
cls.api.delete_profile(cls.profile_uuid)
Expand Down
Loading

0 comments on commit 6d0bb94

Please sign in to comment.