[PATCH 0/5] NetEm support implementation for LNST
by Jiri Prochazka
This patch set adds support for network emulation tool
NetEm (http://www.linuxfoundation.org/collaborate/workgroups/networking/netem).
NetEm params are configured on each individual interface in XML recipe, format
of implementation is described in Wiki page NetEm.
Currently are supported these NetEm params:
* packet delay
* packet loss
* packet corruption
* packet duplication
* packet reordering
If you want to eg. test your application's behaviour in non-ideal enviroment,
you can make XML recipe with required network artefacts and run LNST with
config_only option.
Second purpose of this implementation is usage in regression testing. For more
information, please visit LNST wiki pages or send an email to this mailing list.
Jiri Prochazka (5):
Add NetEm support to schema-recipe.rng
Add NetEm XML recipe parsing support
Add Controller support for NetEm.
Add Slave methods for NetEm value parsing from interface config
Add Slave NetEm param configuration and deconfiguration support
lnst/Controller/Machine.py | 6 ++-
lnst/Controller/NetTestController.py | 3 ++
lnst/Controller/RecipeParser.py | 63 +++++++++++++++++++++++++++++
lnst/Slave/NetConfigCommon.py | 77 ++++++++++++++++++++++++++++++++++++
lnst/Slave/NetConfigDevice.py | 11 +++++-
lnst/Slave/NmConfigDevice.py | 9 ++++-
schema-recipe.rng | 46 +++++++++++++++++++++
7 files changed, 212 insertions(+), 3 deletions(-)
--
2.1.0
8 years, 11 months
[PATCH] recipes: remove code duplication in phase1 and phase2 tests
by Jan Tluka
Code cleanup to remove duplicate parts of the code.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.py | 31 ++++----------------
.../regression_tests/phase1/3_vlans_over_bond.py | 31 ++++----------------
recipes/regression_tests/phase1/bonding_test.py | 18 ++----------
recipes/regression_tests/phase1/simple_ping.py | 10 +++----
.../phase1/virtual_bridge_2_vlans_over_bond.py | 26 ++---------------
.../phase1/virtual_bridge_vlan_in_guest.py | 19 ++----------
.../phase1/virtual_bridge_vlan_in_host.py | 19 ++----------
.../regression_tests/phase2/3_vlans_over_team.py | 30 ++++---------------
recipes/regression_tests/phase2/team_test.py | 34 +++-------------------
...l_ovs_bridge_2_vlans_over_active_backup_bond.py | 26 ++---------------
.../phase2/virtual_ovs_bridge_vlan_in_guest.py | 19 ++----------
.../phase2/virtual_ovs_bridge_vlan_in_host.py | 19 ++----------
12 files changed, 42 insertions(+), 240 deletions(-)
diff --git a/recipes/regression_tests/phase1/3_vlans.py b/recipes/regression_tests/phase1/3_vlans.py
index 8aa6a2b..3ead92f 100644
--- a/recipes/regression_tests/phase1/3_vlans.py
+++ b/recipes/regression_tests/phase1/3_vlans.py
@@ -106,7 +106,7 @@ for vlan1 in vlans:
offload, state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
# Ping test
m1.run(ping_mod)
@@ -116,29 +116,12 @@ for vlan1 in vlans:
m2.run(netperf_cli_tcp, timeout=70)
m2.run(netperf_cli_udp, timeout=70)
srv_proc.intr()
- elif ipv == 'ipv6':
- # Ping test
- m1.run(ping_mod6)
- # Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
- srv_proc.intr()
- else:
- # Ping tests
- m1.run(ping_mod)
+ if ipv in [ 'ipv6', 'both' ]:
+ # Ping test
m1.run(ping_mod6)
# Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
- srv_proc.intr()
-
- # Netperf test (both TCP and UDP)
srv_proc = m1.run(netperf_srv6, bg=True)
ctl.wait(2)
m2.run(netperf_cli_tcp6, timeout=70)
@@ -155,11 +138,9 @@ for vlan1 in vlans:
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
# Ping test
m1.run(ping_mod, expect="fail")
- elif ipv == 'ipv6':
- m1.run(ping_mod6, expect="fail")
- else:
- m1.run(ping_mod, expect="fail")
+
+ if ipv in [ 'ipv6', 'both' ]:
m1.run(ping_mod6, expect="fail")
diff --git a/recipes/regression_tests/phase1/3_vlans_over_bond.py b/recipes/regression_tests/phase1/3_vlans_over_bond.py
index 4cc0f41..f793ed6 100644
--- a/recipes/regression_tests/phase1/3_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/3_vlans_over_bond.py
@@ -108,7 +108,7 @@ for vlan1 in vlans:
offload, state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
# Ping test
m1.run(ping_mod)
@@ -118,29 +118,12 @@ for vlan1 in vlans:
m2.run(netperf_cli_tcp, timeout=70)
m2.run(netperf_cli_udp, timeout=70)
srv_proc.intr()
- elif ipv == 'ipv6':
- # Ping test
- m1.run(ping_mod6)
- # Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
- srv_proc.intr()
- else:
- # Ping tests
- m1.run(ping_mod)
+ if ipv in [ 'ipv6', 'both' ]:
+ # Ping test
m1.run(ping_mod6)
# Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
- srv_proc.intr()
-
- # Netperf test (both TCP and UDP)
srv_proc = m1.run(netperf_srv6, bg=True)
ctl.wait(2)
m2.run(netperf_cli_tcp6, timeout=70)
@@ -159,11 +142,9 @@ for vlan1 in vlans:
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
# Ping test
m1.run(ping_mod, expect="fail")
- elif ipv == 'ipv6':
- m1.run(ping_mod6, expect="fail")
- else:
- m1.run(ping_mod, expect="fail")
+
+ if ipv in [ 'ipv6', 'both' ]:
m1.run(ping_mod6, expect="fail")
diff --git a/recipes/regression_tests/phase1/bonding_test.py b/recipes/regression_tests/phase1/bonding_test.py
index 885c541..d0a18f4 100644
--- a/recipes/regression_tests/phase1/bonding_test.py
+++ b/recipes/regression_tests/phase1/bonding_test.py
@@ -95,28 +95,16 @@ for offload in offloads:
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
m1.run(ping_mod)
server_proc = m1.run(netperf_srv, bg=True)
ctl.wait(2)
m2.run(netperf_cli_tcp, timeout=70)
m2.run(netperf_cli_udp, timeout=70)
server_proc.intr()
- elif ipv == 'ipv6':
- m1.run(ping_mod6)
- server_proc = m1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
- else:
- m1.run(ping_mod)
+
+ if ipv in [ 'ipv6', 'both' ]:
m1.run(ping_mod6)
- server_proc = m1.run(netperf_srv, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
server_proc = m1.run(netperf_srv6, bg=True)
ctl.wait(2)
m2.run(netperf_cli_tcp6, timeout=70)
diff --git a/recipes/regression_tests/phase1/simple_ping.py b/recipes/regression_tests/phase1/simple_ping.py
index d2bcdb6..dc961d7 100644
--- a/recipes/regression_tests/phase1/simple_ping.py
+++ b/recipes/regression_tests/phase1/simple_ping.py
@@ -24,12 +24,10 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
ctl.wait(15)
-if ctl.get_alias('ipv') == 'ipv6':
- hostA.run(ping_mod6)
+ipv = ctl.get_alias('ipv')
-elif ctl.get_alias('ipv') == 'ipv4':
- hostA.run(ping_mod)
+if ipv in [ 'ipv6', 'both' ]:
+ hostA.run(ping_mod6)
-else:
+if ipv in [ 'ipv4', 'both' ]:
hostA.run(ping_mod)
- hostA.run(ping_mod6)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index 907b3d5..141f4f0 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -164,7 +164,7 @@ for offload in offloads:
offload, state))
g4.run("ethtool -K %s %s %s" % (g4.get_devname("guestnic"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
g4.run(ping_mod2)
g1.run(ping_mod_bad, expect="fail")
@@ -175,30 +175,8 @@ for offload in offloads:
g3.run(netperf_cli_tcp, timeout=70)
g3.run(netperf_cli_udp, timeout=70)
server_proc.intr()
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- g4.run(ping_mod62)
- g1.run(ping_mod6_bad, expect="fail")
- g3.run(ping_mod6_bad2, expect="fail")
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- g3.run(netperf_cli_tcp6, timeout=70)
- g3.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
- else:
- # IPv4
- g1.run(ping_mod)
- g4.run(ping_mod2)
- g1.run(ping_mod_bad, expect="fail")
- g3.run(ping_mod_bad2, expect="fail")
-
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- g3.run(netperf_cli_tcp, timeout=70)
- g3.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
- # IPv6
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
g4.run(ping_mod62)
g1.run(ping_mod6_bad, expect="fail")
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
index 6f93c14..1a2f911 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
@@ -102,7 +102,7 @@ for offload in offloads:
h2.run("ethtool -K %s %s %s" % (h2.get_devname("nic"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -110,25 +110,12 @@ for offload in offloads:
h2.run(netperf_cli_udp, timeout=70)
server_proc.intr()
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp6, timeout=70)
- h2.run(netperf_cli_udp6, timeout=70)
-
- server_proc.intr()
- else:
- g1.run(ping_mod)
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp, timeout=70)
- h2.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
h2.run(netperf_cli_tcp6, timeout=70)
h2.run(netperf_cli_udp6, timeout=70)
+
server_proc.intr()
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
index 0525ea5..0188686 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
@@ -101,23 +101,7 @@ for offload in offloads:
offload, state))
h2.run("ethtool -K %s %s %s" % (h2.get_devname("nic"),
offload, state))
- if ipv == 'ipv4':
- g1.run(ping_mod)
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp, timeout=70)
- h2.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
-
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp6, timeout=70)
- h2.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
-
- else:
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -125,6 +109,7 @@ for offload in offloads:
h2.run(netperf_cli_udp, timeout=70)
server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
diff --git a/recipes/regression_tests/phase2/3_vlans_over_team.py b/recipes/regression_tests/phase2/3_vlans_over_team.py
index dab21ac..96d1be2 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_team.py
+++ b/recipes/regression_tests/phase2/3_vlans_over_team.py
@@ -110,7 +110,7 @@ for vlan1 in vlans:
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
# Ping test
m1.run(ping_mod)
@@ -120,25 +120,8 @@ for vlan1 in vlans:
m2.run(netperf_cli_tcp, timeout=70)
m2.run(netperf_cli_udp, timeout=70)
srv_proc.intr()
- elif ipv == 'ipv6':
- m1.run(ping_mod6)
-
- # Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
- srv_proc.intr()
- else:
- m1.run(ping_mod)
-
- # Netperf test (both TCP and UDP)
- srv_proc = m1.run(netperf_srv, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
- srv_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
m1.run(ping_mod6)
# Netperf test (both TCP and UDP)
@@ -162,11 +145,8 @@ for vlan1 in vlans:
m2.run("ethtool -K %s %s %s" % (m2.get_devname("eth1"),
offload, state))
# Ping test
- if ipv == 'ipv4':
- m1.run(ping_mod, expect="fail")
- elif ipv == 'ipv6':
- m1.run(ping_mod6, expect="fail")
- else:
+ if ipv in [ 'ipv4', 'both' ]:
m1.run(ping_mod, expect="fail")
- m1.run(ping_mod6, expect="fail")
+ if ipv in [ 'ipv6', 'both' ]:
+ m1.run(ping_mod6, expect="fail")
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index 4c87613..776589a 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -94,21 +94,7 @@ for offload in offloads:
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
state))
- if ipv == "ipv4":
- m1.run(ping_mod)
- server_proc = m1.run(netperf_srv, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
- elif ipv == "ipv6":
- m1.run(ping_mod6)
- server_proc = m1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
- else:
+ if ipv in [ 'ipv4', 'both' ]:
m1.run(ping_mod)
server_proc = m1.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -116,6 +102,7 @@ for offload in offloads:
m2.run(netperf_cli_udp, timeout=70)
server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
m1.run(ping_mod6)
server_proc = m1.run(netperf_srv6, bg=True)
ctl.wait(2)
@@ -197,21 +184,7 @@ for offload in offloads:
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
state))
- if ipv == 'ipv4':
- m2.run(ping_mod)
- server_proc = m2.run(netperf_srv, bg=True)
- ctl.wait(2)
- m1.run(netperf_cli_tcp, timeout=70)
- m1.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
- elif ipv == 'ipv6':
- m2.run(ping_mod6)
- server_proc = m2.run(netperf_srv6, bg=True)
- ctl.wait(2)
- m1.run(netperf_cli_tcp6, timeout=70)
- m1.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
- else:
+ if ipv in [ 'ipv4', 'both' ]:
m2.run(ping_mod)
server_proc = m2.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -219,6 +192,7 @@ for offload in offloads:
m1.run(netperf_cli_udp, timeout=70)
server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
m2.run(ping_mod6)
server_proc = m2.run(netperf_srv6, bg=True)
ctl.wait(2)
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index f09ef36..8daa471 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -166,7 +166,7 @@ for offload in offloads:
offload, state))
g4.run("ethtool -K %s %s %s" % (g4.get_devname("guestnic"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
g4.run(ping_mod2)
g1.run(ping_mod_bad, expect="fail")
@@ -177,30 +177,8 @@ for offload in offloads:
g3.run(netperf_cli_tcp, timeout=70)
g3.run(netperf_cli_udp, timeout=70)
server_proc.intr()
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- g4.run(ping_mod62)
- g1.run(ping_mod6_bad, expect="fail")
- g3.run(ping_mod6_bad2, expect="fail")
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- g3.run(netperf_cli_tcp6, timeout=70)
- g3.run(netperf_cli_udp6, timeout=70)
- server_proc.intr()
- else:
- # IPv4
- g1.run(ping_mod)
- g4.run(ping_mod2)
- g1.run(ping_mod_bad, expect="fail")
- g3.run(ping_mod_bad2, expect="fail")
-
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- g3.run(netperf_cli_tcp, timeout=70)
- g3.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
- # IPv6
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
g4.run(ping_mod62)
g1.run(ping_mod6_bad, expect="fail")
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 2417c8a..662e888 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -101,7 +101,7 @@ for offload in offloads:
offload, state))
h2.run("ethtool -K %s %s %s" % (h2.get_devname("nic"),
offload, state))
- if ipv == 'ipv4':
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -109,25 +109,12 @@ for offload in offloads:
h2.run(netperf_cli_udp, timeout=70)
server_proc.intr()
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp6, timeout=70)
- h2.run(netperf_cli_udp6, timeout=70)
-
- server_proc.intr()
- else:
- g1.run(ping_mod)
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp, timeout=70)
- h2.run(netperf_cli_udp, timeout=70)
- server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
h2.run(netperf_cli_tcp6, timeout=70)
h2.run(netperf_cli_udp6, timeout=70)
+
server_proc.intr()
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index cee4c49..15122c4 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -100,23 +100,7 @@ for offload in offloads:
offload, state))
h2.run("ethtool -K %s %s %s" % (h2.get_devname("nic"),
offload, state))
- if ipv == 'ipv4':
- g1.run(ping_mod)
- server_proc = g1.run(netperf_srv, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp, timeout=65)
- h2.run(netperf_cli_udp, timeout=65)
- server_proc.intr()
-
- elif ipv == 'ipv6':
- g1.run(ping_mod6)
- server_proc = g1.run(netperf_srv6, bg=True)
- ctl.wait(2)
- h2.run(netperf_cli_tcp6, timeout=65)
- h2.run(netperf_cli_udp6, timeout=65)
- server_proc.intr()
-
- else:
+ if ipv in [ 'ipv4', 'both' ]:
g1.run(ping_mod)
server_proc = g1.run(netperf_srv, bg=True)
ctl.wait(2)
@@ -124,6 +108,7 @@ for offload in offloads:
h2.run(netperf_cli_udp, timeout=65)
server_proc.intr()
+ if ipv in [ 'ipv6', 'both' ]:
g1.run(ping_mod6)
server_proc = g1.run(netperf_srv6, bg=True)
ctl.wait(2)
--
1.9.3
8 years, 11 months
[PATCH] recipes: add a short sleep before starting the tests
by Jan Tluka
There might be a short delay when switch is enabling ports to which
test interfaces are connected to. Adding a short sleep before the test
should help dropping first packets sent through the test interface as we
saw in ICMPPing test.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.py | 2 ++
recipes/regression_tests/phase1/3_vlans_over_bond.py | 2 ++
recipes/regression_tests/phase1/bonding_test.py | 2 ++
recipes/regression_tests/phase1/simple_ping.py | 2 ++
recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py | 2 ++
recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py | 2 ++
recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py | 2 ++
recipes/regression_tests/phase2/3_vlans_over_team.py | 2 ++
recipes/regression_tests/phase2/team_test.py | 2 ++
.../phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py | 1 +
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py | 1 +
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py | 1 +
12 files changed, 21 insertions(+)
diff --git a/recipes/regression_tests/phase1/3_vlans.py b/recipes/regression_tests/phase1/3_vlans.py
index d3406a7..8aa6a2b 100644
--- a/recipes/regression_tests/phase1/3_vlans.py
+++ b/recipes/regression_tests/phase1/3_vlans.py
@@ -19,6 +19,8 @@ offloads = ["gso", "gro", "tso"]
ipv = ctl.get_alias('ipv')
+ctl.wait(15)
+
for vlan1 in vlans:
for vlan2 in vlans:
ping_mod = ctl.get_module("IcmpPing",
diff --git a/recipes/regression_tests/phase1/3_vlans_over_bond.py b/recipes/regression_tests/phase1/3_vlans_over_bond.py
index c922719..4cc0f41 100644
--- a/recipes/regression_tests/phase1/3_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/3_vlans_over_bond.py
@@ -19,6 +19,8 @@ offloads = ["gso", "gro", "tso"]
ipv = ctl.get_alias('ipv')
+ctl.wait(15)
+
for vlan1 in vlans:
for vlan2 in vlans:
ping_mod = ctl.get_module("IcmpPing",
diff --git a/recipes/regression_tests/phase1/bonding_test.py b/recipes/regression_tests/phase1/bonding_test.py
index 5d94f1d..885c541 100644
--- a/recipes/regression_tests/phase1/bonding_test.py
+++ b/recipes/regression_tests/phase1/bonding_test.py
@@ -87,6 +87,8 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"-L %s -6" % m2.get_ip("test_if", 1)
})
+ctl.wait(15)
+
for offload in offloads:
for state in ["off", "on"]:
m1.run("ethtool -K %s %s %s" % (m1.get_devname("test_if"), offload,
diff --git a/recipes/regression_tests/phase1/simple_ping.py b/recipes/regression_tests/phase1/simple_ping.py
index 2fd48d1..d2bcdb6 100644
--- a/recipes/regression_tests/phase1/simple_ping.py
+++ b/recipes/regression_tests/phase1/simple_ping.py
@@ -22,6 +22,8 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
"iface" : hostA.get_ip("testiface", 1),
"limit_rate": 90})
+ctl.wait(15)
+
if ctl.get_alias('ipv') == 'ipv6':
hostA.run(ping_mod6)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index ecc423d..907b3d5 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -144,6 +144,8 @@ ping_mod6_bad2 = ctl.get_module("Icmp6Ping",
"interval" : 0.1
})
+ctl.wait(15)
+
for offload in offloads:
for state in ["off", "on"]:
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic1"),
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
index e4efece..6f93c14 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
@@ -91,6 +91,8 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"-L %s -6" % h2.get_ip("vlan10", 1)
})
+ctl.wait(15)
+
for offload in offloads:
for state in ["off", "on"]:
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
index a3b6153..0525ea5 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
@@ -91,6 +91,8 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"-L %s -6" % h2.get_ip("vlan10", 1)
})
+ctl.wait(15)
+
for offload in offloads:
for state in ["off", "on"]:
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
diff --git a/recipes/regression_tests/phase2/3_vlans_over_team.py b/recipes/regression_tests/phase2/3_vlans_over_team.py
index f7982a9..dab21ac 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_team.py
+++ b/recipes/regression_tests/phase2/3_vlans_over_team.py
@@ -19,6 +19,8 @@ offloads = ["gso", "gro", "tso"]
ipv = ctl.get_alias('ipv')
+ctl.wait(15)
+
for vlan1 in vlans:
for vlan2 in vlans:
ping_mod = ctl.get_module("IcmpPing",
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index 0482c90..4c87613 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -86,6 +86,8 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"-L %s -6" % m2.get_ip("test_if", 1)
})
+ctl.wait(15)
+
for offload in offloads:
for state in ["off", "on"]:
m1.run("ethtool -K %s %s %s" % (m1.get_devname("test_if"), offload,
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index 0b192bc..f09ef36 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -146,6 +146,7 @@ ping_mod6_bad2 = ctl.get_module("Icmp6Ping",
"interval" : 0.1
})
+ctl.wait(15)
for offload in offloads:
for state in ["off", "on"]:
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 9e61372..2417c8a 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -91,6 +91,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"-L %s -6" % h2.get_ip("vlan10", 1)
})
+ctl.wait(15)
for offload in offloads:
for state in ["off", "on"]:
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index a6958d3..cee4c49 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -90,6 +90,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
"netperf_opts" :
"-L %s -6" % h2.get_ip("vlan10", 1)
})
+ctl.wait(15)
for offload in offloads:
for state in ["off", "on"]:
--
1.9.3
8 years, 11 months
[PATCH] recipes: swap order of offload settings
by Jan Tluka
With some drivers like ixgbe or e1000e setting tso offload on will return
with non-zero exit code if the offload is already turned on. This makes
the whole recipe fail. The simplest solution to this is reverse the
order in which the offload is set. Setting offload off does not fail if
already set on a device so this change should work.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.py | 4 ++--
recipes/regression_tests/phase1/3_vlans_over_bond.py | 4 ++--
recipes/regression_tests/phase1/bonding_test.py | 2 +-
recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py | 2 +-
recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py | 2 +-
recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py | 2 +-
recipes/regression_tests/phase2/3_vlans_over_team.py | 4 ++--
recipes/regression_tests/phase2/team_test.py | 4 ++--
.../phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py | 2 +-
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py | 2 +-
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py | 2 +-
11 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/recipes/regression_tests/phase1/3_vlans.py b/recipes/regression_tests/phase1/3_vlans.py
index 0f1749d..d3406a7 100644
--- a/recipes/regression_tests/phase1/3_vlans.py
+++ b/recipes/regression_tests/phase1/3_vlans.py
@@ -98,7 +98,7 @@ for vlan1 in vlans:
# These tests should pass
# Ping between same VLANs
if vlan1 == vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
@@ -146,7 +146,7 @@ for vlan1 in vlans:
# These tests should fail
# Ping across different VLAN
elif vlan1 != vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
diff --git a/recipes/regression_tests/phase1/3_vlans_over_bond.py b/recipes/regression_tests/phase1/3_vlans_over_bond.py
index 865e2cc..c922719 100644
--- a/recipes/regression_tests/phase1/3_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/3_vlans_over_bond.py
@@ -98,7 +98,7 @@ for vlan1 in vlans:
# These tests should pass
# Ping between same VLANs
if vlan1 == vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
@@ -148,7 +148,7 @@ for vlan1 in vlans:
# These tests should fail
# Ping across different VLAN
elif vlan1 != vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
diff --git a/recipes/regression_tests/phase1/bonding_test.py b/recipes/regression_tests/phase1/bonding_test.py
index 165978b..5d94f1d 100644
--- a/recipes/regression_tests/phase1/bonding_test.py
+++ b/recipes/regression_tests/phase1/bonding_test.py
@@ -88,7 +88,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
m1.run("ethtool -K %s %s %s" % (m1.get_devname("test_if"), offload,
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index 57d24cf..ecc423d 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -145,7 +145,7 @@ ping_mod6_bad2 = ctl.get_module("Icmp6Ping",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic1"),
offload, state))
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic2"),
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
index aefda4a..e4efece 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
@@ -92,7 +92,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
offload, state))
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic"),
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
index e2d32d6..a3b6153 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
@@ -92,7 +92,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
offload, state))
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic"),
diff --git a/recipes/regression_tests/phase2/3_vlans_over_team.py b/recipes/regression_tests/phase2/3_vlans_over_team.py
index e8d6281..f7982a9 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_team.py
+++ b/recipes/regression_tests/phase2/3_vlans_over_team.py
@@ -97,7 +97,7 @@ for vlan1 in vlans:
# These tests should pass
# Ping between same VLANs
if vlan1 == vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
@@ -149,7 +149,7 @@ for vlan1 in vlans:
# These tests should fail
# Ping across different VLAN
elif vlan1 != vlan2:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
# Offload setup
m1.run("ethtool -K %s %s %s" % (m1.get_devname("eth1"),
offload, state))
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index ba9941d..0482c90 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -87,7 +87,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
m1.run("ethtool -K %s %s %s" % (m1.get_devname("test_if"), offload,
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
@@ -190,7 +190,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
m1.run("ethtool -K %s %s %s" % (m1.get_devname("test_if"), offload,
state))
m2.run("ethtool -K %s %s %s" % (m2.get_devname("test_if"), offload,
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index 7238e1b..0b192bc 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -148,7 +148,7 @@ ping_mod6_bad2 = ctl.get_module("Icmp6Ping",
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic1"),
offload, state))
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic2"),
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 9adf380..9e61372 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -93,7 +93,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic"),
offload, state))
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index fbda2cb..a6958d3 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -92,7 +92,7 @@ netperf_cli_udp6 = ctl.get_module("Netperf",
})
for offload in offloads:
- for state in ["on", "off"]:
+ for state in ["off", "on"]:
h1.run("ethtool -K %s %s %s" % (h1.get_devname("nic"),
offload, state))
g1.run("ethtool -K %s %s %s" % (g1.get_devname("guestnic"),
--
1.9.3
8 years, 11 months
[lnst] Task, Interface: add {get, set}_mtu methods
by olichtne
commit 3e0183bbc12fbba3a3f236e10742fd585012738c
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri May 15 10:36:57 2015 +0200
Task, Interface: add {get, set}_mtu methods
The Device class (Slave) now tracks mtu changes for the interface and
the changes are sent to the Controller through an update message.
The Interface class (Controller) got two new methods: {get, set}_mtu.
get_mtu just reads the value currently stored in the object (this gets
updated automatically).
set_mtu sends a config command, this means that deconfiguration will
take care of resetting the mtu value to the original, however it also
means that for 'get' we use Netlink and for 'set' we use sysfs. This
will need to be addressed in the future.
Finally the InterfaceAPI class gained the {get, set}_mtu methods that
connect to the Interface class.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Controller/Machine.py | 27 +++++++++++++++++++++++++--
lnst/Controller/Task.py | 6 ++++++
lnst/Slave/InterfaceManager.py | 6 +++++-
3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index e303c1a..dc30ef0 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -91,8 +91,7 @@ class Machine(object):
except:
iface = None
if iface:
- iface.set_hwaddr(if_data["hwaddr"])
- iface.set_devname(if_data["devname"])
+ iface.update(if_data)
#
# Factory methods for constructing interfaces on this machine. The
@@ -513,6 +512,7 @@ class Interface(object):
self._netns = None
self._peer = None
+ self._mtu = None
def get_id(self):
return self._id
@@ -612,6 +612,29 @@ class Interface(object):
except IndexError:
raise PrefixMissingError
+ def get_mtu(self):
+ return self._mtu
+
+ def set_mtu(self, mtu):
+ command = {"type": "config",
+ "host": self._machine.get_id(),
+ "persistent": False,
+ "options":[
+ {"name": "/sys/class/net/%s/mtu" % self._devname,
+ "value": str(mtu)}
+ ]}
+ if self._netns != None:
+ command["netns"] = self._netns
+
+ self._machine.run_command(command)
+ self._mtu = mtu
+ return self._mtu
+
+ def update(self, if_data):
+ self.set_hwaddr(if_data["hwaddr"])
+ self.set_devname(if_data["devname"])
+ self._mtu = if_data["mtu"]
+
def _get_config(self):
config = {"hwaddr": self._hwaddr, "type": self._type,
"addresses": self._addresses, "slaves": self._slaves.keys(),
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 16d9282..f2ee4e0 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -353,6 +353,12 @@ class InterfaceAPI(object):
def get_ip_prefix(self, ip_index):
return VolatileValue(self._if.get_prefix, ip_index)
+ def get_mtu(self):
+ return VolatileValue(self._if.get_mtu)
+
+ def set_mtu(self, mtu):
+ return self._if.set_mtu(mtu)
+
class ModuleAPI(object):
""" An API class representing a module. """
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 5727646..fc65ccc 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -270,6 +270,7 @@ class Device(object):
self._slaves = []
self._netns = None
self._peer = None
+ self._mtu = None
self._if_manager = if_manager
@@ -282,6 +283,7 @@ class Device(object):
self._ip = None #TODO
self.set_master(nl_msg.get_attr("IFLA_MASTER"), primary=True)
self._netns = None
+ self._mtu = nl_msg.get_attr("IFLA_MTU")
self._initialized = True
@@ -292,6 +294,7 @@ class Device(object):
self._state = nl_msg.get_attr("IFLA_OPERSTATE")
self._ip = None #TODO
self.set_master(nl_msg.get_attr("IFLA_MASTER"), primary=True)
+ self._mtu = nl_msg.get_attr("IFLA_MTU")
link = nl_msg.get_attr("IFLA_LINK")
if link != None:
@@ -316,7 +319,8 @@ class Device(object):
#return an update message that will be sent to the controller
return {"type": "if_update",
"devname": self._name,
- "hwaddr": self._hwaddr}
+ "hwaddr": self._hwaddr,
+ "mtu": self._mtu}
return None
def del_link(self):
8 years, 11 months
[PATCH] Task, Interface: add {get, set}_mtu methods
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The Device class (Slave) now tracks mtu changes for the interface and
the changes are sent to the Controller through an update message.
The Interface class (Controller) got two new methods: {get, set}_mtu.
get_mtu just reads the value currently stored in the object (this gets
updated automatically).
set_mtu sends a config command, this means that deconfiguration will
take care of resetting the mtu value to the original, however it also
means that for 'get' we use Netlink and for 'set' we use sysfs. This
will need to be addressed in the future.
Finally the InterfaceAPI class gained the {get, set}_mtu methods that
connect to the Interface class.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 27 +++++++++++++++++++++++++--
lnst/Controller/Task.py | 6 ++++++
lnst/Slave/InterfaceManager.py | 6 +++++-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index e303c1a..dc30ef0 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -91,8 +91,7 @@ class Machine(object):
except:
iface = None
if iface:
- iface.set_hwaddr(if_data["hwaddr"])
- iface.set_devname(if_data["devname"])
+ iface.update(if_data)
#
# Factory methods for constructing interfaces on this machine. The
@@ -513,6 +512,7 @@ class Interface(object):
self._netns = None
self._peer = None
+ self._mtu = None
def get_id(self):
return self._id
@@ -612,6 +612,29 @@ class Interface(object):
except IndexError:
raise PrefixMissingError
+ def get_mtu(self):
+ return self._mtu
+
+ def set_mtu(self, mtu):
+ command = {"type": "config",
+ "host": self._machine.get_id(),
+ "persistent": False,
+ "options":[
+ {"name": "/sys/class/net/%s/mtu" % self._devname,
+ "value": str(mtu)}
+ ]}
+ if self._netns != None:
+ command["netns"] = self._netns
+
+ self._machine.run_command(command)
+ self._mtu = mtu
+ return self._mtu
+
+ def update(self, if_data):
+ self.set_hwaddr(if_data["hwaddr"])
+ self.set_devname(if_data["devname"])
+ self._mtu = if_data["mtu"]
+
def _get_config(self):
config = {"hwaddr": self._hwaddr, "type": self._type,
"addresses": self._addresses, "slaves": self._slaves.keys(),
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 16d9282..f2ee4e0 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -353,6 +353,12 @@ class InterfaceAPI(object):
def get_ip_prefix(self, ip_index):
return VolatileValue(self._if.get_prefix, ip_index)
+ def get_mtu(self):
+ return VolatileValue(self._if.get_mtu)
+
+ def set_mtu(self, mtu):
+ return self._if.set_mtu(mtu)
+
class ModuleAPI(object):
""" An API class representing a module. """
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 5727646..fc65ccc 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -270,6 +270,7 @@ class Device(object):
self._slaves = []
self._netns = None
self._peer = None
+ self._mtu = None
self._if_manager = if_manager
@@ -282,6 +283,7 @@ class Device(object):
self._ip = None #TODO
self.set_master(nl_msg.get_attr("IFLA_MASTER"), primary=True)
self._netns = None
+ self._mtu = nl_msg.get_attr("IFLA_MTU")
self._initialized = True
@@ -292,6 +294,7 @@ class Device(object):
self._state = nl_msg.get_attr("IFLA_OPERSTATE")
self._ip = None #TODO
self.set_master(nl_msg.get_attr("IFLA_MASTER"), primary=True)
+ self._mtu = nl_msg.get_attr("IFLA_MTU")
link = nl_msg.get_attr("IFLA_LINK")
if link != None:
@@ -316,7 +319,8 @@ class Device(object):
#return an update message that will be sent to the controller
return {"type": "if_update",
"devname": self._name,
- "hwaddr": self._hwaddr}
+ "hwaddr": self._hwaddr,
+ "mtu": self._mtu}
return None
def del_link(self):
--
2.1.0
8 years, 11 months
[lnst] ConnectionHandler: import IPRSocket directly
by olichtne
commit 1794d65e090b747e3a7d0a811082326b00f7c5f4
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Thu May 14 09:54:49 2015 +0200
ConnectionHandler: import IPRSocket directly
The pyroute2 has fixed issue that we had in the past with isinstance()
check. It is possible to do the proper import now.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Common/ConnectionHandler.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Common/ConnectionHandler.py b/lnst/Common/ConnectionHandler.py
index 8beaafc..36349dc 100644
--- a/lnst/Common/ConnectionHandler.py
+++ b/lnst/Common/ConnectionHandler.py
@@ -15,7 +15,7 @@ import select
import cPickle
import socket
from _multiprocessing import Connection
-from pyroute2.netlink.rtnl import IPRSocket
+from pyroute2 import IPRSocket
def send_data(s, data):
try:
8 years, 11 months
[PATCH] ConnectionHandler: import IPRSocket directly
by Jan Tluka
The pyroute2 has fixed issue that we had in the past with isinstance()
check. It is possible to do the proper import now.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Common/ConnectionHandler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Common/ConnectionHandler.py b/lnst/Common/ConnectionHandler.py
index 8beaafc..36349dc 100644
--- a/lnst/Common/ConnectionHandler.py
+++ b/lnst/Common/ConnectionHandler.py
@@ -15,7 +15,7 @@ import select
import cPickle
import socket
from _multiprocessing import Connection
-from pyroute2.netlink.rtnl import IPRSocket
+from pyroute2 import IPRSocket
def send_data(s, data):
try:
--
1.9.3
8 years, 11 months
[lnst] NetTestSlave: don't crash when deconfiguration fails
by olichtne
commit 7986a213bc2a20dde3ccd30caab575442966f352
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Thu May 7 13:31:48 2015 +0200
NetTestSlave: don't crash when deconfiguration fails
Trying to deconfigure a device that wasn't configured causes lnst-slave
to get into an inconsistent state. This patch fixes the issue by
skipping the deconfiguration and logging an error message.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Slave/InterfaceManager.py | 2 +-
lnst/Slave/NetTestSlave.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index b2bb92e..5727646 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -132,7 +132,7 @@ class InterfaceManager(object):
elif if_id in self._tmp_mapping:
return self._tmp_mapping[if_id]
else:
- raise IfMgrError("No device with id %s mapped." % if_id)
+ return None
def get_mapped_devices(self):
ret = {}
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 8eb1f99..ec6de85 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -253,7 +253,10 @@ class SlaveMethods:
def deconfigure_interface(self, if_id):
device = self._if_manager.get_mapped_device(if_id)
- device.clear_configuration()
+ if device is not None:
+ device.clear_configuration()
+ else:
+ logging.error("No device with id '%s' to deconfigure." % if_id)
return True
def start_packet_capture(self, filt):
8 years, 11 months
[PATCH] xslt: fix highlighting bug
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
A command result is identified byt task_id, host_id and bg_id
(optional). host_id wasn't used until now which resulted in multiple
background command results being highlighted when they had the same
bg_id but different host_id. This fixes the issue.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
result_xslt/xml_to_html.js | 16 ++++++++++------
result_xslt/xml_to_html.xsl | 8 ++++----
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/result_xslt/xml_to_html.js b/result_xslt/xml_to_html.js
index 12176e4..97cfdc8 100644
--- a/result_xslt/xml_to_html.js
+++ b/result_xslt/xml_to_html.js
@@ -1,4 +1,4 @@
-window.toggleResultData = function (event, task_id, bg_id) {
+window.toggleResultData = function (event, task_id, host_id, bg_id) {
switch_display = function(elem){
if (elem.style.display == 'none'){
elem.style.display = '';
@@ -13,17 +13,19 @@ window.toggleResultData = function (event, task_id, bg_id) {
result_cell = row.cells[result_cell_i];
switch_display(result_cell);
- if (task_id !== undefined && bg_id !== undefined){
+ if (task_id !== undefined && host_id != undefined && bg_id !== undefined){
rows = row.parentNode.rows;
for (i = 0; i < rows.length; ++i){
- if (rows[i].name == ("task_id="+task_id+"bg_id="+bg_id)){
+ if (rows[i].name == ("task_id=" + task_id +
+ "host_id=" + host_id +
+ "bg_id=" + bg_id)){
switch_display(rows[i].cells[2]);
}
}
}
}
-window.highlightResultData = function (event, task_id, bg_id) {
+window.highlightResultData = function (event, task_id, host_id, bg_id) {
switch_background = function(elem){
if (elem.style.background == ''){
elem.style.background = 'lightblue';
@@ -35,10 +37,12 @@ window.highlightResultData = function (event, task_id, bg_id) {
cell = event.target.parentNode;
row = cell.parentNode;
- if (task_id !== undefined && bg_id !== undefined){
+ if (task_id !== undefined && host_id != undefined && bg_id !== undefined){
rows = row.parentNode.rows;
for (i = 0; i < rows.length; ++i){
- if (rows[i].getAttribute("name") == ("task_id="+task_id+"bg_id="+bg_id)){
+ if (rows[i].getAttribute("name") == ("task_id=" + task_id +
+ "host_id=" + host_id +
+ "bg_id=" + bg_id)){
switch_background(rows[i]);
}
}
diff --git a/result_xslt/xml_to_html.xsl b/result_xslt/xml_to_html.xsl
index 0e85d01..c31de36 100644
--- a/result_xslt/xml_to_html.xsl
+++ b/result_xslt/xml_to_html.xsl
@@ -84,7 +84,7 @@
<xsl:template match="command">
<xsl:param name="task_id"/>
<tr class="tr_top">
- <xsl:attribute name="name">task_id=<xsl:value-of select="$task_id"/>bg_id=<xsl:value-of select="@proc_id"/></xsl:attribute>
+ <xsl:attribute name="name">task_id=<xsl:value-of select="$task_id"/>host_id=<xsl:value-of select="@host"/>bg_id=<xsl:value-of select="@proc_id"/></xsl:attribute>
<xsl:choose>
<xsl:when test="@type='exec'">
<xsl:call-template name="cmd_exec"/>
@@ -300,7 +300,7 @@
<xsl:choose>
<xsl:when test="@bg_id">
<xsl:attribute name="onclick">
- toggleResultData(event, '<xsl:value-of select="$task_id"/>', '<xsl:value-of select="@bg_id"/>');
+ toggleResultData(event, '<xsl:value-of select="$task_id"/>', '<xsl:value-of select="@host"/>', '<xsl:value-of select="@bg_id"/>');
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
@@ -317,7 +317,7 @@
<xsl:param name="task_id"/>
<button type="button">
<xsl:attribute name="onclick">
- highlightResultData(event, '<xsl:value-of select="$task_id"/>', '<xsl:value-of select="@bg_id"/>');
+ highlightResultData(event, '<xsl:value-of select="$task_id"/>', '<xsl:value-of select="@host"/>', '<xsl:value-of select="@bg_id"/>');
</xsl:attribute>
Highlight result command
</button>
@@ -358,7 +358,7 @@
</xsl:when>
<xsl:otherwise>
<tr class="tr_bottom">
- <xsl:attribute name="name">task_id=<xsl:value-of select="$task_id"/>bg_id=<xsl:value-of select="@proc_id"/></xsl:attribute>
+ <xsl:attribute name="name">task_id=<xsl:value-of select="$task_id"/>host_id=<xsl:value-of select="@host"/>bg_id=<xsl:value-of select="@proc_id"/></xsl:attribute>
<td>
</td>
<td>
--
2.1.0
8 years, 11 months