Skip to content

Commit

Permalink
WIP test l2vpn processing edge cases / errors
Browse files Browse the repository at this point in the history
  • Loading branch information
loulecrivain committed Jul 17, 2024
1 parent a0606b6 commit 2f37831
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cosmo/tests/test_case_l2x_err_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
device_list:
- device_type:
slug: S9510-28DC-BN0B
id: '17649'
interfaces: []
name: TEST0001
platform:
manufacturer:
slug: rtbrick
slug: rtbrick-consolidated-bng-q2a-24-1-1-1
primary_ip4:
address: 198.51.100.15/24
serial: ''
staticroute_set: []
l2vpn_list: []
vrf_list: []
21 changes: 21 additions & 0 deletions cosmo/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@ def test_router_platforms(capsys):
assert "unsupported platform vendor: ACME" in capsys.readouterr().err


def test_l2vpn_errors(capsys):
template = _yaml_load("./test_case_l2x_err_template.yaml")

vpws_incorrect_terminations = template
vpws_incorrect_terminations['l2vpn_list'].append({
'id': '53',
'identifier': None,
'name': 'WAN: incorrect VPWS',
'type': 'VPWS',
'terminations': [
{}, {}, {}
]
})

RouterSerializer(device=vpws_incorrect_terminations['device_list'][0],
l2vpn_list=vpws_incorrect_terminations['l2vpn_list'],
vrfs=vpws_incorrect_terminations['vrf_list'])

assert "VPWS circuits are only allowed to have two terminations"\
in capsys.readouterr().err

def test_router_physical_interface():
[sd] = get_router_sd_from_path("./test_case_1.yaml")

Expand Down

0 comments on commit 2f37831

Please sign in to comment.