mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
test: update infix_dhcp test topologies
This commit is contained in:
committed by
Mattias Walström
parent
f5884098fb
commit
b963788fbc
@@ -18,13 +18,13 @@ with infamy.Test() as test:
|
||||
ADDRESS = '10.0.0.42'
|
||||
with test.step("Initialize"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
client = env.attach("client", "mgmt")
|
||||
_, host = env.ltop.xlate("host", "data")
|
||||
|
||||
with infamy.IsolatedMacVlan(host) as netns:
|
||||
netns.addip("10.0.0.1")
|
||||
with infamy.dhcp.Server(netns, ip=ADDRESS):
|
||||
_, port = env.ltop.xlate("target", "data")
|
||||
_, port = env.ltop.xlate("client", "data")
|
||||
config = {
|
||||
"dhcp-client": {
|
||||
"client-if": [{
|
||||
@@ -32,9 +32,9 @@ with infamy.Test() as test:
|
||||
}]
|
||||
}
|
||||
}
|
||||
target.put_config_dict("infix-dhcp-client", config)
|
||||
client.put_config_dict("infix-dhcp-client", config)
|
||||
|
||||
with test.step(f"Waiting for client to set DHCP lease {ADDRESS}"):
|
||||
until(lambda: iface.address_exist(target, port, ADDRESS))
|
||||
until(lambda: iface.address_exist(client, port, ADDRESS))
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
graph "1x2" {
|
||||
layout="neato";
|
||||
overlap="false";
|
||||
esep="+20";
|
||||
esep="+80";
|
||||
|
||||
node [shape=record, fontname="monospace"];
|
||||
edge [color="cornflowerblue", penwidth="2"];
|
||||
|
||||
host [
|
||||
label="host | { <tgt> tgt | <data> | data }",
|
||||
pos="0,12!",
|
||||
label="host \n(10.0.0.1) | { <tgt> tgt | <data> data }",
|
||||
pos="0,20!",
|
||||
kind="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data> data } | target",
|
||||
pos="10,12!",
|
||||
|
||||
client [
|
||||
label="{ <mgmt> mgmt | <data> data } | client",
|
||||
pos="200,20!",
|
||||
kind="infix",
|
||||
];
|
||||
|
||||
host:tgt -- target:mgmt [kind=mgmt]
|
||||
host:data -- target:data
|
||||
host:tgt -- client:mgmt [kind=mgmt, color=black, taillabel="10.0.0.42/24"]
|
||||
host:data -- client:data
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -16,13 +16,13 @@ with infamy.Test() as test:
|
||||
ROUTER = '192.168.0.254'
|
||||
with test.step("Initialize"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
client = env.attach("client", "mgmt")
|
||||
_, host = env.ltop.xlate("host", "data")
|
||||
|
||||
with infamy.IsolatedMacVlan(host) as netns:
|
||||
netns.addip("192.168.0.1")
|
||||
with infamy.dhcp.Server(netns, router=ROUTER):
|
||||
_, port = env.ltop.xlate("target", "data")
|
||||
_, port = env.ltop.xlate("client", "data")
|
||||
config = {
|
||||
"dhcp-client": {
|
||||
"client-if": [{
|
||||
@@ -33,9 +33,9 @@ with infamy.Test() as test:
|
||||
}]
|
||||
}
|
||||
}
|
||||
target.put_config_dict("infix-dhcp-client", config)
|
||||
client.put_config_dict("infix-dhcp-client", config)
|
||||
|
||||
with test.step(f"Wait for client to set up default route via {ROUTER}"):
|
||||
until(lambda: route.ipv4_route_exist(target, "0.0.0.0/0", ROUTER))
|
||||
until(lambda: route.ipv4_route_exist(client, "0.0.0.0/0", ROUTER))
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
graph "1x2" {
|
||||
layout="neato";
|
||||
overlap="false";
|
||||
esep="+20";
|
||||
esep="+80";
|
||||
|
||||
node [shape=record, fontname="monospace"];
|
||||
edge [color="cornflowerblue", penwidth="2"];
|
||||
|
||||
host [
|
||||
label="host | { <tgt> tgt | <data> | data }",
|
||||
pos="0,12!",
|
||||
label="host \n(192.168.0.1) | { <tgt> tgt | <data> data }",
|
||||
pos="0,20!",
|
||||
kind="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data> data } | target",
|
||||
pos="10,12!",
|
||||
|
||||
client [
|
||||
label="{ <mgmt> mgmt | <data> data } | client",
|
||||
pos="200,20!",
|
||||
kind="infix",
|
||||
];
|
||||
|
||||
host:tgt -- target:mgmt [kind=mgmt]
|
||||
host:data -- target:data
|
||||
host:tgt -- client:mgmt [kind=mgmt, color=black, taillabel="192.168.0.254/24"]
|
||||
host:data -- client:data
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 10 KiB |
@@ -17,13 +17,13 @@ with infamy.Test() as test:
|
||||
ROUTER = '192.168.0.254'
|
||||
with test.step("Initialize"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
client = env.attach("client", "mgmt")
|
||||
_, host = env.ltop.xlate("host", "data")
|
||||
|
||||
with infamy.IsolatedMacVlan(host) as netns:
|
||||
netns.addip("192.168.0.1")
|
||||
with infamy.dhcp.Server(netns, prefix=PREFIX, router=ROUTER):
|
||||
_, port = env.ltop.xlate("target", "data")
|
||||
_, port = env.ltop.xlate("client", "data")
|
||||
config = {
|
||||
"dhcp-client": {
|
||||
"client-if": [{
|
||||
@@ -35,13 +35,13 @@ with infamy.Test() as test:
|
||||
}]
|
||||
}
|
||||
}
|
||||
target.put_config_dict("infix-dhcp-client", config)
|
||||
client.put_config_dict("infix-dhcp-client", config)
|
||||
|
||||
with test.step(f"Verify client sets up correct route via {ROUTER}"):
|
||||
# Wait for client to set the classless static route, option 121
|
||||
until(lambda: route.ipv4_route_exist(target, PREFIX, ROUTER))
|
||||
until(lambda: route.ipv4_route_exist(client, PREFIX, ROUTER))
|
||||
# Ensure client did *not* use option 3 (option 121 takes precedence)
|
||||
if route.ipv4_route_exist(target, "0.0.0.0/0", ROUTER):
|
||||
if route.ipv4_route_exist(client, "0.0.0.0/0", ROUTER):
|
||||
test.fail()
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
graph "1x2" {
|
||||
layout="neato";
|
||||
overlap="false";
|
||||
esep="+20";
|
||||
esep="+100";
|
||||
|
||||
node [shape=record, fontname="monospace"];
|
||||
edge [color="cornflowerblue", penwidth="2"];
|
||||
|
||||
host [
|
||||
label="host | { <tgt> tgt | <data> | data }",
|
||||
pos="0,12!",
|
||||
label="host \n(10.0.0.0/24) | { <tgt> tgt | <data> data }",
|
||||
pos="0,20!",
|
||||
kind="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data> data } | target",
|
||||
pos="10,12!",
|
||||
|
||||
client [
|
||||
label="{ <mgmt> mgmt | <data> data } | client",
|
||||
pos="200,20!",
|
||||
kind="infix",
|
||||
];
|
||||
|
||||
host:tgt -- target:mgmt [kind=mgmt]
|
||||
host:data -- target:data
|
||||
host:tgt -- client:mgmt [kind=mgmt, color=black, taillabel="192.168.0.254/24"]
|
||||
host:data -- client:data
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user