mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
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>
146 lines
5.2 KiB
Python
Executable File
146 lines
5.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
r"""
|
|
Bridge forwarding dual DUTs
|
|
|
|
Ping through two bridges on two different DUTs.
|
|
|
|
....
|
|
|
|
.-------------------------. .-------------------------.
|
|
| [ DUT1 ] link | | link [ DUT2 ] |
|
|
| br0 -----|-------|----- br0 |
|
|
| / | | / \ |
|
|
| mgmt data1 | | data1 data2 mgmt |
|
|
'-------------------------' '-------------------------'
|
|
| | | | |
|
|
| | | | |
|
|
.---------------------------------------------------------------.
|
|
| mgmt1 data11 data21 data22 mgmt2 |
|
|
| [10.0.0.2] [10.0.0.3] [10.0.0.4] |
|
|
| (ns11) (ns20) (ns21) |
|
|
| |
|
|
| [ HOST ] |
|
|
'---------------------------------------------------------------'
|
|
|
|
....
|
|
|
|
"""
|
|
|
|
import infamy
|
|
|
|
with infamy.Test() as test:
|
|
with test.step("Set up topology and attach to target DUT"):
|
|
env = infamy.Env()
|
|
dut1 = env.attach("dut1", "mgmt")
|
|
dut2 = env.attach("dut2", "mgmt")
|
|
|
|
with test.step("Configure a bridge with triple physical port"):
|
|
_, tport11 = env.ltop.xlate("dut1", "data1")
|
|
_, tport1_link = env.ltop.xlate("dut1", "link")
|
|
_, tport21 = env.ltop.xlate("dut2", "data1")
|
|
_, tport22 = env.ltop.xlate("dut2", "data2")
|
|
_, tport2_link = env.ltop.xlate("dut2", "link")
|
|
|
|
dut1.put_config_dict("ietf-interfaces", {
|
|
"interfaces": {
|
|
"interface": [
|
|
{
|
|
"name": "br0",
|
|
"type": "infix-if-type:bridge",
|
|
"enabled": True,
|
|
"bridge": {
|
|
"vlans": {
|
|
"vlan": [
|
|
{
|
|
"vid": 10,
|
|
"untagged": [ tport11 ],
|
|
"tagged": [ "br0", tport1_link ]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": tport11,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"pvid": 10,
|
|
"bridge": "br0"
|
|
}
|
|
},
|
|
{
|
|
"name": tport1_link,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"bridge": "br0",
|
|
}
|
|
}
|
|
]
|
|
}
|
|
})
|
|
|
|
dut2.put_config_dict("ietf-interfaces", {
|
|
"interfaces": {
|
|
"interface": [
|
|
{
|
|
"name": "br0",
|
|
"type": "infix-if-type:bridge",
|
|
"enabled": True,
|
|
"bridge": {
|
|
"vlans": {
|
|
"vlan": [
|
|
{
|
|
"vid": 10,
|
|
"untagged": [ tport21, tport22 ],
|
|
"tagged": [ "br0", tport2_link ]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": tport21,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"pvid": 10,
|
|
"bridge": "br0"
|
|
}
|
|
},
|
|
{
|
|
"name": tport22,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"pvid": 10,
|
|
"bridge": "br0"
|
|
}
|
|
},
|
|
{
|
|
"name": tport2_link,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"bridge": "br0",
|
|
}
|
|
}
|
|
]
|
|
}
|
|
})
|
|
|
|
with test.step("Verify ping 10.0.0.3 and 10.0.0.4 from host:data11"):
|
|
|
|
_, hport11 = env.ltop.xlate("host", "data11")
|
|
_, hport21 = env.ltop.xlate("host", "data21")
|
|
_, hport22 = env.ltop.xlate("host", "data22")
|
|
|
|
with infamy.IsolatedMacVlan(hport11) as ns11, \
|
|
infamy.IsolatedMacVlan(hport21) as ns21, \
|
|
infamy.IsolatedMacVlan(hport22) as ns22:
|
|
|
|
ns11.addip("10.0.0.2")
|
|
ns21.addip("10.0.0.3")
|
|
ns22.addip("10.0.0.4")
|
|
|
|
ns11.must_reach("10.0.0.3")
|
|
ns11.must_reach("10.0.0.4")
|
|
|
|
test.succeed()
|