On Wed, May 15, 2019 at 01:44:09PM +0200, csfakian(a)redhat.com wrote:
From: Christos Sfakianakis <csfakian(a)redhat.com>
Add the following recipes corresponding to master-phase3
recipes:
- IpsecEspAeadRecipe
- NoVirtOvsVxlanRecipe
- VirtOvsVxlanRecipe
- VxlanMulticastRecipe
- VxlanRemoteRecipe
You missed the IpsecEspAhCompRecipe recipe :).
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
lnst/Recipes/ENRT/IpsecEspAeadRecipe.py | 220 +++++++++++++++++++
lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py | 251 ++++++++++++++++++++++
lnst/Recipes/ENRT/NoVirtOvsVxlanRecipe.py | 76 +++++++
lnst/Recipes/ENRT/VirtOvsVxlanRecipe.py | 107 +++++++++
lnst/Recipes/ENRT/VxlanMulticastRecipe.py | 81 +++++++
lnst/Recipes/ENRT/VxlanRemoteRecipe.py | 66 ++++++
6 files changed, 801 insertions(+)
create mode 100644 lnst/Recipes/ENRT/IpsecEspAeadRecipe.py
create mode 100644 lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py
create mode 100644 lnst/Recipes/ENRT/NoVirtOvsVxlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/VirtOvsVxlanRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanMulticastRecipe.py
create mode 100644 lnst/Recipes/ENRT/VxlanRemoteRecipe.py
diff --git a/lnst/Recipes/ENRT/IpsecEspAeadRecipe.py
b/lnst/Recipes/ENRT/IpsecEspAeadRecipe.py
new file mode 100644
index 0000000..33e9b2f
--- /dev/null
+++ b/lnst/Recipes/ENRT/IpsecEspAeadRecipe.py
@@ -0,0 +1,220 @@
+"""
+Implements scenario similar to regression_tests/phase3/
+(ipsec_esp_aead.xml + ipsec_esp_aead.py)
+"""
+import signal
+from lnst.Common.IpAddress import ipaddress
+from lnst.Common.IpAddress import AF_INET, AF_INET6
+from lnst.Common.Parameters import StrParam
+from lnst.Controller import HostReq, DeviceReq, RecipeParam
+from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration,
EnrtSubConfiguration
+from lnst.RecipeCommon.PacketAssert import PacketAssertConf,
PacketAssertTestAndEvaluate
+from lnst.RecipeCommon.Perf.Measurements import Flow as PerfFlow
+from lnst.RecipeCommon.Ping import PingConf
+from lnst.Recipes.ENRT.XfrmTools import configure_ipsec_esp_aead, generate_key
+
+class IpsecEnrtSubConfiguration(EnrtSubConfiguration):
+ def __init__(self):
+ super(IpsecEnrtSubConfiguration, self).__init__()
+ self._ips = ()
+ self._ipsec_settings = ()
+
+ @property
+ def ipsec_settings(self):
+ return self._ipsec_settings
+
+ @ipsec_settings.setter
+ def ipsec_settings(self, value):
+ self._ipsec_settings = value
+
+ @property
+ def ips(self):
+ return self._ips
+
+ @ips.setter
+ def ips(self, value):
+ self._ips = value
+
+class IpsecEspAeadRecipe(BaseEnrtRecipe, PacketAssertTestAndEvaluate):
+ host1 = HostReq()
+ host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
+
+ host2 = HostReq()
+ host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
+
+ algorithm = [('rfc4106(gcm(aes))', 160, 96)]
+ spi_values = ["0x00001000", "0x00001001"]
+ ipsec_mode = StrParam(default="transport")
+
+ def generate_sub_configurations(self, main_config):
+ ipsec_mode = self.params.ipsec_mode
+ spi_values = self.spi_values
+ for offload_settings in self.params.offload_combinations:
+ for ipv in self.params.ip_versions:
+ if ipv == "ipv4":
+ family = AF_INET
+ elif ipv == "ipv6":
+ family = AF_INET6
+
+ ip1 = main_config.endpoint1.ips_filter(family=family)[0]
+ ip2 = main_config.endpoint2.ips_filter(family=family)[0]
+
+ for algo, key_len, icv_len in self.algorithm:
+ g_key = generate_key(key_len)
+ sub_config = IpsecEnrtSubConfiguration()
+ sub_config.offload_settings = offload_settings
+ sub_config.ips = (ip1, ip2)
+ sub_config.ipsec_settings = (algo, g_key, icv_len,
+ ipsec_mode, spi_values)
+ yield sub_config
+
+ def apply_sub_configuration(self, main_config, sub_config):
+ super(IpsecEspAeadRecipe, self).apply_sub_configuration(main_config,
sub_config)
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ ipsec_sets = sub_config.ipsec_settings
+ configure_ipsec_esp_aead(ns1, ip1, ns2, ip2, *ipsec_sets)
+
+ def remove_sub_configuration(self, main_config, sub_config):
+ super(IpsecEspAeadRecipe, self).remove_sub_configuration(main_config,
sub_config)
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ for ns in (ns1, ns2):
+ ns.run("ip xfrm policy flush")
+ ns.run("ip xfrm state flush")
+
+ def generate_ping_configurations(self, main_config, sub_config):
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ count = self.params.ping_count
+ interval = self.params.ping_interval
+ size = self.params.ping_psize
+ common_args = {'count' : count, 'interval' : interval,
'size' : size}
+ ping_conf = PingConf(client = ns1,
+ client_bind = ip1,
+ destination = ns2,
+ destination_address = ip2,
+ **common_args)
+ yield [ping_conf]
+
+ def generate_flow_combinations(self, main_config, sub_config):
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ for perf_test in self.params.perf_tests:
+ offload_values = sub_config.offload_settings.values()
+ offload_items = sub_config.offload_settings.items()
+ if ((perf_test == 'udp_stream' and ('gro', 'off') in
offload_items)
+ or
+ (perf_test == 'sctp_stream' and 'off' in offload_values
and
+ ('gso', 'on') in offload_items)):
+ continue
+
+ flow = PerfFlow(
+ type = perf_test,
+ generator = ns1,
+ generator_bind = ip1,
+ receiver = ns2,
+ receiver_bind = ip2,
+ msg_size = self.params.perf_msg_size,
+ duration = self.params.perf_duration,
+ parallel_streams = self.params.perf_parallel_streams,
+ cpupin = self.params.perf_tool_cpu if "perf_tool_cpu" in
self.params else None
+ )
+ yield [flow]
+
+ if "perf_reverse" in self.params and self.params.perf_reverse:
+ reverse_flow = self._create_reverse_flow(flow)
+ yield [reverse_flow]
+
+ def ping_test(self, ping_config):
+ m1, m2 = ping_config[0].client, ping_config[0].destination
+ ip1, ip2 = ping_config[0].client_bind, ping_config[0].destination_address
+ if1_name = self.get_dev_by_ip(m1, ip1).name
+ if2 = self.get_dev_by_ip(m2, ip2)
+
+ pa_kwargs = {}
+ pa_kwargs["p_filter"] = "esp"
+ pa_kwargs["grep_for"] = ["ESP\(spi=" + self.spi_values[1]]
+ if ping_config[0].count:
+ pa_kwargs["p_min"] = ping_config[0].count
+ pa_config = PacketAssertConf(m2, if2, **pa_kwargs)
+
+ dump = m1.run("tcpdump -i %s -nn -vv" % if1_name, bg=True)
+ pa_job = self.packet_assert_test(pa_config)
+ pa_job.start(bg=True)
+ self.ctl.wait(2)
+ ping_result = super(IpsecEspAeadRecipe, self).ping_test(ping_config)
+ self.ctl.wait(2)
+ pa_job.kill(signal=signal.SIGINT)
+ pa_job.wait()
+ pa_result = pa_job.result
+ dump.kill(signal=signal.SIGINT)
+
+ return (ping_result, pa_config, pa_result)
+
+ def ping_evaluate_and_report(self, ping_config, result):
+ super(IpsecEspAeadRecipe, self).ping_evaluate_and_report(ping_config,
result[0])
+ self.packet_assert_evaluate_and_report(result[1], result[2])
+
+ def get_dev_by_ip(self, netns, ip):
+ for dev in netns.device_database:
+ if ip in dev.ips:
+ return dev
+ from lnst.Common.LnstError import LnstError
Move the import to the module level, unless you have a reason to keep it
on the method level?
+ raise LnstError("Could not match ip %s to any device of
%s." %
+ (ip, netns.name))
+
+ def test_wide_configuration(self):
+ host1, host2 = self.matched.host1, self.matched.host2
+
+ for host in [host1, host2]:
+ host.eth0.down()
+
+ net_addr = "192.168."
+ net_addr6 = "fc00:"
+
+ for i, host in enumerate([host1, host2]):
+ host.eth0.ip_add(ipaddress(net_addr + str(i+99) + ".1/24"))
+ host.eth0.ip_add(ipaddress(net_addr6 + str(i+1) + "::1/64"))
+
+ #Due to limitations in the current EnrtConfiguration
+ #class, a single vlan test pair is chosen
+ configuration = EnrtConfiguration()
+ configuration.endpoint1 = host1.eth0
+ configuration.endpoint2 = host2.eth0
+
+ if self.params.ping_parallel or self.params.ping_bidirect:
+ import logging
same here with the import
+ logging.debug("Parallelism in pings is not
supported for this recipe, "
+ "ping_parallel/bidirect will be ignored.")
+
+ if "mtu" in self.params:
+ for host in [host1, host2]:
+ host.eth0.mtu = self.params.mtu
+
+ for host in [host1, host2]:
+ host.eth0.up()
+
+ for host, dst in [(host1, host2), (host2, host1)]:
+ for family in [AF_INET, AF_INET6]:
+ host.run("ip route add %s dev %s" %
+ (dst.eth0.ips_filter(family=family)[0], host.eth0.name))
+
+ #TODO better service handling through HostAPI
+ if "dev_intr_cpu" in self.params:
+ for host in [host1, host2]:
+ host.run("service irqbalance stop")
+ self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
+
+ if self.params.perf_parallel_streams > 1:
+ for host in [host1, host2]:
+ host.run("tc qdisc replace dev %s root mq" % host.eth0.name)
+
+ return configuration
+
+ def test_wide_deconfiguration(self, config):
+ host1, host2 = self.matched.host1, self.matched.host2
+
+ #TODO better service handling through HostAPI
+ if "dev_intr_cpu" in self.params:
+ for host in [host1, host2]:
+ host.run("service irqbalance start")
diff --git a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py
b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py
new file mode 100644
index 0000000..849c7d8
--- /dev/null
+++ b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py
@@ -0,0 +1,251 @@
+"""
+Implements scenario similar to regression_tests/phase3/
+(ipsec_esp_ah_comp.xml + ipsec_esp_ah_comp.py)
+"""
+import signal
+from copy import copy
+from lnst.Common.IpAddress import ipaddress
+from lnst.Common.IpAddress import AF_INET, AF_INET6
+from lnst.Common.Parameters import StrParam
+from lnst.Controller import HostReq, DeviceReq, RecipeParam
+from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration,
EnrtSubConfiguration
+from lnst.RecipeCommon.PacketAssert import PacketAssertConf,
PacketAssertTestAndEvaluate
+from lnst.RecipeCommon.Perf.Measurements import Flow as PerfFlow
+from lnst.RecipeCommon.Ping import PingConf
+from lnst.Recipes.ENRT.XfrmTools import configure_ipsec_esp_ah_comp, generate_key
+
+class IpsecEnrtSubConfiguration(EnrtSubConfiguration):
+ def __init__(self):
+ super(IpsecEnrtSubConfiguration, self).__init__()
+ self._ips = ()
+ self._ipsec_settings = ()
+
+ @property
+ def ipsec_settings(self):
+ return self._ipsec_settings
+
+ @ipsec_settings.setter
+ def ipsec_settings(self, value):
+ self._ipsec_settings = value
+
+ @property
+ def ips(self):
+ return self._ips
+
+ @ips.setter
+ def ips(self, value):
+ self._ips = value
+
+class IpsecEspAhCompRecipe(BaseEnrtRecipe, PacketAssertTestAndEvaluate):
+ host1 = HostReq()
+ host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
+
+ host2 = HostReq()
+ host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
+
+ ciphers = [('aes', 128), ('aes', 256)]
+ hashes = [('hmac(md5)', 128), ('sha256', 256)]
+ spi_values = ["0x00000001", "0x00000002",
"0x00000003", "0x00000004"]
+ ipsec_mode = StrParam(default="transport")
+
+ def generate_sub_configurations(self, main_config):
+ ipsec_mode = self.params.ipsec_mode
+ spi_values = self.spi_values
+ for offload_settings in self.params.offload_combinations:
+ for ipv in self.params.ip_versions:
+ if ipv == "ipv4":
+ family = AF_INET
+ elif ipv == "ipv6":
+ family = AF_INET6
+
+ ip1 = main_config.endpoint1.ips_filter(family=family)[0]
+ ip2 = main_config.endpoint2.ips_filter(family=family)[0]
+
+ for ciph_alg, ciph_len in self.ciphers:
+ for hash_alg, hash_len in self.hashes:
+ ciph_key = generate_key(ciph_len)
+ hash_key = generate_key(hash_len)
+ sub_config = IpsecEnrtSubConfiguration()
+ sub_config.offload_settings = offload_settings
+ sub_config.ips = (ip1, ip2)
+ sub_config.ipsec_settings = (ciph_alg, ciph_key, hash_alg,
+ hash_key, ipsec_mode, spi_values)
+ yield sub_config
+
+ def apply_sub_configuration(self, main_config, sub_config):
+ super(IpsecEspAhCompRecipe, self).apply_sub_configuration(main_config,
sub_config)
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ ipsec_sets = sub_config.ipsec_settings
+ configure_ipsec_esp_ah_comp(ns1, ip1, ns2, ip2, *ipsec_sets)
+
+ def remove_sub_configuration(self, main_config, sub_config):
+ super(IpsecEspAhCompRecipe, self).remove_sub_configuration(main_config,
sub_config)
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ for ns in (ns1, ns2):
+ ns.run("ip xfrm policy flush")
+ ns.run("ip xfrm state flush")
+
+ def generate_ping_configurations(self, main_config, sub_config):
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ count = self.params.ping_count
+ interval = self.params.ping_interval
+ size = self.params.ping_psize
+ common_args = {'count' : count, 'interval' : interval,
'size' : size}
+ ping_conf = PingConf(client = ns1,
+ client_bind = ip1,
+ destination = ns2,
+ destination_address = ip2,
+ **common_args)
+ yield [ping_conf]
+
+ def generate_flow_combinations(self, main_config, sub_config):
+ ns1, ns2 = main_config.endpoint1.netns, main_config.endpoint2.netns
+ ip1, ip2 = sub_config.ips
+ for perf_test in self.params.perf_tests:
+ offload_values = sub_config.offload_settings.values()
+ offload_items = sub_config.offload_settings.items()
+ if ((perf_test == 'udp_stream' and ('gro', 'off') in
offload_items)
+ or
+ (perf_test == 'sctp_stream' and 'off' in offload_values
and
+ ('gso', 'on') in offload_items)):
+ continue
+
+ flow = PerfFlow(
+ type = perf_test,
+ generator = ns1,
+ generator_bind = ip1,
+ receiver = ns2,
+ receiver_bind = ip2,
+ msg_size = self.params.perf_msg_size,
+ duration = self.params.perf_duration,
+ parallel_streams = self.params.perf_parallel_streams,
+ cpupin = self.params.perf_tool_cpu if "perf_tool_cpu" in
self.params else None
+ )
+ yield [flow]
+
+ if "perf_reverse" in self.params and self.params.perf_reverse:
+ reverse_flow = self._create_reverse_flow(flow)
+ yield [reverse_flow]
+
+ def ping_test(self, ping_config):
+ m1, m2 = ping_config[0].client, ping_config[0].destination
+ ip1, ip2 = ping_config[0].client_bind, ping_config[0].destination_address
+ if1_name = self.get_dev_by_ip(m1, ip1).name
+ if2 = self.get_dev_by_ip(m2, ip2)
+
+ pa_kwargs = {}
+ pa_kwargs["p_filter"] = "ah"
+ pa_kwargs["grep_for"] = ["AH\(spi=" + self.spi_values[2],
"ESP\(spi=" + self.spi_values[1]]
+ if ping_config[0].count:
+ pa_kwargs["p_min"] = 2 * ping_config[0].count
+ pa_config = PacketAssertConf(m2, if2, **pa_kwargs)
+
+ dump = m1.run("tcpdump -i %s -nn -vv" % if1_name, bg=True)
+ pa_job = self.packet_assert_test(pa_config)
+ pa_job.start(bg=True)
+ self.ctl.wait(2)
+ ping_result = super(IpsecEspAhCompRecipe, self).ping_test(ping_config)
+ self.ctl.wait(2)
+ pa_job.kill(signal=signal.SIGINT)
+ pa_job.wait()
+ pa_result = pa_job.result
+ dump.kill(signal=signal.SIGINT)
+
+ m1.run("ip -s xfrm pol")
+ m1.run("ip -s xfrm state")
+
+ dump2 = m1.run("tcpdump -i %s -nn -vv" % if1_name, bg=True)
+ no_trans = self.params.ipsec_mode != 'transport'
+ if no_trans:
+ pa_kwargs2 = copy(pa_kwargs)
+ pa_kwargs2["p_filter"] = ''
+ pa_kwargs2["grep_for"] = ["IPComp"]
+ pa_config2 = PacketAssertConf(m2, if2, **pa_kwargs2)
+ pa_job2 = self.packet_assert_test(pa_config2)
+ pa_job2.start(bg=True)
+ self.ctl.wait(2)
+ ping_config2 = copy(ping_config)
+ ping_config2[0].size = 1500
+ ping_result2 = super(IpsecEspAhCompRecipe, self).ping_test(ping_config2)
+ self.ctl.wait(2)
+ if no_trans:
+ pa_job2.kill(signal=signal.SIGINT)
+ pa_job2.wait()
+ pa_result2 = pa_job2.result
+ dump2.kill(signal=signal.SIGINT)
+
+ result = ((ping_result, pa_config, pa_result),)
+ if no_trans:
+ result += ((ping_result2, pa_config2, pa_result2),)
+ return result
+
+ def ping_evaluate_and_report(self, ping_config, result):
+ for res in result:
+ super(IpsecEspAhCompRecipe, self).ping_evaluate_and_report(ping_config,
res[0])
+ self.packet_assert_evaluate_and_report(res[1], res[2])
+
+ def get_dev_by_ip(self, netns, ip):
+ for dev in netns.device_database:
+ if ip in dev.ips:
+ return dev
+ from lnst.Common.LnstError import LnstError
same here with the import
+ raise LnstError("Could not match ip %s to any device of
%s." %
+ (ip, netns.name))
+
+ def test_wide_configuration(self):
+ host1, host2 = self.matched.host1, self.matched.host2
+
+ for host in [host1, host2]:
+ host.eth0.down()
+
+ net_addr = "192.168."
+ net_addr6 = "fc00:"
+
+ for i, host in enumerate([host1, host2]):
+ host.eth0.ip_add(ipaddress(net_addr + str(i+99) + ".1/24"))
+ host.eth0.ip_add(ipaddress(net_addr6 + str(i+1) + "::1/64"))
+
+ #Due to limitations in the current EnrtConfiguration
+ #class, a single vlan test pair is chosen
+ configuration = EnrtConfiguration()
+ configuration.endpoint1 = host1.eth0
+ configuration.endpoint2 = host2.eth0
+
+ if self.params.ping_parallel or self.params.ping_bidirect:
+ import logging
and here
+ logging.debug("Parallelism in pings is not
supported for this recipe, "
+ "ping_parallel/bidirect will be ignored.")
+
+ if "mtu" in self.params:
+ for host in [host1, host2]:
+ host.eth0.mtu = self.params.mtu
+
+ for host in [host1, host2]:
+ host.eth0.up()
+
+ for host, dst in [(host1, host2), (host2, host1)]:
+ for family in [AF_INET, AF_INET6]:
+ host.run("ip route add %s dev %s" %
+ (dst.eth0.ips_filter(family=family)[0], host.eth0.name))
+
+ #TODO better service handling through HostAPI
+ if "dev_intr_cpu" in self.params:
+ for host in [host1, host2]:
+ host.run("service irqbalance stop")
+ self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
+
+ if self.params.perf_parallel_streams > 1:
+ for host in [host1, host2]:
+ host.run("tc qdisc replace dev %s root mq" % host.eth0.name)
+
+ return configuration
+
+ def test_wide_deconfiguration(self, config):
+ host1, host2 = self.matched.host1, self.matched.host2
+
+ #TODO better service handling through HostAPI
+ if "dev_intr_cpu" in self.params:
+ for host in [host1, host2]:
+ host.run("service irqbalance start")
There's a lot of duplicated code in between the two Ipsec recipes, I
think we can accept it for now since we just want the old recipes to be
ported but later on we should definitely have a second look at these and
do some refactoring.
> diff --git a/lnst/Recipes/ENRT/NoVirtOvsVxlanRecipe.py
b/lnst/Recipes/ENRT/NoVirtOvsVxlanRecipe.py
> new file mode 100644
> index 0000000..31e2635
> --- /dev/null
> +++ b/lnst/Recipes/ENRT/NoVirtOvsVxlanRecipe.py
> @@ -0,0 +1,76 @@
> +"""
> +Implements scenario similar to regression_tests/phase3/
> +(novirt_ovs_vxlan.xml + novirt_ovs_vxlan.py)
> +"""
> +from lnst.Common.IpAddress import ipaddress
> +from lnst.Controller import HostReq, DeviceReq, RecipeParam
> +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration
> +from lnst.Devices import OvsBridgeDevice
> +
> +class NoVirtOvsVxlanRecipe(BaseEnrtRecipe):
> + host1 = HostReq()
> + host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> +
> + host2 = HostReq()
> + host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> +
> + def test_wide_configuration(self):
> + host1, host2 = self.matched.host1, self.matched.host2
> +
> + for host in [host1, host2]:
> + host.eth0.down()
> +
> + net_addr = "192.168.2"
> + vxlan_net_addr = "192.168.100"
> + vxlan_net_addr6 = "fc00:0:0:0"
> +
> + flow_entries=[]
> +
flow_entries.append("table=0,in_port=5,actions=set_field:100->tun_id,output:10")
> +
flow_entries.append("table=0,in_port=10,tun_id=100,actions=output:5")
> + flow_entries.append("table=0,priority=100,actions=drop")
> +
> + for i, host in enumerate([host1, host2]):
> + host.eth0.ip_add(ipaddress(net_addr + "." + str (i+1) +
"/24"))
> + host.br0 = OvsBridgeDevice()
> + host.int0 = host.br0.internal_port_add(ofport_request='5',
name="int0")
> + host.int0.ip_add(ipaddress(vxlan_net_addr + "." + str (i+1) +
"/24"))
> + host.int0.ip_add(ipaddress(vxlan_net_addr6 + "::" + str (i+1)
+ "/64"))
> + tunnel_opts = {"option:remote_ip" : net_addr + "." +
str (2-i), "option:key" : "flow",
> + "ofport_request" : "10"}
> + host.br0.tunnel_add("vxlan", tunnel_opts)
> + host.br0.flows_add(flow_entries)
> +
> + #Due to limitations in the current EnrtConfiguration
> + #class, a single vlan test pair is chosen
> + configuration = EnrtConfiguration()
> + configuration.endpoint1 = host1.int0
> + configuration.endpoint2 = host2.int0
> +
> + if "mtu" in self.params:
> + for host in [host1, host2]:
> + host.int0.mtu = self.params.mtu
> +
> + for host in [host1, host2]:
> + host.eth0.up()
> + host.int0.up()
> + host.br0.up()
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance stop")
> + self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
> +
> + if self.params.perf_parallel_streams > 1:
> + for host in [host1, host2]:
> + host.run("tc qdisc replace dev %s root mq" %
host.eth0.name)
> +
> + return configuration
> +
> + def test_wide_deconfiguration(self, config):
> + host1, host2 = self.matched.host1, self.matched.host2
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance start")
> diff --git a/lnst/Recipes/ENRT/VirtOvsVxlanRecipe.py
b/lnst/Recipes/ENRT/VirtOvsVxlanRecipe.py
> new file mode 100644
> index 0000000..3c25bc8
> --- /dev/null
> +++ b/lnst/Recipes/ENRT/VirtOvsVxlanRecipe.py
> @@ -0,0 +1,107 @@
> +"""
> +Implements scenario similar to regression_tests/phase3/
> +(2_virt_ovs_vxlan.xml + 2_virt_ovs_vxlan.py)
> +"""
> +from lnst.Common.IpAddress import ipaddress
> +from lnst.Controller import HostReq, DeviceReq, RecipeParam
> +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration
> +from lnst.Devices import OvsBridgeDevice
> +
> +class VirtOvsVxlanRecipe(BaseEnrtRecipe):
> + host1 = HostReq()
> + host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> + host1.tap0 = DeviceReq(label="to_guest1")
> + host1.tap1 = DeviceReq(label="to_guest2")
> +
> + host2 = HostReq()
> + host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> + host2.tap0 = DeviceReq(label="to_guest3")
> + host2.tap1 = DeviceReq(label="to_guest4")
> +
> + guest1 = HostReq()
> + guest1.eth0 = DeviceReq(label="to_guest1")
> +
> + guest2 = HostReq()
> + guest2.eth0 = DeviceReq(label="to_guest2")
> +
> + guest3 = HostReq()
> + guest3.eth0 = DeviceReq(label="to_guest3")
> +
> + guest4 = HostReq()
> + guest4.eth0 = DeviceReq(label="to_guest4")
> +
> + def test_wide_configuration(self):
> + host1, host2, guest1, guest2, guest3, guest4 = self.matched.host1,
self.matched.host2,\
> + self.matched.guest1, self.matched.guest2, self.matched.guest3,
self.matched.guest4
> +
> + for host in [host1, host2]:
> + host.eth0.down()
> + host.tap0.down()
> + host.tap1.down()
> + for guest in [guest1, guest2, guest3, guest4]:
> + guest.eth0.down()
> +
> + net_addr = "192.168.2"
> + vxlan_net_addr = "192.168.100"
> + vxlan_net_addr6 = "fc00:0:0:0"
> +
> + flow_entries=[]
> +
flow_entries.append("table=0,in_port=5,actions=set_field:100->tun_id,output:10")
> +
flow_entries.append("table=0,in_port=6,actions=set_field:200->tun_id,output:10")
> +
flow_entries.append("table=0,in_port=10,tun_id=100,actions=output:5")
> +
flow_entries.append("table=0,in_port=10,tun_id=200,actions=output:6")
> + flow_entries.append("table=0,priority=100,actions=drop")
> +
> + for i, host in enumerate([host1, host2]):
> + host.eth0.ip_add(ipaddress(net_addr + "." + str (i+1) +
"/24"))
> + host.br0 = OvsBridgeDevice()
> + for dev, ofport_r in [(host.tap0, '5'), (host.tap1,
'6')]:
> + host.br0.port_add(dev, set_iface=True, ofport_request=ofport_r)
> + tunnel_opts = {"option:remote_ip" : net_addr + "." +
str (2-i), "option:key" : "flow",
> + "ofport_request" : '10'}
> + host.br0.tunnel_add("vxlan", tunnel_opts)
> + host.br0.flows_add(flow_entries)
> +
> + for i, guest in enumerate([guest1, guest2, guest3, guest4]):
> + guest.eth0.ip_add(ipaddress(vxlan_net_addr + "." + str (i+1) +
"/24"))
> + guest.eth0.ip_add(ipaddress(vxlan_net_addr6 + "::" + str (i+1)
+ "/64"))
> +
> + #Due to limitations in the current EnrtConfiguration
> + #class, a single vlan test pair is chosen
> + configuration = EnrtConfiguration()
> + configuration.endpoint1 = guest1.eth0
> + configuration.endpoint2 = guest3.eth0
> +
> + if "mtu" in self.params:
> + for guest in [guest1, guest2, guest3, guest4]:
> + guest.eth0.mtu = self.params.mtu
> +
> + for host in [host1, host2]:
> + host.eth0.up()
> + host.tap0.up()
> + host.tap1.up()
> + host.br0.up()
> + for guest in [guest1, guest2, guest3, guest4]:
> + guest.eth0.up()
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for machine in [host1, host2, guest1, guest2, guest3, guest4]:
> + machine.run("service irqbalance stop")
> + for host in [host1, host2]:
> + self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
> +
> + if self.params.perf_parallel_streams > 1:
> + for host in [host1, host2]:
> + host.run("tc qdisc replace dev %s root mq" %
host.eth0.name)
> +
> + return configuration
> +
> + def test_wide_deconfiguration(self, config):
> + host1, host2, guest1, guest2, guest3, guest4 = self.matched.host1,
self.matched.host2,\
> + self.matched.guest1, self.matched.guest2, self.matched.guest3,
self.matched.guest4
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for machine in [host1, host2, guest1, guest2, guest3, guest4]:
> + machine.run("service irqbalance start")
> diff --git a/lnst/Recipes/ENRT/VxlanMulticastRecipe.py
b/lnst/Recipes/ENRT/VxlanMulticastRecipe.py
> new file mode 100644
> index 0000000..53ada96
> --- /dev/null
> +++ b/lnst/Recipes/ENRT/VxlanMulticastRecipe.py
> @@ -0,0 +1,81 @@
> +"""
> +Implements scenario similar to regression_tests/phase3/
> +(vxlan_multicast.xml + vxlan_multicast.py)
> +"""
> +from lnst.Common.IpAddress import ipaddress
> +from lnst.Controller import HostReq, DeviceReq, RecipeParam
> +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration
> +from lnst.Devices import BridgeDevice, VxlanDevice
> +
> +class VxlanMulticastRecipe(BaseEnrtRecipe):
> + host1 = HostReq()
> + host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> + host1.tap0 = DeviceReq(label="to_guest1")
> +
> + host2 = HostReq()
> + host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> +
> + guest1 = HostReq()
> + guest1.eth0 = DeviceReq(label="to_guest1")
> +
> + def test_wide_configuration(self):
> + host1, host2, guest1 = self.matched.host1, self.matched.host2,
self.matched.guest1
> +
> + for machine in [host1, host2, guest1]:
> + machine.eth0.down()
> + host1.tap0.down()
> +
> + net_addr = "192.168.0"
> + vxlan_net_addr = "192.168.100"
> + vxlan_net_addr6 = "fc00:0:0:0"
> + #TODO: Enable usage of a proper address (like 239.1.1.1)
> + vxlan_group_ip = "192.168.0.3"
> +
> + host1.br0 = BridgeDevice()
> + host1.br0.slave_add(host1.eth0)
> + host1.br0.slave_add(host1.tap0)
> +
> + for i, (machine, dev) in enumerate([(host1, host1.br0), (guest1,
guest1.eth0),
> + (host2, host2.eth0)]):
> + dev.ip_add(ipaddress(net_addr + "." + str(i+1) +
"/24"))
> + machine.vxlan0 = VxlanDevice(vxlan_id='1',
group=vxlan_group_ip)
> + machine.vxlan0.realdev = dev
> + machine.vxlan0.ip_add(ipaddress(vxlan_net_addr + "." + str
(i+1) + "/24"))
> + machine.vxlan0.ip_add(ipaddress(vxlan_net_addr6 + "::" + str
(i+1) + "/64"))
> +
> + #Due to limitations in the current EnrtConfiguration
> + #class, a single vlan test pair is chosen
> + configuration = EnrtConfiguration()
> + configuration.endpoint1 = host1.vxlan0
> + configuration.endpoint2 = host2.vxlan0
> +
> + if "mtu" in self.params:
> + for machine in [host1, host2, guest1]:
> + machine.vxlan0.mtu = self.params.mtu
> +
> + for machine in [host1, host2, guest1]:
> + machine.eth0.up()
> + host1.tap0.up()
> + host1.br0.up()
> + for machine in [host1, host2, guest1]:
> + machine.vxlan0.up()
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance stop")
> + self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
> +
> + if self.params.perf_parallel_streams > 1:
> + for host in [host1, host2]:
> + host.run("tc qdisc replace dev %s root mq" %
host.eth0.name)
> +
> + return configuration
> +
> + def test_wide_deconfiguration(self, config):
> + host1, host2, guest1 = self.matched.host1, self.matched.host2,
self.matched.guest1
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance start")
> diff --git a/lnst/Recipes/ENRT/VxlanRemoteRecipe.py
b/lnst/Recipes/ENRT/VxlanRemoteRecipe.py
> new file mode 100644
> index 0000000..99e2522
> --- /dev/null
> +++ b/lnst/Recipes/ENRT/VxlanRemoteRecipe.py
> @@ -0,0 +1,66 @@
> +"""
> +Implements scenario similar to regression_tests/phase3/
> +(vxlan_remote.xml + vxlan_remote.py)
> +"""
> +from lnst.Common.IpAddress import ipaddress
> +from lnst.Controller import HostReq, DeviceReq, RecipeParam
> +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration
> +from lnst.Devices import VxlanDevice
> +
> +class VxlanRemoteRecipe(BaseEnrtRecipe):
> + host1 = HostReq()
> + host1.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> +
> + host2 = HostReq()
> + host2.eth0 = DeviceReq(label="to_switch",
driver=RecipeParam("driver"))
> +
> + def test_wide_configuration(self):
> + host1, host2 = self.matched.host1, self.matched.host2
> +
> + for host in [host1, host2]:
> + host.eth0.down()
> +
> + net_addr = "192.168.0"
> + vxlan_net_addr = "192.168.100"
> + vxlan_net_addr6 = "fc00:0:0:0"
> +
> + for i, host in enumerate([host1, host2]):
> + host.eth0.ip_add(ipaddress(net_addr + "." + str(i+1) +
"/24"))
> + host.vxlan0 = VxlanDevice(vxlan_id='1', remote=net_addr +
"." + str(2-i))
> + host.vxlan0.realdev = host.eth0
> + host.vxlan0.ip_add(ipaddress(vxlan_net_addr + "." + str (i+1)
+ "/24"))
> + host.vxlan0.ip_add(ipaddress(vxlan_net_addr6 + "::" + str
(i+1) + "/64"))
> +
> + #Due to limitations in the current EnrtConfiguration
> + #class, a single vlan test pair is chosen
> + configuration = EnrtConfiguration()
> + configuration.endpoint1 = host1.vxlan0
> + configuration.endpoint2 = host2.vxlan0
> +
> + if "mtu" in self.params:
> + for host in [host1, host2]:
> + host.vxlan0.mtu = self.params.mtu
> +
> + for host in [host1, host2]:
> + host.eth0.up()
> + host.vxlan0.up()
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance stop")
> + self._pin_dev_interrupts(host.eth0, self.params.dev_intr_cpu)
> +
> + if self.params.perf_parallel_streams > 1:
> + for host in [host1, host2]:
> + host.run("tc qdisc replace dev %s root mq" %
host.eth0.name)
> +
> + return configuration
> +
> + def test_wide_deconfiguration(self, config):
> + host1, host2 = self.matched.host1, self.matched.host2
> +
> + #TODO better service handling through HostAPI
> + if "dev_intr_cpu" in self.params:
> + for host in [host1, host2]:
> + host.run("service irqbalance start")
> --
> 2.17.1
> _______________________________________________
> LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
> Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...