aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_gbp.py
AgeCommit message (Expand)AuthorFilesLines
2019-03-14GBP: get source address from ARP packets for LPM classificationNeale Ranns1-0/+10
2019-03-12GBP: L3 out fixesNeale Ranns1-34/+102
2019-03-12GBP: contracts API fixed length of allowed ethertypesNeale Ranns1-1/+4
2019-03-11vpp_papi_provider: Remove more wrapper functions.Ole Troan1-3/+3
2019-03-11VPP-1508: Tests: Fix vpp_api struct.error under py3.Paul Vinciguerra1-3/+3
2019-03-11VPP-1508: Use scapy.compat to manage packet level library differences.Paul Vinciguerra1-1/+1
2019-03-06GBP: use sclass in the DP for policyNeale Ranns1-70/+60
2019-03-06GBP: learn from ARP and L2 packetsNeale Ranns1-9/+108
2019-03-05GBP: per-group EP retention policyNeale Ranns1-38/+34
2019-03-04test framework: Fix wrapper functions to match API message names.Ole Troan1-3/+3
2019-03-01Tests: Remove all wildcard imports.Paul Vinciguerra1-16/+14
2019-01-22GBP: Sclass to src-epg conversionsNeale Ranns1-166/+83
2019-01-10ARP/ND: copy opaque2 persistent fields to new packetNeale Ranns1-2/+3
2019-01-10Enable GBP tests for ARMjuraj.linkes1-6/+1
2018-12-21GBP: add allowed ethertypes to contractsNeale Ranns1-34/+56
2018-12-20GBP: test case hardening against timing racesNeale Ranns1-13/+12
2018-12-20Tests: Cleanup @skip decorator.Paul Vinciguerra1-2/+2
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan1-48/+43
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-1/+0
2018-12-06Skip failing ARM testcases for CIjuraj.linkes1-1/+6
2018-11-30GBP: UT more robust for endpoint timeoutNeale Ranns1-16/+17
2018-11-29GBP: l3-out subnetsNeale Ranns1-12/+347
2018-11-29gbp: Add support for flow hash profileMohsin Kazmi1-59/+158
2018-11-15GBP: redirect contractsNeale Ranns1-27/+601
2018-11-07GBP: Endpoints with VLAN tags and birdges that don't learnNeale Ranns1-2/+178
2018-11-07GBP Endpoint LearningNeale Ranns1-241/+1164
2018-11-06BD ARP entry use common API typesNeale Ranns1-35/+33
2018-10-22GBP: Revert back to using VppIpPrefix wrapperOle Troan1-5/+4
2018-10-22PAPI: Add support for format/unformat functions.Ole Troan1-4/+5
2018-09-25L2 BD: introduce a BD interface on which to send UU packetsNeale Ranns1-3/+6
2018-09-11GBP Endpoint UpdatesNeale Ranns1-249/+241
2018-09-10vxlan-gbp: Add support for vxlan gbpMohsin Kazmi1-1/+1
2018-07-19gbp: Add support for ACLMohsin Kazmi1-10/+78
2018-06-24Revert "Revert "make test: fix broken interfaces""Klement Sekera1-5/+3
2018-06-22Revert "make test: fix broken interfaces"Ole Troan1-3/+5
2018-06-22make test: fix broken interfacesKlement Sekera1-5/+3
2018-05-18IP table bind allowed only if table existsNeale Ranns1-0/+2
2018-04-25GBPv6: NAT66 actions for GBPNeale Ranns1-58/+150
2018-04-13GBP V2Neale Ranns1-179/+850
2018-02-09GBP pluginNeale Ranns1-0/+369
s="p">() i.config_ip6() i.resolve_ndp() table_id += 1 def tearDown(self): 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() super(TestUdpEncap, self).tearDown() def validate_outer4(self, rx, encap_obj): self.assertEqual(rx[IP].src, encap_obj.src_ip_s) self.assertEqual(rx[IP].dst, encap_obj.dst_ip_s) self.assertEqual(rx[UDP].sport, encap_obj.src_port) self.assertEqual(rx[UDP].dport, encap_obj.dst_port) def validate_outer6(self, rx, encap_obj): self.assertEqual(rx[IPv6].src, encap_obj.src_ip_s) self.assertEqual(rx[IPv6].dst, encap_obj.dst_ip_s) self.assertEqual(rx[UDP].sport, encap_obj.src_port) self.assertEqual(rx[UDP].dport, encap_obj.dst_port) def validate_inner4(self, rx, tx, ttl=None): self.assertEqual(rx[IP].src, tx[IP].src) self.assertEqual(rx[IP].dst, tx[IP].dst) if ttl: self.assertEqual(rx[IP].ttl, ttl) else: self.assertEqual(rx[IP].ttl, tx[IP].ttl) def validate_inner6(self, rx, tx): self.assertEqual(rx.src, tx[IPv6].src) self.assertEqual(rx.dst, tx[IPv6].dst) self.assertEqual(rx.hlim, tx[IPv6].hlim) def test_udp_encap(self): """ UDP Encap test """ # # construct a UDP encap object through each of the peers # v4 through the first two peers, v6 through the second. # udp_encap_0 = VppUdpEncap(self, self.pg0.local_ip4, self.pg0.remote_ip4, 330, 440) udp_encap_1 = VppUdpEncap(self, self.pg1.local_ip4, self.pg1.remote_ip4, 331, 441, table_id=1) udp_encap_2 = VppUdpEncap(self, self.pg2.local_ip6, self.pg2.remote_ip6, 332, 442, table_id=2) udp_encap_3 = VppUdpEncap(self, self.pg3.local_ip6, self.pg3.remote_ip6, 333, 443, table_id=3) udp_encap_0.add_vpp_config() udp_encap_1.add_vpp_config() udp_encap_2.add_vpp_config() udp_encap_3.add_vpp_config() self.logger.info(self.vapi.cli("sh udp encap")) self.assertTrue(find_udp_encap(self, udp_encap_2)) self.assertTrue(find_udp_encap(self, udp_encap_3)) self.assertTrue(find_udp_encap(self, udp_encap_0)) self.assertTrue(find_udp_encap(self, udp_encap_1)) # # 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, 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 # p_4o4 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / IP(src="2.2.2.2", dst="1.1.0.1") / UDP(sport=1234, dport=1234) / Raw('\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) p = IP(p["UDP"].payload.load) self.validate_inner4(p, p_4o4) self.assertEqual(udp_encap_0.get_stats()['packets'], NUM_PKTS) # # 4o6 encap # p_4o6 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / IP(src="2.2.2.2", dst="1.1.2.1") / UDP(sport=1234, dport=1234) / Raw('\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) p = IP(p["UDP"].payload.load) self.validate_inner4(p, p_4o6) self.assertEqual(udp_encap_2.get_stats()['packets'], NUM_PKTS) # # 6o4 encap # p_6o4 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / IPv6(src="2001::100", dst="2001::1") / UDP(sport=1234, dport=1234) / Raw('\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) p = IPv6(p["UDP"].payload.load) self.validate_inner6(p, p_6o4) self.assertEqual(udp_encap_1.get_stats()['packets'], NUM_PKTS) # # 6o6 encap # p_6o6 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) / IPv6(src="2001::100", dst="2001::3") / UDP(sport=1234, dport=1234) / Raw('\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) p = IPv6(p["UDP"].payload.load) self.validate_inner6(p, p_6o6) self.assertEqual(udp_encap_3.get_stats()['packets'], NUM_PKTS) # # 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, 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)) rx = self.send_and_expect(self.pg0, p_4omo4*NUM_PKTS, self.pg1) for p in rx: self.validate_outer4(p, udp_encap_1) p = MPLS(p["UDP"].payload.load) self.validate_inner4(p, p_4omo4, ttl=63) self.assertEqual(udp_encap_1.get_stats()['packets'], 2*NUM_PKTS) class TestUDP(VppTestCase): """ UDP Test Case """ @classmethod def setUpClass(cls): super(TestUDP, cls).setUpClass() @classmethod def tearDownClass(cls): super(TestUDP, cls).tearDownClass() def setUp(self): super(TestUDP, self).setUp() self.vapi.session_enable_disable(is_enabled=1) self.create_loopback_interfaces(2) table_id = 0 for i in self.lo_interfaces: i.admin_up() if table_id != 0: tbl = VppIpTable(self, table_id) tbl.add_vpp_config() i.set_table_ip4(table_id) i.config_ip4() table_id += 1 # Configure namespaces self.vapi.app_namespace_add_del(namespace_id="0", sw_if_index=self.loop0.sw_if_index) self.vapi.app_namespace_add_del(namespace_id="1", sw_if_index=self.loop1.sw_if_index) def tearDown(self): for i in self.lo_interfaces: i.unconfig_ip4() i.set_table_ip4(0) i.admin_down() self.vapi.session_enable_disable(is_enabled=0) super(TestUDP, self).tearDown() def test_udp_transfer(self): """ UDP echo client/server transfer """ # Add inter-table routes ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32, [VppRoutePath("0.0.0.0", 0xffffffff, nh_table_id=1)]) ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32, [VppRoutePath("0.0.0.0", 0xffffffff, nh_table_id=0)], table_id=1) ip_t01.add_vpp_config() ip_t10.add_vpp_config() # Start builtin server and client uri = "udp://" + self.loop0.local_ip4 + "/1234" error = self.vapi.cli("test echo server appns 0 fifo-size 4 no-echo" + "uri " + uri) if error: self.logger.critical(error) self.assertNotIn("failed", error) error = self.vapi.cli("test echo client mbytes 10 appns 1 " + "fifo-size 4 no-output test-bytes " + "syn-timeout 2 no-return uri " + uri) if error: self.logger.critical(error) self.assertNotIn("failed", error) # Delete inter-table routes ip_t01.remove_vpp_config() ip_t10.remove_vpp_config() if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)