Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Tomáš Pecka <tomas.pecka@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "trompeloeil_doctest.h" |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 9 | #include <filesystem> |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 10 | #include "pretty_printers.h" |
| 11 | #include "system/IETFInterfaces.h" |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 12 | #include "system/IETFInterfacesConfig.h" |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 13 | #include "test_log_setup.h" |
| 14 | #include "test_sysrepo_helpers.h" |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 15 | #include "tests/configure.cmake.h" |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 16 | #include "tests/mock/system.h" |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 17 | #include "utils/io.h" |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 18 | |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 19 | using namespace std::string_literals; |
| 20 | |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 21 | TEST_CASE("ietf-interfaces localhost") |
| 22 | { |
| 23 | TEST_SYSREPO_INIT_LOGS; |
| 24 | TEST_SYSREPO_INIT; |
| 25 | TEST_SYSREPO_INIT_CLIENT; |
| 26 | |
| 27 | auto network = std::make_shared<velia::system::IETFInterfaces>(srSess); |
| 28 | |
| 29 | // We didn't came up with some way of mocking netlink. At least check that there is the loopback |
| 30 | // interface with expected values. It is *probably* safe to assume that there is at least the lo device. |
Tomáš Pecka | 70e5456 | 2021-03-10 12:39:03 +0100 | [diff] [blame] | 31 | auto lo = dataFromSysrepo(client, "/ietf-interfaces:interfaces/interface[name='lo']", SR_DS_OPERATIONAL); |
| 32 | |
| 33 | // ensure statistics keys exist and remove them ; we can't really predict the content |
| 34 | for (const auto& key : {"/statistics", "/statistics/in-discards", "/statistics/in-errors", "/statistics/in-octets", "/statistics/out-discards", "/statistics/out-errors", "/statistics/out-octets"}) { |
| 35 | auto it = lo.find(key); |
| 36 | REQUIRE(it != lo.end()); |
| 37 | lo.erase(it); |
| 38 | } |
| 39 | |
| 40 | REQUIRE(lo == std::map<std::string, std::string> { |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 41 | {"/name", "lo"}, |
| 42 | {"/type", "iana-if-type:softwareLoopback"}, |
| 43 | {"/phys-address", "00:00:00:00:00:00"}, |
| 44 | {"/oper-status", "unknown"}, |
Tomáš Pecka | 0972938 | 2021-03-08 19:36:50 +0100 | [diff] [blame] | 45 | {"/ietf-ip:ipv4", ""}, |
| 46 | {"/ietf-ip:ipv4/address[ip='127.0.0.1']", ""}, |
| 47 | {"/ietf-ip:ipv4/address[ip='127.0.0.1']/ip", "127.0.0.1"}, |
| 48 | {"/ietf-ip:ipv4/address[ip='127.0.0.1']/prefix-length", "8"}, |
| 49 | {"/ietf-ip:ipv6", ""}, |
| 50 | {"/ietf-ip:ipv6/address[ip='::1']", ""}, |
| 51 | {"/ietf-ip:ipv6/address[ip='::1']/ip", "::1"}, |
| 52 | {"/ietf-ip:ipv6/address[ip='::1']/prefix-length", "128"}, |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 53 | }); |
Tomáš Pecka | 3663aae | 2021-03-10 13:46:31 +0100 | [diff] [blame] | 54 | // NOTE: There are no neighbours on loopback |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 55 | |
| 56 | SECTION("Link changes disabled") |
| 57 | { |
| 58 | client->session_switch_ds(SR_DS_STARTUP); |
| 59 | |
| 60 | SECTION("Only specified link names can appear in configurable datastore") |
| 61 | { |
| 62 | for (const auto& [name, type] : {std::pair<const char*, const char*>{"eth0", "iana-if-type:ethernetCsmacd"}, |
| 63 | {"eth1", "iana-if-type:ethernetCsmacd"}, |
| 64 | {"br0", "iana-if-type:bridge"}, |
| 65 | {"osc", "iana-if-type:ethernetCsmacd"}, |
| 66 | {"oscW", "iana-if-type:ethernetCsmacd"}, |
| 67 | {"oscE", "iana-if-type:ethernetCsmacd"}}) { |
| 68 | client->set_item_str(("/ietf-interfaces:interfaces/interface[name='"s + name + "']/type").c_str(), type); |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 69 | client->set_item_str(("/ietf-interfaces:interfaces/interface[name='"s + name + "']/enabled").c_str(), "false"); |
Tomáš Pecka | 71a98b0 | 2021-05-17 15:59:40 +0200 | [diff] [blame] | 70 | } |
| 71 | client->apply_changes(); |
| 72 | } |
| 73 | |
| 74 | SECTION("Invalid type for a valid link") |
| 75 | { |
| 76 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/type", "iana-if-type:softwareLoopback"); |
| 77 | REQUIRE_THROWS_AS(client->apply_changes(), sysrepo::sysrepo_exception); |
| 78 | } |
| 79 | |
| 80 | SECTION("Invalid name") |
| 81 | { |
| 82 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='blah0']/type", "iana-if-type:ethernetCsmacd"); |
| 83 | REQUIRE_THROWS_AS(client->apply_changes(), sysrepo::sysrepo_exception); |
| 84 | } |
| 85 | } |
Tomáš Pecka | de0ef2f | 2021-07-08 13:23:50 +0200 | [diff] [blame] | 86 | |
| 87 | SECTION("There must always be enabled protocol or the interface must be explicitely disabled") |
| 88 | { |
| 89 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/type", "iana-if-type:ethernetCsmacd"); |
| 90 | |
| 91 | SECTION("Disabled protocols; enabled link") |
| 92 | { |
| 93 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 94 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "false"); |
| 95 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "false"); |
| 96 | REQUIRE_THROWS_AS(client->apply_changes(), sysrepo::sysrepo_exception); |
| 97 | } |
| 98 | |
| 99 | SECTION("Active protocols; disabled link") |
| 100 | { |
| 101 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "false"); |
| 102 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "false"); |
| 103 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "true"); |
| 104 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:address[ip='2001:db8::1']/ietf-ip:prefix-length", "32"); |
| 105 | client->apply_changes(); |
| 106 | } |
| 107 | |
| 108 | SECTION("IPv4 only; enabled link") |
| 109 | { |
| 110 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 111 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "true"); |
| 112 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 113 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "false"); |
| 114 | client->apply_changes(); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | SECTION("Every active protocol must have at least one IP address assigned") |
| 119 | { |
| 120 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "false"); |
| 121 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4"); |
| 122 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6"); |
| 123 | client->apply_changes(); |
| 124 | |
| 125 | SECTION("Enabled IPv4 protocol with some IPs assigned is valid") |
| 126 | { |
| 127 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 128 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "true"); |
| 129 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 130 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.2']/ietf-ip:prefix-length", "24"); |
| 131 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "false"); |
| 132 | client->apply_changes(); |
| 133 | } |
| 134 | |
| 135 | SECTION("Enabled IPv6 protocol with some IPs assigned is valid") |
| 136 | { |
| 137 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 138 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "false"); |
| 139 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "true"); |
| 140 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:address[ip='2001:db8::1']/ietf-ip:prefix-length", "32"); |
| 141 | client->apply_changes(); |
| 142 | } |
| 143 | |
| 144 | SECTION("Enabled IPv4 protocol must have at least one IP") |
| 145 | { |
| 146 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 147 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "true"); |
| 148 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "false"); |
| 149 | REQUIRE_THROWS_AS(client->apply_changes(), sysrepo::sysrepo_exception); |
| 150 | } |
| 151 | |
| 152 | SECTION("Enabled IPv6 protocol must have at least one IP") |
| 153 | { |
| 154 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/enabled", "true"); |
| 155 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:enabled", "false"); |
| 156 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:enabled", "true"); |
| 157 | REQUIRE_THROWS_AS(client->apply_changes(), sysrepo::sysrepo_exception); |
| 158 | } |
| 159 | } |
Tomáš Pecka | f10b930 | 2021-02-23 19:02:02 +0100 | [diff] [blame] | 160 | } |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 161 | |
| 162 | struct FakeNetworkReload { |
| 163 | public: |
| 164 | MAKE_CONST_MOCK1(cb, void(const std::vector<std::string>&)); |
| 165 | }; |
| 166 | |
| 167 | TEST_CASE("Config data in ietf-interfaces") |
| 168 | { |
| 169 | TEST_SYSREPO_INIT_LOGS; |
| 170 | TEST_SYSREPO_INIT; |
| 171 | TEST_SYSREPO_INIT_CLIENT; |
| 172 | trompeloeil::sequence seq1; |
| 173 | |
| 174 | auto fake = FakeNetworkReload(); |
| 175 | |
| 176 | const auto fakeConfigDir = std::filesystem::path(CMAKE_CURRENT_BINARY_DIR) / "tests/network/"s; |
| 177 | std::filesystem::remove_all(fakeConfigDir); |
| 178 | std::filesystem::create_directories(fakeConfigDir); |
| 179 | |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 180 | auto network = std::make_shared<velia::system::IETFInterfacesConfig>(srSess, fakeConfigDir, std::vector<std::string>{"eth0", "eth1"}, [&fake](const std::vector<std::string>& updatedInterfaces) { fake.cb(updatedInterfaces); }); |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 181 | |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 182 | |
| 183 | std::string expectedContents; |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 184 | SECTION("Setting IPs to eth0") |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 185 | { |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 186 | const auto expectedFilePath = fakeConfigDir / "eth0.network"; |
| 187 | |
| 188 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/type", "iana-if-type:ethernetCsmacd"); |
| 189 | |
| 190 | SECTION("Single IPv4 address") |
| 191 | { |
| 192 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/description", "Hello world"); |
| 193 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 194 | expectedContents = R"([Match] |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 195 | Name=eth0 |
| 196 | |
| 197 | [Network] |
| 198 | Description=Hello world |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 199 | Address=192.0.2.1/24 |
| 200 | LinkLocalAddressing=no |
| 201 | DHCP=no |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 202 | LLDP=true |
| 203 | EmitLLDP=nearest-bridge |
| 204 | )"; |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 205 | } |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 206 | |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 207 | SECTION("Two IPv4 addresses") |
| 208 | { |
| 209 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 210 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.2']/ietf-ip:prefix-length", "24"); |
| 211 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6"); |
| 212 | expectedContents = R"([Match] |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 213 | Name=eth0 |
| 214 | |
| 215 | [Network] |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 216 | Address=192.0.2.1/24 |
| 217 | Address=192.0.2.2/24 |
| 218 | LinkLocalAddressing=no |
| 219 | DHCP=no |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 220 | LLDP=true |
| 221 | EmitLLDP=nearest-bridge |
| 222 | )"; |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 223 | } |
| 224 | |
| 225 | SECTION("IPv4 and IPv6 addresses") |
| 226 | { |
| 227 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 228 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:address[ip='2001:db8::1']/ietf-ip:prefix-length", "32"); |
| 229 | expectedContents = R"([Match] |
| 230 | Name=eth0 |
| 231 | |
| 232 | [Network] |
| 233 | Address=192.0.2.1/24 |
| 234 | Address=2001:db8::1/32 |
| 235 | DHCP=no |
| 236 | LLDP=true |
| 237 | EmitLLDP=nearest-bridge |
| 238 | )"; |
| 239 | } |
| 240 | |
| 241 | SECTION("IPv4 and IPv6 addresses but IPv6 disabled") |
| 242 | { |
| 243 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 244 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/ietf-ip:address[ip='2001:db8::1']/ietf-ip:prefix-length", "32"); |
| 245 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv6/enabled", "false"); |
| 246 | expectedContents = R"([Match] |
| 247 | Name=eth0 |
| 248 | |
| 249 | [Network] |
| 250 | Address=192.0.2.1/24 |
| 251 | LinkLocalAddressing=no |
| 252 | DHCP=no |
| 253 | LLDP=true |
| 254 | EmitLLDP=nearest-bridge |
| 255 | )"; |
| 256 | } |
| 257 | |
| 258 | REQUIRE_CALL(fake, cb(std::vector<std::string>{"eth0"})).IN_SEQUENCE(seq1); |
| 259 | client->apply_changes(); |
| 260 | REQUIRE(std::filesystem::exists(expectedFilePath)); |
| 261 | REQUIRE(velia::utils::readFileToString(expectedFilePath) == expectedContents); |
| 262 | |
| 263 | // reset the contents |
| 264 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth0']"); |
| 265 | REQUIRE_CALL(fake, cb(std::vector<std::string>{"eth0"})).IN_SEQUENCE(seq1); |
| 266 | client->apply_changes(); |
| 267 | REQUIRE(!std::filesystem::exists(expectedFilePath)); |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 268 | } |
| 269 | |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 270 | SECTION("Setting IPs to eth0 and eth1") |
| 271 | { |
| 272 | const auto expectedFilePathEth0 = fakeConfigDir / "eth0.network"; |
| 273 | const auto expectedFilePathEth1 = fakeConfigDir / "eth1.network"; |
| 274 | const std::string expectedContentsEth0 = R"([Match] |
| 275 | Name=eth0 |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 276 | |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 277 | [Network] |
| 278 | Address=192.0.2.1/24 |
| 279 | LinkLocalAddressing=no |
| 280 | DHCP=no |
| 281 | LLDP=true |
| 282 | EmitLLDP=nearest-bridge |
| 283 | )"; |
| 284 | const std::string expectedContentsEth1 = R"([Match] |
| 285 | Name=eth1 |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 286 | |
Tomáš Pecka | 85f7775 | 2021-06-03 10:09:58 +0200 | [diff] [blame^] | 287 | [Network] |
| 288 | Address=2001:db8::1/32 |
| 289 | DHCP=no |
| 290 | LLDP=true |
| 291 | EmitLLDP=nearest-bridge |
| 292 | )"; |
| 293 | |
| 294 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/type", "iana-if-type:ethernetCsmacd"); |
| 295 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ietf-ip:address[ip='192.0.2.1']/ietf-ip:prefix-length", "24"); |
| 296 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth1']/type", "iana-if-type:ethernetCsmacd"); |
| 297 | client->set_item_str("/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv6/ietf-ip:address[ip='2001:db8::1']/ietf-ip:prefix-length", "32"); |
| 298 | |
| 299 | REQUIRE_CALL(fake, cb(std::vector<std::string>{"eth0", "eth1"})).IN_SEQUENCE(seq1); |
| 300 | client->apply_changes(); |
| 301 | REQUIRE(std::filesystem::exists(expectedFilePathEth0)); |
| 302 | REQUIRE(std::filesystem::exists(expectedFilePathEth1)); |
| 303 | REQUIRE(velia::utils::readFileToString(expectedFilePathEth0) == expectedContentsEth0); |
| 304 | REQUIRE(velia::utils::readFileToString(expectedFilePathEth1) == expectedContentsEth1); |
| 305 | |
| 306 | // reset the contents |
| 307 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth0']"); |
| 308 | client->delete_item("/ietf-interfaces:interfaces/interface[name='eth1']"); |
| 309 | REQUIRE_CALL(fake, cb(std::vector<std::string>{"eth0", "eth1"})).IN_SEQUENCE(seq1); |
| 310 | client->apply_changes(); |
| 311 | REQUIRE(!std::filesystem::exists(expectedFilePathEth0)); |
| 312 | REQUIRE(!std::filesystem::exists(expectedFilePathEth1)); |
| 313 | } |
Tomáš Pecka | 39bbb51 | 2021-05-23 22:07:22 +0200 | [diff] [blame] | 314 | } |