Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.19) |
Tomáš Pecka | 698fabc | 2023-04-07 10:14:07 +0200 | [diff] [blame] | 2 | project(velia LANGUAGES CXX) |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 3 | cmake_policy(SET CMP0109 NEW) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 4 | |
| 5 | # Build options |
Václav Kubernát | b332d98 | 2021-04-16 01:40:11 +0200 | [diff] [blame] | 6 | set(CMAKE_CXX_STANDARD 20) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 8 | |
| 9 | set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}") |
Václav Kubernát | d4b8a69 | 2021-04-16 01:21:44 +0200 | [diff] [blame] | 10 | set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Woverloaded-virtual -Wimplicit-fallthrough ${CMAKE_CXX_FLAGS}") |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 11 | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
| 12 | set(CMAKE_CXX_FLAGS "-Wsuggest-override ${CMAKE_CXX_FLAGS}") |
| 13 | endif() |
| 14 | |
Tomáš Pecka | 5d4cf2a | 2020-07-13 13:19:41 +0200 | [diff] [blame] | 15 | if(CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+" AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) |
| 16 | set(STD_FILESYSTEM_LIBRARY c++fs) |
| 17 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1) |
| 18 | set(STD_FILESYSTEM_LIBRARY stdc++fs) |
| 19 | endif() |
| 20 | |
| 21 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 22 | add_custom_target(velia-version-cmake-ide |
| 23 | cmake/ProjectGitVersion.cmake |
| 24 | cmake/ProjectGitVersionRunner.cmake |
| 25 | ) |
| 26 | include(cmake/ProjectGitVersion.cmake) |
| 27 | prepare_git_version(VELIA_VERSION "0.0") |
| 28 | |
| 29 | find_package(Doxygen) |
| 30 | option(WITH_DOCS "Create and install internal documentation (needs Doxygen)" ${DOXYGEN_FOUND}) |
| 31 | |
Václav Kubernát | de0e4e6 | 2021-02-08 17:46:14 +0100 | [diff] [blame] | 32 | find_package(Boost REQUIRED) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 33 | find_package(spdlog REQUIRED) |
Tomáš Pecka | 6a266d8 | 2021-11-19 11:35:39 +0100 | [diff] [blame] | 34 | find_package(sdbus-c++ "1.0.0" REQUIRED) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 35 | find_package(PkgConfig) |
Tomáš Pecka | af4abff | 2023-01-18 12:23:53 +0100 | [diff] [blame] | 36 | find_package(fmt "8.0.0" REQUIRED) |
Jan Kundrát | fee3bea | 2022-02-15 20:36:08 +0100 | [diff] [blame] | 37 | find_package(nlohmann_json REQUIRED) |
Jan Kundrát | 9e8752a | 2023-02-02 20:55:39 +0100 | [diff] [blame] | 38 | pkg_check_modules(DOCOPT REQUIRED IMPORTED_TARGET docopt) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 39 | |
| 40 | pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd) |
Tomáš Pecka | 1f42cfe | 2020-10-21 18:38:27 +0200 | [diff] [blame] | 41 | if(${SYSTEMD_VERSION} VERSION_EQUAL 245) |
| 42 | message(FATAL_ERROR "Systemd 245 has a bug affecting DBus method calls using sdbus-c++. Please see https://github.com/Kistler-Group/sdbus-cpp/issues/106.") |
| 43 | endif() |
Tomáš Pecka | 070f60d | 2021-10-13 21:48:14 +0200 | [diff] [blame] | 44 | #TODO: Check patch 20333 active |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 45 | |
Jan Kundrát | b3e9998 | 2022-03-18 17:38:20 +0100 | [diff] [blame] | 46 | pkg_check_modules(SYSREPO REQUIRED sysrepo-cpp>=1.1.0 IMPORTED_TARGET sysrepo) |
| 47 | pkg_check_modules(LIBYANG REQUIRED libyang-cpp>=1.1.0 IMPORTED_TARGET libyang) |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 48 | pkg_check_modules(LIBNL REQUIRED IMPORTED_TARGET libnl-route-3.0) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 49 | |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 50 | include(GNUInstallDirs) |
| 51 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 52 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/) |
| 53 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 54 | set(YANG_SRCS |
Jan Kundrát | 7a30cf4 | 2022-07-12 22:24:09 +0200 | [diff] [blame] | 55 | yang/czechlight-system@2022-07-08.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 56 | yang/iana-hardware@2018-03-13.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 57 | yang/ietf-hardware@2018-03-13.yang |
Tomáš Pecka | f98ce03 | 2021-01-14 13:35:00 +0100 | [diff] [blame] | 58 | yang/iana-crypt-hash@2014-08-06.yang |
| 59 | yang/ietf-inet-types@2013-07-15.yang |
| 60 | yang/ietf-netconf-acm@2018-02-14.yang |
| 61 | yang/ietf-system@2014-08-06.yang |
| 62 | yang/ietf-yang-types@2013-07-15.yang |
Tomáš Pecka | 435ca2a | 2021-01-27 10:53:48 +0100 | [diff] [blame] | 63 | yang/ietf-ethertypes@2019-03-04.yang |
| 64 | yang/ietf-interfaces@2018-02-20.yang |
| 65 | yang/ietf-packet-fields@2019-03-04.yang |
Václav Kubernát | 637fe80 | 2021-01-22 02:43:18 +0100 | [diff] [blame] | 66 | yang/ietf-access-control-list@2019-03-04.yang |
Václav Kubernát | 457d1ad | 2021-01-22 02:43:18 +0100 | [diff] [blame] | 67 | yang/czechlight-firewall@2021-01-25.yang |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 68 | yang/czechlight-network@2021-02-22.yang |
| 69 | yang/iana-if-type@2017-01-19.yang |
| 70 | yang/ietf-ip@2018-02-22.yang |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 71 | yang/ietf-routing@2018-03-13.yang |
| 72 | yang/ietf-ipv4-unicast-routing@2018-03-13.yang |
| 73 | yang/ietf-ipv6-unicast-routing@2018-03-13.yang |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 74 | yang/czechlight-lldp@2020-11-04.yang |
| 75 | yang/iana-afn-safi@2013-07-04.yang |
Tomáš Pecka | 6a2334b | 2022-07-12 13:57:54 +0200 | [diff] [blame] | 76 | yang/ietf-alarms@2019-09-11.yang |
| 77 | yang/velia-alarms@2022-07-12.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 78 | ) |
| 79 | |
Tomáš Pecka | 59a148f | 2023-01-16 19:14:15 +0100 | [diff] [blame] | 80 | # temporary until our CI switches to fmt>=9 |
| 81 | add_compile_definitions(FMT_DEPRECATED_OSTREAM) |
| 82 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 83 | # Targets |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 84 | # - utils |
Tomáš Pecka | bd82886 | 2020-06-15 15:53:35 +0200 | [diff] [blame] | 85 | add_library(velia-utils STATIC |
Tomáš Pecka | ad3247f | 2023-05-11 15:56:26 +0200 | [diff] [blame] | 86 | src/utils/alarms.cpp |
| 87 | src/utils/alarms.h |
Tomáš Pecka | a193c03 | 2020-06-22 17:33:31 +0200 | [diff] [blame] | 88 | src/utils/exceptions.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 89 | src/utils/exceptions.h |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 90 | src/utils/exec.cpp |
| 91 | src/utils/exec.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 92 | src/utils/io.cpp |
| 93 | src/utils/io.h |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 94 | src/utils/journal.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 95 | src/utils/journal.h |
Václav Kubernát | cbdc98a | 2021-01-28 13:24:37 +0100 | [diff] [blame] | 96 | src/utils/libyang.cpp |
| 97 | src/utils/libyang.h |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 98 | src/utils/log.h |
Václav Kubernát | 6018f08 | 2021-02-11 01:32:18 +0100 | [diff] [blame] | 99 | src/utils/log.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 100 | src/utils/log-fwd.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 101 | src/utils/log-init.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 102 | src/utils/log-init.h |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 103 | src/utils/sysrepo.cpp |
| 104 | src/utils/sysrepo.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 105 | src/utils/time.cpp |
| 106 | src/utils/time.h |
Tomáš Pecka | d033707 | 2021-01-25 19:57:00 +0100 | [diff] [blame] | 107 | src/utils/waitUntilSignalled.cpp |
| 108 | src/utils/waitUntilSignalled.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 109 | ) |
Tomáš Pecka | 1eb1f35 | 2023-04-14 10:39:56 +0200 | [diff] [blame] | 110 | target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::LIBYANG PkgConfig::SYSREPO fmt::fmt PkgConfig::DOCOPT) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 111 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 112 | # - health |
| 113 | add_library(velia-health STATIC |
Tomáš Pecka | e1f0abd | 2022-07-13 19:31:13 +0200 | [diff] [blame] | 114 | src/health/outputs/AlarmsOutputs.cpp |
| 115 | src/health/outputs/AlarmsOutputs.h |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 116 | src/health/outputs/LedSysfsDriver.cpp |
| 117 | src/health/outputs/callables.cpp |
| 118 | src/health/State.cpp |
Tomáš Pecka | 1d2b95c | 2023-05-11 16:01:46 +0200 | [diff] [blame] | 119 | src/health/SystemdUnits.cpp |
| 120 | src/health/SystemdUnits.h |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 121 | ) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 122 | target_link_libraries(velia-health |
| 123 | PUBLIC |
| 124 | velia-utils |
| 125 | Boost::boost |
| 126 | SDBusCpp::sdbus-c++ |
| 127 | ${STD_FILESYSTEM_LIBRARY} |
Tomáš Pecka | 6a2334b | 2022-07-12 13:57:54 +0200 | [diff] [blame] | 128 | PRIVATE |
| 129 | PkgConfig::LIBYANG |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 130 | ) |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 131 | |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 132 | # - ietf-hardware |
| 133 | add_library(velia-ietf-hardware STATIC |
| 134 | src/ietf-hardware/sysfs/EMMC.cpp |
| 135 | src/ietf-hardware/sysfs/EMMC.h |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 136 | src/ietf-hardware/sysfs/HWMon.cpp |
| 137 | src/ietf-hardware/sysfs/HWMon.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 138 | src/ietf-hardware/IETFHardware.cpp |
| 139 | src/ietf-hardware/IETFHardware.h |
Tomáš Pecka | 45b67f9 | 2024-01-11 14:13:05 +0100 | [diff] [blame] | 140 | src/ietf-hardware/FspYh.cpp |
| 141 | src/ietf-hardware/FspYh.h |
Tomáš Pecka | 50584c5 | 2023-04-19 10:17:01 +0200 | [diff] [blame] | 142 | src/ietf-hardware/thresholds.h |
Tomáš Pecka | dad552b8 | 2023-05-04 20:18:18 +0200 | [diff] [blame] | 143 | src/ietf-hardware/thresholds.cpp |
Tomáš Pecka | 50584c5 | 2023-04-19 10:17:01 +0200 | [diff] [blame] | 144 | src/ietf-hardware/thresholds_fwd.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 145 | ) |
| 146 | target_link_libraries(velia-ietf-hardware |
| 147 | PUBLIC |
| 148 | velia-utils |
| 149 | ${STD_FILESYSTEM_LIBRARY} |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 150 | Boost::boost |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 151 | ) |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 152 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 153 | add_library(velia-ietf-hardware-sysrepo STATIC |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 154 | src/ietf-hardware/sysrepo/Sysrepo.cpp |
| 155 | src/ietf-hardware/sysrepo/Sysrepo.h |
| 156 | ) |
| 157 | target_link_libraries(velia-ietf-hardware-sysrepo |
| 158 | PUBLIC |
| 159 | velia-utils |
| 160 | PkgConfig::SYSREPO |
| 161 | PkgConfig::LIBYANG |
| 162 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 163 | |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 164 | set(NOBODY_UID 65534 CACHE STRING "UID which refers to 'nobody'. Used for dropping root privileges.") |
| 165 | set(NOBODY_GID 65534 CACHE STRING "GID which refers to 'nobody'. Used for dropping root privileges.") |
| 166 | |
Václav Kubernát | de0e4e6 | 2021-02-08 17:46:14 +0100 | [diff] [blame] | 167 | if(NOT NFT_EXECUTABLE) |
| 168 | find_program(NFT_EXECUTABLE nft) |
| 169 | endif() |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 170 | if(NOT SSH_KEYGEN_EXECUTABLE) |
| 171 | find_program(SSH_KEYGEN_EXECUTABLE ssh-keygen) |
| 172 | endif() |
| 173 | if(NOT CHPASSWD_EXECUTABLE) |
| 174 | find_program(CHPASSWD_EXECUTABLE chpasswd) |
| 175 | endif() |
Tomáš Pecka | 879a603 | 2021-02-03 17:21:48 +0100 | [diff] [blame] | 176 | if(NOT SYSTEMCTL_EXECUTABLE) |
| 177 | find_program(SYSTEMCTL_EXECUTABLE systemctl) |
| 178 | endif() |
Tomáš Pecka | 5c19e72 | 2021-02-15 20:41:29 +0100 | [diff] [blame] | 179 | if(NOT NETWORKCTL_EXECUTABLE) |
| 180 | find_program(NETWORKCTL_EXECUTABLE networkctl) |
| 181 | endif() |
Václav Kubernát | 566c940 | 2021-02-10 08:33:54 +0100 | [diff] [blame] | 182 | if(NOT HOSTNAMECTL_EXECUTABLE) |
| 183 | find_program(HOSTNAMECTL_EXECUTABLE hostnamectl) |
| 184 | endif() |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 185 | |
| 186 | set(VELIA_AUTHORIZED_KEYS_FORMAT "{HOME}/.ssh/authorized_keys" CACHE STRING "pattern for determining path to users' SSH authorized_keys file. Must at least one of '{USER}' or '{HOME}' which will get replaced by the name of the user and the home directory of the user respectively.") |
| 187 | if(NOT VELIA_AUTHORIZED_KEYS_FORMAT) |
| 188 | message(FATAL_ERROR "VELIA_AUTHORIZED_KEYS_FORMAT not set.") |
| 189 | endif() |
| 190 | |
| 191 | if(NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{USER}" AND NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{HOME}") |
| 192 | message(FATAL_ERROR "Wrong format string given for VELIA_AUTHORIZED_KEYS_FORMAT: at least one of {USER} or {HOME} expected.") |
| 193 | endif() |
| 194 | |
| 195 | set(VELIA_REAL_ETC_PASSWD "/etc/passwd" CACHE STRING "Path to passwd file") |
| 196 | if(NOT VELIA_REAL_ETC_PASSWD) |
| 197 | message(FATAL_ERROR "VELIA_REAL_ETC_PASSWD not set") |
| 198 | endif() |
| 199 | |
| 200 | set(VELIA_REAL_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to shadow file") |
| 201 | if(NOT VELIA_REAL_ETC_SHADOW) |
| 202 | message(FATAL_ERROR "VELIA_REAL_ETC_SHADOW not set") |
| 203 | endif() |
| 204 | |
| 205 | set(VELIA_BACKUP_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to where /etc/shadow gets copied to upon each change") |
| 206 | if(NOT VELIA_BACKUP_ETC_SHADOW) |
| 207 | message(FATAL_ERROR "VELIA_BACKUP_ETC_SHADOW not set") |
| 208 | endif() |
Václav Kubernát | de0e4e6 | 2021-02-08 17:46:14 +0100 | [diff] [blame] | 209 | |
Václav Kubernát | 566c940 | 2021-02-10 08:33:54 +0100 | [diff] [blame] | 210 | set(VELIA_BACKUP_ETC_HOSTNAME "/etc/hostname" CACHE STRING "Path to hostname file") |
| 211 | if(NOT VELIA_BACKUP_ETC_HOSTNAME ) |
| 212 | message(FATAL_ERROR "VELIA_BACKUP_ETC_HOSTNAME not set") |
| 213 | endif() |
| 214 | |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 215 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/system/system_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/system_vars.h @ONLY) |
| 216 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
| 217 | |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 218 | # - ietf-system |
| 219 | add_library(velia-system STATIC |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 220 | src/system/RAUC.cpp |
| 221 | src/system/RAUC.h |
Tomáš Pecka | 594a676 | 2021-01-29 11:06:08 +0100 | [diff] [blame] | 222 | src/system/Firmware.cpp |
| 223 | src/system/Firmware.h |
Tomáš Pecka | f976c5b | 2021-01-23 21:19:52 +0100 | [diff] [blame] | 224 | src/system/IETFSystem.cpp |
| 225 | src/system/IETFSystem.h |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 226 | src/system/Authentication.cpp |
| 227 | src/system/Authentication.h |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 228 | src/system/Rtnetlink.cpp |
| 229 | src/system/Rtnetlink.h |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 230 | src/system/IETFInterfaces.cpp |
| 231 | src/system/IETFInterfaces.h |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 232 | src/system/IETFInterfacesConfig.cpp |
| 233 | src/system/IETFInterfacesConfig.h |
Tomáš Pecka | e566fd4 | 2024-01-02 17:00:10 +0100 | [diff] [blame] | 234 | src/system/JournalUpload.cpp |
| 235 | src/system/JournalUpload.h |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 236 | src/system/LED.cpp |
| 237 | src/system/LED.h |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 238 | src/system/LLDP.cpp |
| 239 | src/system/LLDP.h |
| 240 | src/system/LLDPCallback.cpp |
| 241 | src/system/LLDPCallback.h |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 242 | ) |
| 243 | target_link_libraries(velia-system |
| 244 | PUBLIC |
| 245 | velia-utils |
| 246 | PkgConfig::SYSREPO |
| 247 | PkgConfig::LIBYANG |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 248 | PkgConfig::LIBNL |
Václav Kubernát | 6dd52c8 | 2021-01-21 08:38:42 +0100 | [diff] [blame] | 249 | SDBusCpp::sdbus-c++ |
Jan Kundrát | fee3bea | 2022-02-15 20:36:08 +0100 | [diff] [blame] | 250 | nlohmann_json::nlohmann_json |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 251 | ) |
| 252 | |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 253 | # - firewall |
| 254 | add_library(velia-firewall STATIC |
| 255 | src/firewall/Firewall.cpp |
| 256 | ) |
| 257 | target_link_libraries(velia-firewall |
| 258 | PUBLIC |
| 259 | velia-utils |
| 260 | PkgConfig::SYSREPO |
| 261 | PRIVATE |
| 262 | PkgConfig::LIBYANG |
| 263 | ) |
| 264 | |
| 265 | |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 266 | # - daemons |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 267 | add_executable(veliad-health |
| 268 | src/main-health.cpp |
Tomáš Pecka | 139e361 | 2021-01-25 19:49:00 +0100 | [diff] [blame] | 269 | src/health/Factory.cpp |
| 270 | src/health/Factory.h |
| 271 | ) |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 272 | target_link_libraries(veliad-health |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 273 | PUBLIC |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 274 | velia-health |
Jan Kundrát | 9e8752a | 2023-02-02 20:55:39 +0100 | [diff] [blame] | 275 | PkgConfig::DOCOPT |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 276 | ) |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 277 | add_dependencies(veliad-health target-VELIA_VERSION) |
| 278 | target_include_directories(veliad-health PUBLIC ${CMAKE_BINARY_DIR}) |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 279 | |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 280 | add_executable(veliad-system |
| 281 | src/main-system.cpp |
| 282 | ) |
| 283 | target_link_libraries(veliad-system |
| 284 | PUBLIC |
| 285 | velia-system |
Jan Kundrát | 9e8752a | 2023-02-02 20:55:39 +0100 | [diff] [blame] | 286 | PkgConfig::DOCOPT |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 287 | ) |
| 288 | add_dependencies(veliad-system target-VELIA_VERSION) |
| 289 | target_include_directories(veliad-system PUBLIC ${CMAKE_BINARY_DIR}) |
| 290 | |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 291 | add_executable(veliad-firewall |
| 292 | src/main-firewall.cpp |
| 293 | ) |
| 294 | target_link_libraries(veliad-firewall |
| 295 | PUBLIC |
| 296 | velia-firewall |
| 297 | velia-utils |
Jan Kundrát | 9e8752a | 2023-02-02 20:55:39 +0100 | [diff] [blame] | 298 | PkgConfig::DOCOPT |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 299 | ) |
| 300 | add_dependencies(veliad-firewall target-VELIA_VERSION) |
| 301 | target_include_directories(veliad-firewall PUBLIC ${CMAKE_BINARY_DIR}) |
| 302 | |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 303 | add_executable(veliad-hardware |
| 304 | src/main-hardware.cpp |
| 305 | src/ietf-hardware/Factory.cpp |
| 306 | src/ietf-hardware/Factory.h |
| 307 | ) |
| 308 | target_link_libraries(veliad-hardware |
| 309 | PUBLIC |
| 310 | velia-ietf-hardware |
| 311 | velia-ietf-hardware-sysrepo |
Jan Kundrát | 9e8752a | 2023-02-02 20:55:39 +0100 | [diff] [blame] | 312 | PkgConfig::DOCOPT |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 313 | ) |
| 314 | add_dependencies(veliad-hardware target-VELIA_VERSION) |
| 315 | target_include_directories(veliad-hardware PUBLIC ${CMAKE_BINARY_DIR}) |
| 316 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 317 | # Testing |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 318 | include(CTest) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 319 | if(BUILD_TESTING) |
Jan Kundrát | 613f07f | 2023-11-03 13:28:51 +0100 | [diff] [blame] | 320 | find_package(trompeloeil 45 REQUIRED) |
| 321 | find_package(doctest 2.4.11 REQUIRED) |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 322 | include(cmake/SysrepoTest.cmake) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 323 | |
Tomáš Pecka | efd8843 | 2020-06-17 15:31:39 +0200 | [diff] [blame] | 324 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/configure.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/configure.cmake.h) |
| 325 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 326 | add_library(DoctestIntegration STATIC |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 327 | tests/doctest_integration.cpp |
| 328 | tests/trompeloeil_doctest.h |
| 329 | tests/wait-a-bit-longer.cpp |
| 330 | ) |
Václav Kubernát | 7efd6d5 | 2021-11-09 01:31:11 +0100 | [diff] [blame] | 331 | target_link_libraries(DoctestIntegration doctest::doctest spdlog::spdlog) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 332 | target_include_directories(DoctestIntegration PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 333 | target_compile_definitions(DoctestIntegration PUBLIC DOCTEST_CONFIG_SUPER_FAST_ASSERTS) |
| 334 | |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 335 | add_library(SysrepoTesting STATIC |
Tomáš Pecka | 0ed5f4f | 2023-05-17 12:20:23 +0200 | [diff] [blame] | 336 | tests/mock/ietf_hardware.h |
| 337 | tests/mock/system.h |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 338 | tests/sysrepo-helpers/common.cpp |
| 339 | tests/sysrepo-helpers/common.h |
Tomáš Pecka | 7eb6459 | 2024-01-24 14:10:47 +0100 | [diff] [blame] | 340 | tests/sysrepo-helpers/datastore.cpp |
| 341 | tests/sysrepo-helpers/datastore.h |
Tomáš Pecka | 9f7b13e | 2024-01-24 13:47:04 +0100 | [diff] [blame] | 342 | tests/sysrepo-helpers/notifications.cpp |
| 343 | tests/sysrepo-helpers/notifications.h |
Tomáš Pecka | 6fcb759 | 2024-01-24 14:42:14 +0100 | [diff] [blame] | 344 | tests/sysrepo-helpers/rpc.cpp |
| 345 | tests/sysrepo-helpers/rpc.h |
Tomáš Pecka | baf289c | 2024-01-24 15:12:44 +0100 | [diff] [blame] | 346 | tests/sysrepo-helpers/alarms.cpp |
| 347 | tests/sysrepo-helpers/alarms.h |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 348 | ) |
| 349 | target_link_libraries(SysrepoTesting DoctestIntegration PkgConfig::SYSREPO) |
| 350 | |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 351 | add_library(DbusTesting STATIC |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 352 | tests/dbus-helpers/dbus_rauc_server.cpp |
| 353 | tests/dbus-helpers/dbus_rauc_server.h |
Tomáš Pecka | 79344c8 | 2021-09-16 18:25:59 +0200 | [diff] [blame] | 354 | tests/dbus-helpers/dbus_resolve1_server.cpp |
| 355 | tests/dbus-helpers/dbus_resolve1_server.h |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 356 | tests/dbus-helpers/dbus_semaphore_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 357 | tests/dbus-helpers/dbus_semaphore_server.h |
Tomáš Pecka | ccd80c3 | 2020-06-22 14:44:32 +0200 | [diff] [blame] | 358 | tests/dbus-helpers/dbus_systemd_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 359 | tests/dbus-helpers/dbus_systemd_server.h |
| 360 | ) |
| 361 | target_link_libraries(DbusTesting |
| 362 | PUBLIC |
| 363 | velia-utils |
| 364 | SDBusCpp::sdbus-c++ |
| 365 | ) |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 366 | |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 367 | add_library(FsTestUtils STATIC |
| 368 | tests/fs-helpers/FileInjector.cpp |
| 369 | tests/fs-helpers/FileInjector.h |
| 370 | tests/fs-helpers/utils.cpp |
| 371 | tests/fs-helpers/utils.h |
| 372 | ) |
| 373 | target_link_libraries(FsTestUtils |
| 374 | PUBLIC |
| 375 | ${STD_FILESYSTEM_LIBRARY} |
| 376 | ) |
| 377 | |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 378 | find_program(IPROUTE2_EXECUTABLE ip REQUIRED) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 379 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/test_vars.h @ONLY) |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 380 | |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 381 | function(velia_test) |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 382 | cmake_parse_arguments(TEST "" "NAME" "" ${ARGN}) |
| 383 | sysrepo_test(NAME ${TEST_NAME} ${TEST_UNPARSED_ARGUMENTS}) |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 384 | target_link_libraries(test-${TEST_NAME} DoctestIntegration SysrepoTesting) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 385 | endfunction() |
| 386 | |
Tomáš Pecka | 0f85ab6 | 2023-02-02 14:53:14 +0100 | [diff] [blame] | 387 | find_program(YANGLINT_PATH yanglint) |
| 388 | if (NOT YANGLINT_PATH) |
| 389 | message(FATAL_ERROR "Cannot find libyang's yanglint") |
| 390 | endif() |
| 391 | foreach(yang_file ${YANG_SRCS}) |
| 392 | add_test(NAME yang-tree:${yang_file} COMMAND ${YANGLINT_PATH} -f tree ${CMAKE_CURRENT_SOURCE_DIR}/${yang_file}) |
| 393 | endforeach() |
| 394 | |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 395 | velia_test(NAME system_rauc LIBRARIES velia-system DbusTesting RESOURCE_LOCK dbus-rauc) |
| 396 | velia_test(NAME system_lldp LIBRARIES velia-system DbusTesting) |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 397 | |
Tomáš Pecka | 50584c5 | 2023-04-19 10:17:01 +0200 | [diff] [blame] | 398 | velia_test(NAME hardware_thresholds LIBRARIES velia-ietf-hardware) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 399 | velia_test(NAME hardware_emmc LIBRARIES velia-ietf-hardware FsTestUtils) |
| 400 | velia_test(NAME hardware_hwmon LIBRARIES velia-ietf-hardware FsTestUtils) |
Tomáš Pecka | 45b67f9 | 2024-01-11 14:13:05 +0100 | [diff] [blame] | 401 | velia_test(NAME hardware_fspyh LIBRARIES velia-ietf-hardware FsTestUtils) |
Tomáš Pecka | 3f81196 | 2023-04-14 10:54:32 +0200 | [diff] [blame] | 402 | velia_test(NAME hardware_ietf-hardware LIBRARIES velia-ietf-hardware) |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 403 | |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 404 | set(fixture_sysrepo-czechlight-lldp --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-lldp@2020-11-04.yang) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 405 | velia_test(NAME sysrepo_system-lldp LIBRARIES velia-system DbusTesting FIXTURE fixture_sysrepo-czechlight-lldp) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 406 | |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 407 | set(fixture_sysrepo-ietf-system --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-system@2014-08-06.yang) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 408 | velia_test(NAME sysrepo_system-ietfsystem LIBRARIES velia-system DbusTesting FIXTURE fixture_sysrepo-ietf-system) |
Tomáš Pecka | cb7a5f8 | 2021-01-20 15:12:00 +0100 | [diff] [blame] | 409 | |
Tomáš Pecka | 24b5483 | 2024-01-17 18:10:44 +0100 | [diff] [blame] | 410 | set(fixture_sysrepo-czechlight-system --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-system@2022-07-08.yang --init-data ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-authentication.json) |
Tomáš Pecka | c164ca6 | 2024-01-24 13:38:03 +0100 | [diff] [blame] | 411 | velia_test(NAME sysrepo_system-firmware LIBRARIES velia-system DbusTesting FIXTURE fixture_sysrepo-czechlight-system RESOURCE_LOCK dbus-rauc) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 412 | velia_test(NAME sysrepo_authentication LIBRARIES velia-system FsTestUtils FIXTURE fixture_sysrepo-czechlight-system) |
| 413 | velia_test(NAME sysrepo_system-leds LIBRARIES velia-system FsTestUtils FIXTURE fixture_sysrepo-czechlight-system) |
Tomáš Pecka | e566fd4 | 2024-01-02 17:00:10 +0100 | [diff] [blame] | 414 | velia_test(NAME sysrepo_system-journalupload LIBRARIES velia-system FIXTURE fixture_sysrepo-czechlight-system) |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 415 | |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 416 | set(fixture_sysrepo-czechlight-network |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 417 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-if-type@2017-01-19.yang |
| 418 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-interfaces@2018-02-20.yang |
| 419 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ip@2018-02-22.yang |
| 420 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-routing@2018-03-13.yang |
| 421 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv4-unicast-routing@2018-03-13.yang |
| 422 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv6-unicast-routing@2018-03-13.yang |
| 423 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-network@2021-02-22.yang) |
Jan Kundrát | f1af318 | 2023-02-08 21:55:15 +0100 | [diff] [blame] | 424 | velia_test(NAME sysrepo_interfaces-systemd-networkd LIBRARIES velia-system FIXTURE fixture_sysrepo-czechlight-network) |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 425 | |
Tomáš Pecka | fd5ec7b | 2023-02-02 18:48:37 +0100 | [diff] [blame] | 426 | find_program(UNSHARE_EXECUTABLE unshare REQUIRED) |
Jan Kundrát | cb93e66 | 2023-02-08 17:39:06 +0100 | [diff] [blame] | 427 | find_program(MOUNT_EXECUTABLE mount REQUIRED) |
Tomáš Pecka | fd5ec7b | 2023-02-02 18:48:37 +0100 | [diff] [blame] | 428 | pkg_get_variable(SR_GROUP sysrepo SR_GROUP) |
| 429 | if (SR_GROUP) |
| 430 | set(UNSHARE_MAP_GROUP_ARG "--map-group=${SR_GROUP}") |
| 431 | else() |
| 432 | set(UNSHARE_MAP_GROUP_ARG "") |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 433 | endif() |
Jan Kundrát | d16357d | 2023-02-08 21:57:57 +0100 | [diff] [blame] | 434 | velia_test(NAME sysrepo_interfaces-libnl LIBRARIES velia-system FIXTURE fixture_sysrepo-czechlight-network |
| 435 | COMMAND ${UNSHARE_EXECUTABLE} --net --mount --map-root-user ${UNSHARE_MAP_GROUP_ARG} sh -c "set -ex $<SEMICOLON> ${MOUNT_EXECUTABLE} -t sysfs none /sys $<SEMICOLON> $<TARGET_FILE:test-sysrepo_interfaces-libnl>") |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 436 | |
Tomáš Pecka | 2117ce5 | 2023-05-12 11:28:34 +0200 | [diff] [blame] | 437 | set(fixture_sysrepo-ietf-hardware |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 438 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-hardware@2018-03-13.yang |
| 439 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-hardware@2018-03-13.yang |
| 440 | --enable-feature hardware-sensor |
| 441 | --enable-feature hardware-state |
| 442 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-alarms@2019-09-11.yang |
| 443 | --enable-feature alarm-shelving |
| 444 | --enable-feature alarm-summary |
| 445 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/velia-alarms@2022-07-12.yang |
| 446 | --install ${CMAKE_CURRENT_SOURCE_DIR}/tests/yang/sysrepo-ietf-alarms@2022-02-17.yang) |
Tomáš Pecka | 3f81196 | 2023-04-14 10:54:32 +0200 | [diff] [blame] | 447 | velia_test(NAME sysrepo_ietf-hardware LIBRARIES velia-ietf-hardware velia-ietf-hardware-sysrepo FsTestUtils FIXTURE fixture_sysrepo-ietf-hardware) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 448 | |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 449 | # ctest dance for sysrepo_two-daemons: compile daemon, create a fixture for test, add the test into the fixture |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 450 | add_executable(test-sysrepo_test_merge-daemon ${CMAKE_SOURCE_DIR}/tests/sysrepo_two-daemons_daemon.cpp) |
| 451 | target_link_libraries(test-sysrepo_test_merge-daemon PkgConfig::SYSREPO PkgConfig::LIBYANG) |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 452 | velia_test(NAME sysrepo_two-daemons LIBRARIES velia-ietf-hardware-sysrepo FIXTURE fixture_sysrepo-ietf-hardware) |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 453 | |
| 454 | add_test(NAME sysrepo_test_merge-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh start) |
| 455 | add_test(NAME sysrepo_test_merge-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh stop) |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 456 | set_tests_properties(sysrepo_test_merge-start PROPERTIES FIXTURES_SETUP sysrepo:two-daemons) |
| 457 | set_tests_properties(sysrepo_test_merge-stop PROPERTIES FIXTURES_CLEANUP sysrepo:two-daemons) |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 458 | get_property(TWO_DAEMONS_ENV TEST test-sysrepo_two-daemons PROPERTY ENVIRONMENT) |
| 459 | set_property(TEST sysrepo_test_merge-start sysrepo_test_merge-stop PROPERTY ENVIRONMENT ${TWO_DAEMONS_ENV}) |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 460 | set_property(TEST test-sysrepo_two-daemons APPEND PROPERTY FIXTURES_REQUIRED sysrepo:two-daemons) |
| 461 | |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 462 | # ensure we run two-daemons merge test and ietf-hardware test sequentially and don't cleanup before everything ends |
Tomáš Pecka | 3f81196 | 2023-04-14 10:54:32 +0200 | [diff] [blame] | 463 | set_tests_properties(sysrepo_test_merge-start PROPERTIES DEPENDS test-sysrepo_ietf-hardware) |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 464 | set_tests_properties(sysrepo:clean:sysrepo_two-daemons PROPERTIES DEPENDS sysrepo_test_merge-stop) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 465 | |
Václav Kubernát | 5a745d2 | 2021-11-12 12:09:57 +0100 | [diff] [blame] | 466 | set(fixture_sysrepo-firewall |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 467 | # Installing czechlight-firewall automatically installs ietf-access-control-list as implemented (not just |
| 468 | # imported) but I still need to install it myself to enable the features. |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 469 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-access-control-list@2019-03-04.yang |
| 470 | --enable-feature match-on-eth |
| 471 | --enable-feature eth |
| 472 | --enable-feature match-on-ipv4 |
| 473 | --enable-feature ipv4 |
| 474 | --enable-feature match-on-ipv6 |
| 475 | --enable-feature ipv6 |
| 476 | --enable-feature mixed-eth-ipv4-ipv6 |
| 477 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-firewall@2021-01-25.yang |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 478 | ) |
| 479 | |
Tomáš Pecka | 174cc84 | 2023-02-02 14:52:12 +0100 | [diff] [blame] | 480 | velia_test(NAME sysrepo-firewall LIBRARIES velia-firewall FIXTURE fixture_sysrepo-firewall) |
Tomáš Pecka | 6a2334b | 2022-07-12 13:57:54 +0200 | [diff] [blame] | 481 | |
| 482 | set(fixture_sysrepo-alarms |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 483 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-alarms@2019-09-11.yang |
| 484 | --enable-feature alarm-shelving |
| 485 | --enable-feature alarm-summary |
| 486 | --install ${CMAKE_CURRENT_SOURCE_DIR}/yang/velia-alarms@2022-07-12.yang |
| 487 | --install ${CMAKE_CURRENT_SOURCE_DIR}/tests/yang/sysrepo-ietf-alarms@2022-02-17.yang |
Tomáš Pecka | 6a2334b | 2022-07-12 13:57:54 +0200 | [diff] [blame] | 488 | ) |
Tomáš Pecka | 3906c89 | 2022-07-26 13:51:17 +0200 | [diff] [blame] | 489 | velia_test(NAME health_systemd-units LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms) |
| 490 | velia_test(NAME sysrepo_health-led-alarms LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms) |
Tomáš Pecka | be79707 | 2022-07-15 20:45:52 +0200 | [diff] [blame] | 491 | |
| 492 | find_program(SYSREPO_IETF_ALARMSD_EXECUTABLE sysrepo-ietf-alarmsd) |
| 493 | if(SYSREPO_IETF_ALARMSD_EXECUTABLE) |
| 494 | velia_test(NAME sysrepo_ietf-alarms LIBRARIES velia-health DbusTesting FIXTURE fixture_sysrepo-alarms) |
| 495 | |
| 496 | add_test(NAME sysrepo_ietf-alarms-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_sysrepo-ietf-alarms_control.sh start ${SYSREPO_IETF_ALARMSD_EXECUTABLE} ${CMAKE_BINARY_DIR}/sysrepo-ietf-alarmsd.log) |
| 497 | add_test(NAME sysrepo_ietf-alarms-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_sysrepo-ietf-alarms_control.sh stop) |
Jan Kundrát | d012b32 | 2024-01-12 18:37:05 +0100 | [diff] [blame] | 498 | get_property(IETF_ALARMS_ENV TEST test-sysrepo_ietf-alarms PROPERTY ENVIRONMENT) |
| 499 | set_property(TEST sysrepo_ietf-alarms-start sysrepo_ietf-alarms-stop PROPERTY ENVIRONMENT ${IETF_ALARMS_ENV}) |
| 500 | message(STATUS "IETF_ALARMS_ENV:\n${IETF_ALARMS_ENV}") |
Tomáš Pecka | be79707 | 2022-07-15 20:45:52 +0200 | [diff] [blame] | 501 | set_tests_properties(sysrepo_ietf-alarms-start PROPERTIES FIXTURES_SETUP sysrepo-ietf-alarmsd) |
| 502 | set_tests_properties(sysrepo_ietf-alarms-stop PROPERTIES FIXTURES_CLEANUP sysrepo-ietf-alarmsd) |
| 503 | set_property(TEST test-sysrepo_ietf-alarms APPEND PROPERTY FIXTURES_REQUIRED sysrepo-ietf-alarmsd) |
| 504 | |
| 505 | set_tests_properties(sysrepo_ietf-alarms-start PROPERTIES DEPENDS sysrepo:prep:sysrepo_ietf-alarms) |
| 506 | set_tests_properties(sysrepo:clean:sysrepo_ietf-alarms PROPERTIES DEPENDS sysrepo_ietf-alarms-stop) |
| 507 | endif() |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 508 | endif() |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 509 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 510 | if(WITH_DOCS) |
| 511 | set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) |
| 512 | set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) |
| 513 | configure_file(${doxyfile_in} ${doxyfile} @ONLY) |
| 514 | add_custom_target(doc |
| 515 | COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} |
| 516 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
| 517 | COMMENT "Generating API documentation with Doxygen" |
| 518 | VERBATIM |
| 519 | SOURCES ${doxyfile_in} |
| 520 | ) |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 521 | endif() |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 522 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 523 | set(YANG_DIR ${CMAKE_INSTALL_PREFIX}/share/velia/yang) |
| 524 | install(FILES ${YANG_SRCS} DESTINATION ${YANG_DIR}) |
Tomáš Pecka | 24b5483 | 2024-01-17 18:10:44 +0100 | [diff] [blame] | 525 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-authentication.json DESTINATION ${YANG_DIR}) |
Tomáš Pecka | eb31772 | 2021-04-13 21:33:20 +0200 | [diff] [blame] | 526 | install(FILES ${CMAKE_SOURCE_DIR}/yang/ietf-ipv6-router-advertisements@2018-03-13.yang DESTINATION ${YANG_DIR}) |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 527 | install(TARGETS veliad-health RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 528 | install(TARGETS veliad-system RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 529 | install(TARGETS veliad-hardware RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | fb14b18 | 2021-01-27 10:54:00 +0100 | [diff] [blame] | 530 | install(TARGETS veliad-firewall RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |