+ #
+ # disable ipv4/vxlan
+ #
+ self.vxlan2.remove_vpp_config()
+
+ def test_gso_ipip(self):
+ """ GSO IPIP test """
+ self.logger.info(self.vapi.cli("sh int addr"))
+ #
+ # Send jumbo frame with gso enabled only on input interface and
+ # create IPIP tunnel on VPP pg0.
+ #
+ self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index)
+
+ #
+ # enable ipip4
+ #
+ self.ipip4.add_vpp_config()
+
+ # Set interface up and enable IP on it
+ self.ipip4.admin_up()
+ self.ipip4.set_unnumbered(self.pg0.sw_if_index)
+
+ # Add IPv4 routes via tunnel interface
+ self.ip4_via_ip4_tunnel = VppIpRoute(
+ self, "172.16.10.0", 24,
+ [VppRoutePath("0.0.0.0",
+ self.ipip4.sw_if_index,
+ proto=FibPathProto.FIB_PATH_NH_PROTO_IP4)])
+ self.ip4_via_ip4_tunnel.add_vpp_config()
+
+ #
+ # IPv4/IPv4 - IPIP
+ #
+ p47 = (Ether(src=self.pg2.remote_mac, dst="02:fe:60:1e:a2:79") /
+ IP(src=self.pg2.remote_ip4, dst="172.16.10.3", flags='DF') /
+ TCP(sport=1234, dport=1234) /
+ Raw(b'\xa5' * 65200))
+
+ rxs = self.send_and_expect(self.pg2, [p47], self.pg0, 45)
+ size = 0
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, self.pg0.local_mac)
+ self.assertEqual(rx[Ether].dst, self.pg0.remote_mac)
+ self.assertEqual(rx[IP].src, self.pg0.local_ip4)
+ self.assertEqual(rx[IP].dst, self.pg0.remote_ip4)
+ self.assertEqual(rx[IP].proto, 4) # ipencap
+ inner = rx[IP].payload
+ self.assertEqual(inner[IP].src, self.pg2.remote_ip4)
+ self.assertEqual(inner[IP].dst, "172.16.10.3")
+ size += inner[IP].len - 20 - 20
+ self.assertEqual(size, 65200)
+
+ self.ip6_via_ip4_tunnel = VppIpRoute(
+ self, "fd01:10::", 64,
+ [VppRoutePath("::",
+ self.ipip4.sw_if_index,
+ proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)])
+ self.ip6_via_ip4_tunnel.add_vpp_config()
+ #
+ # IPv4/IPv6 - IPIP
+ #
+ p67 = (Ether(src=self.pg2.remote_mac, dst="02:fe:60:1e:a2:79") /
+ IPv6(src=self.pg2.remote_ip6, dst="fd01:10::3") /
+ TCP(sport=1234, dport=1234) /
+ Raw(b'\xa5' * 65200))
+
+ rxs = self.send_and_expect(self.pg2, [p67], self.pg0, 45)
+ size = 0
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, self.pg0.local_mac)
+ self.assertEqual(rx[Ether].dst, self.pg0.remote_mac)
+ self.assertEqual(rx[IP].src, self.pg0.local_ip4)
+ self.assertEqual(rx[IP].dst, self.pg0.remote_ip4)
+ self.assertEqual(rx[IP].proto, 41) # ipv6
+ inner = rx[IP].payload
+ self.assertEqual(inner[IPv6].src, self.pg2.remote_ip6)
+ self.assertEqual(inner[IPv6].dst, "fd01:10::3")
+ size += inner[IPv6].plen - 20
+ self.assertEqual(size, 65200)
+
+ #
+ # Send jumbo frame with gso enabled only on input interface and
+ # create IPIP tunnel on VPP pg0. Enable gso feature node on ipip
+ # tunnel - IPSec use case
+ #
+ self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index, 0)
+ self.vapi.feature_gso_enable_disable(self.ipip4.sw_if_index)
+
+ rxs = self.send_and_expect(self.pg2, [p47], self.pg0, 45)
+ size = 0
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, self.pg0.local_mac)
+ self.assertEqual(rx[Ether].dst, self.pg0.remote_mac)
+ self.assertEqual(rx[IP].src, self.pg0.local_ip4)
+ self.assertEqual(rx[IP].dst, self.pg0.remote_ip4)
+ self.assertEqual(rx[IP].proto, 4) # ipencap
+ inner = rx[IP].payload
+ self.assertEqual(inner[IP].src, self.pg2.remote_ip4)
+ self.assertEqual(inner[IP].dst, "172.16.10.3")
+ size += inner[IP].len - 20 - 20
+ self.assertEqual(size, 65200)
+
+ #
+ # disable ipip4
+ #
+ self.vapi.feature_gso_enable_disable(self.ipip4.sw_if_index, 0)
+ self.ip4_via_ip4_tunnel.remove_vpp_config()
+ self.ip6_via_ip4_tunnel.remove_vpp_config()
+ self.ipip4.remove_vpp_config()
+
+ #
+ # enable ipip6
+ #
+ self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index)
+ self.ipip6.add_vpp_config()
+
+ # Set interface up and enable IP on it
+ self.ipip6.admin_up()
+ self.ipip6.set_unnumbered(self.pg0.sw_if_index)
+
+ # Add IPv4 routes via tunnel interface
+ self.ip4_via_ip6_tunnel = VppIpRoute(
+ self, "172.16.10.0", 24,
+ [VppRoutePath("0.0.0.0",
+ self.ipip6.sw_if_index,
+ proto=FibPathProto.FIB_PATH_NH_PROTO_IP4)])
+ self.ip4_via_ip6_tunnel.add_vpp_config()
+
+ #
+ # IPv6/IPv4 - IPIP
+ #
+ p48 = (Ether(src=self.pg2.remote_mac, dst="02:fe:60:1e:a2:79") /
+ IP(src=self.pg2.remote_ip4, dst="172.16.10.3", flags='DF') /
+ TCP(sport=1234, dport=1234) /
+ Raw(b'\xa5' * 65200))
+
+ rxs = self.send_and_expect(self.pg2, [p48], self.pg0, 45)
+ size = 0
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, self.pg0.local_mac)
+ self.assertEqual(rx[Ether].dst, self.pg0.remote_mac)
+ self.assertEqual(rx[IPv6].src, self.pg0.local_ip6)
+ self.assertEqual(rx[IPv6].dst, self.pg0.remote_ip6)
+ self.assertEqual(ipv6nh[rx[IPv6].nh], "IP")
+ inner = rx[IPv6].payload
+ self.assertEqual(inner[IP].src, self.pg2.remote_ip4)
+ self.assertEqual(inner[IP].dst, "172.16.10.3")
+ size += inner[IP].len - 20 - 20
+ self.assertEqual(size, 65200)
+
+ self.ip6_via_ip6_tunnel = VppIpRoute(
+ self, "fd01:10::", 64,
+ [VppRoutePath("::",
+ self.ipip6.sw_if_index,
+ proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)])
+ self.ip6_via_ip6_tunnel.add_vpp_config()
+
+ #
+ # IPv6/IPv6 - IPIP
+ #
+ p68 = (Ether(src=self.pg2.remote_mac, dst="02:fe:60:1e:a2:79") /
+ IPv6(src=self.pg2.remote_ip6, dst="fd01:10::3") /
+ TCP(sport=1234, dport=1234) /
+ Raw(b'\xa5' * 65200))
+
+ rxs = self.send_and_expect(self.pg2, [p68], self.pg0, 45)
+ size = 0
+ for rx in rxs:
+ self.assertEqual(rx[Ether].src, self.pg0.local_mac)
+ self.assertEqual(rx[Ether].dst, self.pg0.remote_mac)
+ self.assertEqual(rx[IPv6].src, self.pg0.local_ip6)
+ self.assertEqual(rx[IPv6].dst, self.pg0.remote_ip6)
+ self.assertEqual(ipv6nh[rx[IPv6].nh], "IPv6")
+ inner = rx[IPv6].payload
+ self.assertEqual(inner[IPv6].src, self.pg2.remote_ip6)
+ self.assertEqual(inner[IPv6].dst, "fd01:10::3")
+ size += inner[IPv6].plen - 20
+ self.assertEqual(size, 65200)
+
+ #
+ # disable ipip6
+ #
+ self.ip4_via_ip6_tunnel.remove_vpp_config()
+ self.ip6_via_ip6_tunnel.remove_vpp_config()
+ self.ipip6.remove_vpp_config()
+