aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
AgeCommit message (Expand)AuthorFilesLines
2023-09-16vapi: fix coverity warningsDave Wallace1-12/+13
2023-09-06vapi: fix verification for reply messageSylvain Cadilhac1-1/+1
2023-08-18vapi: improve vl_api_string_t handlingKlement Sekera4-34/+89
2023-08-18vapi: support servicesStanislav Zaikin8-53/+367
2023-08-16tests docs: update python3 venv packagesDave Wallace4-5/+1
2023-05-19stats: fix memory leak in stat_segment_dump_r()Duncan Eastoe1-0/+2
2023-04-17stats: check if stats vector entry is emptyOle Troan1-0/+5
2023-03-21papi: vla list of fixed stringsOle Troan2-4/+28
2023-03-07build: make Python3 mandatoryDamjan Marion1-23/+17
2023-03-02stats: expose symlink to stats clientOle Troan2-4/+6
2023-01-04vapi: add vapi_stop_rx_thread()Matthew Smith2-14/+37
2022-12-20vapi: use the correct my_context_id when disconnecting API clientsMauro Sardara1-5/+75
2022-12-14vapi: implement vapi_wait() for readsMatthew Smith3-15/+11
2022-12-12papi: fix VPP_API_DIRPim van Pelt1-1/+4
2022-12-07papi: export packed message structuresOle Troan1-0/+16
2022-12-07tests: multiple apidir locationsOle Troan1-1/+6
2022-12-07papi: fix async support for socket transportOle Troan2-4/+5
2022-12-05stats: return empty vector rather than NULL if stat_segment_dump_r() is run o...Andrew Yourtchenko1-0/+9
2022-11-29stats: fix the memory leak in stat_client.cAndrew Yourtchenko1-0/+2
2022-11-28vapi: write enumflag types to vapi headersMatthew Smith2-0/+15
2022-10-12misc: fix issues reported by clang-15Damjan Marion1-2/+0
2022-06-01papi: vpp_serializer.py - replace slow bytes() with fast bytearray()Viktor Velichkin1-8/+8
2022-05-10tests: replace pycodestyle with blackKlement Sekera15-1553/+1867
2022-05-02vapi: support api clients within vpp processOle Troan2-43/+428
2022-04-27vapi: Fix build when directory contains @Renato Botelho do Couto2-2/+3
2022-03-31stats: convert error counters to normal countersDamjan Marion3-83/+16
2022-03-09stats: refactorDamjan Marion2-20/+19
2022-02-24vapi: Missing include file in vlib.api.vapi.hDave Wallace1-17/+17
2022-02-01stats: vpp_get_stats crashes in stat_segment_data_freeSteven Luong1-0/+1
2022-01-25api: vapi: honor non-blocking settingKlement Sekera2-12/+25
2021-11-16vapi: verify message size when receivedKlement Sekera3-18/+51
2021-11-02tests: change code to avoid gcc-11 warningKlement Sekera1-4/+10
2021-10-18interface: add api test fileFilip Tehlar5-2/+7
2021-10-14tests: fix coverity warningsKlement Sekera1-6/+2
2021-10-13docs: convert vpp doc md->rstNathan Skrzypczak3-155/+191
2021-10-13vapi: fix vapi test coverity warningFlorin Coras1-0/+1
2021-09-28api: API trace improvementsFilip Tehlar1-8/+0
2021-09-28misc: vpe.api messages dynamically allocatedOle Troan2-15/+7
2021-09-28build: complete python3 support, no hardcode pathNick Brown1-2/+3
2021-09-27tests: don't install vapi_c{,pp}_testDmitry Valter1-0/+2
2021-09-27misc: api move continuedFlorin Coras3-4/+8
2021-09-17build: use GNUInstallDirs install destinationsNick Brown1-1/+1
2021-08-31stats: check epoch in python vpp_stats lsOle Troan1-0/+3
2021-07-12papi: remove shared memory transportOle Troan3-154/+6
2021-06-25stats: reverts part of a fix on Python clientArthur de Kerhor1-12/+4
2021-06-25stats: fix race conditions in vpp-api stats clientArthur de Kerhor1-4/+12
2021-05-27build: kindly ask python not to polute src/Damjan Marion1-2/+2
2021-05-26tests: move vapi C/C++ test files into src/Damjan Marion4-0/+1538
2021-05-21stats: catch stat segment overrun in retry loopOle Troan1-3/+3
2021-05-13tests: move test source to vpp/testDave Wallace3-173/+0
n>remote_stop = ip_address(text_type(remote_stop)) self.proto = proto self.is_outbound = is_outbound self.priority = priority if not policy: self.policy = (VppEnum.vl_api_ipsec_spd_action_t. IPSEC_API_SPD_ACTION_BYPASS) else: self.policy = policy self.is_ipv6 = (0 if self.local_start.version == 4 else 1) self.local_port_start = local_port_start self.local_port_stop = local_port_stop self.remote_port_start = remote_port_start self.remote_port_stop = remote_port_stop def add_vpp_config(self): rv = self.test.vapi.ipsec_spd_entry_add_del( self.spd.id, self.sa_id, self.local_start, self.local_stop, self.remote_start, self.remote_stop, protocol=self.proto, is_ipv6=self.is_ipv6, is_outbound=self.is_outbound, priority=self.priority, policy=self.policy, local_port_start=self.local_port_start, local_port_stop=self.local_port_stop, remote_port_start=self.remote_port_start, remote_port_stop=self.remote_port_stop) self.stat_index = rv.stat_index self.test.registry.register(self, self.test.logger) return self def remove_vpp_config(self): self.test.vapi.ipsec_spd_entry_add_del( self.spd.id, self.sa_id, self.local_start, self.local_stop, self.remote_start, self.remote_stop, protocol=self.proto, is_ipv6=self.is_ipv6, is_outbound=self.is_outbound, priority=self.priority, policy=self.policy, local_port_start=self.local_port_start, local_port_stop=self.local_port_stop, remote_port_start=self.remote_port_start, remote_port_stop=self.remote_port_stop, is_add=0) def object_id(self): return "spd-entry-%d-%d-%d-%d-%d-%d" % (self.spd.id, self.priority, self.policy, self.is_outbound, self.is_ipv6, self.remote_port_start) def query_vpp_config(self): ss = self.test.vapi.ipsec_spd_dump(self.spd.id) for s in ss: if s.entry.sa_id == self.sa_id and \ s.entry.is_outbound == self.is_outbound and \ s.entry.priority == self.priority and \ s.entry.policy == self.policy and \ s.entry.remote_address_start == self.remote_start and \ s.entry.remote_port_start == self.remote_port_start: return True return False def get_stats(self, worker=None): c = self.test.statistics.get_counter("/net/ipsec/policy") if worker is None: total = mk_counter() for t in c: total['packets'] += t[self.stat_index]['packets'] return total else: # +1 to skip main thread return c[worker+1][self.stat_index] class VppIpsecSA(VppObject): """ VPP SAD Entry """ DEFAULT_UDP_PORT = 4500 def __init__(self, test, id, spi, integ_alg, integ_key, crypto_alg, crypto_key, proto, tun_src=None, tun_dst=None, flags=None, salt=0, tun_flags=None, dscp=None, udp_src=None, udp_dst=None, hop_limit=None): e = VppEnum.vl_api_ipsec_sad_flags_t self.test = test self.id = id self.spi = spi self.integ_alg = integ_alg self.integ_key = integ_key self.crypto_alg = crypto_alg self.crypto_key = crypto_key self.proto = proto self.salt = salt self.table_id = 0 self.tun_src = tun_src self.tun_dst = tun_dst if not flags: self.flags = e.IPSEC_API_SAD_FLAG_NONE else: self.flags = flags if (tun_src): self.tun_src = ip_address(text_type(tun_src)) self.flags = self.flags | e.IPSEC_API_SAD_FLAG_IS_TUNNEL if (tun_dst): self.tun_dst = ip_address(text_type(tun_dst)) self.udp_src = udp_src self.udp_dst = udp_dst self.tun_flags = (VppEnum.vl_api_tunnel_encap_decap_flags_t. TUNNEL_API_ENCAP_DECAP_FLAG_NONE) if tun_flags: self.tun_flags = tun_flags self.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_CS0 if dscp: self.dscp = dscp self.hop_limit = 255 if hop_limit: self.hop_limit = hop_limit def tunnel_encode(self): return {'src': (self.tun_src if self.tun_src else []), 'dst': (self.tun_dst if self.tun_dst else []), 'encap_decap_flags': self.tun_flags, 'dscp': self.dscp, 'hop_limit': self.hop_limit, 'table_id': self.table_id } def add_vpp_config(self): entry = { 'sad_id': self.id, 'spi': self.spi, 'integrity_algorithm': self.integ_alg, 'integrity_key': { 'length': len(self.integ_key), 'data': self.integ_key, }, 'crypto_algorithm': self.crypto_alg, 'crypto_key': { 'data': self.crypto_key, 'length': len(self.crypto_key), }, 'protocol': self.proto, 'tunnel': self.tunnel_encode(), 'flags': self.flags, 'salt': self.salt } # don't explicitly send the defaults, let papi fill them in if self.udp_src: entry['udp_src_port'] = self.udp_src if self.udp_dst: entry['udp_dst_port'] = self.udp_dst r = self.test.vapi.ipsec_sad_entry_add(entry=entry) self.stat_index = r.stat_index self.test.registry.register(self, self.test.logger) return self def remove_vpp_config(self): self.test.vapi.ipsec_sad_entry_del(id=self.id) def object_id(self): return "ipsec-sa-%d" % self.id def query_vpp_config(self): e = VppEnum.vl_api_ipsec_sad_flags_t bs = self.test.vapi.ipsec_sa_v3_dump() for b in bs: if b.entry.sad_id == self.id: # if udp encap is configured then the ports should match # those configured or the default if (self.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP): if not b.entry.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP: return False if self.udp_src: if self.udp_src != b.entry.udp_src_port: return False else: if self.DEFAULT_UDP_PORT != b.entry.udp_src_port: return False if self.udp_dst: if self.udp_dst != b.entry.udp_dst_port: return False else: if self.DEFAULT_UDP_PORT != b.entry.udp_dst_port: return False return True return False def get_stats(self, worker=None): c = self.test.statistics.get_counter("/net/ipsec/sa") if worker is None: total = mk_counter() for t in c: total['packets'] += t[self.stat_index]['packets'] return total else: # +1 to skip main thread return c[worker+1][self.stat_index] def get_lost(self, worker=None): c = self.test.statistics.get_counter("/net/ipsec/sa/lost") if worker is None: total = 0 for t in c: total += t[self.stat_index] return total else: # +1 to skip main thread return c[worker+1][self.stat_index] class VppIpsecTunProtect(VppObject): """ VPP IPSEC tunnel protection """ def __init__(self, test, itf, sa_out, sas_in, nh=None): self.test = test self.itf = itf self.sas_in = [] for sa in sas_in: self.sas_in.append(sa.id) self.sa_out = sa_out.id self.nh = nh if not self.nh: self.nh = "0.0.0.0" def update_vpp_config(self, sa_out, sas_in): self.sas_in = [] for sa in sas_in: self.sas_in.append(sa.id) self.sa_out = sa_out.id self.test.vapi.ipsec_tunnel_protect_update( tunnel={ 'sw_if_index': self.itf._sw_if_index, 'n_sa_in': len(self.sas_in), 'sa_out': self.sa_out, 'sa_in': self.sas_in, 'nh': self.nh}) def object_id(self): return "ipsec-tun-protect-%s-%s" % (self.itf, self.nh) def add_vpp_config(self): self.test.vapi.ipsec_tunnel_protect_update( tunnel={ 'sw_if_index': self.itf._sw_if_index, 'n_sa_in': len(self.sas_in), 'sa_out': self.sa_out, 'sa_in': self.sas_in, 'nh': self.nh}) self.test.registry.register(self, self.test.logger) def remove_vpp_config(self): self.test.vapi.ipsec_tunnel_protect_del( sw_if_index=self.itf.sw_if_index, nh=self.nh) def query_vpp_config(self): bs = self.test.vapi.ipsec_tunnel_protect_dump( sw_if_index=self.itf.sw_if_index) for b in bs: if b.tun.sw_if_index == self.itf.sw_if_index and \ self.nh == str(b.tun.nh): return True return False class VppIpsecInterface(VppInterface): """ VPP IPSec interface """ def __init__(self, test, mode=None, instance=0xffffffff): super(VppIpsecInterface, self).__init__(test) self.mode = mode if not self.mode: self.mode = (VppEnum.vl_api_tunnel_mode_t. TUNNEL_API_MODE_P2P) self.instance = instance def add_vpp_config(self): r = self.test.vapi.ipsec_itf_create(itf={ 'user_instance': self.instance, 'mode': self.mode, }) self.set_sw_if_index(r.sw_if_index) self.test.registry.register(self, self.test.logger) ts = self.test.vapi.ipsec_itf_dump(sw_if_index=self._sw_if_index) self.instance = ts[0].itf.user_instance return self def remove_vpp_config(self): self.test.vapi.ipsec_itf_delete(sw_if_index=self._sw_if_index) def query_vpp_config(self): ts = self.test.vapi.ipsec_itf_dump(sw_if_index=0xffffffff) for t in ts: if t.itf.sw_if_index == self._sw_if_index: return True return False def __str__(self): return self.object_id() def object_id(self): return "ipsec%d" % self.instance