Browse Source

[4321] Rename useNA and usePD to requestAddress and requestPrefix.

Marcin Siodelski 9 years ago
parent
commit
cb1c570297

+ 7 - 7
src/bin/dhcp6/tests/confirm_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -115,7 +115,7 @@ TEST_F(ConfirmTest, sanityCheck) {
 TEST_F(ConfirmTest, directClientSameIAID) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -157,7 +157,7 @@ TEST_F(ConfirmTest, directClientSameIAID) {
 TEST_F(ConfirmTest, directClientDifferentIAID) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -205,7 +205,7 @@ TEST_F(ConfirmTest, relayedClient) {
     // Client to send relayed message.
     client.useRelay();
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[1], 2, client));
     // Keep the client's lease for future reference.
@@ -265,7 +265,7 @@ TEST_F(ConfirmTest, relayedClientNoSubnet) {
     // Client to send relayed message.
     client.useRelay();
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[1], 2, client));
     // Now that the client has a lease, let's remove any subnets to check
@@ -305,7 +305,7 @@ TEST_F(ConfirmTest, relayedUnicast) {
     // Client to send relayed message.
     client.useRelay();
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[1], 2, client));
     // Make sure we have got the lease.
@@ -329,7 +329,7 @@ TEST_F(ConfirmTest, relayedUnicast) {
 TEST_F(ConfirmTest, unicast) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(CONFIRM_CONFIGS[0], 2, client));
     // Make sure the client has got the lease.

+ 2 - 2
src/bin/dhcp6/tests/decline_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -78,7 +78,7 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client,
     StatsMgr::instance().setValue("declined-addresses", static_cast<int64_t>(0));
 
     client.setDUID(duid1);
-    client.useNA(iaid1);
+    client.requestAddress(iaid1);
 
     // Configure the server with a configuration.
     ASSERT_NO_THROW(configure(DECLINE_CONFIGS[0], *client.getServer()));

+ 6 - 22
src/bin/dhcp6/tests/dhcp6_client.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -725,32 +725,16 @@ Dhcp6Client::sendMsg(const Pkt6Ptr& msg) {
     srv_->run();
 }
 
-/*void
-Dhcp6Client::useNA(const bool use, const uint32_t iaid) {
-    use_na_ = use;
-    client_ias_.push_back(ClientIA(Lease::TYPE_NA, iaid,
-                                   asiolink::IOAddress::IPV6_ZERO_ADDRESS(),
-                                   0));
-    na_iaid_ = iaid;
-} */
-
 void
-Dhcp6Client::useNA(const uint32_t iaid, const asiolink::IOAddress& address) {
+Dhcp6Client::requestAddress(const uint32_t iaid,
+                            const asiolink::IOAddress& address) {
     client_ias_.push_back(ClientIA(Lease::TYPE_NA, iaid, address, 128));
 }
 
-/*void
-Dhcp6Client::usePD(const bool use, const uint32_t iaid) {
-    use_pd_ = use;
-    client_ias_.push_back(ClientIA(Lease::TYPE_PD, iaid,
-                                   asiolink::IOAddress::IPV6_ZERO_ADDRESS(),
-                                   0));
-    pd_iaid_ = iaid;
-}*/
-
 void
-Dhcp6Client::usePD(const uint32_t iaid,const asiolink::IOAddress& prefix,
-                   const uint8_t prefix_len) {
+Dhcp6Client::requestPrefix(const uint32_t iaid,
+                           const uint8_t prefix_len,
+                           const asiolink::IOAddress& prefix) {
     client_ias_.push_back(ClientIA(Lease::TYPE_PD, iaid, prefix, prefix_len));
 }
 

+ 54 - 50
src/bin/dhcp6/tests/dhcp6_client.h

@@ -442,54 +442,59 @@ public:
         link_local_ = link_local;
     }
 
-    /// @brief Place IA_NA options to request address assignment.
-    ///
-    /// This function configures the client to place IA_NA options in its
-    /// Solicit messages to request the IPv6 address assignment.
-    ///
-    /// @param iaid IAID to be used in the IA_NA.
-/*    void useNA(const uint32_t iaid) {
-        useNA(true, iaid);
-    } */
-
-/*    /// @brief Place IA_NA options to request address assignment.
-    ///
-    /// This function configures the client to place IA_NA options in its
-    /// Solicit messages to request the IPv6 address assignment.
-    ///
-    /// @param use Parameter which 'true' value indicates that client should
-    /// request address assignment.
-    /// @param iaid IAID to be used in the IA_NA.
-    void useNA(const bool use = true, const uint32_t iaid = 1234); */
-
-    /// @brief Place IA_PD options to request address assignment.
-    ///
-    /// This function configures the client to place IA_NA options in its
-    /// Solicit messages to request the IPv6 address assignment.
-    ///
-    /// @param iaid IAID to be used in the IA_PD.
-/*    void usePD(const uint32_t iaid) {
-        usePD(true, iaid);
-    } */
-
-    /// @brief Place IA_PD options to request prefix assignment.
-    ///
-    /// This function configures the client to place IA_PD options in its
-    /// Solicit messages to request the IPv6 address assignment.
-    ///
-    /// @param use Parameter which 'true' value indicates that client should
-    /// request prefix assignment.
-    /// @param iaid IAID to be used in the IA_NA.
-//    void usePD(const bool use = true, const uint32_t iaid = 5678);
-
-    void useNA(const uint32_t iaid = 1234, const asiolink::IOAddress& address =
-               asiolink::IOAddress::IPV6_ZERO_ADDRESS());
-
-    void usePD(const uint32_t iaid = 5678, const asiolink::IOAddress& prefix =
-               asiolink::IOAddress::IPV6_ZERO_ADDRESS(),
-               const uint8_t prefix_len = 0);
-
-    /// @brief Removes requested IAs.
+    /// @brief Specifies address to be included in client's message.
+    ///
+    /// This method specifies IPv6 address to be included within IA_NA
+    /// option sent by the client. In order to specify multiple addresses
+    /// to be included in a particular IA_NA, this method must be called
+    /// multiple times to specify each address separately. In such case,
+    /// the value of the IAID should remain the same across all calls to
+    /// this method.
+    ///
+    /// This method is typically called to specify IA_NA options to be
+    /// sent to the server during 4-way handshakes and during lease
+    /// renewal to request allocation of new leases (as per RFC7550).
+    ///
+    /// @param iaid IAID.
+    /// @param address IPv6 address to be included in the IA_NA. It defaults
+    /// to IPv6 zero address, which indicates that no address should be
+    /// included in the IA_NA (empty IA_NA will be sent).
+    void requestAddress(const uint32_t iaid = 1234,
+                        const asiolink::IOAddress& address =
+                        asiolink::IOAddress::IPV6_ZERO_ADDRESS());
+
+    /// @brief Specifies IPv6 prefix to be included in client's message.
+    ///
+    /// This method specifies IPv6 prefix to be included within IA_PD
+    /// option sent by the client. In order to specify multiple prefixes
+    /// to be included in a particular IA_PD, this method must be called
+    /// multiple times to specify each prefix separately. In such case,
+    /// the value of the IAID should remain the same across all calls to
+    /// this method.
+    ///
+    /// This method is typically called to specify IA_PD options to be
+    /// sent to the server during 4-way handshakes and during lease
+    /// renewal to request allocation of new leases (as per RFC7550).
+    ///
+    /// @param iaid IAID.
+    /// @param prefix_len Prefix length.
+    /// @param prefix Prefix to be included. This value defaults to the
+    /// IPv6 zero address. If zero address is specified and prefix_len is
+    /// set to 0, the IA Prefix option will not be included in the IA_PD.
+    /// If the prefix_len is non-zero and the prefix is IPv6 zero address
+    /// the prefix length hint will be included in the IA Prefix option.
+    void requestPrefix(const uint32_t iaid = 5678,
+                       const uint8_t prefix_len = 0,
+                       const asiolink::IOAddress& prefix =
+                       asiolink::IOAddress::IPV6_ZERO_ADDRESS());
+
+    /// @brief Removes IAs specified with @ref includeAddress and
+    /// @ref includePrefix methods.
+    ///
+    /// If this method is called and the client initiates an exchange with
+    /// a server the client will only include IAs for which it has leases.
+    /// If the client has no leases (e.g. a Solicit case), no IAs will be
+    /// included in the client's message.
     void clearRequestedIAs() {
         client_ias_.clear();
     }
@@ -629,8 +634,7 @@ private:
 
     /// @brief Includes IAs to be requested.
     ///
-    /// This method checks if @c use_na_ and/or @c use_pd_ are specified and
-    /// includes appropriate IA types, if they are not already included.
+    /// This method includes IAs explicitly requested using 
     ///
     /// @param query Pointer to the client's message to which IAs should be
     /// added.

+ 7 - 7
src/bin/dhcp6/tests/host_unittest.cc

@@ -142,7 +142,7 @@ public:
 
         // Configure client to request IA_NA and append IA_NA option
         //  to the client's message.
-        client.useNA(1234, IOAddress("2001:db8:1:1::dead:beef"));
+        client.requestAddress(1234, IOAddress("2001:db8:1:1::dead:beef"));
 
         // Perform 4-way exchange.
         ASSERT_NO_THROW(client.doSARR());
@@ -181,7 +181,7 @@ TEST_F(HostTest, basicSarrs) {
     // Configure client to request IA_NA and aAppend IA_NA option
     //  to the client's message.
     client.setDUID("01:02:03:04");
-    client.useNA(1234, IOAddress("2001:db8:1:1::dead:beef"));
+    client.requestAddress(1234, IOAddress("2001:db8:1:1::dead:beef"));
 
     // Perform 4-way exchange.
     ASSERT_NO_THROW(client.doSARR());
@@ -220,7 +220,7 @@ TEST_F(HostTest, basicSarrs) {
     client.clearConfig();
     client.modifyDUID();
     client.clearRequestedIAs();
-    client.useNA(1234);
+    client.requestAddress(1234);
 
     // Perform 4-way exchange.
     ASSERT_NO_THROW(client.doSARR());
@@ -245,7 +245,7 @@ TEST_F(HostTest, sarrAndRenew) {
     configure(CONFIGS[0], *client.getServer());
 
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
 
     const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->
         getCfgSubnets6()->getAll();
@@ -254,7 +254,7 @@ TEST_F(HostTest, sarrAndRenew) {
     // Configure client to request IA_NA and aAppend IA_NA option
     //  to the client's message.
     client.setDUID("01:02:03:04");
-    client.useNA(1234, IOAddress("2001:db8:1:1::dead:beef"));
+    client.requestAddress(1234, IOAddress("2001:db8:1:1::dead:beef"));
 
     // Perform 4-way exchange.
     ASSERT_NO_THROW(client.doSARR());
@@ -297,7 +297,7 @@ TEST_F(HostTest, sarrAndRebind) {
     configure(CONFIGS[0], *client.getServer());
 
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
 
     const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->
         getCfgSubnets6()->getAll();
@@ -306,7 +306,7 @@ TEST_F(HostTest, sarrAndRebind) {
     // Configure client to request IA_NA and aAppend IA_NA option
     //  to the client's message.
     client.setDUID("01:02:03:04");
-    client.useNA(1234, IOAddress("2001:db8:1:1::dead:beef"));
+    client.requestAddress(1234, IOAddress("2001:db8:1:1::dead:beef"));
 
     // Perform 4-way exchange.
     ASSERT_NO_THROW(client.doSARR());

+ 23 - 23
src/bin/dhcp6/tests/rebind_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -259,7 +259,7 @@ TEST_F(RebindTest, sanityCheck) {
 TEST_F(RebindTest, directClient) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -288,7 +288,7 @@ TEST_F(RebindTest, directClient) {
 TEST_F(RebindTest, directClientChangingSubnet) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -325,7 +325,7 @@ TEST_F(RebindTest, directClientChangingSubnet) {
 TEST_F(RebindTest, directClientChangingIAID) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -334,7 +334,7 @@ TEST_F(RebindTest, directClientChangingIAID) {
     // one to IAID we guarantee that the IAID will change.
     client.clearRequestedIAs();
     client.config_.leases_[0].iaid_ = 1235;
-    client.useNA(1235);
+    client.requestAddress(1235);
 
     // Try to Rebind. The server should allocate new lease for this IAID.
     ASSERT_NO_THROW(client.doRebind());
@@ -359,7 +359,7 @@ TEST_F(RebindTest, directClientChangingIAID) {
 TEST_F(RebindTest, directClientLostLease) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -384,7 +384,7 @@ TEST_F(RebindTest, directClientLostLease) {
 TEST_F(RebindTest, relayedClient) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Configure DHCPv6 client to simulate sending the message through a relay
     // agent. The default link-addr is 3001:1::1. This address should be used
     // by the server to pick the suitable subnet.
@@ -417,7 +417,7 @@ TEST_F(RebindTest, relayedClient) {
 TEST_F(RebindTest, relayedClientChangingSubnet) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Configure DHCPv6 client to simulate sending the message through a relay
     // agent. The default link-addr is 3001:1::1. This address should be used
     // by the server to pick the suitable subnet.
@@ -448,7 +448,7 @@ TEST_F(RebindTest, relayedClientChangingSubnet) {
 TEST_F(RebindTest, relayedClientChangingIAID) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Configure DHCPv6 client to simulate sending the message through a relay
     // agent. The default link-addr is 3001:1::1. This address should be used
     // by the server to pick the suitable subnet.
@@ -462,7 +462,7 @@ TEST_F(RebindTest, relayedClientChangingIAID) {
     // one to IAID we guarantee that the IAID will change.
     client.clearRequestedIAs();
     client.config_.leases_[0].iaid_ = 1235;
-    client.useNA(1235);
+    client.requestAddress(1235);
 
     // Try to Rebind. The server should allocate new lease for this IAID.
     ASSERT_NO_THROW(client.doRebind());
@@ -487,7 +487,7 @@ TEST_F(RebindTest, relayedClientChangingIAID) {
 TEST_F(RebindTest, relayedClientLostLease) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Configure DHCPv6 client to simulate sending the message through a relay
     // agent. The default link-addr is 3001:1::1. This address should be used
     // by the server to pick the suitable subnet.
@@ -516,7 +516,7 @@ TEST_F(RebindTest, relayedClientLostLease) {
 TEST_F(RebindTest, relayedClientChangingAddress) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[2], 2, client));
     // Keep the client's lease for future reference.
@@ -572,7 +572,7 @@ TEST_F(RebindTest, relayedClientChangingAddress) {
 TEST_F(RebindTest, directClientPD) {
     Dhcp6Client client;
     // Configure client to request IA_PD.
-    client.usePD();
+    client.requestPrefix();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[4], 2, client));
     // Keep the client's lease for future reference.
@@ -599,7 +599,7 @@ TEST_F(RebindTest, directClientPD) {
 TEST_F(RebindTest, directClientPDChangingSubnet) {
     Dhcp6Client client;
     // Configure client to request IA_PD.
-    client.usePD();
+    client.requestPrefix();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[4], 2, client));
     // Keep the client's lease for future reference.
@@ -636,7 +636,7 @@ TEST_F(RebindTest, directClientPDChangingSubnet) {
 TEST_F(RebindTest, directClientPDChangingIAID) {
     Dhcp6Client client;
     // Configure client to request IA_PD.
-    client.usePD();
+    client.requestPrefix();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[4], 2, client));
     // Keep the client's lease for future reference.
@@ -646,7 +646,7 @@ TEST_F(RebindTest, directClientPDChangingIAID) {
     // one to IAID we guarantee that the IAID will change.
     client.clearRequestedIAs();
     client.config_.leases_[0].iaid_ = 5679;
-    client.usePD(5679);
+    client.requestPrefix(5679);
 
     // Try to Rebind. The server should allocate new lease for this IAID.
     ASSERT_NO_THROW(client.doRebind());
@@ -671,7 +671,7 @@ TEST_F(RebindTest, directClientPDChangingIAID) {
 TEST_F(RebindTest, directClientPDChangingPrefix) {
     Dhcp6Client client;
     // Configure client to request IA_PD.
-    client.usePD();
+    client.requestPrefix();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[4], 2, client));
     // Keep the client's lease for future reference.
@@ -727,7 +727,7 @@ TEST_F(RebindTest, directClientPDChangingPrefix) {
 TEST_F(RebindTest, unicast) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Make 4-way exchange to get the lease.
     ASSERT_NO_FATAL_FAILURE(requestLease(REBIND_CONFIGS[0], 2, client));
     // Keep the client's lease for future reference.
@@ -756,7 +756,7 @@ TEST_F(RebindTest, unicast) {
 TEST_F(RebindTest, relayedUnicast) {
     Dhcp6Client client;
     // Configure client to request IA_NA.
-    client.useNA();
+    client.requestAddress();
     // Configure DHCPv6 client to simulate sending the message through a relay
     // agent. The default link-addr is 3001:1::1. This address should be used
     // by the server to pick the suitable subnet.
@@ -791,8 +791,8 @@ TEST_F(RebindTest, requestPrefixInRebind) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA();
-    client.usePD();
+    client.requestAddress();
+    client.requestPrefix();
 
     // Configure the server with NA pools only.
     ASSERT_NO_THROW(configure(REBIND_CONFIGS[0], *client.getServer()));
@@ -846,8 +846,8 @@ TEST_F(RebindTest, requestAddressInRebind) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA();
-    client.usePD();
+    client.requestAddress();
+    client.requestPrefix();
 
     // Configure the server with PD pools only.
     ASSERT_NO_THROW(configure(REBIND_CONFIGS[4], *client.getServer()));

+ 10 - 10
src/bin/dhcp6/tests/renew_unittest.cc

@@ -116,8 +116,8 @@ TEST_F(RenewTest, requestPrefixInRenew) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA(na_iaid_);
-    client.usePD(pd_iaid_);
+    client.requestAddress(na_iaid_);
+    client.requestPrefix(pd_iaid_);
 
     // Configure the server with NA pools only.
     ASSERT_NO_THROW(configure(RENEW_CONFIGS[0], *client.getServer()));
@@ -175,8 +175,8 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA(na_iaid_);
-    client.usePD(pd_iaid_);
+    client.requestAddress(na_iaid_);
+    client.requestPrefix(pd_iaid_);
 
     // Configure the server with NA pools only.
     ASSERT_NO_THROW(configure(RENEW_CONFIGS[0], *client.getServer()));
@@ -208,7 +208,7 @@ TEST_F(RenewTest, requestPrefixInRenewUseHint) {
     EXPECT_EQ(STATUS_Success, client.getStatusCode(na_iaid_));
 
     // Specify the hint used for IA_PD.
-    client.usePD(pd_iaid_, IOAddress::IPV6_ZERO_ADDRESS(), 64);
+    client.requestPrefix(pd_iaid_, 64, IOAddress::IPV6_ZERO_ADDRESS());
 
     // Send Renew message to the server, including IA_NA and requesting IA_PD.
     ASSERT_NO_THROW(client.doRenew());
@@ -248,8 +248,8 @@ TEST_F(RenewTest, requestAddressInRenew) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA(na_iaid_);
-    client.usePD(pd_iaid_);
+    client.requestAddress(na_iaid_);
+    client.requestPrefix(pd_iaid_);
 
     // Configure the server with PD pools only.
     ASSERT_NO_THROW(configure(RENEW_CONFIGS[1], *client.getServer()));
@@ -308,8 +308,8 @@ TEST_F(RenewTest, requestAddressInRenewHint) {
     Dhcp6Client client;
 
     // Configure client to request IA_NA and IA_PD.
-    client.useNA(na_iaid_);
-    client.usePD(pd_iaid_);
+    client.requestAddress(na_iaid_);
+    client.requestPrefix(pd_iaid_);
 
     // Configure the server with PD pools only.
     ASSERT_NO_THROW(configure(RENEW_CONFIGS[1], *client.getServer()));
@@ -331,7 +331,7 @@ TEST_F(RenewTest, requestAddressInRenewHint) {
     ASSERT_EQ(0, leases_client_na.size());
     ASSERT_EQ(STATUS_NoAddrsAvail, client.getStatusCode(na_iaid_));
 
-    client.useNA(na_iaid_, IOAddress("2001:db8:1::100"));
+    client.requestAddress(na_iaid_, IOAddress("2001:db8:1::100"));
 
     // Send Renew message to the server, including IA_PD and requesting IA_NA.
     // The server should return NoAddrsAvail status code in this case.

+ 11 - 12
src/bin/dhcp6/tests/sarr_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -123,15 +123,14 @@ public:
 TEST_F(SARRTest, directClientPrefixHint) {
     Dhcp6Client client;
     // Configure client to request IA_PD.
-    client.usePD();
+    client.requestPrefix();
     configure(CONFIGS[0], *client.getServer());
     // Make sure we ended-up having expected number of subnets configured.
     const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->
         getCfgSubnets6()->getAll();
     ASSERT_EQ(1, subnets->size());
     // Append IAPREFIX option to the client's message.
-    ASSERT_NO_THROW(client.usePD(5678, asiolink::IOAddress("2001:db8:3:33::33"),
-                                 64));
+    ASSERT_NO_THROW(client.requestPrefix(5678, 64, asiolink::IOAddress("2001:db8:3:33::33")));
     // Perform 4-way exchange.
     ASSERT_NO_THROW(client.doSARR());
     // Server should have assigned a prefix.
@@ -156,7 +155,7 @@ TEST_F(SARRTest, directClientPrefixHint) {
 
     // Use the hint with some least significant bytes set.
     client.clearRequestedIAs();
-    ASSERT_NO_THROW(client.usePD(5678, IOAddress("2001:db8:3:33::34"), 64));
+    ASSERT_NO_THROW(client.requestPrefix(5678, 64, IOAddress("2001:db8:3:33::34")));
     ASSERT_NO_THROW(client.doSARR());
     // Server should assign a lease.
     ASSERT_EQ(1, client.getLeaseNum());
@@ -179,7 +178,7 @@ TEST_F(SARRTest, directClientPrefixHint) {
 TEST_F(SARRTest, rapidCommitEnable) {
     Dhcp6Client client;
     // Configure client to request IA_NA
-    client.useNA();
+    client.requestAddress();
     configure(CONFIGS[1], *client.getServer());
     ASSERT_NO_THROW(client.getServer()->startD2());
     // Make sure we ended-up having expected number of subnets configured.
@@ -217,7 +216,7 @@ TEST_F(SARRTest, rapidCommitEnable) {
 TEST_F(SARRTest, rapidCommitNoOption) {
     Dhcp6Client client;
     // Configure client to request IA_NA
-    client.useNA();
+    client.requestAddress();
     configure(CONFIGS[1], *client.getServer());
     ASSERT_NO_THROW(client.getServer()->startD2());
     // Make sure we ended-up having expected number of subnets configured.
@@ -250,7 +249,7 @@ TEST_F(SARRTest, rapidCommitDisable) {
     // The subnet assigned to eth1 has Rapid Commit disabled.
     client.setInterface("eth1");
     // Configure client to request IA_NA
-    client.useNA();
+    client.requestAddress();
     configure(CONFIGS[1], *client.getServer());
     ASSERT_NO_THROW(client.getServer()->startD2());
     // Make sure we ended-up having expected number of subnets configured.
@@ -286,7 +285,7 @@ TEST_F(SARRTest, sarrStats) {
     Dhcp6Client client;
     configure(CONFIGS[1], *client.getServer());
     client.setInterface("eth1");
-    client.useNA();
+    client.requestAddress();
 
     // Make sure we ended-up having expected number of subnets configured.
     const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->
@@ -350,7 +349,7 @@ TEST_F(SARRTest, pkt6ReceiveDropStat1) {
     Dhcp6Client client;
     configure(CONFIGS[1], *client.getServer());
     client.setInterface("eth1");
-    client.useNA();
+    client.requestAddress();
 
     client.doSolicit();
     client.useServerId(bogus_srv_id);
@@ -375,7 +374,7 @@ TEST_F(SARRTest, pkt6ReceiveDropStat2) {
     Dhcp6Client client;
     configure(CONFIGS[1], *client.getServer());
     client.setInterface("eth1");
-    client.useNA();
+    client.requestAddress();
 
     client.setDestAddress(asiolink::IOAddress("2001:db8::1")); // Pretend it's unicast
     client.doSolicit();
@@ -400,7 +399,7 @@ TEST_F(SARRTest, pkt6ReceiveDropStat3) {
     Dhcp6Client client;
     configure(CONFIGS[1], *client.getServer());
     client.setInterface("eth1");
-    client.useNA();
+    client.requestAddress();
 
     // Let's send our client-id as server-id. That will result in the
     // packet containing the client-id twice. That should cause RFCViolation