Files
infix/test/case/interfaces/bridge_fwd_sgl_dut/test.py
T
Joachim Wiberg 1bbd80d8c7 test: drop leading ietf/infix prefix from directories
Let's drop the leading IETF or Infix prefixes from tests.  Initially the
idea was to mimnic the YANG models, but it's difficult to navigate and
does not provide any real benefit to developers or end-users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-11-20 20:23:23 +01: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()