Mininet is a network emulator. With Mininet, it is possible to create virtual hosts linked through virtual switches and links. Programs are executed on a single machine, but on different virtual hosts. This creates a network test bench which emulates complex (possibly corrupted or degraded) topologies.
As network emulation is run on a single machine, it is easy to automate tests and run them frequently.
The Linux kernel provides network virtualization features. Mininet is a high level interface written in Python2 which wraps network virtualization of the Linux kernel. The main benefits of Mininet are as follows:
- degraded or corrupted topologies: links that drop packets, high latency links, links with limited bandwidth…
- simulate attacks such as Deny of Service or TCP injection,
- tests can be run on a single machine (or in a single docker container),
- continuous integration tests.
Mininet, Python3 and Continuous Integration¶
The currently recommended version of Mininet is the 2.2.1, which does not support Python3.
provides an OPC-UA client interface in Python3, and uses Python3 for its test
It was natural to port Mininet to Python3 in this context (mostly thanks to scripts such as
Our test docker containers will embed Mininet 2.2.1 on Python3. With such docker containers, it is straightforward to have continuous integration tests of network resilience using the S2OPC toolkit.
Performance Evaluations: Theoretical Overhead¶
Another use of the Mininet network emulator is to measure bandwidth overheads of the OPC-UA protocol. This operation can be done offline, but the OPC-UA protocol has many optional fields or fields with variable length. It is easier to measure the number of answered requests per second on industrial test cases with respect to the bandwidth of the virtual network links.
In OPC-UA, a service message is typed. For instance, a ReadRequest, a WriteRequest, or a BrowseRequest. In these messages, multiple requests can be packed to reduce the message overhead.
On realistic test cases, it is possible to read or write around 100 000 requests per second on a 100 Mbps link connecting the client and the server.
Performance Evaluations: Regression Tests¶
With a Mininet network in the Continuous Integration, it is possible to make regression tests about performances, to ensure that no major performance bottleneck is introduced in the development of S2OPC.
The following graph shows the current performances of the client Python interface of S2OPC for the write service on a desktop Linux. The server is a simple S2OPC server written in C. The graph includes a comparison with the theoretical limits. The left part of the graph shows that grouping request items in small bunches really slows down the service rates. In this case, most of the CPU time is used to decode the OPC-UA protocol. When items are regrouped in larger requests, the link bandwidth becomes the bottleneck in the service rates.