Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 1 | project(velia LANGUAGES CXX) |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 2 | cmake_minimum_required(VERSION 3.19) |
| 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 | a193c03 | 2020-06-22 17:33:31 +0200 | [diff] [blame] | 33 | find_package(docopt REQUIRED) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 34 | find_package(spdlog REQUIRED) |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 35 | find_package(sdbus-c++ REQUIRED) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 36 | find_package(PkgConfig) |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 37 | find_package(fmt) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 38 | |
| 39 | pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd) |
Tomáš Pecka | 1f42cfe | 2020-10-21 18:38:27 +0200 | [diff] [blame] | 40 | if(${SYSTEMD_VERSION} VERSION_EQUAL 245) |
| 41 | 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.") |
| 42 | endif() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 43 | |
Jan Kundrát | 5681a50 | 2021-10-01 01:38:22 +0200 | [diff] [blame] | 44 | pkg_check_modules(SYSREPO REQUIRED sysrepo-cpp>=1.4.148 IMPORTED_TARGET sysrepo) |
| 45 | pkg_check_modules(LIBYANG REQUIRED libyang-cpp>=1.0.248 IMPORTED_TARGET libyang) |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 46 | pkg_check_modules(LIBNL REQUIRED IMPORTED_TARGET libnl-route-3.0) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 47 | |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 48 | find_path(SD_LLDP_H systemd/sd-lldp.h PATHS ${SYSTEMD_INCLUDEDIR} NO_DEFAULT_PATH) |
| 49 | if(NOT SD_LLDP_H) |
| 50 | message(FATAL_ERROR "Cannot find required header <systemd/sd-lldp.h>, use https://github.com/systemd/systemd/pull/16744") |
| 51 | endif() |
| 52 | |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 53 | include(GNUInstallDirs) |
| 54 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 55 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/) |
| 56 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 57 | set(YANG_SRCS |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 58 | yang/czechlight-system@2021-01-13.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 59 | yang/iana-hardware@2018-03-13.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 60 | yang/ietf-hardware@2018-03-13.yang |
Tomáš Pecka | f98ce03 | 2021-01-14 13:35:00 +0100 | [diff] [blame] | 61 | yang/iana-crypt-hash@2014-08-06.yang |
| 62 | yang/ietf-inet-types@2013-07-15.yang |
| 63 | yang/ietf-netconf-acm@2018-02-14.yang |
| 64 | yang/ietf-system@2014-08-06.yang |
| 65 | yang/ietf-yang-types@2013-07-15.yang |
Tomáš Pecka | 435ca2a | 2021-01-27 10:53:48 +0100 | [diff] [blame] | 66 | yang/ietf-ethertypes@2019-03-04.yang |
| 67 | yang/ietf-interfaces@2018-02-20.yang |
| 68 | yang/ietf-packet-fields@2019-03-04.yang |
Václav Kubernát | 637fe80 | 2021-01-22 02:43:18 +0100 | [diff] [blame] | 69 | yang/ietf-access-control-list@2019-03-04.yang |
Václav Kubernát | 457d1ad | 2021-01-22 02:43:18 +0100 | [diff] [blame] | 70 | yang/czechlight-firewall@2021-01-25.yang |
Tomáš Pecka | dac27d4 | 2021-02-22 13:20:05 +0100 | [diff] [blame] | 71 | yang/czechlight-network@2021-02-22.yang |
| 72 | yang/iana-if-type@2017-01-19.yang |
| 73 | yang/ietf-ip@2018-02-22.yang |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 74 | yang/ietf-routing@2018-03-13.yang |
| 75 | yang/ietf-ipv4-unicast-routing@2018-03-13.yang |
| 76 | yang/ietf-ipv6-unicast-routing@2018-03-13.yang |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 77 | yang/czechlight-lldp@2020-11-04.yang |
| 78 | yang/iana-afn-safi@2013-07-04.yang |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 79 | ) |
| 80 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 81 | # Targets |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 82 | # - utils |
Tomáš Pecka | bd82886 | 2020-06-15 15:53:35 +0200 | [diff] [blame] | 83 | add_library(velia-utils STATIC |
Tomáš Pecka | a193c03 | 2020-06-22 17:33:31 +0200 | [diff] [blame] | 84 | src/utils/exceptions.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 85 | src/utils/exceptions.h |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 86 | src/utils/exec.cpp |
| 87 | src/utils/exec.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 88 | src/utils/io.cpp |
| 89 | src/utils/io.h |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 90 | src/utils/journal.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 91 | src/utils/journal.h |
Václav Kubernát | cbdc98a | 2021-01-28 13:24:37 +0100 | [diff] [blame] | 92 | src/utils/libyang.cpp |
| 93 | src/utils/libyang.h |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 94 | src/utils/log.h |
Václav Kubernát | 6018f08 | 2021-02-11 01:32:18 +0100 | [diff] [blame] | 95 | src/utils/log.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 96 | src/utils/log-fwd.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 97 | src/utils/log-init.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 98 | src/utils/log-init.h |
Tomáš Pecka | ba2dc31 | 2021-01-23 22:29:11 +0100 | [diff] [blame] | 99 | src/utils/sysrepo.cpp |
| 100 | src/utils/sysrepo.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 101 | src/utils/time.cpp |
| 102 | src/utils/time.h |
Tomáš Pecka | d033707 | 2021-01-25 19:57:00 +0100 | [diff] [blame] | 103 | src/utils/waitUntilSignalled.cpp |
| 104 | src/utils/waitUntilSignalled.h |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 105 | ) |
Václav Kubernát | 6018f08 | 2021-02-11 01:32:18 +0100 | [diff] [blame] | 106 | target_link_libraries(velia-utils PUBLIC spdlog::spdlog PRIVATE PkgConfig::SYSTEMD PkgConfig::SYSREPO fmt::fmt docopt) |
Tomáš Pecka | a433681 | 2020-07-24 15:32:58 +0200 | [diff] [blame] | 107 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 108 | # - health |
| 109 | add_library(velia-health STATIC |
| 110 | src/health/inputs/AbstractInput.cpp |
| 111 | src/health/inputs/DbusSemaphoreInput.cpp |
| 112 | src/health/inputs/DbusSystemdInput.cpp |
| 113 | src/health/manager/AbstractManager.cpp |
| 114 | src/health/manager/StateManager.cpp |
| 115 | src/health/outputs/LedSysfsDriver.cpp |
| 116 | src/health/outputs/callables.cpp |
| 117 | src/health/State.cpp |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 118 | ) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 119 | target_link_libraries(velia-health |
| 120 | PUBLIC |
| 121 | velia-utils |
| 122 | Boost::boost |
| 123 | SDBusCpp::sdbus-c++ |
| 124 | ${STD_FILESYSTEM_LIBRARY} |
| 125 | ) |
Tomáš Pecka | 74b885f | 2020-06-06 20:02:41 +0200 | [diff] [blame] | 126 | |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 127 | # - ietf-hardware |
| 128 | add_library(velia-ietf-hardware STATIC |
| 129 | src/ietf-hardware/sysfs/EMMC.cpp |
| 130 | src/ietf-hardware/sysfs/EMMC.h |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 131 | src/ietf-hardware/sysfs/HWMon.cpp |
| 132 | src/ietf-hardware/sysfs/HWMon.h |
Tomáš Pecka | 339bc67 | 2020-11-11 15:59:03 +0100 | [diff] [blame] | 133 | src/ietf-hardware/IETFHardware.cpp |
| 134 | src/ietf-hardware/IETFHardware.h |
Václav Kubernát | 97e5ea1 | 2021-03-24 00:36:57 +0100 | [diff] [blame] | 135 | src/ietf-hardware/FspYhPsu.cpp |
| 136 | src/ietf-hardware/FspYhPsu.h |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 137 | ) |
| 138 | target_link_libraries(velia-ietf-hardware |
| 139 | PUBLIC |
| 140 | velia-utils |
| 141 | ${STD_FILESYSTEM_LIBRARY} |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 142 | Boost::boost |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 143 | ) |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 144 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 145 | add_library(velia-ietf-hardware-sysrepo STATIC |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 146 | src/ietf-hardware/sysrepo/Sysrepo.cpp |
| 147 | src/ietf-hardware/sysrepo/Sysrepo.h |
| 148 | ) |
| 149 | target_link_libraries(velia-ietf-hardware-sysrepo |
| 150 | PUBLIC |
| 151 | velia-utils |
| 152 | PkgConfig::SYSREPO |
| 153 | PkgConfig::LIBYANG |
| 154 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 155 | |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 156 | set(NOBODY_UID 65534 CACHE STRING "UID which refers to 'nobody'. Used for dropping root privileges.") |
| 157 | set(NOBODY_GID 65534 CACHE STRING "GID which refers to 'nobody'. Used for dropping root privileges.") |
| 158 | |
Václav Kubernát | de0e4e6 | 2021-02-08 17:46:14 +0100 | [diff] [blame] | 159 | if(NOT NFT_EXECUTABLE) |
| 160 | find_program(NFT_EXECUTABLE nft) |
| 161 | endif() |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 162 | if(NOT SSH_KEYGEN_EXECUTABLE) |
| 163 | find_program(SSH_KEYGEN_EXECUTABLE ssh-keygen) |
| 164 | endif() |
| 165 | if(NOT CHPASSWD_EXECUTABLE) |
| 166 | find_program(CHPASSWD_EXECUTABLE chpasswd) |
| 167 | endif() |
Tomáš Pecka | 879a603 | 2021-02-03 17:21:48 +0100 | [diff] [blame] | 168 | if(NOT SYSTEMCTL_EXECUTABLE) |
| 169 | find_program(SYSTEMCTL_EXECUTABLE systemctl) |
| 170 | endif() |
Tomáš Pecka | 5c19e72 | 2021-02-15 20:41:29 +0100 | [diff] [blame] | 171 | if(NOT NETWORKCTL_EXECUTABLE) |
| 172 | find_program(NETWORKCTL_EXECUTABLE networkctl) |
| 173 | endif() |
Václav Kubernát | 566c940 | 2021-02-10 08:33:54 +0100 | [diff] [blame] | 174 | if(NOT HOSTNAMECTL_EXECUTABLE) |
| 175 | find_program(HOSTNAMECTL_EXECUTABLE hostnamectl) |
| 176 | endif() |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 177 | |
| 178 | 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.") |
| 179 | if(NOT VELIA_AUTHORIZED_KEYS_FORMAT) |
| 180 | message(FATAL_ERROR "VELIA_AUTHORIZED_KEYS_FORMAT not set.") |
| 181 | endif() |
| 182 | |
| 183 | if(NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{USER}" AND NOT VELIA_AUTHORIZED_KEYS_FORMAT MATCHES "{HOME}") |
| 184 | message(FATAL_ERROR "Wrong format string given for VELIA_AUTHORIZED_KEYS_FORMAT: at least one of {USER} or {HOME} expected.") |
| 185 | endif() |
| 186 | |
| 187 | set(VELIA_REAL_ETC_PASSWD "/etc/passwd" CACHE STRING "Path to passwd file") |
| 188 | if(NOT VELIA_REAL_ETC_PASSWD) |
| 189 | message(FATAL_ERROR "VELIA_REAL_ETC_PASSWD not set") |
| 190 | endif() |
| 191 | |
| 192 | set(VELIA_REAL_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to shadow file") |
| 193 | if(NOT VELIA_REAL_ETC_SHADOW) |
| 194 | message(FATAL_ERROR "VELIA_REAL_ETC_SHADOW not set") |
| 195 | endif() |
| 196 | |
| 197 | set(VELIA_BACKUP_ETC_SHADOW "/etc/shadow" CACHE STRING "Path to where /etc/shadow gets copied to upon each change") |
| 198 | if(NOT VELIA_BACKUP_ETC_SHADOW) |
| 199 | message(FATAL_ERROR "VELIA_BACKUP_ETC_SHADOW not set") |
| 200 | endif() |
Václav Kubernát | de0e4e6 | 2021-02-08 17:46:14 +0100 | [diff] [blame] | 201 | |
Václav Kubernát | 566c940 | 2021-02-10 08:33:54 +0100 | [diff] [blame] | 202 | set(VELIA_BACKUP_ETC_HOSTNAME "/etc/hostname" CACHE STRING "Path to hostname file") |
| 203 | if(NOT VELIA_BACKUP_ETC_HOSTNAME ) |
| 204 | message(FATAL_ERROR "VELIA_BACKUP_ETC_HOSTNAME not set") |
| 205 | endif() |
| 206 | |
Václav Kubernát | 6d9357e | 2021-01-28 15:38:24 +0100 | [diff] [blame] | 207 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/system/system_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/system_vars.h @ONLY) |
| 208 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
| 209 | |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 210 | # - ietf-system |
| 211 | add_library(velia-system STATIC |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 212 | src/system/RAUC.cpp |
| 213 | src/system/RAUC.h |
Tomáš Pecka | 594a676 | 2021-01-29 11:06:08 +0100 | [diff] [blame] | 214 | src/system/Firmware.cpp |
| 215 | src/system/Firmware.h |
Tomáš Pecka | f976c5b | 2021-01-23 21:19:52 +0100 | [diff] [blame] | 216 | src/system/IETFSystem.cpp |
| 217 | src/system/IETFSystem.h |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 218 | src/system/Authentication.cpp |
| 219 | src/system/Authentication.h |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 220 | src/system/Rtnetlink.cpp |
| 221 | src/system/Rtnetlink.h |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 222 | src/system/IETFInterfaces.cpp |
| 223 | src/system/IETFInterfaces.h |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 224 | src/system/IETFInterfacesConfig.cpp |
| 225 | src/system/IETFInterfacesConfig.h |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 226 | src/system/LED.cpp |
| 227 | src/system/LED.h |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 228 | src/system/LLDP.cpp |
| 229 | src/system/LLDP.h |
| 230 | src/system/LLDPCallback.cpp |
| 231 | src/system/LLDPCallback.h |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 232 | ) |
| 233 | target_link_libraries(velia-system |
| 234 | PUBLIC |
| 235 | velia-utils |
| 236 | PkgConfig::SYSREPO |
| 237 | PkgConfig::LIBYANG |
Tomáš Pecka | 2d578c8 | 2021-02-23 19:01:35 +0100 | [diff] [blame] | 238 | PkgConfig::LIBNL |
Václav Kubernát | 6dd52c8 | 2021-01-21 08:38:42 +0100 | [diff] [blame] | 239 | SDBusCpp::sdbus-c++ |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 240 | ) |
| 241 | |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 242 | # - firewall |
| 243 | add_library(velia-firewall STATIC |
| 244 | src/firewall/Firewall.cpp |
| 245 | ) |
| 246 | target_link_libraries(velia-firewall |
| 247 | PUBLIC |
| 248 | velia-utils |
| 249 | PkgConfig::SYSREPO |
| 250 | PRIVATE |
| 251 | PkgConfig::LIBYANG |
| 252 | ) |
| 253 | |
| 254 | |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 255 | # - daemons |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 256 | add_executable(veliad-health |
| 257 | src/main-health.cpp |
Tomáš Pecka | 139e361 | 2021-01-25 19:49:00 +0100 | [diff] [blame] | 258 | src/health/Factory.cpp |
| 259 | src/health/Factory.h |
| 260 | ) |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 261 | target_link_libraries(veliad-health |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 262 | PUBLIC |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 263 | velia-health |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 264 | docopt |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 265 | ) |
Tomáš Pecka | cd19e62 | 2021-01-27 09:18:11 +0100 | [diff] [blame] | 266 | add_dependencies(veliad-health target-VELIA_VERSION) |
| 267 | target_include_directories(veliad-health PUBLIC ${CMAKE_BINARY_DIR}) |
Tomáš Pecka | d03044f | 2020-11-12 14:33:10 +0100 | [diff] [blame] | 268 | |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 269 | add_executable(veliad-system |
| 270 | src/main-system.cpp |
| 271 | ) |
| 272 | target_link_libraries(veliad-system |
| 273 | PUBLIC |
| 274 | velia-system |
| 275 | docopt |
| 276 | ) |
| 277 | add_dependencies(veliad-system target-VELIA_VERSION) |
| 278 | target_include_directories(veliad-system PUBLIC ${CMAKE_BINARY_DIR}) |
| 279 | |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 280 | add_executable(veliad-firewall |
| 281 | src/main-firewall.cpp |
| 282 | ) |
| 283 | target_link_libraries(veliad-firewall |
| 284 | PUBLIC |
| 285 | velia-firewall |
| 286 | velia-utils |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 287 | docopt |
| 288 | ) |
| 289 | add_dependencies(veliad-firewall target-VELIA_VERSION) |
| 290 | target_include_directories(veliad-firewall PUBLIC ${CMAKE_BINARY_DIR}) |
| 291 | |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 292 | add_executable(veliad-hardware |
| 293 | src/main-hardware.cpp |
| 294 | src/ietf-hardware/Factory.cpp |
| 295 | src/ietf-hardware/Factory.h |
| 296 | ) |
| 297 | target_link_libraries(veliad-hardware |
| 298 | PUBLIC |
| 299 | velia-ietf-hardware |
| 300 | velia-ietf-hardware-sysrepo |
| 301 | docopt |
| 302 | ) |
| 303 | add_dependencies(veliad-hardware target-VELIA_VERSION) |
| 304 | target_include_directories(veliad-hardware PUBLIC ${CMAKE_BINARY_DIR}) |
| 305 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 306 | # Testing |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 307 | include(CTest) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 308 | if(BUILD_TESTING) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 309 | find_package(trompeloeil 33 REQUIRED) |
| 310 | find_package(doctest 2.3.1 REQUIRED) |
| 311 | |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 312 | option(TEST_NETWORK_WITH_SUDO "Include ietf-routing and ietf-interfaces tests that require root privileges" "OFF") |
| 313 | |
Tomáš Pecka | efd8843 | 2020-06-17 15:31:39 +0200 | [diff] [blame] | 314 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/configure.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/configure.cmake.h) |
| 315 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 316 | add_library(DoctestIntegration STATIC |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 317 | tests/doctest_integration.cpp |
| 318 | tests/trompeloeil_doctest.h |
| 319 | tests/wait-a-bit-longer.cpp |
| 320 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 321 | target_link_libraries(DoctestIntegration doctest::doctest trompeloeil spdlog::spdlog) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 322 | target_include_directories(DoctestIntegration PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 323 | target_compile_definitions(DoctestIntegration PUBLIC DOCTEST_CONFIG_SUPER_FAST_ASSERTS) |
| 324 | |
Tomáš Pecka | a18702d | 2021-01-25 18:07:23 +0100 | [diff] [blame] | 325 | add_library(SysrepoTesting STATIC |
| 326 | tests/mock/sysrepo/events.cpp |
| 327 | tests/mock/sysrepo/events.h |
| 328 | ) |
| 329 | target_link_libraries(SysrepoTesting DoctestIntegration PkgConfig::SYSREPO) |
| 330 | |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 331 | add_library(DbusTesting STATIC |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 332 | tests/dbus-helpers/dbus_network1_server.cpp |
| 333 | tests/dbus-helpers/dbus_network1_server.h |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 334 | tests/dbus-helpers/dbus_rauc_server.cpp |
| 335 | tests/dbus-helpers/dbus_rauc_server.h |
Tomáš Pecka | 79344c8 | 2021-09-16 18:25:59 +0200 | [diff] [blame] | 336 | tests/dbus-helpers/dbus_resolve1_server.cpp |
| 337 | tests/dbus-helpers/dbus_resolve1_server.h |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 338 | tests/dbus-helpers/dbus_semaphore_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 339 | tests/dbus-helpers/dbus_semaphore_server.h |
Tomáš Pecka | ccd80c3 | 2020-06-22 14:44:32 +0200 | [diff] [blame] | 340 | tests/dbus-helpers/dbus_systemd_server.cpp |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 341 | tests/dbus-helpers/dbus_systemd_server.h |
| 342 | ) |
| 343 | target_link_libraries(DbusTesting |
| 344 | PUBLIC |
| 345 | velia-utils |
| 346 | SDBusCpp::sdbus-c++ |
| 347 | ) |
Tomáš Pecka | 0a2e890 | 2020-06-09 21:11:20 +0200 | [diff] [blame] | 348 | |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 349 | add_library(FsTestUtils STATIC |
| 350 | tests/fs-helpers/FileInjector.cpp |
| 351 | tests/fs-helpers/FileInjector.h |
| 352 | tests/fs-helpers/utils.cpp |
| 353 | tests/fs-helpers/utils.h |
| 354 | ) |
| 355 | target_link_libraries(FsTestUtils |
| 356 | PUBLIC |
| 357 | ${STD_FILESYSTEM_LIBRARY} |
| 358 | ) |
| 359 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 360 | function(velia_test name) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 361 | add_executable(test-${name} ${CMAKE_SOURCE_DIR}/tests/${name}.cpp) |
| 362 | target_link_libraries(test-${name} DoctestIntegration ${ARGN}) |
| 363 | target_include_directories(test-${name} |
| 364 | PUBLIC |
| 365 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 366 | PRIVATE |
| 367 | ${CMAKE_BINARY_DIR} |
| 368 | ) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 369 | |
| 370 | if(NOT CMAKE_CROSSCOMPILING) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 371 | add_test(test-${name} test-${name}) |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 372 | endif() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 373 | endfunction() |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 374 | |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 375 | find_program(SYSREPOCTL sysrepoctl) |
| 376 | find_program(SYSREPOCFG sysrepocfg) |
| 377 | |
| 378 | set(sysrepo_previous_fixture_name UNDEFINED) |
| 379 | function(sysrepo_fixture_env name) |
| 380 | set(test_name_init sysrepo:prep:${name}) |
| 381 | set(test_name_cleanup sysrepo:clean:${name}) |
| 382 | set(fixture_name sysrepo:env:${name}) |
| 383 | |
| 384 | add_test(NAME ${test_name_init} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} prepare ${ARGN}) |
| 385 | set_tests_properties(${test_name_init} PROPERTIES FIXTURES_SETUP ${fixture_name} RESOURCE_LOCK sysrepo) |
| 386 | add_test(NAME ${test_name_cleanup} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepoctl-manage-module.sh ${SYSREPOCTL} ${SYSREPOCFG} uninstall ${ARGN}) |
| 387 | set_tests_properties(${test_name_cleanup} PROPERTIES FIXTURES_CLEANUP ${fixture_name} RESOURCE_LOCK sysrepo) |
| 388 | |
| 389 | if (sysrepo_previous_fixture_name) |
| 390 | set_tests_properties(${test_name_init} PROPERTIES DEPENDS sysrepo:clean:${sysrepo_previous_fixture_name}) |
| 391 | endif () |
| 392 | |
| 393 | set(sysrepo_previous_fixture_name ${name} PARENT_SCOPE) |
| 394 | endfunction() |
| 395 | |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 396 | velia_test(health_state-manager velia-health) |
| 397 | velia_test(health_input-semaphore velia-health DbusTesting) |
| 398 | velia_test(health_input-systemd velia-health DbusTesting) |
| 399 | velia_test(health_output-led velia-health) |
Tomáš Pecka | 491f4f2 | 2020-11-05 15:44:00 +0100 | [diff] [blame] | 400 | |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 401 | velia_test(system_rauc velia-system DbusTesting) |
Tomáš Pecka | cb7a5f8 | 2021-01-20 15:12:00 +0100 | [diff] [blame] | 402 | set_tests_properties( |
| 403 | test-system_rauc |
| 404 | PROPERTIES RESOURCE_LOCK dbus-rauc |
| 405 | ) |
Tomáš Pecka | 991e4d5 | 2021-01-11 10:03:14 +0100 | [diff] [blame] | 406 | |
Tomáš Pecka | 7acf392 | 2021-08-10 11:16:57 +0200 | [diff] [blame] | 407 | velia_test(system_lldp velia-system DbusTesting) |
| 408 | |
| 409 | sysrepo_fixture_env(sysrepo-czechlight-lldp YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-lldp@2020-11-04.yang) |
| 410 | velia_test(sysrepo_system-lldp velia-system DbusTesting) |
| 411 | target_link_libraries(test-sysrepo_system-lldp) |
| 412 | set_tests_properties( |
| 413 | test-sysrepo_system-lldp |
| 414 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-czechlight-lldp |
| 415 | RESOURCE_LOCK sysrepo |
| 416 | ) |
| 417 | |
Tomáš Pecka | 9b1c967 | 2020-11-11 15:24:06 +0100 | [diff] [blame] | 418 | velia_test(hardware_emmc velia-ietf-hardware FsTestUtils) |
| 419 | velia_test(hardware_hwmon velia-ietf-hardware FsTestUtils) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 420 | |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 421 | sysrepo_fixture_env(sysrepo-ietf-system YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-system@2014-08-06.yang) |
Tomáš Pecka | f976c5b | 2021-01-23 21:19:52 +0100 | [diff] [blame] | 422 | velia_test(sysrepo_system-ietfsystem velia-system DbusTesting) |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 423 | set_tests_properties( |
Tomáš Pecka | f976c5b | 2021-01-23 21:19:52 +0100 | [diff] [blame] | 424 | test-sysrepo_system-ietfsystem |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 425 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-ietf-system |
| 426 | RESOURCE_LOCK sysrepo |
Tomáš Pecka | cb7a5f8 | 2021-01-20 15:12:00 +0100 | [diff] [blame] | 427 | ) |
| 428 | |
| 429 | sysrepo_fixture_env(sysrepo-czechlight-system YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-system@2021-01-13.yang) |
Tomáš Pecka | 594a676 | 2021-01-29 11:06:08 +0100 | [diff] [blame] | 430 | velia_test(sysrepo_system-firmware velia-system DbusTesting) |
| 431 | target_link_libraries(test-sysrepo_system-firmware SysrepoTesting) |
Tomáš Pecka | cb7a5f8 | 2021-01-20 15:12:00 +0100 | [diff] [blame] | 432 | set_tests_properties( |
Tomáš Pecka | 594a676 | 2021-01-29 11:06:08 +0100 | [diff] [blame] | 433 | test-sysrepo_system-firmware |
Tomáš Pecka | cb7a5f8 | 2021-01-20 15:12:00 +0100 | [diff] [blame] | 434 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-czechlight-system |
| 435 | RESOURCE_LOCK "sysrepo;dbus-rauc" |
Tomáš Pecka | 292bc9c | 2021-01-11 22:03:11 +0100 | [diff] [blame] | 436 | ) |
| 437 | |
Václav Kubernát | babbab9 | 2021-01-27 09:25:05 +0100 | [diff] [blame] | 438 | velia_test(sysrepo_authentication velia-system FsTestUtils) |
| 439 | |
| 440 | set_tests_properties( |
| 441 | test-sysrepo_authentication |
| 442 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-czechlight-system |
| 443 | RESOURCE_LOCK sysrepo |
| 444 | ) |
| 445 | |
Tomáš Pecka | 5be83e4 | 2021-04-21 17:26:40 +0200 | [diff] [blame] | 446 | velia_test(sysrepo_system-leds velia-system FsTestUtils) |
Tomáš Pecka | af7b704 | 2021-04-20 20:14:13 +0200 | [diff] [blame] | 447 | set_tests_properties( |
| 448 | test-sysrepo_system-leds |
| 449 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-czechlight-system |
| 450 | RESOURCE_LOCK sysrepo |
| 451 | ) |
| 452 | |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 453 | sysrepo_fixture_env(sysrepo-czechlight-network |
| 454 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/iana-if-type@2017-01-19.yang |
| 455 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-interfaces@2018-02-20.yang |
| 456 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ip@2018-02-22.yang |
Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 457 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-routing@2018-03-13.yang |
| 458 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv4-unicast-routing@2018-03-13.yang |
| 459 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-ipv6-unicast-routing@2018-03-13.yang |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 460 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-network@2021-02-22.yang) |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 461 | |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 462 | velia_test(sysrepo_system-ietfinterfaces velia-system) |
| 463 | set_tests_properties( |
| 464 | test-sysrepo_system-ietfinterfaces |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 465 | PROPERTIES FIXTURES_REQUIRED "sysrepo:env:sysrepo-czechlight-network" |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 466 | RESOURCE_LOCK sysrepo |
| 467 | ) |
| 468 | |
Tomáš Pecka | 9fa5f6a | 2021-04-13 11:36:11 +0200 | [diff] [blame] | 469 | if(TEST_NETWORK_WITH_SUDO) |
| 470 | find_program(SUDO_EXECUTABLE sudo REQUIRED) |
| 471 | find_program(IPROUTE2_EXECUTABLE ip REQUIRED) |
| 472 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars.h.in ${CMAKE_CURRENT_BINARY_DIR}/test_vars.h @ONLY) |
| 473 | |
| 474 | add_test(NAME network-czechlight0-prepare COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_system-ietfinterfaces-sudo.sh ${SUDO_EXECUTABLE}) |
| 475 | add_test(NAME network-czechlight0-cleanup COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_system-ietfinterfaces-sudo.sh ${SUDO_EXECUTABLE}) |
| 476 | set_tests_properties(network-czechlight0-prepare PROPERTIES FIXTURES_SETUP network-czechlight0) |
| 477 | set_tests_properties(network-czechlight0-cleanup PROPERTIES FIXTURES_CLEANUP network-czechlight0) |
| 478 | |
| 479 | velia_test(sysrepo_system-ietfinterfaces-sudo velia-system) |
| 480 | set_tests_properties( |
| 481 | test-sysrepo_system-ietfinterfaces-sudo |
| 482 | PROPERTIES FIXTURES_REQUIRED "sysrepo:env:sysrepo-czechlight-network;network-czechlight0" |
| 483 | RESOURCE_LOCK sysrepo |
| 484 | ) |
| 485 | endif() |
| 486 | |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 487 | 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) |
Václav Kubernát | 97e5ea1 | 2021-03-24 00:36:57 +0100 | [diff] [blame] | 488 | velia_test(hardware_ietf-hardware velia-ietf-hardware velia-ietf-hardware-sysrepo FsTestUtils) |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 489 | set_tests_properties( |
| 490 | test-hardware_ietf-hardware |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 491 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-ietf-hardware |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 492 | RESOURCE_LOCK sysrepo |
| 493 | ) |
| 494 | |
| 495 | velia_test(sysrepo_two-daemons velia-ietf-hardware-sysrepo) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 496 | # 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] | 497 | add_executable(test-sysrepo_test_merge-daemon ${CMAKE_SOURCE_DIR}/tests/sysrepo_two-daemons_daemon.cpp) |
| 498 | target_link_libraries(test-sysrepo_test_merge-daemon PkgConfig::SYSREPO PkgConfig::LIBYANG) |
| 499 | |
| 500 | add_test(NAME sysrepo_test_merge-start COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh start) |
| 501 | add_test(NAME sysrepo_test_merge-stop COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/sysrepo_two-daemons_control.sh stop) |
| 502 | set_tests_properties(sysrepo_test_merge-start PROPERTIES FIXTURES_SETUP sysrepo:two-daemons RESOURCE_LOCK sysrepo) |
| 503 | set_tests_properties(sysrepo_test_merge-stop PROPERTIES FIXTURES_CLEANUP sysrepo:two-daemons RESOURCE_LOCK sysrepo) |
Tomáš Pecka | 55f64f8 | 2020-12-10 19:03:30 +0100 | [diff] [blame] | 504 | |
| 505 | set_tests_properties( |
| 506 | test-sysrepo_two-daemons |
| 507 | PROPERTIES |
| 508 | FIXTURES_REQUIRED "sysrepo:two-daemons;sysrepo:env:sysrepo-ietf-hardware" |
Tomáš Pecka | 98ad18d | 2020-11-13 15:39:55 +0100 | [diff] [blame] | 509 | RESOURCE_LOCK sysrepo |
| 510 | ) |
Tomáš Pecka | 83b62e1 | 2020-12-16 14:50:49 +0100 | [diff] [blame] | 511 | # ensure we run two-daemons merge test and ietf-hardware test sequentially and don't cleanup before everything ends |
| 512 | set_tests_properties(sysrepo_test_merge-start PROPERTIES DEPENDS test-hardware_ietf-hardware) |
| 513 | set_tests_properties(sysrepo:clean:sysrepo-ietf-hardware PROPERTIES DEPENDS sysrepo_test_merge-stop) |
| 514 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 515 | |
| 516 | find_program(YANGLINT_PATH yanglint) |
| 517 | if (NOT YANGLINT_PATH) |
| 518 | message(FATAL_ERROR "Cannot find libyang's yanglint") |
| 519 | endif() |
| 520 | foreach(yang_file ${YANG_SRCS}) |
| 521 | add_test(NAME yang-tree:${yang_file} COMMAND ${YANGLINT_PATH} -f tree ${CMAKE_CURRENT_SOURCE_DIR}/${yang_file}) |
| 522 | endforeach() |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 523 | |
| 524 | sysrepo_fixture_env(sysrepo-firewall |
| 525 | # Installing czechlight-firewall automatically installs ietf-access-control-list as implemented (not just |
| 526 | # imported) but I still need to install it myself to enable the features. |
| 527 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/ietf-access-control-list@2019-03-04.yang |
| 528 | FEATURE eth |
| 529 | FEATURE match-on-eth |
| 530 | FEATURE match-on-ipv4 |
| 531 | FEATURE ipv4 |
| 532 | FEATURE match-on-ipv6 |
| 533 | FEATURE ipv6 |
| 534 | FEATURE mixed-eth-ipv4-ipv6 |
| 535 | YANG ${CMAKE_CURRENT_SOURCE_DIR}/yang/czechlight-firewall@2021-01-25.yang |
| 536 | ) |
| 537 | |
| 538 | velia_test(sysrepo-firewall velia-firewall) |
| 539 | set_tests_properties( |
| 540 | test-sysrepo-firewall |
| 541 | PROPERTIES FIXTURES_REQUIRED sysrepo:env:sysrepo-firewall |
| 542 | RESOURCE_LOCK sysrepo |
| 543 | ) |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 544 | endif() |
Tomáš Pecka | c927d66 | 2020-07-13 11:16:16 +0200 | [diff] [blame] | 545 | |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 546 | if(WITH_DOCS) |
| 547 | set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) |
| 548 | set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) |
| 549 | configure_file(${doxyfile_in} ${doxyfile} @ONLY) |
| 550 | add_custom_target(doc |
| 551 | COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} |
| 552 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
| 553 | COMMENT "Generating API documentation with Doxygen" |
| 554 | VERBATIM |
| 555 | SOURCES ${doxyfile_in} |
| 556 | ) |
Tomáš Pecka | a06d74d | 2020-06-14 18:18:13 +0200 | [diff] [blame] | 557 | endif() |
Tomáš Pecka | 261c886 | 2020-11-05 11:23:08 +0100 | [diff] [blame] | 558 | |
Tomáš Pecka | 73a13cc | 2020-11-17 11:12:19 +0100 | [diff] [blame] | 559 | set(YANG_DIR ${CMAKE_INSTALL_PREFIX}/share/velia/yang) |
| 560 | install(FILES ${YANG_SRCS} DESTINATION ${YANG_DIR}) |
Tomáš Pecka | eb31772 | 2021-04-13 21:33:20 +0200 | [diff] [blame] | 561 | 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] | 562 | install(TARGETS veliad-health RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | 625b7a1 | 2021-01-23 20:55:51 +0100 | [diff] [blame] | 563 | install(TARGETS veliad-system RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | aae9fe3 | 2021-01-25 19:57:22 +0100 | [diff] [blame] | 564 | install(TARGETS veliad-hardware RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |
Tomáš Pecka | fb14b18 | 2021-01-27 10:54:00 +0100 | [diff] [blame] | 565 | install(TARGETS veliad-firewall RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/) |