tests: Basic test for ietf-interfaces and routing

The test operates on a dummy interface that is created. Only privileged
user can create the interface using iproute2 and therefore we use sudo
to call the iproute2 binary (I was too lazy to use rtnetlink messages
for operating with the links and routes).

Because of that the test is "hidden" from the basic test suite. You
shall invoke cmake with -D=TEST_NETWORK_WITH_SUDO=ON to compile the test binary.

Also bump CMake minimum required version: find_program(... REQUIRED) is
supported since version 3.18 (and the minimum supported version
requirement is not mentioned until the 3.20 docs [1]). However, this is
`sudo` and `sudo` is magic, typically not installed as world-readable,
just world-executable (or magic-group-executable), and that means that
cmake's find_program ignores that. That is, unless CMP0109 [2] is set to
`NEW`, and that one requires CMake 3.19+.

Finally, bcause /usr/sbin/sudo is not in a non-privileged user's $PATH,
adjust the CI environment.

[1] https://cmake.org/cmake/help/v3.20/command/find_program.html
[2] https://cmake.org/cmake/help/latest/policy/CMP0109.html

Change-Id: Ia3dad61b6baff3b4d6e55a333f1375984bb937e5
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0c9a68..af01252 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
 project(velia LANGUAGES CXX)
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.19)
+cmake_policy(SET CMP0109 NEW)
 
 # Build options
 set(CMAKE_CXX_STANDARD 20)
@@ -297,6 +298,8 @@
     find_package(trompeloeil 33 REQUIRED)
     find_package(doctest 2.3.1 REQUIRED)
 
+    option(TEST_NETWORK_WITH_SUDO "Include ietf-routing and ietf-interfaces tests that require root privileges" "OFF")
+
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/configure.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/configure.cmake.h)
 
     add_library(DoctestIntegration STATIC
@@ -437,13 +440,32 @@
             YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv4-unicast-routing@2018-03-13.yang
             YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv6-unicast-routing@2018-03-13.yang
             YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-network@2021-02-22.yang)
+
     velia_test(sysrepo_system-ietfinterfaces velia-system)
     set_tests_properties(
             test-sysrepo_system-ietfinterfaces
-            PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-czechlight-network
+            PROPERTIES FIXTURES_REQUIRED "sysrepo:env:sysrepo-czechlight-network"
             RESOURCE_LOCK sysrepo
     )
 
+    if(TEST_NETWORK_WITH_SUDO)
+        find_program(SUDO_EXECUTABLE sudo REQUIRED)
+        find_program(IPROUTE2_EXECUTABLE ip REQUIRED)
+        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/test_vars.h @ONLY)
+
+        add_test(NAME network-czechlight0-prepare COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_system-ietfinterfaces-sudo.sh ${SUDO_EXECUTABLE})
+        add_test(NAME network-czechlight0-cleanup COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_system-ietfinterfaces-sudo.sh ${SUDO_EXECUTABLE})
+        set_tests_properties(network-czechlight0-prepare PROPERTIES FIXTURES_SETUP network-czechlight0)
+        set_tests_properties(network-czechlight0-cleanup PROPERTIES FIXTURES_CLEANUP network-czechlight0)
+
+        velia_test(sysrepo_system-ietfinterfaces-sudo velia-system)
+        set_tests_properties(
+                test-sysrepo_system-ietfinterfaces-sudo
+                PROPERTIES FIXTURES_REQUIRED "sysrepo:env:sysrepo-czechlight-network;network-czechlight0"
+                RESOURCE_LOCK sysrepo
+        )
+    endif()
+
     sysrepo_fixture_env(sysrepo-ietf-hardware YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-hardware@2018-03-13.yang YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-hardware@2018-03-13.yang FEATURE hardware-sensor)
     velia_test(hardware_ietf-hardware velia-ietf-hardware velia-ietf-hardware-sysrepo FsTestUtils)
     set_tests_properties(