mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-28 11:43:01 +02:00
This can now a days be inferred and isn't needed. Also, the interface type in virtual testing is now etherlike not ethernet. Signed-off-by: Richard Alpe <richard@bit42.se>
63 lines
1.8 KiB
Python
Executable File
63 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# PING --> br0 10.0.0.2
|
|
# /
|
|
# PC ---- e0
|
|
#
|
|
|
|
import infamy
|
|
|
|
with infamy.Test() as test:
|
|
with test.step("Initialize"):
|
|
env = infamy.Env(infamy.std_topology("1x2"))
|
|
target = env.attach("target", "mgmt")
|
|
|
|
with test.step("Configure single bridge with a single physical port, bridge @ IP 10.0.0.2"):
|
|
_, tport = env.ltop.xlate("target", "data")
|
|
|
|
target.put_config_dict("ietf-interfaces", {
|
|
"interfaces": {
|
|
"interface": [
|
|
{
|
|
"name": "br0",
|
|
"type": "infix-if-type:bridge",
|
|
"enabled": True,
|
|
"ipv4": {
|
|
"address": [
|
|
{
|
|
"ip": "10.0.0.2",
|
|
"prefix-length": 24,
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": tport,
|
|
"enabled": True,
|
|
"infix-interfaces:bridge-port": {
|
|
"bridge": "br0"
|
|
}
|
|
},
|
|
]
|
|
}
|
|
})
|
|
|
|
with test.step("Ping bridge 10.0.0.2 from host:data with IP 10.0.0.1"):
|
|
_, hport = env.ltop.xlate("host", "data")
|
|
|
|
with infamy.IsolatedMacVlan(hport) as ns:
|
|
pingtest = ns.runsh("""
|
|
set -ex
|
|
|
|
ip link set iface up
|
|
ip addr add 10.0.0.1/24 dev iface
|
|
|
|
ping -c1 -w5 10.0.0.2 || exit 1
|
|
""")
|
|
|
|
if pingtest.returncode:
|
|
print(pingtest.stdout)
|
|
test.fail()
|
|
|
|
test.succeed()
|