summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
AgeCommit message (Expand)AuthorFilesLines
2021-10-27api: fix buffer overflow in vl_msg_replay_jsonBenoît Ganne1-0/+4
2021-10-18interface: add api test fileFilip Tehlar5-64/+43
2021-10-12api: cli coverity fixesFlorin Coras1-2/+2
2021-10-11api: set missing handlersFilip Tehlar1-0/+3
2021-09-28api: API trace improvementsFilip Tehlar8-155/+485
2021-09-28misc: vpe.api messages dynamically allocatedOle Troan2-1/+9
2021-09-27misc: api move continuedFlorin Coras3-0/+61
2021-09-27misc: move part of vpe apis to vlibmemoryFlorin Coras5-601/+1674
2021-07-14api: fix memory error in multi-thread environmentXiaoming Jiang1-1/+7
2021-06-22api: asan: use vec_set_len() so ASan can keep track of buffer lenBenoît Ganne1-6/+6
2021-06-16api: remove custom dumpFilip Tehlar1-32/+3
2021-05-26api: socket client connect set to blockingFlorin Coras1-1/+1
2021-03-26vlib: split vlib_main_t into global and per-threadDamjan Marion1-2/+3
2021-03-26vlib: introduce vlib_get_elog_main()Damjan Marion1-11/+16
2021-03-26vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()Damjan Marion1-2/+2
2021-03-19api: Avoid the usage of the freed registration by the API callsAndrew Yourtchenko1-23/+51
2021-03-03api: fix crash when cf removedwanghanlin1-2/+16
2021-01-20vlib: fix build with muslNathan Moos1-0/+1
2020-12-28vlib: add missing file template descriptionsPaul Vinciguerra1-0/+2
2020-12-14misc: move to new pool_foreach macrosDamjan Marion3-13/+13
2020-10-21svm: fix ASAN annotations for external chunksBenoît Ganne1-0/+5
2020-09-30svm: harmonize ssvm namesFlorin Coras2-3/+3
2020-08-18api: retry sending fd on EAGAINFlorin Coras1-1/+2
2020-07-19api: call api reaper callbacks for socket clientsDave Barach2-5/+7
2020-06-17docs: add more FEATURE.yaml documentationDave Barach1-0/+13
2020-05-27dhcp: vat support for the dhcp_client_dump APIDave Barach2-0/+12
2020-05-25api: add new stream message conventionOle Troan1-0/+22
2020-05-15misc: removed executable bits from source filesRay Kinsella1-0/+0
2020-05-12api: use malloc for rx thread arg instead of heapFlorin Coras1-2/+2
2020-04-22api: 'api trace' CLI consumes a line of inputNeale Ranns1-16/+22
2020-04-22misc: asan: do not poison memory after munmap()Benoît Ganne1-5/+0
2020-02-12api: do not truncate api dump file sizeBenoît Ganne1-1/+1
2020-02-11misc: fix coverity warningsDave Barach1-2/+4
2020-02-05api: fix vl_api_clnt_node process stack overflowChenmin Sun1-0/+1
2020-01-23api: mark api_trace_command_fn thread-safeDave Barach1-1/+20
2019-12-17misc: address sanitizer: fix instrumentationBenoît Ganne1-0/+8
2019-12-12vcl: fix disconnect from binary apiFlorin Coras1-1/+1
2019-12-11vcl: separate binary api connections per thread workerFlorin Coras1-4/+27
2019-12-11api: Use vl_msg_push/pop_heapNathan Skrzypczak3-55/+26
2019-12-10api: pass api and client main to rx threadFlorin Coras2-1/+28
2019-12-10api: multiple connections per processDave Barach8-88/+105
2019-12-09api: fix sock reg passing on read eventFlorin Coras3-26/+24
2019-12-07vlib: use explicit types in apiOle Troan1-1/+1
2019-12-06api: avoid swapping vlib_rp before barrier syncFlorin Coras3-61/+46
2019-12-06api: fix free socket process argsFlorin Coras1-0/+1
2019-12-06api: multiple socket connections per single processFlorin Coras2-31/+164
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne3-5/+27
2019-11-18api: configurable binary api client rx pthread fcnDave Barach2-19/+39
2019-11-07api: fix dead client scan heap issueNathan Skrzypczak1-0/+4
2019-10-25dhcp: fix crash on unicast renewal sendNeale Ranns1-0/+1
an class="o">.logger.info(self.vapi.ppcli("show l2fib verbose")) self.logger.info(self.vapi.ppcli("show bridge-domain %s detail" % self.bd_id)) @classmethod def create_hosts_and_learn(cls, count): """ Create required number of host MAC addresses and distribute them among interfaces. Create host IPv4 address for every host MAC address. Create L2 MAC packet stream with host MAC addresses per interface to let the bridge domain learn these MAC addresses. :param count: Integer number of hosts to create MAC/IPv4 addresses for. """ n_int = len(cls.pg_interfaces) macs_per_if = count / n_int i = -1 for pg_if in cls.pg_interfaces: i += 1 start_nr = macs_per_if * i end_nr = count if i == (n_int - 1) else macs_per_if * (i + 1) cls.hosts_by_pg_idx[pg_if.sw_if_index] = [] hosts = cls.hosts_by_pg_idx[pg_if.sw_if_index] packets = [] for j in range(start_nr, end_nr): host = Host( "00:00:00:ff:%02x:%02x" % (pg_if.sw_if_index, j), "172.17.1%02x.%u" % (pg_if.sw_if_index, j)) packet = (Ether(dst="ff:ff:ff:ff:ff:ff", src=host.mac)) hosts.append(host) if hasattr(pg_if, 'sub_if'): packet = pg_if.sub_if.add_dot1_layer(packet) packets.append(packet) pg_if.add_stream(packets) cls.logger.info("Sending broadcast eth frames for MAC learning") cls.pg_start() def create_stream(self, src_if, packet_sizes, packets_per_burst): """ Create input packet stream for defined interface. :param object src_if: Interface to create packet stream for. :param list packet_sizes: List of required packet sizes. :param int packets_per_burst: Number of packets in burst. :return: Stream of packets. """ pkts = [] for i in range(0, packets_per_burst): dst_if = self.flows[src_if][i % 2] dst_host = random.choice(self.hosts_by_pg_idx[dst_if.sw_if_index]) src_host = random.choice(self.hosts_by_pg_idx[src_if.sw_if_index]) pkt_info = self.create_packet_info(src_if, dst_if) payload = self.info_to_payload(pkt_info) p = (Ether(dst=dst_host.mac, src=src_host.mac) / IP(src=src_host.ip4, dst=dst_host.ip4) / UDP(sport=1234, dport=1234) / Raw(payload)) pkt_info.data = p.copy() if hasattr(src_if, 'sub_if'): p = src_if.sub_if.add_dot1_layer(p) size = random.choice(packet_sizes) self.extend_packet(p, size) pkts.append(p) return pkts def verify_capture(self, pg_if, capture): """ Verify captured input packet stream for defined interface. :param object pg_if: Interface to verify captured packet stream for. :param list capture: Captured packet stream. """ last_info = dict() for i in self.pg_interfaces: last_info[i.sw_if_index] = None dst_sw_if_index = pg_if.sw_if_index for packet in capture: payload_info = self.payload_to_info(str(packet[Raw])) src_sw_if_index = payload_info.src src_if = None for ifc in self.pg_interfaces: if ifc != pg_if: if ifc.sw_if_index == src_sw_if_index: src_if = ifc break if hasattr(src_if, 'sub_if'): # Check VLAN tags and Ethernet header packet = src_if.sub_if.remove_dot1_layer(packet) self.assertTrue(Dot1Q not in packet) try: ip = packet[IP] udp = packet[UDP] packet_index = payload_info.index self.assertEqual(payload_info.dst, dst_sw_if_index) self.logger.debug("Got packet on port %s: src=%u (id=%u)" % (pg_if.name, payload_info.src, packet_index)) next_info = self.get_next_packet_info_for_interface2( payload_info.src, dst_sw_if_index, last_info[payload_info.src]) last_info[payload_info.src] = next_info self.assertTrue(next_info is not None) self.assertEqual(packet_index, next_info.index) saved_packet = next_info.data # Check standard fields self.assertEqual(ip.src, saved_packet[IP].src) self.assertEqual(ip.dst, saved_packet[IP].dst) self.assertEqual(udp.sport, saved_packet[UDP].sport) self.assertEqual(udp.dport, saved_packet[UDP].dport) except: self.logger.error(ppp("Unexpected or invalid packet:", packet)) raise for i in self.pg_interfaces: remaining_packet = self.get_next_packet_info_for_interface2( i, dst_sw_if_index, last_info[i.sw_if_index]) self.assertTrue( remaining_packet is None, "Port %u: Packet expected from source %u didn't arrive" % (dst_sw_if_index, i.sw_if_index)) def run_l2bd_test(self, pkts_per_burst): """ L2BD MAC learning test """ # Create incoming packet streams for packet-generator interfaces for i in self.pg_interfaces: packet_sizes = self.sub_if_packet_sizes if hasattr(i, 'sub_if') \ else self.pg_if_packet_sizes pkts = self.create_stream(i, packet_sizes, pkts_per_burst) i.add_stream(pkts) # Enable packet capture and start packet sending self.pg_enable_capture(self.pg_interfaces) self.pg_start() # Verify outgoing packet streams per packet-generator interface for i in self.pg_interfaces: capture = i.get_capture() self.logger.info("Verifying capture on interface %s" % i.name) self.verify_capture(i, capture) def test_l2bd_sl(self): """ L2BD MAC learning single-loop test Test scenario: 1.config MAC learning enabled learn 100 MAC enries 3 interfaces: untagged, dot1q, dot1ad (dot1q used instead of dot1ad in the first version) 2.sending l2 eth pkts between 3 interface 64B, 512B, 1518B, 9200B (ether_size) burst of 2 pkts per interface """ self.run_l2bd_test(self.sl_pkts_per_burst) def test_l2bd_dl(self): """ L2BD MAC learning dual-loop test Test scenario: 1.config MAC learning enabled learn 100 MAC enries 3 interfaces: untagged, dot1q, dot1ad (dot1q used instead of dot1ad in the first version) 2.sending l2 eth pkts between 3 interface 64B, 512B, 1518B, 9200B (ether_size) burst of 257 pkts per interface """ self.run_l2bd_test(self.dl_pkts_per_burst) if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)