Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 2 | /* |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-2018, Regents of the University of California, |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 26 | #include "nfdc/face-module.hpp" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 27 | |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 28 | #include "execute-command-fixture.hpp" |
| 29 | #include "status-fixture.hpp" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 30 | |
| 31 | namespace nfd { |
| 32 | namespace tools { |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 33 | namespace nfdc { |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 34 | namespace tests { |
| 35 | |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 36 | using ndn::nfd::FaceQueryFilter; |
| 37 | |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 38 | BOOST_AUTO_TEST_SUITE(Nfdc) |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 39 | BOOST_AUTO_TEST_SUITE(TestFaceModule) |
| 40 | |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 41 | BOOST_FIXTURE_TEST_SUITE(ListCommand, ExecuteCommandFixture) |
| 42 | |
| 43 | const std::string NONQUERY_OUTPUT = |
| 44 | "faceid=134 remote=udp4://233.252.0.4:6363 local=udp4://192.0.2.1:6363" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 45 | " congestion={base-marking-interval=12345ms default-threshold=54321B}" |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 46 | " counters={in={22562i 22031d 63n 2522915B} out={30121i 20940d 1218n 1353592B}}" |
| 47 | " flags={non-local permanent multi-access}\n" |
| 48 | "faceid=745 remote=fd://75 local=unix:///var/run/nfd.sock" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 49 | " congestion={base-marking-interval=100ms default-threshold=65536B}" |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 50 | " counters={in={18998i 26701d 147n 4672308B} out={34779i 17028d 1176n 8957187B}}" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 51 | " flags={local on-demand point-to-point local-fields lp-reliability congestion-marking}\n"; |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 52 | |
| 53 | BOOST_AUTO_TEST_CASE(NormalNonQuery) |
| 54 | { |
| 55 | this->processInterest = [this] (const Interest& interest) { |
| 56 | FaceStatus payload1; |
| 57 | payload1.setFaceId(134) |
| 58 | .setRemoteUri("udp4://233.252.0.4:6363") |
| 59 | .setLocalUri("udp4://192.0.2.1:6363") |
| 60 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 61 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT) |
| 62 | .setLinkType(ndn::nfd::LINK_TYPE_MULTI_ACCESS) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 63 | .setBaseCongestionMarkingInterval(12345_ms) |
| 64 | .setDefaultCongestionThreshold(54321) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 65 | .setNInInterests(22562) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 66 | .setNInData(22031) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 67 | .setNInNacks(63) |
| 68 | .setNOutInterests(30121) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 69 | .setNOutData(20940) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 70 | .setNOutNacks(1218) |
| 71 | .setNInBytes(2522915) |
| 72 | .setNOutBytes(1353592); |
| 73 | FaceStatus payload2; |
| 74 | payload2.setFaceId(745) |
| 75 | .setRemoteUri("fd://75") |
| 76 | .setLocalUri("unix:///var/run/nfd.sock") |
| 77 | .setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL) |
| 78 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 79 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 80 | .setBaseCongestionMarkingInterval(100_ms) |
| 81 | .setDefaultCongestionThreshold(65536) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 82 | .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true) |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 83 | .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 84 | .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 85 | .setNInInterests(18998) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 86 | .setNInData(26701) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 87 | .setNInNacks(147) |
| 88 | .setNOutInterests(34779) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 89 | .setNOutData(17028) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 90 | .setNOutNacks(1176) |
| 91 | .setNInBytes(4672308) |
| 92 | .setNOutBytes(8957187); |
| 93 | this->sendDataset("/localhost/nfd/faces/list", payload1, payload2); |
| 94 | }; |
| 95 | |
| 96 | this->execute("face list"); |
| 97 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 98 | BOOST_CHECK(out.is_equal(NONQUERY_OUTPUT)); |
| 99 | BOOST_CHECK(err.is_empty()); |
| 100 | } |
| 101 | |
| 102 | const std::string QUERY_OUTPUT = |
| 103 | "faceid=177 remote=tcp4://53.239.9.114:6363 local=tcp4://164.0.31.106:20396" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 104 | " congestion={base-marking-interval=555ms default-threshold=10000B}" |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 105 | " counters={in={2325i 1110d 79n 4716834B} out={2278i 485d 841n 308108B}}" |
| 106 | " flags={non-local persistent point-to-point}\n"; |
| 107 | |
| 108 | BOOST_AUTO_TEST_CASE(NormalQuery) |
| 109 | { |
| 110 | this->processInterest = [this] (const Interest& interest) { |
| 111 | BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName())); |
| 112 | BOOST_CHECK_EQUAL(interest.getName().size(), 5); |
| 113 | FaceQueryFilter filter(interest.getName().at(4).blockFromValue()); |
| 114 | FaceQueryFilter expectedFilter; |
| 115 | expectedFilter.setRemoteUri("tcp4://53.239.9.114:6363") |
| 116 | .setLocalUri("tcp4://164.0.31.106:20396") |
| 117 | .setUriScheme("tcp4"); |
| 118 | BOOST_CHECK_EQUAL(filter, expectedFilter); |
| 119 | |
| 120 | FaceStatus payload; |
| 121 | payload.setFaceId(177) |
| 122 | .setRemoteUri("tcp4://53.239.9.114:6363") |
| 123 | .setLocalUri("tcp4://164.0.31.106:20396") |
| 124 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 125 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT) |
| 126 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 127 | .setBaseCongestionMarkingInterval(555_ms) |
| 128 | .setDefaultCongestionThreshold(10000) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 129 | .setNInInterests(2325) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 130 | .setNInData(1110) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 131 | .setNInNacks(79) |
| 132 | .setNOutInterests(2278) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 133 | .setNOutData(485) |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 134 | .setNOutNacks(841) |
| 135 | .setNInBytes(4716834) |
| 136 | .setNOutBytes(308108); |
| 137 | this->sendDataset(interest.getName(), payload); |
| 138 | }; |
| 139 | |
| 140 | this->execute("face list tcp://53.239.9.114 scheme tcp4 local tcp://164.0.31.106:20396"); |
| 141 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 142 | BOOST_CHECK(out.is_equal(QUERY_OUTPUT)); |
| 143 | BOOST_CHECK(err.is_empty()); |
| 144 | } |
| 145 | |
| 146 | BOOST_AUTO_TEST_CASE(NotFound) |
| 147 | { |
| 148 | this->processInterest = [this] (const Interest& interest) { |
| 149 | this->sendEmptyDataset(interest.getName()); |
| 150 | }; |
| 151 | |
| 152 | this->execute("face list scheme udp6"); |
| 153 | BOOST_CHECK_EQUAL(exitCode, 3); |
| 154 | BOOST_CHECK(out.is_empty()); |
| 155 | BOOST_CHECK(err.is_equal("Face not found\n")); |
| 156 | } |
| 157 | |
| 158 | BOOST_AUTO_TEST_CASE(Error) |
| 159 | { |
| 160 | this->processInterest = nullptr; // no response |
| 161 | |
| 162 | this->execute("face list local udp4://31.67.17.2:6363"); |
| 163 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 164 | BOOST_CHECK(out.is_empty()); |
| 165 | BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout\n")); |
| 166 | } |
| 167 | |
| 168 | BOOST_AUTO_TEST_SUITE_END() // ListCommand |
| 169 | |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 170 | BOOST_FIXTURE_TEST_SUITE(ShowCommand, ExecuteCommandFixture) |
| 171 | |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 172 | const std::string NORMAL_ALL_CONGESTION_OUTPUT = std::string(R"TEXT( |
| 173 | faceid=256 |
| 174 | remote=udp4://84.67.35.111:6363 |
| 175 | local=udp4://79.91.49.215:6363 |
| 176 | congestion={base-marking-interval=123ms default-threshold=10000B} |
| 177 | counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}} |
| 178 | flags={non-local on-demand point-to-point} |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 179 | )TEXT").substr(1); |
| 180 | |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 181 | BOOST_AUTO_TEST_CASE(NormalAllCongestionParams) |
| 182 | { |
| 183 | this->processInterest = [this] (const Interest& interest) { |
| 184 | BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName())); |
| 185 | BOOST_CHECK_EQUAL(interest.getName().size(), 5); |
| 186 | FaceQueryFilter filter(interest.getName().at(4).blockFromValue()); |
| 187 | BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256)); |
| 188 | |
| 189 | FaceStatus payload; |
| 190 | payload.setFaceId(256) |
| 191 | .setRemoteUri("udp4://84.67.35.111:6363") |
| 192 | .setLocalUri("udp4://79.91.49.215:6363") |
| 193 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 194 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 195 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
| 196 | .setBaseCongestionMarkingInterval(123_ms) |
| 197 | .setDefaultCongestionThreshold(10000) |
| 198 | .setNInInterests(28975) |
| 199 | .setNInData(28232) |
| 200 | .setNInNacks(212) |
| 201 | .setNOutInterests(19525) |
| 202 | .setNOutData(30993) |
| 203 | .setNOutNacks(1038) |
| 204 | .setNInBytes(13307258) |
| 205 | .setNOutBytes(6231946); |
| 206 | |
| 207 | this->sendDataset(interest.getName(), payload); |
| 208 | }; |
| 209 | |
| 210 | this->execute("face show 256"); |
| 211 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 212 | BOOST_CHECK(out.is_equal(NORMAL_ALL_CONGESTION_OUTPUT)); |
| 213 | BOOST_CHECK(err.is_empty()); |
| 214 | } |
| 215 | |
| 216 | const std::string NORMAL_INTERVAL_CONGESTION_OUTPUT = std::string(R"TEXT( |
| 217 | faceid=256 |
| 218 | remote=udp4://84.67.35.111:6363 |
| 219 | local=udp4://79.91.49.215:6363 |
| 220 | congestion={base-marking-interval=123ms} |
| 221 | counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}} |
| 222 | flags={non-local on-demand point-to-point} |
| 223 | )TEXT").substr(1); |
| 224 | |
| 225 | BOOST_AUTO_TEST_CASE(NormalIntervalCongestionParams) |
| 226 | { |
| 227 | this->processInterest = [this] (const Interest& interest) { |
| 228 | BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName())); |
| 229 | BOOST_CHECK_EQUAL(interest.getName().size(), 5); |
| 230 | FaceQueryFilter filter(interest.getName().at(4).blockFromValue()); |
| 231 | BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256)); |
| 232 | |
| 233 | FaceStatus payload; |
| 234 | payload.setFaceId(256) |
| 235 | .setRemoteUri("udp4://84.67.35.111:6363") |
| 236 | .setLocalUri("udp4://79.91.49.215:6363") |
| 237 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 238 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 239 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
| 240 | .setBaseCongestionMarkingInterval(123_ms) |
| 241 | .setNInInterests(28975) |
| 242 | .setNInData(28232) |
| 243 | .setNInNacks(212) |
| 244 | .setNOutInterests(19525) |
| 245 | .setNOutData(30993) |
| 246 | .setNOutNacks(1038) |
| 247 | .setNInBytes(13307258) |
| 248 | .setNOutBytes(6231946); |
| 249 | |
| 250 | this->sendDataset(interest.getName(), payload); |
| 251 | }; |
| 252 | |
| 253 | this->execute("face show 256"); |
| 254 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 255 | BOOST_CHECK(out.is_equal(NORMAL_INTERVAL_CONGESTION_OUTPUT)); |
| 256 | BOOST_CHECK(err.is_empty()); |
| 257 | } |
| 258 | |
| 259 | const std::string NORMAL_THRESHOLD_CONGESTION_OUTPUT = std::string(R"TEXT( |
| 260 | faceid=256 |
| 261 | remote=udp4://84.67.35.111:6363 |
| 262 | local=udp4://79.91.49.215:6363 |
| 263 | congestion={default-threshold=10000B} |
| 264 | counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}} |
| 265 | flags={non-local on-demand point-to-point} |
| 266 | )TEXT").substr(1); |
| 267 | |
| 268 | BOOST_AUTO_TEST_CASE(NormalThresholdCongestionParams) |
| 269 | { |
| 270 | this->processInterest = [this] (const Interest& interest) { |
| 271 | BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName())); |
| 272 | BOOST_CHECK_EQUAL(interest.getName().size(), 5); |
| 273 | FaceQueryFilter filter(interest.getName().at(4).blockFromValue()); |
| 274 | BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256)); |
| 275 | |
| 276 | FaceStatus payload; |
| 277 | payload.setFaceId(256) |
| 278 | .setRemoteUri("udp4://84.67.35.111:6363") |
| 279 | .setLocalUri("udp4://79.91.49.215:6363") |
| 280 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 281 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 282 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
| 283 | .setDefaultCongestionThreshold(10000) |
| 284 | .setNInInterests(28975) |
| 285 | .setNInData(28232) |
| 286 | .setNInNacks(212) |
| 287 | .setNOutInterests(19525) |
| 288 | .setNOutData(30993) |
| 289 | .setNOutNacks(1038) |
| 290 | .setNInBytes(13307258) |
| 291 | .setNOutBytes(6231946); |
| 292 | |
| 293 | this->sendDataset(interest.getName(), payload); |
| 294 | }; |
| 295 | |
| 296 | this->execute("face show 256"); |
| 297 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 298 | BOOST_CHECK(out.is_equal(NORMAL_THRESHOLD_CONGESTION_OUTPUT)); |
| 299 | BOOST_CHECK(err.is_empty()); |
| 300 | } |
| 301 | |
| 302 | const std::string NORMAL_NO_CONGESTION_OUTPUT = std::string(R"TEXT( |
| 303 | faceid=256 |
| 304 | remote=udp4://84.67.35.111:6363 |
| 305 | local=udp4://79.91.49.215:6363 |
| 306 | counters={in={28975i 28232d 212n 13307258B} out={19525i 30993d 1038n 6231946B}} |
| 307 | flags={non-local on-demand point-to-point} |
| 308 | )TEXT").substr(1); |
| 309 | |
| 310 | BOOST_AUTO_TEST_CASE(NormalNoCongestionParams) |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 311 | { |
| 312 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 36e5429 | 2017-02-17 18:43:16 +0000 | [diff] [blame] | 313 | BOOST_CHECK(Name("/localhost/nfd/faces/query").isPrefixOf(interest.getName())); |
Junxiao Shi | 8f803f2 | 2017-02-10 03:04:28 +0000 | [diff] [blame] | 314 | BOOST_CHECK_EQUAL(interest.getName().size(), 5); |
| 315 | FaceQueryFilter filter(interest.getName().at(4).blockFromValue()); |
| 316 | BOOST_CHECK_EQUAL(filter, FaceQueryFilter().setFaceId(256)); |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 317 | |
| 318 | FaceStatus payload; |
| 319 | payload.setFaceId(256) |
| 320 | .setRemoteUri("udp4://84.67.35.111:6363") |
| 321 | .setLocalUri("udp4://79.91.49.215:6363") |
| 322 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 323 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 324 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
| 325 | .setNInInterests(28975) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 326 | .setNInData(28232) |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 327 | .setNInNacks(212) |
| 328 | .setNOutInterests(19525) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 329 | .setNOutData(30993) |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 330 | .setNOutNacks(1038) |
| 331 | .setNInBytes(13307258) |
| 332 | .setNOutBytes(6231946); |
| 333 | |
Junxiao Shi | 8f803f2 | 2017-02-10 03:04:28 +0000 | [diff] [blame] | 334 | this->sendDataset(interest.getName(), payload); |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 335 | }; |
| 336 | |
| 337 | this->execute("face show 256"); |
| 338 | BOOST_CHECK_EQUAL(exitCode, 0); |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 339 | BOOST_CHECK(out.is_equal(NORMAL_NO_CONGESTION_OUTPUT)); |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 340 | BOOST_CHECK(err.is_empty()); |
| 341 | } |
| 342 | |
| 343 | BOOST_AUTO_TEST_CASE(NotFound) |
| 344 | { |
| 345 | this->processInterest = [this] (const Interest& interest) { |
| 346 | this->sendEmptyDataset(interest.getName()); |
| 347 | }; |
| 348 | |
| 349 | this->execute("face show 256"); |
| 350 | BOOST_CHECK_EQUAL(exitCode, 3); |
| 351 | BOOST_CHECK(out.is_empty()); |
Junxiao Shi | 8f803f2 | 2017-02-10 03:04:28 +0000 | [diff] [blame] | 352 | BOOST_CHECK(err.is_equal("Face not found\n")); |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | BOOST_AUTO_TEST_CASE(Error) |
| 356 | { |
| 357 | this->processInterest = nullptr; // no response |
| 358 | |
| 359 | this->execute("face show 256"); |
| 360 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 361 | BOOST_CHECK(out.is_empty()); |
Junxiao Shi | 8f803f2 | 2017-02-10 03:04:28 +0000 | [diff] [blame] | 362 | BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout\n")); |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | BOOST_AUTO_TEST_SUITE_END() // ShowCommand |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 366 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 367 | class ExecuteFaceCreateCommandFixture : public ExecuteCommandFixture |
| 368 | { |
| 369 | protected: |
| 370 | void |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 371 | respond409(const Interest& interest, FacePersistency persistency, |
| 372 | bool enableLpReliability = false, |
| 373 | bool enableCongestionMarking = false) |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 374 | { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 375 | MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create"); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 376 | ControlParameters body; |
| 377 | body.setFaceId(1172) |
| 378 | .setUri("udp4://100.77.30.65:6363") |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 379 | .setLocalUri("udp4://68.62.26.57:24087") |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 380 | .setFacePersistency(persistency) |
| 381 | .setFlags(0); |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 382 | if (enableLpReliability) { |
| 383 | body.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false); |
| 384 | } |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 385 | if (enableCongestionMarking) { |
| 386 | body.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false); |
| 387 | } |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 388 | this->failCommand(interest, 409, "conflict-409", body); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 389 | } |
| 390 | }; |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 391 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 392 | BOOST_FIXTURE_TEST_SUITE(CreateCommand, ExecuteFaceCreateCommandFixture) |
| 393 | |
| 394 | BOOST_AUTO_TEST_CASE(Creating) |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 395 | { |
| 396 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 397 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create"); |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 398 | BOOST_REQUIRE(req.hasUri()); |
| 399 | BOOST_CHECK_EQUAL(req.getUri(), "udp4://159.242.33.78:6363"); |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 400 | BOOST_CHECK(!req.hasLocalUri()); |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 401 | BOOST_REQUIRE(req.hasFacePersistency()); |
| 402 | BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 403 | |
| 404 | ControlParameters resp; |
| 405 | resp.setFaceId(2130) |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 406 | .setUri("udp4://159.242.33.78:6363") |
| 407 | .setLocalUri("udp4://179.63.153.45:28835") |
Junxiao Shi | 5c1bb36 | 2017-05-11 16:03:38 +0000 | [diff] [blame] | 408 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 409 | .setFlags(0); |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 410 | this->succeedCommand(interest, resp); |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 411 | }; |
| 412 | |
| 413 | this->execute("face create udp://159.242.33.78"); |
| 414 | BOOST_CHECK_EQUAL(exitCode, 0); |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 415 | BOOST_CHECK(out.is_equal("face-created id=2130 local=udp4://179.63.153.45:28835 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 416 | "remote=udp4://159.242.33.78:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 417 | "reliability=off congestion-marking=off\n")); |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 418 | BOOST_CHECK(err.is_empty()); |
| 419 | } |
| 420 | |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 421 | BOOST_AUTO_TEST_CASE(CreatingWithParams) |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 422 | { |
| 423 | this->processInterest = [this] (const Interest& interest) { |
| 424 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/create"); |
| 425 | BOOST_REQUIRE(req.hasUri()); |
| 426 | BOOST_CHECK_EQUAL(req.getUri(), "udp4://22.91.89.51:19903"); |
| 427 | BOOST_REQUIRE(req.hasLocalUri()); |
| 428 | BOOST_CHECK_EQUAL(req.getLocalUri(), "udp4://98.68.23.71:6363"); |
| 429 | BOOST_REQUIRE(req.hasFacePersistency()); |
| 430 | BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERMANENT); |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 431 | BOOST_CHECK(req.hasFlags()); |
| 432 | BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 433 | |
| 434 | ControlParameters resp; |
| 435 | resp.setFaceId(301) |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 436 | .setUri("udp4://22.91.89.51:19903") |
| 437 | .setLocalUri("udp4://98.68.23.71:6363") |
Junxiao Shi | 5c1bb36 | 2017-05-11 16:03:38 +0000 | [diff] [blame] | 438 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERMANENT) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 439 | .setBaseCongestionMarkingInterval(100_ms) |
| 440 | .setDefaultCongestionThreshold(65536) |
| 441 | .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false) |
| 442 | .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false); |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 443 | this->succeedCommand(interest, resp); |
| 444 | }; |
| 445 | |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 446 | this->execute("face create udp://22.91.89.51:19903 permanent local udp://98.68.23.71 reliability on " |
| 447 | "congestion-marking on congestion-marking-interval 100 " |
| 448 | "default-congestion-threshold 65536"); |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 449 | BOOST_CHECK_EQUAL(exitCode, 0); |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 450 | BOOST_CHECK(out.is_equal("face-created id=301 local=udp4://98.68.23.71:6363 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 451 | "remote=udp4://22.91.89.51:19903 persistency=permanent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 452 | "reliability=on congestion-marking=on " |
| 453 | "congestion-marking-interval=100ms default-congestion-threshold=65536B\n")); |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 454 | BOOST_CHECK(err.is_empty()); |
| 455 | } |
| 456 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 457 | BOOST_AUTO_TEST_CASE(UpgradingPersistency) |
| 458 | { |
| 459 | bool hasUpdateCommand = false; |
| 460 | this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 461 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 462 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 463 | return; |
| 464 | } |
| 465 | |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 466 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 467 | hasUpdateCommand = true; |
| 468 | BOOST_REQUIRE(req.hasFaceId()); |
| 469 | BOOST_CHECK_EQUAL(req.getFaceId(), 1172); |
| 470 | BOOST_REQUIRE(req.hasFacePersistency()); |
| 471 | BOOST_CHECK_EQUAL(req.getFacePersistency(), FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 472 | BOOST_CHECK(!req.hasFlags()); |
| 473 | |
| 474 | ControlParameters resp; |
| 475 | resp.setFaceId(1172) |
| 476 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 477 | .setFlags(0); |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 478 | this->succeedCommand(interest, resp); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 479 | }; |
| 480 | |
| 481 | this->execute("face create udp://100.77.30.65"); |
| 482 | BOOST_CHECK(hasUpdateCommand); |
| 483 | BOOST_CHECK_EQUAL(exitCode, 0); |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 484 | BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 485 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 486 | "reliability=off congestion-marking=off\n")); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 487 | BOOST_CHECK(err.is_empty()); |
| 488 | } |
| 489 | |
| 490 | BOOST_AUTO_TEST_CASE(NotDowngradingPersistency) |
| 491 | { |
| 492 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 493 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERMANENT); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 494 | // no command other than faces/create is expected |
| 495 | }; |
| 496 | |
| 497 | this->execute("face create udp://100.77.30.65"); |
| 498 | BOOST_CHECK_EQUAL(exitCode, 0); |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 499 | BOOST_CHECK(out.is_equal("face-exists id=1172 local=udp4://68.62.26.57:24087 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 500 | "remote=udp4://100.77.30.65:6363 persistency=permanent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 501 | "reliability=off congestion-marking=off\n")); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 502 | BOOST_CHECK(err.is_empty()); |
| 503 | } |
| 504 | |
| 505 | BOOST_AUTO_TEST_CASE(SamePersistency) |
| 506 | { |
| 507 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 508 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 509 | // no command other than faces/create is expected |
| 510 | }; |
| 511 | |
| 512 | this->execute("face create udp://100.77.30.65"); |
| 513 | BOOST_CHECK_EQUAL(exitCode, 0); |
Junxiao Shi | 1cce2a3 | 2017-05-02 02:39:55 +0000 | [diff] [blame] | 514 | BOOST_CHECK(out.is_equal("face-exists id=1172 local=udp4://68.62.26.57:24087 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 515 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 516 | "reliability=off congestion-marking=off\n")); |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 517 | BOOST_CHECK(err.is_empty()); |
| 518 | } |
| 519 | |
| 520 | BOOST_AUTO_TEST_CASE(EnablingReliability) |
| 521 | { |
| 522 | bool hasUpdateCommand = false; |
| 523 | this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) { |
| 524 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 525 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 526 | return; |
| 527 | } |
| 528 | |
| 529 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
| 530 | hasUpdateCommand = true; |
| 531 | BOOST_REQUIRE(req.hasFaceId()); |
| 532 | BOOST_CHECK_EQUAL(req.getFaceId(), 1172); |
| 533 | BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 534 | BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 535 | |
| 536 | ControlParameters resp; |
| 537 | resp.setFaceId(1172) |
| 538 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 539 | .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true, false); |
| 540 | this->succeedCommand(interest, resp); |
| 541 | }; |
| 542 | |
| 543 | this->execute("face create udp://100.77.30.65 reliability on"); |
| 544 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 545 | BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 " |
| 546 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 547 | "reliability=on congestion-marking=off\n")); |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 548 | BOOST_CHECK(err.is_empty()); |
| 549 | } |
| 550 | |
| 551 | BOOST_AUTO_TEST_CASE(DisablingReliability) |
| 552 | { |
| 553 | bool hasUpdateCommand = false; |
| 554 | this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) { |
| 555 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 556 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, true); |
| 557 | return; |
| 558 | } |
| 559 | |
| 560 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
| 561 | hasUpdateCommand = true; |
| 562 | BOOST_REQUIRE(req.hasFaceId()); |
| 563 | BOOST_CHECK_EQUAL(req.getFaceId(), 1172); |
| 564 | BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 565 | BOOST_CHECK(!req.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)); |
| 566 | |
| 567 | ControlParameters resp; |
| 568 | resp.setFaceId(1172) |
| 569 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 570 | .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false, false); |
| 571 | this->succeedCommand(interest, resp); |
| 572 | }; |
| 573 | |
| 574 | this->execute("face create udp://100.77.30.65 reliability off"); |
| 575 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 576 | BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 " |
| 577 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 578 | "reliability=off congestion-marking=off\n")); |
| 579 | BOOST_CHECK(err.is_empty()); |
| 580 | } |
| 581 | |
| 582 | BOOST_AUTO_TEST_CASE(EnablingCongestionMarking) |
| 583 | { |
| 584 | bool hasUpdateCommand = false; |
| 585 | this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) { |
| 586 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 587 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 588 | return; |
| 589 | } |
| 590 | |
| 591 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
| 592 | hasUpdateCommand = true; |
| 593 | BOOST_REQUIRE(req.hasFaceId()); |
| 594 | BOOST_CHECK_EQUAL(req.getFaceId(), 1172); |
| 595 | BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 596 | BOOST_CHECK(req.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 597 | BOOST_CHECK(!req.hasBaseCongestionMarkingInterval()); |
| 598 | BOOST_CHECK(!req.hasDefaultCongestionThreshold()); |
| 599 | |
| 600 | ControlParameters resp; |
| 601 | resp.setFaceId(1172) |
| 602 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 603 | .setBaseCongestionMarkingInterval(100_ms) |
| 604 | .setDefaultCongestionThreshold(65536) |
| 605 | .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true, false); |
| 606 | this->succeedCommand(interest, resp); |
| 607 | }; |
| 608 | |
| 609 | this->execute("face create udp://100.77.30.65 congestion-marking on"); |
| 610 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 611 | BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 " |
| 612 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
| 613 | "reliability=off congestion-marking=on " |
| 614 | "congestion-marking-interval=100ms default-congestion-threshold=65536B\n")); |
| 615 | BOOST_CHECK(err.is_empty()); |
| 616 | } |
| 617 | |
| 618 | BOOST_AUTO_TEST_CASE(DisablingCongestionMarking) |
| 619 | { |
| 620 | bool hasUpdateCommand = false; |
| 621 | this->processInterest = [this, &hasUpdateCommand] (const Interest& interest) { |
| 622 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 623 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_PERSISTENT, false, true); |
| 624 | return; |
| 625 | } |
| 626 | |
| 627 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
| 628 | hasUpdateCommand = true; |
| 629 | BOOST_REQUIRE(req.hasFaceId()); |
| 630 | BOOST_CHECK_EQUAL(req.getFaceId(), 1172); |
| 631 | BOOST_CHECK(req.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 632 | BOOST_CHECK(!req.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)); |
| 633 | BOOST_CHECK(!req.hasBaseCongestionMarkingInterval()); |
| 634 | BOOST_CHECK(!req.hasDefaultCongestionThreshold()); |
| 635 | |
| 636 | ControlParameters resp; |
| 637 | resp.setFaceId(1172) |
| 638 | .setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT) |
| 639 | .setBaseCongestionMarkingInterval(100_ms) |
| 640 | .setDefaultCongestionThreshold(65536) |
| 641 | .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, false, false); |
| 642 | this->succeedCommand(interest, resp); |
| 643 | }; |
| 644 | |
| 645 | this->execute("face create udp://100.77.30.65 congestion-marking off"); |
| 646 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 647 | BOOST_CHECK(out.is_equal("face-updated id=1172 local=udp4://68.62.26.57:24087 " |
| 648 | "remote=udp4://100.77.30.65:6363 persistency=persistent " |
| 649 | "reliability=off congestion-marking=off " |
| 650 | "congestion-marking-interval=100ms default-congestion-threshold=65536B\n")); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 651 | BOOST_CHECK(err.is_empty()); |
| 652 | } |
| 653 | |
Junxiao Shi | 0d97692 | 2017-04-01 14:35:21 +0000 | [diff] [blame] | 654 | BOOST_AUTO_TEST_CASE(ErrorCanonizeRemote) |
| 655 | { |
| 656 | this->execute("face create invalid://"); |
| 657 | BOOST_CHECK_EQUAL(exitCode, 4); |
| 658 | BOOST_CHECK(out.is_empty()); |
| 659 | BOOST_CHECK(err.is_equal("Error when canonizing 'invalid://': scheme not supported\n")); |
| 660 | } |
| 661 | |
| 662 | BOOST_AUTO_TEST_CASE(ErrorCanonizeLocal) |
| 663 | { |
| 664 | this->execute("face create udp4://24.37.20.47:6363 local invalid://"); |
| 665 | BOOST_CHECK_EQUAL(exitCode, 4); |
| 666 | BOOST_CHECK(out.is_empty()); |
| 667 | BOOST_CHECK(err.is_equal("Error when canonizing 'invalid://': scheme not supported\n")); |
| 668 | } |
| 669 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 670 | BOOST_AUTO_TEST_CASE(ErrorCreate) |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 671 | { |
| 672 | this->processInterest = nullptr; // no response |
| 673 | |
| 674 | this->execute("face create udp://159.242.33.78"); |
| 675 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 676 | BOOST_CHECK(out.is_empty()); |
| 677 | BOOST_CHECK(err.is_equal("Error 10060 when creating face: request timed out\n")); |
| 678 | } |
| 679 | |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 680 | BOOST_AUTO_TEST_CASE(ErrorConflict) |
| 681 | { |
| 682 | // Current NFD will not report a 409-conflict with a different remote FaceUri, but this is |
| 683 | // allowed by FaceMgmt protocol and nfdc should not attempt to upgrade persistency in this case. |
| 684 | |
| 685 | this->processInterest = [this] (const Interest& interest) { |
| 686 | // conflict with udp4://100.77.30.65:6363 |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 687 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 688 | }; |
| 689 | |
| 690 | this->execute("face create udp://20.53.73.45"); |
| 691 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 692 | BOOST_CHECK(out.is_empty()); |
| 693 | BOOST_CHECK(err.is_equal("Error 409 when creating face: conflict-409\n")); |
| 694 | } |
| 695 | |
| 696 | BOOST_AUTO_TEST_CASE(ErrorUpdate) |
| 697 | { |
| 698 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 699 | if (parseCommand(interest, "/localhost/nfd/faces/create")) { |
| 700 | this->respond409(interest, FacePersistency::FACE_PERSISTENCY_ON_DEMAND); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 701 | return; |
| 702 | } |
| 703 | |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 704 | MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/update"); |
Yanbiao Li | 58ba3f9 | 2017-02-15 14:27:18 +0000 | [diff] [blame] | 705 | // no response to faces/update |
| 706 | }; |
| 707 | |
| 708 | this->execute("face create udp://100.77.30.65"); |
| 709 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 710 | BOOST_CHECK(out.is_empty()); |
| 711 | BOOST_CHECK(err.is_equal("Error 10060 when upgrading face persistency: request timed out\n")); |
| 712 | } |
| 713 | |
Junxiao Shi | 1d7fef5 | 2017-02-02 05:33:14 +0000 | [diff] [blame] | 714 | BOOST_AUTO_TEST_SUITE_END() // CreateCommand |
| 715 | |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 716 | BOOST_FIXTURE_TEST_SUITE(DestroyCommand, ExecuteCommandFixture) |
| 717 | |
| 718 | BOOST_AUTO_TEST_CASE(NormalByFaceId) |
| 719 | { |
| 720 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 721 | if (this->respondFaceQuery(interest)) { |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 722 | return; |
| 723 | } |
| 724 | |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 725 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy"); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 726 | BOOST_REQUIRE(req.hasFaceId()); |
| 727 | BOOST_CHECK_EQUAL(req.getFaceId(), 10156); |
| 728 | |
| 729 | ControlParameters resp; |
| 730 | resp.setFaceId(10156); |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 731 | this->succeedCommand(interest, resp); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 732 | }; |
| 733 | |
| 734 | this->execute("face destroy 10156"); |
| 735 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 736 | BOOST_CHECK(out.is_equal("face-destroyed id=10156 local=tcp4://151.26.163.27:22967 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 737 | "remote=tcp4://198.57.27.40:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 738 | "reliability=off congestion-marking=off\n")); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 739 | BOOST_CHECK(err.is_empty()); |
| 740 | } |
| 741 | |
| 742 | BOOST_AUTO_TEST_CASE(NormalByFaceUri) |
| 743 | { |
| 744 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 745 | if (this->respondFaceQuery(interest)) { |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 746 | return; |
| 747 | } |
| 748 | |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 749 | ControlParameters req = MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy"); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 750 | BOOST_REQUIRE(req.hasFaceId()); |
| 751 | BOOST_CHECK_EQUAL(req.getFaceId(), 2249); |
| 752 | |
| 753 | ControlParameters resp; |
| 754 | resp.setFaceId(2249); |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 755 | this->succeedCommand(interest, resp); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 756 | }; |
| 757 | |
| 758 | this->execute("face destroy tcp://32.121.182.82"); |
| 759 | BOOST_CHECK_EQUAL(exitCode, 0); |
| 760 | BOOST_CHECK(out.is_equal("face-destroyed id=2249 local=tcp4://30.99.87.98:31414 " |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 761 | "remote=tcp4://32.121.182.82:6363 persistency=persistent " |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 762 | "reliability=off congestion-marking=off\n")); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 763 | BOOST_CHECK(err.is_empty()); |
| 764 | } |
| 765 | |
| 766 | BOOST_AUTO_TEST_CASE(FaceNotExist) |
| 767 | { |
| 768 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 769 | BOOST_CHECK(this->respondFaceQuery(interest)); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 770 | }; |
| 771 | |
| 772 | this->execute("face destroy 23728"); |
| 773 | BOOST_CHECK_EQUAL(exitCode, 3); |
| 774 | BOOST_CHECK(out.is_empty()); |
| 775 | BOOST_CHECK(err.is_equal("Face not found\n")); |
| 776 | } |
| 777 | |
| 778 | BOOST_AUTO_TEST_CASE(Ambiguous) |
| 779 | { |
| 780 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 781 | BOOST_CHECK(this->respondFaceQuery(interest)); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 782 | }; |
| 783 | |
| 784 | this->execute("face destroy udp4://225.131.75.231:56363"); |
| 785 | BOOST_CHECK_EQUAL(exitCode, 5); |
| 786 | BOOST_CHECK(out.is_empty()); |
| 787 | BOOST_CHECK(err.is_equal("Multiple faces match specified remote FaceUri. " |
| 788 | "Re-run the command with a FaceId: " |
| 789 | "6720 (local=udp4://202.83.168.28:56363), " |
| 790 | "31066 (local=udp4://25.90.26.32:56363)\n")); |
| 791 | } |
| 792 | |
| 793 | BOOST_AUTO_TEST_CASE(ErrorCanonization) |
| 794 | { |
| 795 | this->execute("face destroy udp6://32.38.164.64:10445"); |
| 796 | BOOST_CHECK_EQUAL(exitCode, 4); |
| 797 | BOOST_CHECK(out.is_empty()); |
| 798 | BOOST_CHECK(err.is_equal("Error during remote FaceUri canonization: " |
Eric Newberry | 7d8695d | 2017-05-29 15:49:10 -0700 | [diff] [blame] | 799 | "IPv4/v6 mismatch\n")); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 800 | } |
| 801 | |
| 802 | BOOST_AUTO_TEST_CASE(ErrorDataset) |
| 803 | { |
| 804 | this->processInterest = nullptr; // no response to dataset or command |
| 805 | |
| 806 | this->execute("face destroy udp://159.242.33.78"); |
| 807 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 808 | BOOST_CHECK(out.is_empty()); |
| 809 | BOOST_CHECK(err.is_equal("Error 10060 when querying face: Timeout\n")); |
| 810 | } |
| 811 | |
| 812 | BOOST_AUTO_TEST_CASE(ErrorCommand) |
| 813 | { |
| 814 | this->processInterest = [this] (const Interest& interest) { |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 815 | if (this->respondFaceQuery(interest)) { |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 816 | return; |
| 817 | } |
| 818 | |
Junxiao Shi | 1a25a6e | 2017-03-06 03:09:47 +0000 | [diff] [blame] | 819 | MOCK_NFD_MGMT_REQUIRE_COMMAND_IS("/localhost/nfd/faces/destroy"); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 820 | // no response to command |
| 821 | }; |
| 822 | |
Junxiao Shi | 918e5d4 | 2017-02-25 03:58:21 +0000 | [diff] [blame] | 823 | this->execute("face destroy 10156"); |
Junxiao Shi | 05dd444 | 2017-02-06 22:50:07 +0000 | [diff] [blame] | 824 | BOOST_CHECK_EQUAL(exitCode, 1); |
| 825 | BOOST_CHECK(out.is_empty()); |
| 826 | BOOST_CHECK(err.is_equal("Error 10060 when destroying face: request timed out\n")); |
| 827 | } |
| 828 | |
| 829 | BOOST_AUTO_TEST_SUITE_END() // DestroyCommand |
| 830 | |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 831 | const std::string STATUS_XML = stripXmlSpaces(R"XML( |
| 832 | <faces> |
| 833 | <face> |
| 834 | <faceId>134</faceId> |
| 835 | <remoteUri>udp4://233.252.0.4:6363</remoteUri> |
| 836 | <localUri>udp4://192.0.2.1:6363</localUri> |
| 837 | <faceScope>non-local</faceScope> |
| 838 | <facePersistency>permanent</facePersistency> |
| 839 | <linkType>multi-access</linkType> |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 840 | <congestion/> |
Eric Newberry | 6d932e8 | 2016-11-24 05:05:43 +0000 | [diff] [blame] | 841 | <flags/> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 842 | <packetCounters> |
| 843 | <incomingPackets> |
| 844 | <nInterests>22562</nInterests> |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 845 | <nData>22031</nData> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 846 | <nNacks>63</nNacks> |
| 847 | </incomingPackets> |
| 848 | <outgoingPackets> |
| 849 | <nInterests>30121</nInterests> |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 850 | <nData>20940</nData> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 851 | <nNacks>1218</nNacks> |
| 852 | </outgoingPackets> |
| 853 | </packetCounters> |
| 854 | <byteCounters> |
| 855 | <incomingBytes>2522915</incomingBytes> |
| 856 | <outgoingBytes>1353592</outgoingBytes> |
| 857 | </byteCounters> |
| 858 | </face> |
| 859 | <face> |
| 860 | <faceId>745</faceId> |
| 861 | <remoteUri>fd://75</remoteUri> |
| 862 | <localUri>unix:///var/run/nfd.sock</localUri> |
| 863 | <faceScope>local</faceScope> |
| 864 | <facePersistency>on-demand</facePersistency> |
| 865 | <linkType>point-to-point</linkType> |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 866 | <congestion> |
| 867 | <baseMarkingInterval>PT0.100S</baseMarkingInterval> |
| 868 | <defaultThreshold>65536</defaultThreshold> |
| 869 | </congestion> |
Eric Newberry | 6d932e8 | 2016-11-24 05:05:43 +0000 | [diff] [blame] | 870 | <flags> |
| 871 | <localFieldsEnabled/> |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 872 | <lpReliabilityEnabled/> |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 873 | <congestionMarkingEnabled/> |
Eric Newberry | 6d932e8 | 2016-11-24 05:05:43 +0000 | [diff] [blame] | 874 | </flags> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 875 | <packetCounters> |
| 876 | <incomingPackets> |
| 877 | <nInterests>18998</nInterests> |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 878 | <nData>26701</nData> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 879 | <nNacks>147</nNacks> |
| 880 | </incomingPackets> |
| 881 | <outgoingPackets> |
| 882 | <nInterests>34779</nInterests> |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 883 | <nData>17028</nData> |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 884 | <nNacks>1176</nNacks> |
| 885 | </outgoingPackets> |
| 886 | </packetCounters> |
| 887 | <byteCounters> |
| 888 | <incomingBytes>4672308</incomingBytes> |
| 889 | <outgoingBytes>8957187</outgoingBytes> |
| 890 | </byteCounters> |
| 891 | </face> |
| 892 | </faces> |
| 893 | )XML"); |
| 894 | |
| 895 | const std::string STATUS_TEXT = |
| 896 | "Faces:\n" |
| 897 | " faceid=134 remote=udp4://233.252.0.4:6363 local=udp4://192.0.2.1:6363" |
| 898 | " counters={in={22562i 22031d 63n 2522915B} out={30121i 20940d 1218n 1353592B}}" |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 899 | " flags={non-local permanent multi-access}\n" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 900 | " faceid=745 remote=fd://75 local=unix:///var/run/nfd.sock" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 901 | " congestion={base-marking-interval=100ms default-threshold=65536B}" |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 902 | " counters={in={18998i 26701d 147n 4672308B} out={34779i 17028d 1176n 8957187B}}" |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 903 | " flags={local on-demand point-to-point local-fields lp-reliability congestion-marking}\n"; |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 904 | |
Junxiao Shi | 1f481fa | 2017-01-26 15:14:43 +0000 | [diff] [blame] | 905 | BOOST_FIXTURE_TEST_CASE(Status, StatusFixture<FaceModule>) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 906 | { |
| 907 | this->fetchStatus(); |
| 908 | FaceStatus payload1; |
| 909 | payload1.setFaceId(134) |
| 910 | .setRemoteUri("udp4://233.252.0.4:6363") |
| 911 | .setLocalUri("udp4://192.0.2.1:6363") |
| 912 | .setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL) |
| 913 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERMANENT) |
| 914 | .setLinkType(ndn::nfd::LINK_TYPE_MULTI_ACCESS) |
| 915 | .setNInInterests(22562) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 916 | .setNInData(22031) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 917 | .setNInNacks(63) |
| 918 | .setNOutInterests(30121) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 919 | .setNOutData(20940) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 920 | .setNOutNacks(1218) |
| 921 | .setNInBytes(2522915) |
| 922 | .setNOutBytes(1353592); |
| 923 | FaceStatus payload2; |
| 924 | payload2.setFaceId(745) |
| 925 | .setRemoteUri("fd://75") |
| 926 | .setLocalUri("unix:///var/run/nfd.sock") |
| 927 | .setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL) |
| 928 | .setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND) |
| 929 | .setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 930 | .setBaseCongestionMarkingInterval(100_ms) |
| 931 | .setDefaultCongestionThreshold(65536) |
Eric Newberry | 6d932e8 | 2016-11-24 05:05:43 +0000 | [diff] [blame] | 932 | .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true) |
Eric Newberry | 84d3adc | 2017-08-09 23:31:40 -0400 | [diff] [blame] | 933 | .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true) |
Eric Newberry | de33245 | 2018-01-30 11:45:32 -0700 | [diff] [blame] | 934 | .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, true) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 935 | .setNInInterests(18998) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 936 | .setNInData(26701) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 937 | .setNInNacks(147) |
| 938 | .setNOutInterests(34779) |
Junxiao Shi | f03d479 | 2017-04-06 16:41:22 +0000 | [diff] [blame] | 939 | .setNOutData(17028) |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 940 | .setNOutNacks(1176) |
| 941 | .setNInBytes(4672308) |
| 942 | .setNOutBytes(8957187); |
| 943 | this->sendDataset("/localhost/nfd/faces/list", payload1, payload2); |
| 944 | this->prepareStatusOutput(); |
| 945 | |
| 946 | BOOST_CHECK(statusXml.is_equal(STATUS_XML)); |
| 947 | BOOST_CHECK(statusText.is_equal(STATUS_TEXT)); |
| 948 | } |
| 949 | |
| 950 | BOOST_AUTO_TEST_SUITE_END() // TestFaceModule |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 951 | BOOST_AUTO_TEST_SUITE_END() // Nfdc |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 952 | |
| 953 | } // namespace tests |
Junxiao Shi | 331ade7 | 2016-08-19 14:07:19 +0000 | [diff] [blame] | 954 | } // namespace nfdc |
Junxiao Shi | 38f4ce9 | 2016-08-04 10:01:52 +0000 | [diff] [blame] | 955 | } // namespace tools |
| 956 | } // namespace nfd |