Skip to content

Commit

Permalink
test: refactor test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
axkar committed Sep 3, 2024
1 parent e7c9f59 commit ffd2fe8
Show file tree
Hide file tree
Showing 106 changed files with 1,285 additions and 107 deletions.
23 changes: 12 additions & 11 deletions test/case/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@
- case: meta/wait.py

- name: Misc tests
suite: misc/all.yaml
suite: misc/misc.yaml

- name: ietf-system
suite: ietf_system/all.yaml
suite: ietf_system/ietf_system.yaml

- name: ietf-syslog
suite: ietf_syslog/all.yaml
suite: ietf_syslog/ietf_syslog.yaml

- name: ietf-interfaces
suite: ietf_interfaces/all.yaml
suite: ietf_interfaces/ietf_interfaces.yaml

- name: infix-interfaces
suite: infix_interfaces/all.yaml
suite: infix_interfaces/infix_interfaces.yaml

- name: ietf-routing
suite: ietf_routing/all.yaml
suite: ietf_routing/ietf_routing.yaml

- name: infix-containers
suite: infix_containers/all.yaml
suite: infix_containers/infix_containers.yaml

- name: infix-dhcp
suite: infix_dhcp/all.yaml
suite: infix_dhcp/infix_dhcp.yaml

- name: ietf-hardware
suite: ietf_hardware/all.yaml
#- name: infix-services
# suite: infix_services/all.yaml
suite: ietf_hardware/ietf_hardware.yaml

- name: infix-services
suite: infix_services/infix_services.yaml
2 changes: 0 additions & 2 deletions test/case/ietf_hardware/all.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions test/case/ietf_hardware/ietf_hardware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: usb
case: usb/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("1x1"))
env = infamy.Env()
target = env.attach("target", "mgmt")
available=usb.get_usb_ports(target)

Expand Down
23 changes: 23 additions & 0 deletions test/case/ietf_hardware/usb/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
graph "1x1" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
}
7 changes: 0 additions & 7 deletions test/case/ietf_interfaces/all.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions test/case/ietf_interfaces/ietf_interfaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: vlan_ping
case: vlan_ping/test.py

- name: ipv4_address
case: ipv4_address/test.py

- name: ipv6_address
case: ipv6_address/test.py

- name: iface_phys_address
case: iface_phys_address/test.py

- name: iface_status
case: iface_status/test.py

- name: routing_basic
case: routing_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("1x2"))
env = infamy.Env()
target = env.attach("target", "mgmt")
_, tport = env.ltop.xlate("target", "data")
pmac = iface.get_phys_address(target, tport)
Expand Down
24 changes: 24 additions & 0 deletions test/case/ietf_interfaces/iface_phys_address/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
graph "1x2" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt | <data> | data }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt | <data> data } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
host:data -- target:data
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import infamy
import infamy.iface as iface
import os


def print_err_msg(interface, param, val):
Expand All @@ -27,7 +28,7 @@ def asser_iface_exists(target, interface):

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("1x1"))
env = infamy.Env()
target = env.attach("target", "mgmt")

iface.print_all(target)
Expand Down
23 changes: 23 additions & 0 deletions test/case/ietf_interfaces/iface_status/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
graph "1x1" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

with infamy.Test() as test:
with test.step("Setup"):
env = infamy.Env(infamy.std_topology("1x1"))
env = infamy.Env()
target = env.attach("target", "mgmt")
_, interface_name = env.ltop.xlate("target", "mgmt")

Expand Down
23 changes: 23 additions & 0 deletions test/case/ietf_interfaces/ipv4_address/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
graph "1x1" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

with infamy.Test() as test:
with test.step("Initializing ..."):
env = infamy.Env(infamy.std_topology("1x2"))
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")

Expand Down
24 changes: 24 additions & 0 deletions test/case/ietf_interfaces/ipv6_address/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
graph "1x2" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt | <data> | data }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt | <data> data } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
host:data -- target:data
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def config_target(target, tport0, tport1, enable_fwd):

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("1x3"))
env = infamy.Env()
target = env.attach("target", "mgmt")
_, tport0 = env.ltop.xlate("target", "data0")
_, tport1 = env.ltop.xlate("target", "data1")
Expand Down
25 changes: 25 additions & 0 deletions test/case/ietf_interfaces/routing_basic/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
graph "1x3" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt | <data0> data0 | <data1> data1 }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt | <data0> data0 | <data1> data1 } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
host:data0 -- target:data0
host:data1 -- target:data1
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_ping(hport, should_pass):

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("1x2"))
env = infamy.Env()
target = env.attach("target", "mgmt")

with test.step("Configure VLAN 10 on target:data with IP 10.0.0.2"):
Expand Down
24 changes: 24 additions & 0 deletions test/case/ietf_interfaces/vlan_ping/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
graph "1x2" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <tgt> tgt | <data> | data }",
pos="0,12!",
kind="controller",
];

target [
label="{ <mgmt> mgmt | <data> data } | target",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
host:data -- target:data
}
5 changes: 0 additions & 5 deletions test/case/ietf_routing/all.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions test/case/ietf_routing/ietf_routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: static_routing
case: static_routing/test.py

- name: ospf_basic
case: ospf_basic/test.py

- name: ospf_unnumbered_interface
case: ospf_unnumbered_interface/test.py

- name: ospf_multiarea
case: ospf_multiarea/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def config_target2(target, link):

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("2x2"))
env = infamy.Env()
target1 = env.attach("target1", "mgmt")
target2 = env.attach("target2", "mgmt")

Expand Down
32 changes: 32 additions & 0 deletions test/case/ietf_routing/ospf_basic/topology.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
graph "2x2" {
layout="neato";
overlap="false";
esep="+20";

node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];

host [
label="host | { <mgmt1> mgmt1 | <data1> data1 | <mgmt2> mgmt2 | <data2> data2 }",
pos="0,12!",
kind="controller",
];

target1 [
label="{ <mgmt> mgmt | <data> data | <target2> target2} | target1",
pos="10,18!",

kind="infix",
];
target2 [
label="{ <target1> target1 |<mgmt> mgmt | <data> data } | target2",
pos="10,6!",

kind="infix",
];
host:mgmt1 -- target1:mgmt [kind=mgmt]
host:mgmt2 -- target2:mgmt [kind=mgmt]
host:data1 -- target1:data
host:data2 -- target2:data
target1:target2 -- target2:target1
}
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ def config_target3(target, ring1, ring2, cross, link):
}
})


def config_target4(target, ring1, ring2, cross, link):
target.put_config_dict("ietf-interfaces", {
"interfaces": {
Expand Down Expand Up @@ -540,7 +539,7 @@ def disable_link(target, link):

with infamy.Test() as test:
with test.step("Initialize"):
env = infamy.Env(infamy.std_topology("ring-4-duts"))
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")
dut3 = env.attach("dut3", "mgmt")
Expand Down
Loading

0 comments on commit ffd2fe8

Please sign in to comment.