tests: test IP transports under various combos of address family/scope
In particular, link-local addresses are now tested as well.
Additionally, WebSocketTransport send/receive tests are extended
to check transport counters.
Change-Id: I5b35f498a5d8d70cb1f7a2bea3ce99d22370e050
Refs: #1428
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index ce4d17e..36ccba4 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -27,7 +27,6 @@
#include "face-system-fixture.hpp"
#include "factory-test-common.hpp"
-#include "test-netif-ip.hpp"
#include <boost/algorithm/string/replace.hpp>
#include <boost/range/algorithm/count_if.hpp>
@@ -126,7 +125,8 @@
UdpMcastConfigFixture()
{
for (const auto& netif : collectNetworkInterfaces()) {
- if (netif->isUp() && netif->canMulticast() && hasAddressFamily<AddressFamily::V4>(*netif)) {
+ if (netif->isUp() && netif->canMulticast() &&
+ hasAddressFamily(*netif, ndn::net::AddressFamily::V4)) {
netifs.push_back(netif);
}
}
@@ -146,20 +146,29 @@
return this->listUdpMcastFaces(linkType).size();
}
+ /** \brief determine whether \p netif has at least one address of the given family
+ */
+ static bool
+ hasAddressFamily(const NetworkInterface& netif, ndn::net::AddressFamily af)
+ {
+ return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
+ [af] (const NetworkAddress& a) { return a.getFamily() == af; });
+ }
+
/** \brief determine whether a UDP multicast face is created on \p netif
*/
static bool
- isFaceOnNetif(const Face& face, const shared_ptr<const ndn::net::NetworkInterface>& netif)
+ isFaceOnNetif(const Face& face, const shared_ptr<const NetworkInterface>& netif)
{
auto ip = boost::asio::ip::address_v4::from_string(face.getLocalUri().getHost());
return std::any_of(netif->getNetworkAddresses().begin(), netif->getNetworkAddresses().end(),
- [ip] (const ndn::net::NetworkAddress& a) { return a.getIp() == ip; });
+ [ip] (const NetworkAddress& a) { return a.getIp() == ip; });
}
protected:
/** \brief MulticastUdpTransport-capable network interfaces
*/
- std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs;
+ std::vector<shared_ptr<const NetworkInterface>> netifs;
};
#define SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(n) \