Skip to content

Commit

Permalink
test internal serializer vendor representation
Browse files Browse the repository at this point in the history
+ err on unsupported vendor
  • Loading branch information
loulecrivain committed Jul 17, 2024
1 parent 8d37294 commit a0606b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cosmo/tests/test_case_vendor_unknown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
device_list:
- device_type:
slug: r2000
id: '1999'
interfaces: []
name: TEST0001
platform:
manufacturer:
slug: ACME
slug: coyote-0-2-1-rc1
primary_ip4:
address: 45.139.136.10/24
serial: 4242
staticroute_set: []
l2vpn_list: []
vrf_list: []
17 changes: 17 additions & 0 deletions cosmo/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ def get_switch_sd_from_path(path):
return list(map(lambda s: s.serialize(), get_switch_s_from_path(path)))


def test_router_platforms(capsys):
[juniper_s] = get_router_s_from_path("./test_case_2.yaml")
assert juniper_s.mgmt_routing_instance == "mgmt_junos"
assert juniper_s.mgmt_interface == "fxp0"
assert juniper_s.bmc_interface == None
assert juniper_s.lo_interface == "lo0"

[rtbrick_s] = get_router_s_from_path("./test_case_l3vpn.yml")
assert rtbrick_s.mgmt_routing_instance == "mgmt"
assert rtbrick_s.mgmt_interface == "ma1"
assert rtbrick_s.bmc_interface == "bmc0"
assert rtbrick_s.lo_interface == "lo-0/0/0"

get_router_s_from_path("./test_case_vendor_unknown.yaml")
assert "unsupported platform vendor: ACME" 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 a0606b6

Please sign in to comment.