[PATCH v2 00/14] Various tunnel recipes
by Jan Tluka
This patch series extends the ENRT test recipe set with additional
tunnel recipes.
The series also includes updates to VxlanDevice and a bug fix for Device
class required by VxlanGpeTunnelRecipe.
v2:
- added a patch that enables use of individual HWConfigMixins
- added config mixins to the tunnel recipe classes
Jan Tluka (14):
Recipes.ENRT.ConfigMixins: enable usage of individual HWConfigMixins
Recipes.ENRT: add GeneveLwtTunnelRecipe
Recipes.ENRT: add GreLwtTunnelRecipe
Recipes.ENRT: add VxlanLwtTunnelRecipe
Recipes.ENRT: add GreOvsTunnelRecipe
Recipes.ENRT: add GeneveOvsTunnelRecipe
Recipes.ENRT: add VxlanOvsTunnelRecipe
Recipes.ENRT: add GreTunnelOverVlanRecipe
Recipes.ENRT: add GreTunnelOverMacvlanRecipe
Recipes.ENRT: add VxlanNetnsTunnelRecipe
Devices.VxlanDevice: add gpe property
Devices.VxlanDevice: add learning property
Devices.Device: handle RTM_NEWLINK messages without any IFLA_ADDRESS
Recipes.ENRT: add VxlanGpeTunnelRecipe
docs/source/geneve_lwt_tunnel_recipe.rst | 6 +
docs/source/geneve_ovs_tunnel_recipe.rst | 6 +
docs/source/gre_lwt_tunnel_recipe.rst | 6 +
docs/source/gre_ovs_tunnel_recipe.rst | 6 +
.../source/gre_tunnel_over_macvlan_recipe.rst | 6 +
docs/source/gre_tunnel_over_vlan_recipe.rst | 6 +
docs/source/specific_scenarios.rst | 10 +
docs/source/vxlan_gpe_tunnel_recipe.rst | 6 +
docs/source/vxlan_lwt_tunnel_recipe.rst | 6 +
docs/source/vxlan_netns_tunnel_recipe.rst | 6 +
docs/source/vxlan_ovs_tunnel_recipe.rst | 6 +
lnst/Devices/Device.py | 5 +-
lnst/Devices/VxlanDevice.py | 19 ++
.../ENRT/ConfigMixins/BaseHWConfigMixin.py | 17 +-
.../ConfigMixins/CommonHWSubConfigMixin.py | 16 +-
lnst/Recipes/ENRT/GeneveLwtTunnelRecipe.py | 228 ++++++++++++++++
lnst/Recipes/ENRT/GeneveOvsTunnelRecipe.py | 166 ++++++++++++
lnst/Recipes/ENRT/GreLwtTunnelRecipe.py | 233 +++++++++++++++++
lnst/Recipes/ENRT/GreOvsTunnelRecipe.py | 174 +++++++++++++
.../ENRT/GreTunnelOverMacvlanRecipe.py | 211 +++++++++++++++
lnst/Recipes/ENRT/GreTunnelOverVlanRecipe.py | 212 +++++++++++++++
lnst/Recipes/ENRT/VxlanGpeTunnelRecipe.py | 227 ++++++++++++++++
lnst/Recipes/ENRT/VxlanLwtTunnelRecipe.py | 227 ++++++++++++++++
lnst/Recipes/ENRT/VxlanNetnsTunnelRecipe.py | 245 ++++++++++++++++++
lnst/Recipes/ENRT/VxlanOvsTunnelRecipe.py | 185 +++++++++++++
lnst/Recipes/ENRT/__init__.py | 10 +
26 files changed, 2228 insertions(+), 17 deletions(-)
create mode 100644 docs/source/geneve_lwt_tunnel_recipe.rst
create mode 100644 docs/source/geneve_ovs_tunnel_recipe.rst
create mode 100644 docs/source/gre_lwt_tunnel_recipe.rst
create mode 100644 docs/source/gre_ovs_tunnel_recipe.rst
create mode 100644 docs/source/gre_tunnel_over_macvlan_recipe.rst
create mode 100644 docs/source/gre_tunnel_over_vlan_recipe.rst
create mode 100644 docs/source/vxlan_gpe_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_lwt_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_netns_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_ovs_tunnel_recipe.rst
create mode 100644 lnst/Recipes/ENRT/GeneveLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GeneveOvsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreOvsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreTunnelOverMacvlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreTunnelOverVlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanGpeTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanNetnsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanOvsTunnelRecipe.py
--
2.26.3
2 years
[PATCH] Device.GeneveDevice: add external property
by Jan Tluka
This is to support so called lightweight tunnels when tunnel metadata
is defined externally, e.g. using 'ip route .. encap' command.
Since the external flag makes any mandatory options irrelevant, the
mandatory options are defined dynamically.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Devices/GeneveDevice.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/lnst/Devices/GeneveDevice.py b/lnst/Devices/GeneveDevice.py
index a188ef4c..2418c7c9 100644
--- a/lnst/Devices/GeneveDevice.py
+++ b/lnst/Devices/GeneveDevice.py
@@ -21,7 +21,12 @@ from lnst.Devices.SoftDevice import SoftDevice
class GeneveDevice(SoftDevice):
_name_template = "t_gnv"
_link_type = "geneve"
- _mandatory_opts = ["id", "remote"]
+
+ def __init__(self, ifmanager, *args, **kwargs):
+ if "external" not in kwargs:
+ self._mandatory_opts = ["id", "remote"]
+
+ super(GeneveDevice, self).__init__(ifmanager, *args, **kwargs)
@property
def id(self):
@@ -63,3 +68,13 @@ class GeneveDevice(SoftDevice):
def dst_port(self, val):
self._set_linkinfo_data_attr("IFLA_GENEVE_PORT", int(val))
self._nl_link_sync("set")
+
+ @property
+ def external(self):
+ return self._get_linkinfo_data_attr("IFLA_GENEVE_COLLECT_METADATA") is not None
+
+ @external.setter
+ def external(self, val):
+ if val:
+ self._set_linkinfo_data_attr("IFLA_GENEVE_COLLECT_METADATA", True)
+ self._nl_link_sync("set")
--
2.26.3
2 years
[PATCH] Recipes.ENRT.L2TPTunnelRecipe: add carrier_ipversion parameter
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Recipes/ENRT/L2TPTunnelRecipe.py | 55 ++++++++++++++++++++-------
1 file changed, 41 insertions(+), 14 deletions(-)
diff --git a/lnst/Recipes/ENRT/L2TPTunnelRecipe.py b/lnst/Recipes/ENRT/L2TPTunnelRecipe.py
index 0a78929d..936d88e0 100755
--- a/lnst/Recipes/ENRT/L2TPTunnelRecipe.py
+++ b/lnst/Recipes/ENRT/L2TPTunnelRecipe.py
@@ -1,5 +1,5 @@
from lnst.Controller import HostReq, DeviceReq, RecipeParam
-from lnst.Common.IpAddress import AF_INET
+from lnst.Common.IpAddress import AF_INET, AF_INET6
from lnst.Common.Parameters import ChoiceParam, StrParam
from lnst.RecipeCommon.L2TPManager import L2TPManager
from lnst.Devices import L2TPSessionDevice
@@ -39,9 +39,16 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
The test wide configuration is implemented in the :any:`BaseTunnelRecipe`
class.
- :param l2tp_encapsulation:
- (mandatory test parameter) the encapsulation mode for the L2TP tunnel,
- can be either **udp** or **ip**
+ The recipe provides additional parameter:
+
+ :param carrier_ipversion:
+ This parameter specifies whether IPv4 or IPv6 addresses are
+ used for the underlying (carrier) network. The value is either
+ **ipv4** or **ipv6**
+
+ :param l2tp_encapsulation:
+ (mandatory test parameter) the encapsulation mode for the L2TP tunnel,
+ can be either **udp** or **ip**
"""
host1 = HostReq()
@@ -50,6 +57,7 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
host2 = HostReq()
host2.eth0 = DeviceReq(label="net1", driver=RecipeParam("driver"))
+ carrier_ipversion = ChoiceParam(type=StrParam, choices=set(["ipv4", "ipv6"]))
l2tp_encapsulation = ChoiceParam(
type=StrParam, choices=set(["udp", "ip"]), mandatory=True
)
@@ -63,10 +71,15 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
host2 = self.matched.host2
for i, device in enumerate([host1.eth0, host2.eth0]):
- device.ip_add("192.168.200." + str(i + 1) + "/24")
+ if self.params.carrier_ipversion == "ipv4":
+ device.ip_add("192.168.200." + str(i + 1) + "/24")
+ else:
+ device.ip_add("fc00::" + str(i + 1) + "/64")
+
device.up()
configuration.test_wide_devices.append(device)
+ self.wait_tentative_ips(configuration.test_wide_devices)
configuration.tunnel_endpoints = (host1.eth0, host2.eth0)
def create_tunnel(self, configuration):
@@ -78,7 +91,11 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
endpoint1, endpoint2 = configuration.tunnel_endpoints
host1 = endpoint1.netns
host2 = endpoint2.netns
- ip_filter = {"family": AF_INET}
+ if self.params.carrier_ipversion == "ipv4":
+ ip_filter = {"family": AF_INET}
+ else:
+ ip_filter = {"family": AF_INET6, "is_link_local": False}
+
endpoint1_ip = endpoint1.ips_filter(**ip_filter)[0]
endpoint2_ip = endpoint2.ips_filter(**ip_filter)[0]
@@ -147,7 +164,11 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
def get_packet_assert_config(self, ping_config):
pa_kwargs = {}
- ip_filter = {"family": AF_INET}
+ if self.params.carrier_ipversion == "ipv4":
+ ip_filter = {"family": AF_INET}
+ else:
+ ip_filter = {"family": AF_INET6, "is_link_local": False}
+
m1_carrier = self.matched.host1.eth0
m2_carrier = self.matched.host2.eth0
m1_carrier_ip = m1_carrier.ips_filter(**ip_filter)[0]
@@ -158,15 +179,21 @@ class L2TPTunnelRecipe(CommonHWSubConfigMixin, BaseTunnelRecipe):
encap ip: 192.168.200.1 > 192.168.200.2: ip-proto-115 106
"""
- if self.params.l2tp_encapsulation == 'ip':
- pa_kwargs["p_filter"] = "ip proto 115"
- grep_pattern = "IP {} > {}:[ ]*ip-proto-115".format(
- m1_carrier_ip, m2_carrier_ip
+ if self.params.l2tp_encapsulation == "ip":
+ pa_kwargs["p_filter"] = "{} proto 115".format(
+ "ip" if self.params.carrier_ipversion == "ipv4" else "ip6",
+ )
+ grep_pattern = "{} {} > {}:[ ]*ip-proto-115".format(
+ "IP" if self.params.carrier_ipversion == "ipv4" else "IP6",
+ m1_carrier_ip,
+ m2_carrier_ip,
)
- elif self.params.l2tp_encapsulation == 'udp':
+ elif self.params.l2tp_encapsulation == "udp":
pa_kwargs["p_filter"] = "udp"
- grep_pattern = "IP {}.[0-9]+ > {}.[0-9]+:[ ]*UDP".format(
- m1_carrier_ip, m2_carrier_ip
+ grep_pattern = "{} {}.[0-9]+ > {}.[0-9]+:[ ]*UDP".format(
+ "IP" if self.params.carrier_ipversion == "ipv4" else "IP6",
+ m1_carrier_ip,
+ m2_carrier_ip,
)
pa_kwargs["grep_for"] = [grep_pattern]
--
2.26.3
2 years
[PATCH 00/11] Tunnel recipes enhancements
by Jan Tluka
This includes several enhancements for the recently added tunnel
recipes.
The L2TPTunnelRecipe is updated to automatically load the l2tp_eth
kernel module that is required by the L2TPTunnelManager to function
properly. A new parameter carrier_ipversion is added to this recipe.
Rest of the patches adds specific HWConfigMixins to the recipes, to
allow mtu, pause frames and offload settings configuration.
Jan Tluka (11):
Recipes.ENRT.L2TPTunnelRecipe: load l2tp_eth module before creating
the tunnel
Recipes.ENRT.L2TPTunnelRecipe: add carrier_ipversion parameter
Recipes.ENRT.L2TPTunnelRecipe: add PauseFramesHWConfigMixin
Recipes.ENRT.GeneveTunnelRecipe: add OffloadSubConfigMixin and
PauseFramesHWConfigMixin
Recipes.ENRT.SitTunnelRecipe: add {MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.Ip6TnlTunnelRecipe: add {MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.IpIpTunnelRecipe: add {MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.GreTunnelRecipe: add {MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.GreTunnelOverBondRecipe: add
{MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.Ip6GreNetnsTunnelRecipe.py: add
{MTU,PauseFrames}HWConfigMixins
Recipes.ENRT.Ip6GreTunnelRecipe.py: add
{MTU,PauseFrames}HWConfigMixins
lnst/Recipes/ENRT/GeneveTunnelRecipe.py | 14 +++-
lnst/Recipes/ENRT/GreTunnelOverBondRecipe.py | 17 ++++-
lnst/Recipes/ENRT/GreTunnelRecipe.py | 19 +++++-
lnst/Recipes/ENRT/Ip6GreNetnsTunnelRecipe.py | 19 +++++-
lnst/Recipes/ENRT/Ip6GreTunnelRecipe.py | 17 ++++-
lnst/Recipes/ENRT/Ip6TnlTunnelRecipe.py | 20 ++++--
lnst/Recipes/ENRT/IpIpTunnelRecipe.py | 14 +++-
lnst/Recipes/ENRT/L2TPTunnelRecipe.py | 68 +++++++++++++++-----
lnst/Recipes/ENRT/SitTunnelRecipe.py | 14 +++-
9 files changed, 164 insertions(+), 38 deletions(-)
--
2.26.3
2 years
[PATCH-legacy-py3] lnst/Slave/NetConfigDevice: don't fail on restoring autoneg settings
by Jan Tluka
The command to restore the autoneg settings returns non-zero exit code
after update from RHEL-8.3.0 to RHEL-8.4.0. This causes crash of the
recipe on cleanup.
To fix this, the die_on_err=False is used to ignore the exit code value.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/NetConfigDevice.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index b87769f9..f25cbede 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -105,7 +105,7 @@ class NetConfigDeviceEth(NetConfigDeviceGeneric):
def deconfigure(self):
config = self._dev_config
- exec_cmd("ethtool -s %s autoneg on" % config["name"])
+ exec_cmd("ethtool -s %s autoneg on" % config["name"], die_on_err=False)
if "netem_cmd" in config:
exec_cmd(config["netem_cmd"].replace("add", "del"))
if "lldp" in config:
--
2.26.3
2 years
[PATCH 00/13] Various tunnel recipes
by Jan Tluka
This patch series extends the ENRT test recipe set with additional
tunnel recipes.
The series also includes updates to VxlanDevice and a bug fix for Device
class required by VxlanGpeTunnelRecipe.
Jan Tluka (13):
Recipes.ENRT: add GeneveLwtTunnelRecipe
Recipes.ENRT: add GreLwtTunnelRecipe
Recipes.ENRT: add VxlanLwtTunnelRecipe
Recipes.ENRT: add GreOvsTunnelRecipe
Recipes.ENRT: add GeneveOvsTunnelRecipe
Recipes.ENRT: add VxlanOvsTunnelRecipe
Recipes.ENRT: add GreTunnelOverVlanRecipe
Recipes.ENRT: add GreTunnelOverMacvlanRecipe
Recipes.ENRT: add VxlanNetnsTunnelRecipe
Devices.VxlanDevice: add gpe property
Devices.VxlanDevice: add learning property
Devices.Device: handle RTM_NEWLINK messages without any IFLA_ADDRESS
Recipes.ENRT: add VxlanGpeTunnelRecipe
docs/source/geneve_lwt_tunnel_recipe.rst | 6 +
docs/source/geneve_ovs_tunnel_recipe.rst | 6 +
docs/source/gre_lwt_tunnel_recipe.rst | 6 +
docs/source/gre_ovs_tunnel_recipe.rst | 6 +
.../source/gre_tunnel_over_macvlan_recipe.rst | 6 +
docs/source/gre_tunnel_over_vlan_recipe.rst | 6 +
docs/source/specific_scenarios.rst | 10 +
docs/source/vxlan_gpe_tunnel_recipe.rst | 6 +
docs/source/vxlan_lwt_tunnel_recipe.rst | 6 +
docs/source/vxlan_netns_tunnel_recipe.rst | 6 +
docs/source/vxlan_ovs_tunnel_recipe.rst | 6 +
lnst/Devices/Device.py | 5 +-
lnst/Devices/VxlanDevice.py | 19 ++
lnst/Recipes/ENRT/GeneveLwtTunnelRecipe.py | 216 ++++++++++++++++
lnst/Recipes/ENRT/GeneveOvsTunnelRecipe.py | 162 ++++++++++++
lnst/Recipes/ENRT/GreLwtTunnelRecipe.py | 221 ++++++++++++++++
lnst/Recipes/ENRT/GreOvsTunnelRecipe.py | 170 ++++++++++++
.../ENRT/GreTunnelOverMacvlanRecipe.py | 200 +++++++++++++++
lnst/Recipes/ENRT/GreTunnelOverVlanRecipe.py | 201 +++++++++++++++
lnst/Recipes/ENRT/VxlanGpeTunnelRecipe.py | 215 ++++++++++++++++
lnst/Recipes/ENRT/VxlanLwtTunnelRecipe.py | 215 ++++++++++++++++
lnst/Recipes/ENRT/VxlanNetnsTunnelRecipe.py | 241 ++++++++++++++++++
lnst/Recipes/ENRT/VxlanOvsTunnelRecipe.py | 181 +++++++++++++
lnst/Recipes/ENRT/__init__.py | 10 +
24 files changed, 2125 insertions(+), 1 deletion(-)
create mode 100644 docs/source/geneve_lwt_tunnel_recipe.rst
create mode 100644 docs/source/geneve_ovs_tunnel_recipe.rst
create mode 100644 docs/source/gre_lwt_tunnel_recipe.rst
create mode 100644 docs/source/gre_ovs_tunnel_recipe.rst
create mode 100644 docs/source/gre_tunnel_over_macvlan_recipe.rst
create mode 100644 docs/source/gre_tunnel_over_vlan_recipe.rst
create mode 100644 docs/source/vxlan_gpe_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_lwt_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_netns_tunnel_recipe.rst
create mode 100644 docs/source/vxlan_ovs_tunnel_recipe.rst
create mode 100644 lnst/Recipes/ENRT/GeneveLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GeneveOvsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreOvsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreTunnelOverMacvlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreTunnelOverVlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanGpeTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanLwtTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanNetnsTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanOvsTunnelRecipe.py
--
2.26.3
2 years
[PATCH 1/2] Recipes.ENRT: add L2TPTunnelRecipe to ENRT module imports
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Recipes/ENRT/__init__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/lnst/Recipes/ENRT/__init__.py b/lnst/Recipes/ENRT/__init__.py
index 0b7f4f86..e0c802d9 100644
--- a/lnst/Recipes/ENRT/__init__.py
+++ b/lnst/Recipes/ENRT/__init__.py
@@ -87,6 +87,7 @@ from lnst.Recipes.ENRT.SitTunnelRecipe import SitTunnelRecipe
from lnst.Recipes.ENRT.IpIpTunnelRecipe import IpIpTunnelRecipe
from lnst.Recipes.ENRT.Ip6TnlTunnelRecipe import Ip6TnlTunnelRecipe
from lnst.Recipes.ENRT.GeneveTunnelRecipe import GeneveTunnelRecipe
+from lnst.Recipes.ENRT.L2TPTunnelRecipe import L2TPTunnelRecipe
from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe
from lnst.Recipes.ENRT.BaseTunnelRecipe import BaseTunnelRecipe
--
2.26.3
2 years
[PATCH] Controller.Machine: fix moving a device to a network namespace
by Jan Tluka
When a device is moved to a network namespace an RTM_NEWLINK netlink
message is generated and handled by InterfaceManager. The InterfaceManager
creates a new instance of a generic Device class instead of a specific device
class (e.g. VethDevice). This device also remains in disabled state so
no actions or configurations can be made.
This patch fixes that by following changes.
The InterfaceManager is extended with remap_device() method that
creates a new instance of the specific device class that replaces the
generic Device instance.
The SlaveMethods are extended with remap_device() method that serves as
an rpc interface for calling InterfaceManager's method from the
Controller.
The Machine.remote_device_set_netns() method is updated to include an
explicit rpc_call to remap the device to proper type.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/Machine.py | 10 ++++++++++
lnst/Slave/InterfaceManager.py | 14 ++++++++++++++
lnst/Slave/NetTestSlave.py | 3 +++
3 files changed, 27 insertions(+)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 3bee2a55..a4c724ba 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -141,6 +141,16 @@ class Machine(object):
def remote_device_set_netns(self, dev, dst, src):
self.rpc_call("set_dev_netns", dev, dst.name, netns=src)
+ dev_clsname = dev._dev_cls.__name__
+ dev_args = dev._dev_args
+ dev_kwargs = dev._dev_kwargs
+
+ self.rpc_call("remap_device",
+ dev.ifindex,
+ clsname=dev_clsname,
+ args=dev_args,
+ kwargs=dev_kwargs,
+ netns=dst)
def remote_device_method(self, index, method_name, args, kwargs, netns):
config_res = DeviceMethodCallResult(
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 221d386f..4a653dd7 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -221,6 +221,20 @@ class InterfaceManager(object):
else:
raise DeviceError("Device creation failed")
+ def remap_device(self, ifindex, clsname, args=[], kwargs={}):
+ devcls = self._device_classes[clsname]
+ old_device = self.get_device(ifindex)
+ kwargs["name"] = old_device.name
+
+ try:
+ remapped_device = devcls(self, *args, **kwargs)
+ except KeyError as e:
+ raise DeviceConfigError("%s is a mandatory argument" % e)
+ remapped_device._bulk_enabled = False
+ remapped_device.ifindex = ifindex
+ self.replace_dev(ifindex, remapped_device)
+ self.rescan_devices()
+
def replace_dev(self, if_id, dev):
del self._devices[if_id]
self._devices[if_id] = dev
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index d3ff90bf..2164b9c5 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -646,6 +646,9 @@ class SlaveMethods:
#TODO check if device appeared in the destination namespace
return True
+ def remap_device(self, ifindex, clsname, args=[], kwargs={}):
+ self._if_manager.remap_device(ifindex, clsname, args, kwargs)
+
# def return_if_netns(self, if_id):
# device = self._if_manager.get_mapped_device(if_id)
# if device.get_netns() == None:
--
2.26.3
2 years
[PATCH 0/6] ENRT: a set of functional tunnel recipes
by Jan Tluka
This patch series adds several functional tunnel recipes to ENRT
recipe package.
Jan Tluka (6):
Recipes.ENRT: add Ip6GreTunnelRecipe
Recipes.ENRT: add SitTunnelRecipe
Recipes.ENRT: add GreTunnelOverBondRecipe
Recipes.ENRT: add IpIpTunnelRecipe
Recipes.ENRT: add Ip6TnlTunnelRecipe
Recipes.ENRT: add GeneveTunnelRecipe
docs/source/geneve_tunnel_recipe.rst | 6 +
docs/source/gre_tunnel_over_bond_recipe.rst | 6 +
docs/source/ip6gre_tunnel_recipe.rst | 6 +
docs/source/ip6tnl_tunnel_recipe.rst | 6 +
docs/source/ipip_tunnel_recipe.rst | 6 +
docs/source/sit_tunnel_recipe.rst | 6 +
docs/source/specific_scenarios.rst | 6 +
lnst/Recipes/ENRT/GeneveTunnelRecipe.py | 184 +++++++++++++++
lnst/Recipes/ENRT/GreTunnelOverBondRecipe.py | 227 +++++++++++++++++++
lnst/Recipes/ENRT/Ip6GreTunnelRecipe.py | 187 +++++++++++++++
lnst/Recipes/ENRT/Ip6TnlTunnelRecipe.py | 154 +++++++++++++
lnst/Recipes/ENRT/IpIpTunnelRecipe.py | 154 +++++++++++++
lnst/Recipes/ENRT/SitTunnelRecipe.py | 171 ++++++++++++++
lnst/Recipes/ENRT/__init__.py | 6 +
14 files changed, 1125 insertions(+)
create mode 100644 docs/source/geneve_tunnel_recipe.rst
create mode 100644 docs/source/gre_tunnel_over_bond_recipe.rst
create mode 100644 docs/source/ip6gre_tunnel_recipe.rst
create mode 100644 docs/source/ip6tnl_tunnel_recipe.rst
create mode 100644 docs/source/ipip_tunnel_recipe.rst
create mode 100644 docs/source/sit_tunnel_recipe.rst
create mode 100644 lnst/Recipes/ENRT/GeneveTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/GreTunnelOverBondRecipe.py
create mode 100644 lnst/Recipes/ENRT/Ip6GreTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/Ip6TnlTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/IpIpTunnelRecipe.py
create mode 100644 lnst/Recipes/ENRT/SitTunnelRecipe.py
--
2.26.3
2 years
[PATCH] docs: add gre_tunnel_recipe.rst
by Jan Tluka
I forgot to include this in the previous patches.
Fixes: 20a31890337ee2025067baa4800f2d26fd826eb1
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
docs/source/gre_tunnel_recipe.rst | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 docs/source/gre_tunnel_recipe.rst
diff --git a/docs/source/gre_tunnel_recipe.rst b/docs/source/gre_tunnel_recipe.rst
new file mode 100644
index 00000000..6fcb1197
--- /dev/null
+++ b/docs/source/gre_tunnel_recipe.rst
@@ -0,0 +1,6 @@
+GreTunnelRecipe
+^^^^^^^^^^^^^^^^^^^
+
+.. autoclass:: lnst.Recipes.ENRT.GreTunnelRecipe.GreTunnelRecipe
+ :members:
+ :show-inheritance:
--
2.26.3
2 years