Files
infix/test/case/ietf_interfaces/bridge_fwd_sgl_dut/test.py
T
Jon-Olov Vatn 272a7c1e69 Formatting fixes for test specification and topologies
Also including some existing test to test specification, from ietf_system
and ietf_interfaces directories.
2024-10-17 15:11:12 +02:00

78 lines
2.3 KiB
Python
Executable File

#!/usr/bin/env python3
r"""
Bridge forwarding single DUTs
Tests forwarding through a DUT with two bridged interfaces on one DUT.
....
,------------------------------------------,
| |
| br0 |
| / \ |
| target:mgmt target:data1 target:data2 |
'------------------------------------------'
| | |
| | |
,------------------------------------------,
| host:mgmt host:data1 host:data2 |
| [10.0.0.1] [10.0.0.2] |
| (ns0) (ns1) |
| |
| [ HOST ] |
'------------------------------------------'
....
"""
import infamy
with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
with test.step("Configure a bridge with dual physical port"):
_, tport1 = env.ltop.xlate("target", "data1")
_, tport2 = env.ltop.xlate("target", "data2")
target.put_config_dict("ietf-interfaces", {
"interfaces": {
"interface": [
{
"name": "br0",
"type": "infix-if-type:bridge",
"enabled": True,
},
{
"name": tport1,
"enabled": True,
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
},
{
"name": tport2,
"enabled": True,
"infix-interfaces:bridge-port": {
"bridge": "br0"
}
}
]
}
})
with test.step("Verify ping from host:data1 to 10.0.0.2"):
_, hport1 = env.ltop.xlate("host", "data1")
_, hport2 = env.ltop.xlate("host", "data2")
with infamy.IsolatedMacVlan(hport1) as ns1, \
infamy.IsolatedMacVlan(hport2) as ns2 :
ns2.addip("10.0.0.2")
ns1.addip("10.0.0.1")
ns1.must_reach("10.0.0.2")
test.succeed()