This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add merge function for pim igmp and multicast, fix nested template da…
…ta structure, add multicast to transform fuction. add tests. This should be followed by PR that sets up logic for assinging subparcels to vpn
- Loading branch information
1 parent
cafc368
commit 38e8373
Showing
12 changed files
with
416 additions
and
83 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
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
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
92 changes: 92 additions & 0 deletions
92
catalystwan/tests/config_migration/test_device_template_with_info.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,92 @@ | ||
import unittest | ||
|
||
from catalystwan.api.templates.device_template.device_template import GeneralTemplate | ||
from catalystwan.models.configuration.config_migration import DeviceTemplateWithInfo | ||
|
||
|
||
class TestDeviceTemplate(unittest.TestCase): | ||
def setUp(self): | ||
self.device_template = DeviceTemplateWithInfo( | ||
template_id="1", | ||
factory_default=False, | ||
devices_attached=2, | ||
template_name="DT-example", | ||
template_description="DT-example", | ||
device_role="None", | ||
device_type="None", | ||
security_policy_id="None", | ||
policy_id="None", | ||
generalTemplates=[ | ||
# Flat - stays flat | ||
GeneralTemplate(name="1level", templateId="1", templateType="cedge_aaa", subTemplates=[]), | ||
# No relation between system and logging in the UX2 - flatten them | ||
GeneralTemplate( | ||
name="1level", | ||
templateId="2", | ||
templateType="cisco_system", | ||
subTemplates=[ | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="3", | ||
templateType="cisco_logging", | ||
subTemplates=[], | ||
), | ||
], | ||
), | ||
# Cisco VPN - keep the structure | ||
GeneralTemplate( | ||
name="1level", | ||
templateId="4", | ||
templateType="cisco_vpn", | ||
subTemplates=[ | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="5", | ||
templateType="cisco_vpn_interface", | ||
subTemplates=[], | ||
), | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="6", | ||
templateType="cedge_multicast", | ||
subTemplates=[], | ||
), | ||
], | ||
), | ||
], | ||
) | ||
|
||
def test_flatten_general_templates(self): | ||
self.maxDiff = None | ||
self.assertEqual( | ||
self.device_template.get_flattened_general_templates(), | ||
[ | ||
GeneralTemplate(name="1level", templateId="1", templateType="cedge_aaa", subTemplates=[]), | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="3", | ||
templateType="cisco_logging", | ||
subTemplates=[], | ||
), | ||
GeneralTemplate(name="1level", templateId="2", templateType="cisco_system", subTemplates=[]), | ||
GeneralTemplate( | ||
name="1level", | ||
templateId="4", | ||
templateType="cisco_vpn", | ||
subTemplates=[ | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="5", | ||
templateType="cisco_vpn_interface", | ||
subTemplates=[], | ||
), | ||
GeneralTemplate( | ||
name="2level", | ||
templateId="6", | ||
templateType="cedge_multicast", | ||
subTemplates=[], | ||
), | ||
], | ||
), | ||
], | ||
) |
Oops, something went wrong.