aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vppcom.h
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25vcl: add api to retrieve num bytes for txFlorin Coras1-0/+1
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iaa1b026e2baea1c03f8c75e7d6879d0ff6d379d6
2024-02-23vcl: Use FreeBSD specific errno value for bad fdTom Jones1-0/+7
Type: improvement Change-Id: I7693f2647f65f662c9b20f77bbf7e1a530b58259 Signed-off-by: Tom Jones <thj@freebsd.org>
2023-07-21vcl: ldp support SO_ORIGINAL_DSTqinyang1-0/+1
Type: improvement Support SO_ORIGINAL_DST socket option to get original dst_ip4 and dst_port if nat44 rule enabled. Change-Id: If00e00d03e48f3b78a23a68f1b078954d79dd0f7 Signed-off-by: qinyang <qiny@yusur.tech>
2023-02-20vcl: ldp support for ip_pktinfoFlorin Coras1-43/+51
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c15f38a4a3f5e92506059277948e7fca9cd8b55
2023-01-12misc: use right include for fctnl.h and poll.hGuillaume Solignac1-2/+2
Musl is stricter than glibc and has a warning that including fctnl.h and poll.h should be prefered rather than their sys/ counterparts, which breaks -Wall setups. Type: fix Signed-off-by: Guillaume Solignac <gsoligna@cisco.com> Change-Id: Id101e999371951b0927cc8c4109f8f1536de1bc2
2022-12-14vcl: enable gso for 'sendmsg' in LDP mode.Dou Chao1-0/+18
Some upon apps(e.g. Nginx-quic) package it's several protocol buffers into a struct msg which is a combination of gso_buffer and gso_size. but if HostStack regardless the gso_size to the buffer and split the buffer with default mss, that cause peer client failed on parsing the package. Type: improvement Signed-off-by: Dou Chao <chao.dou@intel.com> Change-Id: I805eb642be826038ba96d1b85dad8ec0c0f6c459 Signed-off-by: Dou Chao <chao.dou@intel.com>
2022-10-06vcl: add api to check if vcl disconnected from vppMaros Ondrejicka1-1/+10
Type: feature Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I98bc108360f9d04a33126865ce49d2702cbe9cdf
2022-07-20vcl: new vcl api to get detailed session errorsRadha krishna Saragadam1-0/+8
Sometimes VPP rejects application connection requests due to various reasons. Some errors application can retry to get a successful connection. In a non-blocking session, VCL sends EPOLLHUP. An application can call a new API vppcom_session_get_error to find the details and retry depending on the error. Type: fix Signed-off-by: Radha krishna Saragadam <krishna_srk2003@yahoo.com> Change-Id: If0e21a8e25701f66a190a2799b2209e0c31f897c
2022-02-09vcl: make eventfd flag configurable from envFilip Tehlar1-0/+1
Type: feature Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Id25e2188c9167b2e187923ebe10660e0bc9c3c0a
2021-11-15vcl: add DSCP support in VCLFilip Tehlar1-0/+1
Type: feature Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I835675267c997b5dc92a0aaccdb58648bc786bb9
2021-06-14vcl: improve shutdown()liuyacan1-3/+2
This commit does following: - Change the behavior of shutdown() with SHUT_RDWR flag. - Check SHUT_RD flag when read() - Change the errno when write() after SHUT_WR - Remove unused code All the above modification passed the packetdrill test. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I0c81f52e563562e58580d70976526b898e65e915
2021-06-05vcl: epoll error handling fixes and improvementsFlorin Coras1-1/+2
- return VPPCOM_EEXIST if attempting to re-add a session - return VPPCOM_ENOENT if the session to be removed is not epolled - generate EPOLLIN if adding it through a mod operation on a session that has data and did not have the event previously set. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I728a06b8cf84af8d8c1dea7406e284de8886dffc
2021-05-25srtp: basic implementation based on libsrtp2Florin Coras1-0/+1
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic5e99938a5f130e83de6d590d2f89252d055bceb
2021-05-12session: support half-close connectionliuyacan1-0/+1
Some app(e.g. Envoy) may call shutdown() instead of close() when draining connection. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I9543b9ca3caa87b10b134fd1fc4019124e41e4d2
2021-05-01vcl: attr api to set endpt ext configFlorin Coras1-0/+1
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I06cd3721c1b534e9449bf96760c02ca30628c21e
2021-04-14session tcp vcl: api to update connection attributesFlorin Coras1-1/+2
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ifdd6024daf044751895bb8d2deabad41d3a80c92
2021-02-22vcl: support sockopt of SO_REUSEPORT and SO_DOMAINwanghanlin1-0/+1
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I800cfffb07bf7d4c4d1454b73febdba03f7d6b75
2021-02-09tls: dtls initial implementationFlorin Coras1-23/+24
Type: feature Basic dtls transport protocol implementation that relies on openssl wire protocol implementation. Retries/timeouts not yet supported. To test using vcl test apps, first ensure all arp entries are properly resolved and subsequently: server: vcl_server -p dtls 1234 client: vcl_client -p dtls <server-ip> 1234 -U -N 2000000 -T 1460 -X Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I04b4516a8fe9ce85ba230bcdd891f33a900046ed
2021-01-28vcl: support set/get vrf attributeFlorin Coras1-0/+2
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I011faa52939d44bdc90de69ad381dc1eea8c8eb3
2021-01-07vcl session: switch to generic cert key apisFlorin Coras1-4/+11
Remove the deprecated tls apis. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia1e12bd813671146f0aca22e83d04c23ac13e595
2020-11-09vcl: remove support for shm api connectionsFlorin Coras1-1/+1
Session layer only supports bapi with socket transport or app socket api attachements. Going forward this will be further restricted to the latter. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib368cf2ce92bbca192cca977664800879cd4058e
2020-09-29vcl svm: provide apps access to fifo chunksFlorin Coras1-4/+4
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2191b8594b1e87ecc00f237316457db249f73603
2020-06-15vcl: move helper functions out of header fileFlorin Coras1-97/+5
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3889fd80b145cf80f76f6054d63247e76bdf20ff
2020-05-21vcl: support connected udp listensFlorin Coras1-0/+1
Request connected udp listener behavior by setting VPPCOM_ATTR_SET_CONNECTED attribute with vppcom_session_attr Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iba95155c0f41cea8c6e1a4263946270d49c213ac
2020-05-15vcl: remove udpc transportFlorin Coras1-5/+1
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I145ff3301f168973c4f7f32c337bbcac47900705
2020-05-04vcl: allow vcl worker index to be set by applicationsPivo1-0/+5
When using vppcom_session* apis to setup TCP sessions in applications build outside of the VPP repository, it is necessary to set the worker_index explicitly when these apis are called from the none-VCL worker threads. An example is when data is to be sent to the TCP session that is originated from a different thread, like the main program thread or from the bin api thread. This change allows the application to set it. Type: fix Signed-off-by: IJsbrand Wijnands <ice@cisco.com> Change-Id: I37f3654a49ea9a8cf3a0d3d0e672583018c12299
2020-03-25session: api to add new transport typesFlorin Coras1-4/+0
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If4dee6dba1ea942daa921d566b35cdecdda680ee
2019-10-21vcl: add api to set lcl ipFlorin Coras1-0/+1
Type: feature Change-Id: I40169fbbe8a20670dd612c341b6c78b5c925bf74 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-08-30vcl: allow non-blocking connectsFlorin Coras1-0/+2
Type: feature Change-Id: I55349f482ce6781337f747b2f0d2c0a027c3a675 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-19session: Use parent_handle instead of transport_optsNathan Skrzypczak1-1/+1
Type: feature This is mostly used for quic in the case of a stream creation (i.e. connect on an already established QUIC session). We want do default parent_handle to INVALID to be able to distinguish it from parent_handle = 0 Change-Id: Id5ac0b0155a3c44e51334231b711e4fd87a96a10 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-07-18vcl: add QUIC supportNathan Skrzypczak1-1/+18
Type: feature * Adds the concept of a "connectable listener" : a session that can be both connected and accepted on. * vppcom_session_is_connectable_listener (fd) that tells if the fd is a connectable listener * vppcom_session_listener (fd) that gives you the listener's fd that accepted the session (if any) * vppcom_session_n_accepted (fd) that gives the number of sessions a listener accepted. Change-Id: Id89d67d8339fb15a7cf7e00a9c5448175eca04fc Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-07-08vcl: add worker unregister apiFlorin Coras1-0/+5
Type:feature Change-Id: Ie73644aed94e58d5dce822de5000183e414401df Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-15vcl: cleanup debug messagesFlorin Coras1-1/+1
Change-Id: Ida3ecffc9a4d7a080ad63cd48fd4b5330b732ffb Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-26vcl: add api to expose worker message queues epfdFlorin Coras1-0/+8
This only works if vcl is configured to do eventd based message queue notifications, instead of condvars. For that, add "use-mq-eventfd" to vcl startup conf. Change-Id: Id0f0288a40ec7d3daef7370f8b88420425867ab6 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-18vcl: move forking logic to vlsFlorin Coras1-2/+0
Change-Id: I721542aca139d7908a4f917629856f82cae79962 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-08vcl/ldp: select cleanup/improvementsFlorin Coras1-4/+5
Change-Id: I640e69388f2ab0f66ad60c5165c749f5a5a9f525 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-07vcl/ldp: add locked sessions shim layerFlorin Coras1-2/+4
Moves LDP logic that allows sharing of sessions between multi-process app workers into a separate VCL shim layer. Also refactors LDP to use the new layer. Change-Id: I8198b51eae7d099a8c486e36b29e3a0cb8cee8e9 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-05vcl/session: add api for changing session app workerFlorin Coras1-1/+4
In case of multi process apps, after forking, the parent may decide to close part or all of the sessions it shares with the child. Because the sessions have fifos allocated in the parent's segment manager, they must be moved to the child's segment manager. Change-Id: I85b4c8c8545005724023ee14043647719cef61dd Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-04Add TLS support for VCLPing Yu1-2/+19
Ater this patch, vcl_test_client and vcl_test_server can work happily with TLS connection. "-S" is to indicate TLS connection. Change-Id: I761894b0b5929912691625f0fe63604725b55978 Signed-off-by: Ping Yu <ping.yu@intel.com>
2019-01-01vcl/ldp: add write msg function and fine tuningFlorin Coras1-0/+2
Allows app to push data. Additionally, ensure reset/close replies are not sent unless vcl closes the session. Change-Id: Icbbf933cf57b55cfbcc7b802af0f83919a066f65 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-11-29vcl: basic support for apps that forkFlorin Coras1-0/+1
- intercept fork and register a new worker with vpp - share sessions between parent and forked child - keep binary api state per worker Change-Id: Ib177517d661724fa042bd2d98d18e777056352a2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-11-29ldp: basic multiworker supportFlorin Coras1-0/+5
Change-Id: Ia794fa7e15dac02c8607c4cee2f119ad9815c0a8 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-11-27ldp: sid to fd mapper for apps with multiple workersFlorin Coras1-0/+1
Change-Id: I79585cd6b467b007c3eb9a7668387ff3777de46d Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-11-14vcl/ldp: fix pollFlorin Coras1-1/+1
Change-Id: I8eb5546ff8634d5498d8ce5bbc9407bceb9ae3ef Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-09-22vcl: remove vcl_eventFlorin Coras1-5/+0
Change-Id: I0f805ae47f6e9465070a54d85f164bc74877af01 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-09-12vcl: add apis that expos fifo as bufferFlorin Coras1-0/+15
Change-Id: I4bd9c9f73499711e04b38d53daa5c917a4285bf5 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-30vcl: add support for multi-worker appsFlorin Coras1-14/+24
Add basic support for app registration of multiple workers. LDP does not work with multi-worker apps. Change-Id: I3fc421a2a591a077b275827463f874b261415a63 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-10vcl: support for eventfd mq signalingFlorin Coras1-11/+13
- support eventfd based mq signaling. Based on configuration, vcl epoll/select can use either condvars or epoll on mq eventfds. - add vcl support for memfd segments - vpp explicitly registers cut-through segments with apps/vcl - if using eventfd, make ldp allow one call to libc_epoll_create. Needed for the message queue epfd - update svm_queue_t to allow blocking calls with eventfd signaling. Change-Id: I064151ac370bbe29bb16c968bf4e3659c8286bea Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-07-27vcl: use events for epoll/select/read/writeFlorin Coras1-0/+1
Have vcl poll and wait on the event message queues as opposed to constantly polling the session fifos. This also adds event signaling to cut through sessions. On the downside, because we can't wait on multiple condvars, i.e., when we have multiple message queues because of cut-through registrations, we do timed waits. Change-Id: I29ade95dba449659fe46008bb1af502276a7c5fd Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-19VCL: refactor async & spinlocksDave Wallace1-75/+5
- Consolidate async code. - Add macros for spinlocks to improve readability. Change-Id: I2e0fd2b82ea76987aaf298a183d816c7d2ee0867 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
">, path[1:]) def dump_config(self, obj, level=-1): """Dump the startup configuration in VPP config format. :param obj: Python Object to print. :param level: Nested level for indentation. :type obj: Obj :type level: int :returns: nothing """ indent = u" " if level >= 0: self._vpp_config += f"{level * indent}{{\n" if isinstance(obj, dict): for key, val in obj.items(): if hasattr(val, u"__iter__") and not isinstance(val, str): self._vpp_config += f"{(level + 1) * indent}{key}\n" self.dump_config(val, level + 1) else: self._vpp_config += f"{(level + 1) * indent}{key} {val}\n" else: for val in obj: self._vpp_config += f"{(level + 1) * indent}{val}\n" if level >= 0: self._vpp_config += f"{level * indent}}}\n" def add_unix_log(self, value=None): """Add UNIX log configuration. :param value: Log file. :type value: str """ path = [u"unix", u"log"] if value is None: value = self._vpp_logfile self.add_config_item(self._nodeconfig, value, path) def add_unix_cli_listen(self, value=u"/run/vpp/cli.sock"): """Add UNIX cli-listen configuration. :param value: CLI listen address and port or path to CLI socket. :type value: str """ path = [u"unix", u"cli-listen"] self.add_config_item(self._nodeconfig, value, path) def add_unix_gid(self, value=u"vpp"): """Add UNIX gid configuration. :param value: Gid. :type value: str """ path = [u"unix", u"gid"] self.add_config_item(self._nodeconfig, value, path) def add_unix_nodaemon(self): """Add UNIX nodaemon configuration.""" path = [u"unix", u"nodaemon"] self.add_config_item(self._nodeconfig, u"", path) def add_unix_coredump(self): """Add UNIX full-coredump configuration.""" path = [u"unix", u"full-coredump"] self.add_config_item(self._nodeconfig, u"", path) def add_unix_exec(self, value): """Add UNIX exec configuration.""" path = [u"unix", u"exec"] self.add_config_item(self._nodeconfig, value, path) def add_socksvr(self, socket=Constants.SOCKSVR_PATH): """Add socksvr configuration.""" path = [u"socksvr", u"socket-name"] self.add_config_item(self._nodeconfig, socket, path) def add_graph_node_variant(self, variant=Constants.GRAPH_NODE_VARIANT): """Add default graph node variant. :param value: Graph node variant default value. :type value: str """ if variant == u"": return variant_list = [u"hsw", u"skx", u"icl"] if variant not in variant_list: raise ValueError("Invalid graph node variant value") path = [u"node", u"default", u"variant"] self.add_config_item(self._nodeconfig, variant, path) def add_api_segment_gid(self, value=u"vpp"): """Add API-SEGMENT gid configuration. :param value: Gid. :type value: str """ path = [u"api-segment", u"gid"] self.add_config_item(self._nodeconfig, value, path) def add_api_segment_global_size(self, value): """Add API-SEGMENT global-size configuration. :param value: Global size. :type value: str """ path = [u"api-segment", u"global-size"] self.add_config_item(self._nodeconfig, value, path) def add_api_segment_api_size(self, value): """Add API-SEGMENT api-size configuration. :param value: API size. :type value: str """ path = [u"api-segment", u"api-size"] self.add_config_item(self._nodeconfig, value, path) def add_buffers_per_numa(self, value): """Increase number of buffers allocated. :param value: Number of buffers allocated. :type value: int """ path = [u"buffers", u"buffers-per-numa"] self.add_config_item(self._nodeconfig, value, path) def add_buffers_default_data_size(self, value): """Increase buffers data-size allocated. :param value: Buffers data-size allocated. :type value: int """ path = [u"buffers", u"default data-size"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_dev(self, *devices): """Add DPDK PCI device configuration. :param devices: PCI device(s) (format xxxx:xx:xx.x) :type devices: tuple """ for device in devices: if pci_dev_check(device): path = [u"dpdk", f"dev {device}"] self.add_config_item(self._nodeconfig, u"", path) def add_dpdk_dev_parameter(self, device, parameter, value): """Add parameter for DPDK device. :param device: PCI device (format xxxx:xx:xx.x). :param parameter: Parameter name. :param value: Parameter value. :type device: str :type parameter: str :type value: str """ if pci_dev_check(device): path = [u"dpdk", f"dev {device}", parameter] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_cryptodev(self, count): """Add DPDK Crypto PCI device configuration. :param count: Number of HW crypto devices to add. :type count: int """ cryptodev = Topology.get_cryptodev(self._node) for i in range(count): cryptodev_config = re.sub(r"\d.\d$", f"1.{str(i)}", cryptodev) path = [u"dpdk", f"dev {cryptodev_config}"] self.add_config_item(self._nodeconfig, u"", path) self.add_dpdk_uio_driver(u"vfio-pci") def add_dpdk_sw_cryptodev(self, sw_pmd_type, socket_id, count): """Add DPDK SW Crypto device configuration. :param sw_pmd_type: Type of SW crypto device PMD to add. :param socket_id: Socket ID. :param count: Number of SW crypto devices to add. :type sw_pmd_type: str :type socket_id: int :type count: int """ for _ in range(count): cryptodev_config = f"vdev cryptodev_{sw_pmd_type}_pmd," \ f"socket_id={str(socket_id)}" path = [u"dpdk", cryptodev_config] self.add_config_item(self._nodeconfig, u"", path) def add_dpdk_eth_bond_dev(self, ethbond_id, mode, xmit_policy, *slaves): """Add DPDK Eth_bond device configuration. :param ethbond_id: Eth_bond device ID. :param mode: Link bonding mode. :param xmit_policy: Transmission policy. :param slaves: PCI device(s) to be bonded (format xxxx:xx:xx.x). :type ethbond_id: str or int :type mode: str or int :type xmit_policy: str :type slaves: list """ slaves_config = u"slave=" + u",slave=".join( slave if pci_dev_check(slave) else u"" for slave in slaves ) ethbond_config = f"vdev eth_bond{ethbond_id}," \ f"mode={mode}{slaves_config},xmit_policy={xmit_policy}" path = [u"dpdk", ethbond_config] self.add_config_item(self._nodeconfig, u"", path) def add_dpdk_dev_default_rxq(self, value): """Add DPDK dev default rxq configuration. :param value: Default number of rxqs. :type value: str """ path = [u"dpdk", u"dev default", u"num-rx-queues"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_dev_default_txq(self, value): """Add DPDK dev default txq configuration. :param value: Default number of txqs. :type value: str """ path = [u"dpdk", u"dev default", u"num-tx-queues"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_dev_default_rxd(self, value): """Add DPDK dev default rxd configuration. :param value: Default number of rxds. :type value: str """ path = [u"dpdk", u"dev default", u"num-rx-desc"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_dev_default_txd(self, value): """Add DPDK dev default txd configuration. :param value: Default number of txds. :type value: str """ path = [u"dpdk", u"dev default", u"num-tx-desc"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_log_level(self, value): """Add DPDK log-level configuration. :param value: Log level. :type value: str """ path = [u"dpdk", u"log-level"] self.add_config_item(self._nodeconfig, value, path) def add_dpdk_no_pci(self): """Add DPDK no-pci.""" path = [u"dpdk", u"no-pci"] self.add_config_item(self._nodeconfig, u"", path) def add_dpdk_uio_driver(self, value=None): """Add DPDK uio-driver configuration. :param value: DPDK uio-driver configuration. By default, driver will be loaded automatically from Topology file, still leaving option to manually override by parameter. :type value: str """ if value is None: value = Topology.get_uio_driver(self._node) path = [u"dpdk", u"uio-driver"] self.add_config_item(self._nodeconfig, value, path) def add_cpu_main_core(self, value): """Add CPU main core configuration. :param value: Main core option. :type value: str """ path = [u"cpu", u"main-core"] self.add_config_item(self._nodeconfig, value, path) def add_cpu_corelist_workers(self, value): """Add CPU corelist-workers configuration. :param value: Corelist-workers option. :type value: str """ path = [u"cpu", u"corelist-workers"] self.add_config_item(self._nodeconfig, value, path) def add_main_heap_size(self, value): """Add Main Heap Size configuration. :param value: Amount of heap. :type value: str """ path = [u"memory", u"main-heap-size"] self.add_config_item(self._nodeconfig, value, path) def add_main_heap_page_size(self, value): """Add Main Heap Page Size configuration. :param value: Heap page size. :type value: str """ path = [u"memory", u"main-heap-page-size"] self.add_config_item(self._nodeconfig, value, path) def add_api_trace(self): """Add API trace configuration.""" path = [u"api-trace", u"on"] self.add_config_item(self._nodeconfig, u"", path) def add_ip6_hash_buckets(self, value): """Add IP6 hash buckets configuration. :param value: Number of IP6 hash buckets. :type value: str """ path = [u"ip6", u"hash-buckets"] self.add_config_item(self._nodeconfig, value, path) def add_ip6_heap_size(self, value): """Add IP6 heap-size configuration. :param value: IP6 Heapsize amount. :type value: str """ path = [u"ip6", u"heap-size"] self.add_config_item(self._nodeconfig, value, path) def add_statseg_size(self, value): """Add Stats Heap Size configuration. :param value: Stats heapsize amount. :type value: str """ path = [u"statseg", u"size"] self.add_config_item(self._nodeconfig, value, path) def add_statseg_page_size(self, value): """Add Stats Heap Page Size configuration. :param value: Stats heapsize amount. :type value: str """ path = [u"statseg", u"page-size"] self.add_config_item(self._nodeconfig, value, path) def add_statseg_per_node_counters(self, value): """Add stats per-node-counters configuration. :param value: "on" to switch the counters on. :type value: str """ path = [u"statseg", u"per-node-counters"] self.add_config_item(self._nodeconfig, value, path) def add_plugin(self, state, *plugins): """Add plugin section for specific plugin(s). :param state: State of plugin [enable|disable]. :param plugins: Plugin(s) to disable. :type state: str :type plugins: list """ for plugin in plugins: path = [u"plugins", f"plugin {plugin}", state] self.add_config_item(self._nodeconfig, u" ", path) def add_dpdk_no_multi_seg(self): """Add DPDK no-multi-seg configuration.""" path = [u"dpdk", u"no-multi-seg"] self.add_config_item(self._nodeconfig, u"", path) def add_dpdk_no_tx_checksum_offload(self): """Add DPDK no-tx-checksum-offload configuration.""" path = [u"dpdk", u"no-tx-checksum-offload"] self.add_config_item(self._nodeconfig, u"", path) def add_nat(self, value=u"deterministic"): """Add NAT mode configuration. :param value: NAT mode. :type value: str """ path = [u"nat", value] self.add_config_item(self._nodeconfig, u"", path) def add_nat_max_translations_per_thread(self, value): """Add NAT max. translations per thread number configuration. :param value: NAT mode. :type value: str """ path = [u"nat", u"max translations per thread"] self.add_config_item(self._nodeconfig, value, path) def add_nsim_poll_main_thread(self): """Add NSIM poll-main-thread configuration.""" path = [u"nsim", u"poll-main-thread"] self.add_config_item(self._nodeconfig, u"", path) def add_tcp_congestion_control_algorithm(self, value=u"cubic"): """Add TCP congestion control algorithm. :param value: The congestion control algorithm to use. Example: cubic :type value: str """ path = [u"tcp", u"cc-algo"] self.add_config_item(self._nodeconfig, value, path) def add_tcp_preallocated_connections(self, value): """Add TCP pre-allocated connections. :param value: The number of pre-allocated connections. :type value: int """ path = [u"tcp", u"preallocated-connections"] self.add_config_item(self._nodeconfig, value, path) def add_tcp_preallocated_half_open_connections(self, value): """Add TCP pre-allocated half open connections. :param value: The number of pre-allocated half open connections. :type value: int """ path = [u"tcp", u"preallocated-half-open-connections"] self.add_config_item(self._nodeconfig, value, path) def add_session_enable(self): """Add session enable.""" path = [u"session", u"enable"] self.add_config_item(self._nodeconfig, u"", path) def add_session_event_queues_memfd_segment(self): """Add session event queue memfd segment.""" path = [u"session", u"evt_qs_memfd_seg"] self.add_config_item(self._nodeconfig, u"", path) def add_session_event_queue_length(self, value): """Add session event queue length. :param value: Session event queue length. :type value: int """ path = [u"session", u"event-queue-length"] self.add_config_item(self._nodeconfig, value, path) def add_session_event_queues_segment_size(self, value): """Add session event queue length. :param value: Session event queue segment size. :type value: str """ path = [u"session", u"evt_qs_seg_size"] self.add_config_item(self._nodeconfig, value, path) def add_session_preallocated_sessions(self, value): """Add the number of pre-allocated sessions. :param value: Number of pre-allocated sessions. :type value: int """ path = [u"session", u"preallocated-sessions"] self.add_config_item(self._nodeconfig, value, path) def add_session_v4_session_table_buckets(self, value): """Add number of v4 session table buckets to the config. :param value: Number of v4 session table buckets. :type value: int """ path = [u"session", u"v4-session-table-buckets"] self.add_config_item(self._nodeconfig, value, path) def add_session_v4_session_table_memory(self, value): """Add the size of v4 session table memory. :param value: Size of v4 session table memory. :type value: str """ path = [u"session", u"v4-session-table-memory"] self.add_config_item(self._nodeconfig, value, path) def add_session_v4_halfopen_table_buckets(self, value): """Add the number of v4 halfopen table buckets. :param value: Number of v4 halfopen table buckets. :type value: int """ path = [u"session", u"v4-halfopen-table-buckets"] self.add_config_item(self._nodeconfig, value, path) def add_session_v4_halfopen_table_memory(self, value): """Add the size of v4 halfopen table memory. :param value: Size of v4 halfopen table memory. :type value: str """ path = [u"session", u"v4-halfopen-table-memory"] self.add_config_item(self._nodeconfig, value, path) def add_session_local_endpoints_table_buckets(self, value): """Add the number of local endpoints table buckets. :param value: Number of local endpoints table buckets. :type value: int """ path = [u"session", u"local-endpoints-table-buckets"] self.add_config_item(self._nodeconfig, value, path) def add_session_local_endpoints_table_memory(self, value): """Add the size of local endpoints table memory. :param value: Size of local endpoints table memory. :type value: str """ path = [u"session", u"local-endpoints-table-memory"] self.add_config_item(self._nodeconfig, value, path) def write_config(self, filename=None): """Generate and write VPP startup configuration to file. Use data from calls to this class to form a startup.conf file and replace /etc/vpp/startup.conf with it on topology node. :param filename: Startup configuration file name. :type filename: str """ self.dump_config(self._nodeconfig) if filename is None: filename = self._vpp_startup_conf if self._vpp_startup_conf_backup is not None: cmd = f"cp {self._vpp_startup_conf} {self._vpp_startup_conf_backup}" exec_cmd_no_error( self._node, cmd, sudo=True, message=u"Copy config file failed!" ) cmd = f"echo \"{self._vpp_config}\" | sudo tee {filename}" exec_cmd_no_error( self._node, cmd, message=u"Writing config file failed!" ) def apply_config(self, filename=None, verify_vpp=True): """Generate and write VPP startup configuration to file and restart VPP. Use data from calls to this class to form a startup.conf file and replace /etc/vpp/startup.conf with it on topology node. :param filename: Startup configuration file name. :param verify_vpp: Verify VPP is running after restart. :type filename: str :type verify_vpp: bool """ self.write_config(filename=filename) VPPUtil.restart_vpp_service(self._node, self._node_key) if verify_vpp: VPPUtil.verify_vpp(self._node) def restore_config(self): """Restore VPP startup.conf from backup.""" cmd = f"cp {self._vpp_startup_conf_backup} {self._vpp_startup_conf}" exec_cmd_no_error( self._node, cmd, sudo=True, message=u"Copy config file failed!" )