aboutsummaryrefslogtreecommitdiffstats
path: root/test/util.py
AgeCommit message (Expand)AuthorFilesLines
2019-01-21Simplify test/util.py:ppp.Paul Vinciguerra1-9/+3
2018-12-18PAPI: Add MACAddress object wrapper for vl_api_mac_address_tOle Troan1-2/+2
2018-12-10Test framework: StringIO fixes for Python3Ole Troan1-7/+29
2018-10-10Setup, teardown, DEBUG=core, FAILFAST fixesjuraj.linkes1-12/+26
2018-10-03ipsec: add missing ipv6 ah code & ipv6 testsKlement Sekera1-0/+3
2018-03-31make test: print a warning in case a core_pattern contains a filter programAndrew Yourtchenko1-0/+15
2018-03-19Scapy upgrade to 2.4.0.rc5Neale Ranns1-1/+1
2018-03-16IPv6 ND Router discovery data plane (VPP-1095)Juraj Sloboda1-0/+5
2018-02-01IPv4/6 reassemblyKlement Sekera1-10/+185
2017-09-07test: factor out "L4_Conn" into a class within util.py (VPP-931)Andrew Yourtchenko1-0/+66
2017-07-04TEST:add L2BD arp term testsEyal Bari1-0/+26
2017-04-19Learn IP6 link-local ND entries from NSs sourced from link-local addressNeale Ranns1-1/+20
2017-02-27[Proxy] ARP testsNeale Ranns1-0/+5
2017-02-21Add basic 4o4 LISP unit testFilip Tehlar1-0/+13
2017-02-14make test: improve stabilityKlement Sekera1-0/+2
2017-01-17BFD: IPv6 supportKlement Sekera1-3/+8
2017-01-17make test: add checkstyle targetKlement Sekera1-1/+2
2017-01-11vxlan unit test - minor fixesEyal Bari1-0/+10
2016-12-23make test: improve handling of packet capturesKlement Sekera1-10/+7
2016-12-16make test: improve robustness and performanceKlement Sekera1-0/+22
2016-12-07BFD: basic asynchronous session up/downKlement Sekera1-0/+22
2016-12-05make test: fix missing log/packet messagesKlement Sekera1-0/+14
2016-11-11Add IRB testMatej Klotton1-4/+8
2016-10-26refactor test frameworkKlement Sekera1-133/+19
2016-10-03test: new test infrastructureDamjan Marion1-0/+139
n> import ip_address, IPv4Address, IPv6Address from socket import AF_INET, AF_INET6 class TestIpfixExporter(VppTestCase): """ Ipfix Exporter Tests """ def setUp(self): super(TestIpfixExporter, self).setUp() self.create_pg_interfaces(range(4)) for i in self.pg_interfaces: i.admin_up() i.config_ip4() i.resolve_arp() i.config_ip6() i.resolve_ndp() i.disable_ipv6_ra() def tearDown(self): super(TestIpfixExporter, self).tearDown() for i in self.pg_interfaces: i.unconfig_ip4() i.unconfig_ip6() i.admin_down() def find_exp_by_collector_addr(self, exporters, addr): """ Find the exporter in the list of exportes with the given addr """ for exp in exporters: if exp.collector_address == IPv4Address(addr): return exp return None def verify_exporter_detail(self, exp, collector_addr, src_addr, collector_port=4739, mtu=1400, interval=20): self.assertTrue(exp is not None) self.assert_equal(exp.collector_address, collector_addr) self.assert_equal(exp.src_address, src_addr) self.assert_equal(exp.collector_port, collector_port) self.assert_equal(exp.path_mtu, mtu) self.assert_equal(exp.template_interval, interval) def test_create_multipe_exporters(self): """ test that we can create and dump multiple exporters """ mtu = 1400 interval = 20 port = 4739 # Old API - always gives us pool index 0. self.vapi.set_ipfix_exporter( collector_address=self.pg1.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu, template_interval=interval) exporters = self.vapi.ipfix_exporter_dump() exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) # create a 2nd exporter self.vapi.ipfix_exporter_create_delete( collector_address=self.pg2.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu, template_interval=interval, is_create=True) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) self.assertTrue(len(exporters) == 2) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) exp = self.find_exp_by_collector_addr(exporters, self.pg2.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg2.remote_ip4), IPv4Address(self.pg0.local_ip4)) # Create a 3rd exporter self.vapi.ipfix_exporter_create_delete( collector_address=self.pg3.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu, template_interval=interval, is_create=True) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) self.assertTrue(len(exporters) == 3) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) exp = self.find_exp_by_collector_addr(exporters, self.pg2.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg2.remote_ip4), IPv4Address(self.pg0.local_ip4)) exp = self.find_exp_by_collector_addr(exporters, self.pg3.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg3.remote_ip4), IPv4Address(self.pg0.local_ip4)) # Modify the 2nd exporter. self.vapi.ipfix_exporter_create_delete( collector_address=self.pg2.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu+1, template_interval=interval+1, is_create=True) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) self.assertTrue(len(exporters) == 3) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) exp = self.find_exp_by_collector_addr(exporters, self.pg2.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg2.remote_ip4), IPv4Address(self.pg0.local_ip4), mtu=mtu+1, interval=interval+1) exp = self.find_exp_by_collector_addr(exporters, self.pg3.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg3.remote_ip4), IPv4Address(self.pg0.local_ip4)) # Delete 2nd exporter self.vapi.ipfix_exporter_create_delete( collector_address=self.pg2.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu, template_interval=interval, is_create=False) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) self.assertTrue(len(exporters) == 2) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4)) exp = self.find_exp_by_collector_addr(exporters, self.pg3.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg3.remote_ip4), IPv4Address(self.pg0.local_ip4)) # Delete final exporter (exporter in slot 0 can not be deleted) self.vapi.ipfix_exporter_create_delete( collector_address=self.pg3.remote_ip4, src_address=self.pg0.local_ip4, collector_port=4739, path_mtu=mtu, template_interval=interval, is_create=False) exporters = list(self.vapi.vpp.details_iter( self.vapi.ipfix_all_exporter_get)) self.assertTrue(len(exporters) == 1) exp = self.find_exp_by_collector_addr(exporters, self.pg1.remote_ip4) self.verify_exporter_detail(exp, IPv4Address(self.pg1.remote_ip4), IPv4Address(self.pg0.local_ip4))