X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_udp.py;h=af64f8ae704ac10474ed1cfc167a09e98197d01d;hb=90430b6e057ecd1ce4f8200a68d4142ebafcb3ec;hp=c714f25e27f60a4bc38530ac5569dfa1aa18d208;hpb=4271c971919bb8defa3ca54f4a362676cd57bfb2;p=vpp.git diff --git a/test/test_udp.py b/test/test_udp.py index c714f25e27f..af64f8ae704 100644 --- a/test/test_udp.py +++ b/test/test_udp.py @@ -1,8 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import unittest from framework import VppTestCase, VppTestRunner + from vpp_udp_encap import find_udp_encap, VppUdpEncap -from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable, VppMplsLabel +from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable, VppMplsLabel, \ + FibPathType from scapy.packet import Raw from scapy.layers.l2 import Ether @@ -58,7 +60,6 @@ class TestUdpEncap(VppTestCase): for i in self.pg_interfaces: i.unconfig_ip4() i.unconfig_ip6() - i.ip6_disable() i.set_table_ip4(0) i.set_table_ip6(0) i.admin_down() @@ -131,32 +132,34 @@ class TestUdpEncap(VppTestCase): # # Routes via each UDP encap object - all combinations of v4 and v6. # - route_4o4 = VppIpRoute(self, "1.1.0.1", 32, - [VppRoutePath("0.0.0.0", - 0xFFFFFFFF, - is_udp_encap=1, - next_hop_id=udp_encap_0.id)]) - route_4o6 = VppIpRoute(self, "1.1.2.1", 32, - [VppRoutePath("0.0.0.0", - 0xFFFFFFFF, - is_udp_encap=1, - next_hop_id=udp_encap_2.id)]) - route_6o4 = VppIpRoute(self, "2001::1", 128, - [VppRoutePath("0.0.0.0", - 0xFFFFFFFF, - is_udp_encap=1, - next_hop_id=udp_encap_1.id)], - is_ip6=1) - route_6o6 = VppIpRoute(self, "2001::3", 128, - [VppRoutePath("0.0.0.0", - 0xFFFFFFFF, - is_udp_encap=1, - next_hop_id=udp_encap_3.id)], - is_ip6=1) - route_4o4.add_vpp_config() + route_4o4 = VppIpRoute( + self, "1.1.0.1", 32, + [VppRoutePath("0.0.0.0", + 0xFFFFFFFF, + type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP, + next_hop_id=udp_encap_0.id)]) + route_4o6 = VppIpRoute( + self, "1.1.2.1", 32, + [VppRoutePath("0.0.0.0", + 0xFFFFFFFF, + type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP, + next_hop_id=udp_encap_2.id)]) + route_6o4 = VppIpRoute( + self, "2001::1", 128, + [VppRoutePath("0.0.0.0", + 0xFFFFFFFF, + type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP, + next_hop_id=udp_encap_1.id)]) + route_6o6 = VppIpRoute( + self, "2001::3", 128, + [VppRoutePath("0.0.0.0", + 0xFFFFFFFF, + type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP, + next_hop_id=udp_encap_3.id)]) route_4o6.add_vpp_config() route_6o6.add_vpp_config() route_6o4.add_vpp_config() + route_4o4.add_vpp_config() # # 4o4 encap @@ -165,7 +168,7 @@ class TestUdpEncap(VppTestCase): dst=self.pg0.local_mac) / IP(src="2.2.2.2", dst="1.1.0.1") / UDP(sport=1234, dport=1234) / - Raw('\xa5' * 100)) + Raw(b'\xa5' * 100)) rx = self.send_and_expect(self.pg0, p_4o4*NUM_PKTS, self.pg0) for p in rx: self.validate_outer4(p, udp_encap_0) @@ -180,7 +183,7 @@ class TestUdpEncap(VppTestCase): dst=self.pg0.local_mac) / IP(src="2.2.2.2", dst="1.1.2.1") / UDP(sport=1234, dport=1234) / - Raw('\xa5' * 100)) + Raw(b'\xa5' * 100)) rx = self.send_and_expect(self.pg0, p_4o6*NUM_PKTS, self.pg2) for p in rx: self.validate_outer6(p, udp_encap_2) @@ -195,7 +198,7 @@ class TestUdpEncap(VppTestCase): dst=self.pg0.local_mac) / IPv6(src="2001::100", dst="2001::1") / UDP(sport=1234, dport=1234) / - Raw('\xa5' * 100)) + Raw(b'\xa5' * 100)) rx = self.send_and_expect(self.pg0, p_6o4*NUM_PKTS, self.pg1) for p in rx: self.validate_outer4(p, udp_encap_1) @@ -210,7 +213,7 @@ class TestUdpEncap(VppTestCase): dst=self.pg0.local_mac) / IPv6(src="2001::100", dst="2001::3") / UDP(sport=1234, dport=1234) / - Raw('\xa5' * 100)) + Raw(b'\xa5' * 100)) rx = self.send_and_expect(self.pg0, p_6o6*NUM_PKTS, self.pg3) for p in rx: self.validate_outer6(p, udp_encap_3) @@ -222,19 +225,20 @@ class TestUdpEncap(VppTestCase): # A route with an output label # the TTL of the inner packet is decremented on LSP ingress # - route_4oMPLSo4 = VppIpRoute(self, "1.1.2.22", 32, - [VppRoutePath("0.0.0.0", - 0xFFFFFFFF, - is_udp_encap=1, - next_hop_id=1, - labels=[VppMplsLabel(66)])]) + route_4oMPLSo4 = VppIpRoute( + self, "1.1.2.22", 32, + [VppRoutePath("0.0.0.0", + 0xFFFFFFFF, + type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP, + next_hop_id=1, + labels=[VppMplsLabel(66)])]) route_4oMPLSo4.add_vpp_config() p_4omo4 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / IP(src="2.2.2.2", dst="1.1.2.22") / UDP(sport=1234, dport=1234) / - Raw('\xa5' * 100)) + Raw(b'\xa5' * 100)) rx = self.send_and_expect(self.pg0, p_4omo4*NUM_PKTS, self.pg1) for p in rx: self.validate_outer4(p, udp_encap_1) @@ -273,9 +277,9 @@ class TestUDP(VppTestCase): table_id += 1 # Configure namespaces - self.vapi.app_namespace_add_del(namespace_id="0", + self.vapi.app_namespace_add_del(namespace_id="0".encode('ascii'), sw_if_index=self.loop0.sw_if_index) - self.vapi.app_namespace_add_del(namespace_id="1", + self.vapi.app_namespace_add_del(namespace_id="1".encode('ascii'), sw_if_index=self.loop1.sw_if_index) def tearDown(self):