Skip to content

Commit

Permalink
test: update infix_dhcp test topologies
Browse files Browse the repository at this point in the history
  • Loading branch information
axkar committed Sep 9, 2024
1 parent c456fa1 commit ffb87cd
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 40 deletions.
8 changes: 4 additions & 4 deletions test/case/infix_dhcp/dhcp_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@
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": [{
"if-name": f"{port}"
}]
}
}
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()
17 changes: 8 additions & 9 deletions test/case/infix_dhcp/dhcp_basic/topology.dot
Original file line number Diff line number Diff line change
@@ -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 modified test/case/infix_dhcp/dhcp_basic/topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions test/case/infix_dhcp/dhcp_router/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
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": [{
Expand All @@ -33,9 +33,9 @@
}]
}
}
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()
17 changes: 8 additions & 9 deletions test/case/infix_dhcp/dhcp_router/topology.dot
Original file line number Diff line number Diff line change
@@ -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 modified test/case/infix_dhcp/dhcp_router/topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions test/case/infix_dhcp/dhcp_routes/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
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": [{
Expand All @@ -35,13 +35,13 @@
}]
}
}
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()
17 changes: 8 additions & 9 deletions test/case/infix_dhcp/dhcp_routes/topology.dot
Original file line number Diff line number Diff line change
@@ -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 modified test/case/infix_dhcp/dhcp_routes/topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ffb87cd

Please sign in to comment.