Page MenuHomeVyOS Platform

Classes for implementing client/server pairs more easily and in an uniform way
Open, Requires assessmentPublicENHANCEMENT

Description

Hi,

I wanted to provide a more straightforward way for implementing system daemons and their clients without having to deal with sockets/message passing, data validation, state storage, logging and CLI argument parsing. The main motivation for this comes from T2719, which I want to implement.

Therefore I built a package called vyos.client_server which provides base classes for implementing server/client implementations that communicate with eachother with very little code. Both REQ/REP-style and fully bidirectional communication is possible, it uses plain UNIX stream or TCP sockets.

The servers run fully async to better utilize resources and it uses the trio async library, which makes implementations less error-prone than Python's native asyncio. They have some excellent blog posts about their design, just in case one is interested.

So how to get this integrated. Well, it's a two part story.

First, I want to add an ability to build thirdparty debian packages to vyos-build. This is required for one dependency - trio, which is not in buster. An outdated version is available in testing, but I think that's no good option. Fortunately, building trio is pretty simple and I'll add it as a POC with the PR.

Second, vyos-1x needs to be updated with the new Python modules. To demonstrate how to use vyos.client_server, I'll add an implementation of an ipset management daemon + client, which I think will be needed anyway as part of the firewall rewrite in order to be able to add hostnames to ipsets and rules.

I'll create these two PRs so that you can see how this would look like. Feedback very welcome.

Best regards
Robert

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible