summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
AgeCommit message (Expand)AuthorFilesLines
2017-05-22vhost: migrate to use device infra for worker thread assignment, rx-mode.Steven4-484/+336
2017-05-20vhost: buffers leak and interface disable upon vring descriptor out of mmapSteven1-16/+9
2017-05-20af_packet: set mac address supportRay Kinsella1-1/+47
2017-05-17vhost: bad packet assembled from descriptor chainingSteven1-1/+2
2017-05-15af_packet: support changing the mtu sizeRay Kinsella1-1/+23
2017-05-10device: Add callback for set interface rx-modeSteven1-0/+1
2017-05-09Fix remaining 32-bit compile issuesDamjan Marion1-1/+1
2017-05-02Add interface rx mode commands, unify rx mode and placement CLIDamjan Marion3-176/+48
2017-04-28af_packet: reflect admin device state on hostRay Kinsella3-15/+78
2017-04-28vhost: Disallow duplicate path name for vhost interfaceSteven2-1/+37
2017-04-26vhost: Fix mmap size calculationPierre Pfister1-3/+3
2017-04-26vhost: core dump on quit with worker threadsSteven1-0/+2
2017-04-25"autoreply" flag: autogenerate standard xxx_reply_t messagesDave Barach3-55/+5
2017-04-24vhost: remove socket linked file when deleting vhost interfaceSteven1-9/+18
2017-04-11Devices: set interface placement does not remove the old interface placementSteven1-3/+0
2017-04-11vhost: interrupt mode enhancementsSteven2-34/+26
2017-04-10Common device-input interrupt infraDamjan Marion4-29/+175
2017-04-07MPLS McastNeale Ranns1-1/+1
2017-04-06Use thread local storage for thread indexDamjan Marion6-126/+130
2017-03-30vppinfra: add spinlock inline functionsDamjan Marion6-26/+12
2017-03-29vhost: vhost-user component may become unusable with too many open files (VPP...Steven1-9/+20
2017-03-28af_packet driver needs to check VLIB_BUFFER_NEXT_PRESENT flag is setJim Gibson1-1/+2
2017-03-26Rename "show interfaces" -> "show interface"Dave Barach2-2/+2
2017-03-22vhost: support interrupt modeSteven2-22/+322
2017-03-20vnet: add device-input threadplacement infraDamjan Marion5-68/+300
2017-03-17Fix IP feature ordering.Neale Ranns1-1/+0
2017-03-16vhost: wrong value return for VHOST_USER_VRING_GET_BASESteven1-4/+11
2017-03-10Retire vpp_liteDamjan Marion4-4465/+0
2017-03-09vlib_mains == 0 special cases be goneDave Barach1-5/+4
2017-03-08vhost: binary API changes for interrupt modeSteven4-10/+41
2017-03-06features: take device-input buffer advance value directlyDamjan Marion3-4/+3
2017-03-02Clean up binary api message handler registration issuesDave Barach1-9/+1
2017-03-01dpdk: be a pluginDamjan Marion25-11695/+0
2017-03-01devices: vnet_get_aggregate_rx_packets should not be dpdk specificDamjan Marion9-44/+58
2017-02-28dpdk: retire support for dpdk 16.07Damjan Marion5-58/+3
2017-02-28vlib: add buffer cloning supportDamjan Marion2-13/+39
2017-02-27vlib: add VLIB_BUFFER_EXT_HDR_VALID flagDamjan Marion2-2/+2
2017-02-24Fixed QAT device binding and device unbinding when vpp package is removedRadu Nicolau1-1/+1
2017-02-24VPP-279: Document changes for vnet/vnet/devicesBilly McFall2-100/+617
2017-02-22VPP-635: CLI Memory leak with invalid parameterBilly McFall5-134/+343
2017-02-17Implemented IKEv2 initiator features:Radu Nicolau2-0/+4
2017-02-17dpdk: quad loop and prefetch in fill_free_listDamjan Marion1-15/+71
2017-02-14VPP-279: Document changes for vnet/vnet/devicesBilly McFall2-52/+210
2017-02-14Fix is_server flag in vhost dump (VPP-562)Marek Gradzki1-0/+1
2017-02-14vhost-user: fix crash when descriptor points to unknown regionDamjan Marion1-1/+2
2017-02-06vlib: remove algned/unaligned buffers schemeDamjan Marion1-118/+13
2017-02-04dpdk: move to uio_pci_genericDamjan Marion1-1/+1
2017-02-03vhost-user: fix missing speculative enqueue unwindSteven1-0/+4
2017-02-02dpdk: fix crypto coverity warningSergio Gonzalez Monroy1-1/+2
2017-01-27dpdk: rework cryptodev ipsec build and setupSergio Gonzalez Monroy11-166/+287
> last_info = dict() for i in self.interfaces: last_info[i.sw_if_index] = None dst_sw_if_index = dst_if.sw_if_index for packet in capture: try: ip = packet[IP] udp = packet[UDP] payload_info = self.payload_to_info(str(packet[Raw])) 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)" % (dst_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.interfaces: remaining_packet = self.get_next_packet_info_for_interface2( i.sw_if_index, dst_sw_if_index, last_info[i.sw_if_index]) self.assertTrue(remaining_packet is None, "Interface %s: Packet expected from interface %s " "didn't arrive" % (dst_if.name, i.name)) @staticmethod def build_ip_mask(proto='', src_ip='', dst_ip='', src_port='', dst_port=''): """Build IP ACL mask data with hexstring format :param str proto: protocol number <0-ff> :param str src_ip: source ip address <0-ffffffff> :param str dst_ip: destination ip address <0-ffffffff> :param str src_port: source port number <0-ffff> :param str dst_port: destination port number <0-ffff> """ return ('{:0>20}{:0>12}{:0>8}{:0>12}{:0>4}'.format( proto, src_ip, dst_ip, src_port, dst_port)).rstrip('0') @staticmethod def build_ip_match(proto='', src_ip='', dst_ip='', src_port='', dst_port=''): """Build IP ACL match data with hexstring format :param str proto: protocol number with valid option "<0-ff>" :param str src_ip: source ip address with format of "x.x.x.x" :param str dst_ip: destination ip address with format of "x.x.x.x" :param str src_port: source port number <0-ffff> :param str dst_port: destination port number <0-ffff> """ if src_ip: src_ip = socket.inet_aton(src_ip).encode('hex') if dst_ip: dst_ip = socket.inet_aton(dst_ip).encode('hex') return ('{:0>20}{:0>12}{:0>8}{:0>12}{:0>4}'.format( proto, src_ip, dst_ip, src_port, dst_port)).rstrip('0') @staticmethod def build_mac_mask(dst_mac='', src_mac='', ether_type=''): """Build MAC ACL mask data with hexstring format :param str dst_mac: source MAC address <0-ffffffffffff> :param str src_mac: destination MAC address <0-ffffffffffff> :param str ether_type: ethernet type <0-ffff> """ return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac, ether_type)).rstrip('0') @staticmethod def build_mac_match(dst_mac='', src_mac='', ether_type=''): """Build MAC ACL match data with hexstring format :param str dst_mac: source MAC address <x:x:x:x:x:x> :param str src_mac: destination MAC address <x:x:x:x:x:x> :param str ether_type: ethernet type <0-ffff> """ if dst_mac: dst_mac = dst_mac.replace(':', '') if src_mac: src_mac = src_mac.replace(':', '') return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac, ether_type)).rstrip('0') def create_classify_table(self, key, mask, data_offset=0, is_add=1): """Create Classify Table :param str key: key for classify table (ex, ACL name). :param str mask: mask value for interested traffic. :param int match_n_vectors: :param int is_add: option to configure classify table. - create(1) or delete(0) """ r = self.vapi.classify_add_del_table( is_add, binascii.unhexlify(mask), match_n_vectors=(len(mask) - 1) // 32 + 1, miss_next_index=0, current_data_flag=1, current_data_offset=data_offset) self.assertIsNotNone(r, msg='No response msg for add_del_table') self.acl_tbl_idx[key] = r.new_table_index def create_classify_session(self, intf, table_index, match, pbr_option=0, vrfid=0, is_add=1): """Create Classify Session :param VppInterface intf: Interface to apply classify session. :param int table_index: table index to identify classify table. :param str match: matched value for interested traffic. :param int pbr_action: enable/disable PBR feature. :param int vrfid: VRF id. :param int is_add: option to configure classify session. - create(1) or delete(0) """ r = self.vapi.classify_add_del_session( is_add, table_index, binascii.unhexlify(match), opaque_index=0, action=pbr_option, metadata=vrfid) self.assertIsNotNone(r, msg='No response msg for add_del_session') def input_acl_set_interface(self, intf, table_index, is_add=1): """Configure Input ACL interface :param VppInterface intf: Interface to apply Input ACL feature. :param int table_index: table index to identify classify table. :param int is_add: option to configure classify session. - enable(1) or disable(0) """ r = self.vapi.input_acl_set_interface( is_add, intf.sw_if_index, ip4_table_index=table_index) self.assertIsNotNone(r, msg='No response msg for acl_set_interface') def test_acl_ip(self): """ IP ACL test Test scenario for basic IP ACL with source IP - Create IPv4 stream for pg0 -> pg1 interface. - Create ACL with source IP address. - Send and verify received packets on pg1 interface. """ # Basic ACL testing with source IP pkts = self.create_stream(self.pg0, self.pg1, self.pg_if_packet_sizes) self.pg0.add_stream(pkts) self.create_classify_table('ip', self.build_ip_mask(src_ip='ffffffff')) self.create_classify_session( self.pg0, self.acl_tbl_idx.get('ip'), self.build_ip_match(src_ip=self.pg0.remote_ip4)) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('ip')) self.pg_enable_capture(self.pg_interfaces) self.pg_start() pkts = self.pg1.get_capture(len(pkts)) self.verify_capture(self.pg1, pkts) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('ip'), 0) self.pg0.assert_nothing_captured(remark="packets forwarded") self.pg2.assert_nothing_captured(remark="packets forwarded") self.pg3.assert_nothing_captured(remark="packets forwarded") def test_acl_mac(self): """ MAC ACL test Test scenario for basic MAC ACL with source MAC - Create IPv4 stream for pg0 -> pg2 interface. - Create ACL with source MAC address. - Send and verify received packets on pg2 interface. """ # Basic ACL testing with source MAC pkts = self.create_stream(self.pg0, self.pg2, self.pg_if_packet_sizes) self.pg0.add_stream(pkts) self.create_classify_table( 'mac', self.build_mac_mask(src_mac='ffffffffffff'), data_offset=-14) self.create_classify_session( self.pg0, self.acl_tbl_idx.get('mac'), self.build_mac_match(src_mac=self.pg0.remote_mac)) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('mac')) self.pg_enable_capture(self.pg_interfaces) self.pg_start() pkts = self.pg2.get_capture(len(pkts)) self.verify_capture(self.pg2, pkts) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('mac'), 0) self.pg0.assert_nothing_captured(remark="packets forwarded") self.pg1.assert_nothing_captured(remark="packets forwarded") self.pg3.assert_nothing_captured(remark="packets forwarded") def test_acl_pbr(self): """ IP PBR test Test scenario for PBR with source IP - Create IPv4 stream for pg0 -> pg3 interface. - Configure PBR fib entry for packet forwarding. - Send and verify received packets on pg3 interface. """ # PBR testing with source IP pkts = self.create_stream(self.pg0, self.pg3, self.pg_if_packet_sizes) self.pg0.add_stream(pkts) self.create_classify_table('pbr', self.build_ip_mask(src_ip='ffffffff')) pbr_option = 1 self.create_classify_session( self.pg0, self.acl_tbl_idx.get('pbr'), self.build_ip_match(src_ip=self.pg0.remote_ip4), pbr_option, self.pbr_vrfid) self.config_pbr_fib_entry(self.pg3) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('pbr')) self.pg_enable_capture(self.pg_interfaces) self.pg_start() pkts = self.pg3.get_capture(len(pkts)) self.verify_capture(self.pg3, pkts) self.input_acl_set_interface(self.pg0, self.acl_tbl_idx.get('pbr'), 0) self.pg0.assert_nothing_captured(remark="packets forwarded") self.pg1.assert_nothing_captured(remark="packets forwarded") self.pg2.assert_nothing_captured(remark="packets forwarded") if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)