This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Interface GRE model. Add unittests. Add integration tests. Change…
… feature profile integration test structure. Add more Castable literals to the normalizer. Change name factory method to parcel_factory. Change VPN model type to lan/vpn.
- Loading branch information
1 parent
72dc539
commit 5b0b70f
Showing
16 changed files
with
340 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
catalystwan/integration_tests/feature_profile/sdwan/base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import unittest | ||
from typing import cast | ||
|
||
from catalystwan.session import create_manager_session | ||
|
||
|
||
class TestFeatureProfileModels(unittest.TestCase): | ||
def setUp(self) -> None: | ||
# TODO: Add those params to PyTest | ||
self.session = create_manager_session( | ||
url=cast(str, os.environ.get("TEST_VMANAGE_URL", "localhost")), | ||
port=cast(int, int(os.environ.get("TEST_VMANAGE_PORT", 443))), # type: ignore | ||
username=cast(str, os.environ.get("TEST_VMANAGE_USERNAME", "admin")), | ||
password=cast(str, os.environ.get("TEST_VMANAGE_PASSWORD", "admin")), | ||
) |
59 changes: 0 additions & 59 deletions
59
catalystwan/integration_tests/feature_profile/sdwan/service/test_models.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
catalystwan/integration_tests/feature_profile/sdwan/test_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from ipaddress import IPv4Address | ||
|
||
from catalystwan.api.configuration_groups.parcel import Global, as_global | ||
from catalystwan.integration_tests.feature_profile.sdwan.base import TestFeatureProfileModels | ||
from catalystwan.models.configuration.feature_profile.sdwan.service.dhcp_server import ( | ||
AddressPool, | ||
LanVpnDhcpServerParcel, | ||
SubnetMask, | ||
) | ||
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.gre import BasicGre, InterfaceGreParcel | ||
from catalystwan.models.configuration.feature_profile.sdwan.service.lan.vpn import LanVpnParcel | ||
|
||
|
||
class TestServiceFeatureProfileModels(TestFeatureProfileModels): | ||
def setUp(self) -> None: | ||
super().setUp() | ||
self.api = self.session.api.sdwan_feature_profiles.service | ||
self.profile_uuid = self.api.create_profile("TestProfileService", "Description").id | ||
|
||
def test_when_default_values_dhcp_server_parcel_expect_successful_post(self): | ||
# Arrange | ||
dhcp_server_parcel = LanVpnDhcpServerParcel( | ||
parcel_name="DhcpServerDefault", | ||
parcel_description="Dhcp Server Parcel", | ||
address_pool=AddressPool( | ||
network_address=Global[IPv4Address](value=IPv4Address("10.0.0.2")), | ||
subnet_mask=Global[SubnetMask](value="255.255.255.255"), | ||
), | ||
) | ||
# Act | ||
parcel_id = self.api.create_parcel(self.profile_uuid, dhcp_server_parcel).id | ||
# Assert | ||
assert parcel_id | ||
|
||
def test_when_default_values_service_vpn_parcel_expect_successful_post(self): | ||
# Arrange | ||
vpn_parcel = LanVpnParcel( | ||
parcel_name="TestVpnParcel", | ||
parcel_description="Test Vpn Parcel", | ||
vpn_id=Global[int](value=2), | ||
) | ||
# Act | ||
parcel_id = self.api.create_parcel(self.profile_uuid, vpn_parcel).id | ||
# Assert | ||
assert parcel_id | ||
|
||
def tearDown(self) -> None: | ||
self.api.delete_profile(self.profile_uuid) | ||
self.session.close() | ||
|
||
|
||
class TestServiceFeatureProfileVPNInterfaceModels(TestFeatureProfileModels): | ||
def setUp(self) -> None: | ||
super().setUp() | ||
self.api = self.session.api.sdwan_feature_profiles.service | ||
self.profile_uuid = self.api.create_profile("TestProfileService", "Description").id | ||
self.vpn_parcel_uuid = self.api.create_parcel( | ||
self.profile_uuid, | ||
LanVpnParcel( | ||
parcel_name="TestVpnParcel", parcel_description="Test Vpn Parcel", vpn_id=Global[int](value=2) | ||
), | ||
).id | ||
|
||
def test_when_default_values_gre_parcel_expect_successful_post(self): | ||
# Arrange | ||
gre_parcel = InterfaceGreParcel( | ||
parcel_name="TestGreParcel", | ||
parcel_description="Test Gre Parcel", | ||
basic=BasicGre(if_name=as_global("gre1"), tunnel_destination=as_global(IPv4Address("4.4.4.4"))), | ||
) | ||
# Act | ||
parcel_id = self.api.create_parcel(self.profile_uuid, gre_parcel, self.vpn_parcel_uuid).id | ||
# Assert | ||
assert parcel_id | ||
|
||
def tearDown(self) -> None: | ||
self.api.delete_profile(self.profile_uuid) | ||
self.session.close() |
Oops, something went wrong.