EXPECT_FALSE(sol2->inClass("docsis3.0"));
}
+// This test checks that the server will handle a Solicit with the Vendor Class
+// having a length of 4 (enterprise-id only).
+TEST_F(Dhcpv6SrvTest, cableLabsShortVendorClass) {
+ NakedDhcpv6Srv srv(0);
+
+ // Create a simple Solicit with the 4-byte long vendor class option.
+ Pkt6Ptr sol = captureCableLabsShortVendorClass();
+
+ // Simulate that we have received that traffic
+ srv.fakeReceive(sol);
+
+ // Server will now process to run its normal loop, but instead of calling
+ // IfaceMgr::receive6(), it will read all packets from the list set by
+ // fakeReceive()
+ srv.run();
+
+ // Get Advertise...
+ ASSERT_FALSE(srv.fake_sent_.empty());
+ Pkt6Ptr adv = srv.fake_sent_.front();
+ ASSERT_TRUE(adv);
+
+ // This is sent back to relay, so port is 547
+ EXPECT_EQ(DHCP6_SERVER_PORT, adv->getRemotePort());
+
+}
/// @todo: Add more negative tests for processX(), e.g. extend sanityCheck() test
/// to call processX() methods.
Pkt6Ptr captureRelayedSolicit();
Pkt6Ptr captureDocsisRelayedSolicit();
Pkt6Ptr captureeRouterRelayedSolicit();
+ Pkt6Ptr captureCableLabsShortVendorClass();
/// @brief Auxiliary method that sets Pkt6 fields
///
return (pkt);
}
+Pkt6Ptr isc::test::Dhcpv6SrvTest::captureCableLabsShortVendorClass() {
+ // This is a simple non-relayed Solicit:
+ // - client-identifier
+ // - IA_NA
+ // - Vendor Class (4 bytes)
+ // - enterprise-id 4491
+ // - Vendor-specific Information
+ // - enterprise-id 4491
+ std::string hex_string =
+ "01671cb90001000e0001000152ea903a08002758f1e80003000c00004bd10000000000"
+ "000000001000040000118b0011000a0000118b000100020020";
+
+ std::vector<uint8_t> bin;
+
+ // Decode the hex string and store it in bin (which happens
+ // to be OptionBuffer format)
+ isc::util::encode::decodeHex(hex_string, bin);
+
+ Pkt6Ptr pkt(new Pkt6(&bin[0], bin.size()));
+ captureSetDefaultFields(pkt);
+ return (pkt);
+
+}
+
}; // end of isc::test namespace
}; // end of isc namespace