Commit 265d1dab authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3088] Added DNS request construction to d2::NameRemoveTransaction

Added methods for constructing all three types of DNS update requests
required by d2::NameRemoveTransaction to complete the implementation of its
state machine.  Also refactored some unit test code into nc_test_utils.h
and .cc. Renamed request verification functions in nc_test_utils to match
the build request function names.
parent dc1071d7
......@@ -325,19 +325,19 @@ message but the attempt to send it suffered a unexpected error. This is most
likely a programmatic error, rather than a communications issue. Some or all
of the DNS updates requested as part of this request did not succeed.
% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE A DNS udpate message to add a forward DNS entry could not be constructed for this request: %1, reason: %2
% DHCP_DDNS_FORWARD_ADD_BUILD_FAILURE DNS udpate message to add a forward DNS entry could not be constructed for this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address addition. This is due
to invalid data contained in the NameChangeRequest. The request will be aborted.
This is most likely a configuration issue.
% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE A DNS update message to replace a foward DNS entry could not be constructed from this request: %1, reason: %2
% DHCP_DDNS_FORWARD_REPLACE_BUILD_FAILURE DNS update message to replace a foward DNS entry could not be constructed from this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
aborted. This is most likely a configuration issue.
% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE A DNS update message to replace a reverse DNS entry could not be constructed from this request: %1, reason: %2
% DHCP_DDNS_REVERSE_REPLACE_BUILD_FAILURE DNS update message to replace a reverse DNS entry could not be constructed from this request: %1, reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a reverse PTR replacement. This is
due to invalid data contained in the NameChangeRequest. The request will be
......@@ -352,7 +352,7 @@ This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
entry additions have failed. The precise reason for the failure should be
documented in preceding log entries.
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE A DNS udpate message to remove a forward DNS Address entry could not be constructed for this request: %1 reason: %2
% DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE DNS udpate message to remove a forward DNS Address entry could not be constructed for this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a forward address (A or AAAA) removal. This
is due to invalid data contained in the NameChangeRequest. The request will be
......@@ -378,7 +378,7 @@ This is an error message issued when DNSClient returns an unrecognized status
while DHCP_DDNS was removing a forward address mapping. The request will be
aborted. This is most likely a programmatic issue and should be reported.
% DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE A DNS udpate message to remove forward DNS RR entries could not be constructed for this request: %1 reason: %2
% DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE DNS udpate message to remove forward DNS RR entries could not be constructed for this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting forward RR (DHCID RR) removal. This is due
to invalid data contained in the NameChangeRequest. The request will be aborted.This is most likely a configuration issue.
......@@ -403,7 +403,7 @@ This is an error message issued when DNSClient returns an unrecognized status
while DHCP_DDNS was removing forward RRs. The request will be aborted. This is
most likely a programmatic issue and should be reported.
% DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE A DNS update message to remove a reverse DNS entry could not be constructed from this request: %1 reason: %2
% DHCP_DDNS_REVERSE_REMOVE_BUILD_FAILURE DNS update message to remove a reverse DNS entry could not be constructed from this request: %1 reason: %2
This is an error message issued when an error occurs attempting to construct
the server bound packet requesting a reverse PTR removal. This is
due to invalid data contained in the NameChangeRequest. The request will be
......
......@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <d2/d2_log.h>
#include <d2/d2_cfg_mgr.h>
#include <d2/nc_remove.h>
#include <boost/function.hpp>
......@@ -28,7 +29,7 @@ const int NameRemoveTransaction::REMOVING_FWD_RRS_ST;
const int NameRemoveTransaction::REMOVING_REV_PTRS_ST;
// NameRemoveTransaction events
// @todo none so far
// Currently NameRemoveTransaction does not define any events.
NameRemoveTransaction::
NameRemoveTransaction(IOServicePtr& io_service,
......@@ -51,7 +52,7 @@ NameRemoveTransaction::defineEvents() {
NameChangeTransaction::defineEvents();
// Define NameRemoveTransaction events.
// @todo none so far
// Currently NameRemoveTransaction does not define any events.
// defineEvent(TBD_EVENT, "TBD_EVT");
}
......@@ -61,7 +62,7 @@ NameRemoveTransaction::verifyEvents() {
NameChangeTransaction::verifyEvents();
// Verify NameRemoveTransaction events.
// @todo none so far
// Currently NameRemoveTransaction does not define any events.
// getEvent(TBD_EVENT);
}
......@@ -181,7 +182,7 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
// While unlikely, the build might fail if we have invalid
// data. Should that be the case, we need to fail the
// transaction.
LOG_ERROR(dctl_logger,
LOG_ERROR(dctl_logger,
DHCP_DDNS_FORWARD_REMOVE_ADDRS_BUILD_FAILURE)
.arg(getNcr()->toText())
.arg(ex.what());
......@@ -245,7 +246,7 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
default:
// Any other value and we will fail this transaction, something
// bigger is wrong.
LOG_ERROR(dctl_logger,
LOG_ERROR(dctl_logger,
DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS)
.arg(getDnsUpdateStatus())
.arg(getNcr()->getFqdn())
......@@ -285,7 +286,7 @@ NameRemoveTransaction::removingFwdRRsHandler() {
// While unlikely, the build might fail if we have invalid
// data. Should that be the case, we need to fail the
// transaction.
LOG_ERROR(dctl_logger,
LOG_ERROR(dctl_logger,
DHCP_DDNS_FORWARD_REMOVE_RRS_BUILD_FAILURE)
.arg(getNcr()->toText())
.arg(ex.what());
......@@ -307,8 +308,8 @@ NameRemoveTransaction::removingFwdRRsHandler() {
// @todo Not sure if NXDOMAIN is ok here, but I think so.
// A Rcode of NXDOMAIN would mean there are no RRs for the FQDN,
// which is fine. We were asked to delete them, they are not there
// so all is well.
if ((rcode == dns::Rcode::NOERROR()) ||
// so all is well.
if ((rcode == dns::Rcode::NOERROR()) ||
(rcode == dns::Rcode::NXDOMAIN())) {
// We were able to remove the forward mapping. Mark it as done.
setForwardChangeCompleted(true);
......@@ -344,13 +345,13 @@ NameRemoveTransaction::removingFwdRRsHandler() {
.arg(getNcr()->getFqdn())
.arg(getCurrentServer()->getIpAddress());
// @note If we exhaust the IO retries for the current server
// due to IO failures, we will abort the remaining updates.
// The rational is that we are only in this state, if the remove
// of the forward address RR succeeded (removingFwdAddrsHandler)
// @note If we exhaust the IO retries for the current server
// due to IO failures, we will abort the remaining updates.
// The rational is that we are only in this state, if the remove
// of the forward address RR succeeded (removingFwdAddrsHandler)
// on the current server. Therefore we should not attempt another
// removal on a different server. This is perhaps a point
// for discussion.
// for discussion.
// @todo Should we go ahead with the reverse remove?
retryTransition(PROCESS_TRANS_FAILED_ST);
break;
......@@ -544,7 +545,6 @@ NameRemoveTransaction::processRemoveOkHandler() {
}
}
void
NameRemoveTransaction::processRemoveFailedHandler() {
switch(getNextEvent()) {
......@@ -567,36 +567,28 @@ NameRemoveTransaction::buildRemoveFwdAddressRequest() {
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getForwardDomain());
#if 0
// Content on this request is based on RFC 4703, section 5.5, paragraph 4.
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// First build the Prerequisite Section
// First build the Prerequisite Section.
// Create 'FQDN Is Not In Use' prerequisite (RFC 2136, section 2.4.5)
// Add the RR to prerequisite section.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::NONE(),
dns::RRType::ANY(), dns::RRTTL(0)));
// Create an DHCID matches prerequisite RR and add it to the
// pre-requisite section
// Based on RFC 2136, section 2.4.2.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(prereq);
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Next build the Update Section.
// Next build the Update Section
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Create the FQDN/IP 'delete' RR and add it to the update section.
// Add the RR to update section.
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::IN(),
// Based on 2136 section 2.5.4
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::NONE(),
getAddressRRType(), dns::RRTTL(0)));
addLeaseAddressRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Now create the FQDN/DHCID 'add' RR per RFC 4701)
// Set the message RData to DHCID.
// Add the RR to update section.
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
#endif
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
......@@ -607,43 +599,44 @@ NameRemoveTransaction::buildRemoveFwdRRsRequest() {
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getForwardDomain());
#if 0
// Construct dns::Name from NCR fqdn.
dns::Name fqdn(dns::Name(getNcr()->getFqdn()));
// Content on this request is based on RFC 4703, section 5.5, paragraph 5.
// First build the Prerequisite Section.
// Create an 'FQDN Is In Use' prerequisite (RFC 2136, section 2.4.4)
// Add it to the pre-requisite section.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::ANY(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Now create an DHCID matches prerequisite RR.
// Set the RR's RData to DHCID.
// Add it to the pre-requisite section.
prereq.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
// Based on RFC 2136, section 2.4.2.
dns::RRsetPtr prereq(new dns::RRset(fqdn, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(prereq);
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Create an assertion that there are no A RRs for the FQDN.
// Add it to the pre-reqs.
// Based on RFC 2136, section 2.4.3.
prereq.reset(new dns::RRset(fqdn, dns::RRClass::NONE(),
dns::RRType::A(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Create an assertion that there are no A RRs for the FQDN.
// Add it to the pre-reqs.
// Based on RFC 2136, section 2.4.3.
prereq.reset(new dns::RRset(fqdn, dns::RRClass::NONE(),
dns::RRType::AAAA(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Next build the Update Section.
// Create the FQDN/IP 'delete' RR (RFC 2136, section 2.5.1)
// Create the 'delete' of all RRs for FQDN.
// Set the message RData to lease address.
// Add the RR to update section.
// Based on RFC 2136, section 2.5.3.
dns::RRsetPtr update(new dns::RRset(fqdn, dns::RRClass::ANY(),
getAddressRRType(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the FQDN/IP 'add' RR (RFC 2136, section 2.5.1)
// Set the message RData to lease address.
// Add the RR to update section.
update.reset(new dns::RRset(fqdn, dns::RRClass::IN(),
getAddressRRType(), dns::RRTTL(0)));
addLeaseAddressRdata(update);
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
#endif
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
......@@ -654,38 +647,30 @@ NameRemoveTransaction::buildRemoveRevPtrsRequest() {
// Construct an empty request.
D2UpdateMessagePtr request = prepNewRequest(getReverseDomain());
#if 0
// Create the reverse IP address "FQDN".
std::string rev_addr = D2CfgMgr::reverseIpAddress(getNcr()->getIpAddress());
dns::Name rev_ip(rev_addr);
// Reverse replacement has no prerequisites so straight on to
// building the Update section.
// Create the PTR 'delete' RR and add it to update section.
dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
dns::RRType::PTR(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Create the DHCID 'delete' RR and add it to the update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::ANY(),
dns::RRType::DHCID(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Content on this request is based on RFC 4703, section 5.5, paragraph 2.
// First build the Prerequisite Section.
// (Note that per RFC 4703, section 5.4, there is no need to validate
// DHCID RR for PTR entries.)
// Create an assertion that the PTRDNAME in the PTR record matches the
// client's FQDN for the address that was released.
// Based on RFC 2136, section 3.2.3
dns::RRsetPtr prereq(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::PTR(), dns::RRTTL(0)));
addPtrRdata(prereq);
request->addRRset(D2UpdateMessage::SECTION_PREREQUISITE, prereq);
// Create the FQDN/IP PTR 'add' RR, add the FQDN as the PTR Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::PTR(), dns::RRTTL(0)));
addPtrRdata(update);
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
// Now, build the Update section.
// Create the FQDN/IP PTR 'add' RR, add the DHCID Rdata
// then add it to update section.
update.reset(new dns::RRset(rev_ip, dns::RRClass::IN(),
dns::RRType::DHCID(), dns::RRTTL(0)));
addDhcidRdata(update);
// Create a delete of any RRs for the FQDN and add it to update section.
// Based on RFC 2136, section 3.4.2.3
dns::RRsetPtr update(new dns::RRset(rev_ip, dns::RRClass::ANY(),
dns::RRType::ANY(), dns::RRTTL(0)));
request->addRRset(D2UpdateMessage::SECTION_UPDATE, update);
#endif
// Set the transaction's update request to the new request.
setDnsUpdateRequest(request);
......
......@@ -284,7 +284,7 @@ protected:
/// failures, we will abort the remaining updates. The rational is that
/// we are only in this state, if the remove of the forward address RR
/// succeeded (removingFwdAddrsHandler) on the current server so we should
/// not attempt another removal on a different server. This is perhaps a
/// not attempt another removal on a different server. This is perhaps a
/// point for discussion. @todo Should we go ahead with the reverse remove?
///
/// @throw NameRemoveTransactionError if upon entry next event is not:
......@@ -369,25 +369,58 @@ protected:
/// UPDATE_FAILED_EVT
void processRemoveFailedHandler();
/// @brief Builds a DNS request to add an forward DNS entry for an FQDN
/// @brief Builds a DNS request to remove a forward DNS address for a FQDN.
///
/// @todo - Method not implemented yet
/// Constructs a DNS update request, based upon the NCR, for removing a
/// forward DNS address mapping. Once constructed, the request is stored as
/// the transaction's DNS update request.
///
/// @throw isc::NotImplemented
/// The request content is adherent to RFC 4703 section 5.5, paragraph 4.
///
/// Prerequisite RRsets:
/// 1. An assertion that a matching DHCID RR exists
///
/// Updates RRsets:
/// 1. A delete of the FQDN/IP RR (type A for IPv4, AAAA for IPv6)
///
/// @throw This method does not throw but underlying methods may.
void buildRemoveFwdAddressRequest();
/// @brief Builds a DNS request to replace forward DNS entry for an FQDN
/// @brief Builds a DNS request to remove all forward DNS RRs for a FQDN.
///
/// Constructs a DNS update request, based upon the NCR, for removing any
/// remaining forward DNS RRs, once all A or AAAA entries for the FQDN
/// have been removed. Once constructed, the request is stored as the
/// transaction's DNS update request.
///
/// The request content is adherent to RFC 4703 section 5.5, paragraph 5.
///
/// @todo - Method not implemented yet
/// Prerequisite RRsets:
/// 1. An assertion that a matching DHCID RR exists
/// 2. An assertion that no A RRs for the FQDN exist
/// 3. An assertion that no AAAA RRs for the FQDN exist
///
/// @throw isc::NotImplemented
/// Updates RRsets:
/// 1. A delete of all RRs for the FQDN
///
/// @throw This method does not throw but underlying methods may.
void buildRemoveFwdRRsRequest();
/// @brief Builds a DNS request to replace a reverse DNS entry for an FQDN
/// @brief Builds a DNS request to remove a reverse DNS entry for a FQDN
///
/// Constructs a DNS update request, based upon the NCR, for removing a
/// reverse DNS mapping. Once constructed, the request is stored as
/// the transaction's DNS update request.
///
/// The request content is adherent to RFC 4703 section 5.5, paragraph 2:
///
/// Prerequisite RRsets:
/// 1. An assertion that a PTR record matching the client's FQDN exists.
///
/// @todo - Method not implemented yet
/// Updates RRsets:
/// 1. A delete of all RRs for the FQDN
///
/// @throw isc::NotImplemented
/// @throw This method does not throw but underlying methods may.
void buildRemoveRevPtrsRequest();
};
......
......@@ -14,6 +14,7 @@
#include <d2/d2_log.h>
#include <d2/nc_trans.h>
#include <dns/rdata.h>
namespace isc {
namespace d2 {
......@@ -262,17 +263,19 @@ NameChangeTransaction::addLeaseAddressRdata(dns::RRsetPtr& rrset) {
try {
// Manufacture an RData from the lease address then add it to the RR.
dns::rdata::ConstRdataPtr rdata;
if (ncr_->isV4()) {
dns::rdata::in::A a_rdata(ncr_->getIpAddress());
rrset->addRdata(a_rdata);
rdata.reset(new dns::rdata::in::A(ncr_->getIpAddress()));
rrset->addRdata(rdata);
} else {
dns::rdata::in::AAAA rdata(ncr_->getIpAddress());
rdata.reset(new dns::rdata::in::AAAA(ncr_->getIpAddress()));
rrset->addRdata(rdata);
}
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add address rdata: "
<< ex.what());
}
}
void
......@@ -283,14 +286,16 @@ NameChangeTransaction::addDhcidRdata(dns::RRsetPtr& rrset) {
}
try {
dns::rdata::ConstRdataPtr rdata;
const std::vector<uint8_t>& ncr_dhcid = ncr_->getDhcid().getBytes();
util::InputBuffer buffer(ncr_dhcid.data(), ncr_dhcid.size());
dns::rdata::in::DHCID rdata(buffer, ncr_dhcid.size());
rdata.reset(new dns::rdata::in::DHCID(buffer, ncr_dhcid.size()));
rrset->addRdata(rdata);
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add DCHID rdata: "
<< ex.what());
}
}
void
......@@ -301,7 +306,8 @@ NameChangeTransaction::addPtrRdata(dns::RRsetPtr& rrset) {
}
try {
dns::rdata::generic::PTR rdata(getNcr()->getFqdn());
dns::rdata::ConstRdataPtr rdata;
rdata.reset(new dns::rdata::generic::PTR(getNcr()->getFqdn()));
rrset->addRdata(rdata);
} catch (const std::exception& ex) {
isc_throw(NameChangeTransactionError, "Cannot add PTR rdata: "
......@@ -412,7 +418,7 @@ NameChangeTransaction::getUpdateAttempts() const {
const dns::RRType&
NameChangeTransaction::getAddressRRType() const {
return (ncr_->isV4() ? dns::RRType::A(): dns::RRType::AAAA());
return (ncr_->isV4() ? dns::RRType::A() : dns::RRType::AAAA());
}
} // namespace isc::d2
......
......@@ -407,14 +407,14 @@ TEST_F(NameAddTransactionTest, buildForwardAdd) {
NameAddStubPtr name_add;
ASSERT_NO_THROW(name_add = makeTransaction4());
ASSERT_NO_THROW(name_add->buildAddFwdAddressRequest());
checkForwardAddRequest(*name_add);
checkAddFwdAddressRequest(*name_add);
// Create a IPv6 forward add transaction.
// Verify the request builds without error.
// and then verify the request contents.
ASSERT_NO_THROW(name_add = makeTransaction6());
ASSERT_NO_THROW(name_add->buildAddFwdAddressRequest());
checkForwardAddRequest(*name_add);
checkAddFwdAddressRequest(*name_add);
}
/// @brief Tests construction of a DNS update request for replacing a forward
......@@ -426,14 +426,14 @@ TEST_F(NameAddTransactionTest, buildReplaceFwdAddressRequest) {
NameAddStubPtr name_add;
ASSERT_NO_THROW(name_add = makeTransaction4());
ASSERT_NO_THROW(name_add->buildReplaceFwdAddressRequest());
checkForwardReplaceRequest(*name_add);
checkReplaceFwdAddressRequest(*name_add);
// Create a IPv6 forward replace transaction.
// Verify the request builds without error.
// and then verify the request contents.
ASSERT_NO_THROW(name_add = makeTransaction6());
ASSERT_NO_THROW(name_add->buildReplaceFwdAddressRequest());
checkForwardReplaceRequest(*name_add);
checkReplaceFwdAddressRequest(*name_add);
}
/// @brief Tests the construction of a DNS update request for replacing a
......@@ -445,14 +445,14 @@ TEST_F(NameAddTransactionTest, buildReplaceRevPtrsRequest) {
NameAddStubPtr name_add;
ASSERT_NO_THROW(name_add = makeTransaction4());
ASSERT_NO_THROW(name_add->buildReplaceRevPtrsRequest());
checkReverseReplaceRequest(*name_add);
checkReplaceRevPtrsRequest(*name_add);
// Create a IPv6 reverse replace transaction.
// Verify the request builds without error.
// and then verify the request contents.
ASSERT_NO_THROW(name_add = makeTransaction6());
ASSERT_NO_THROW(name_add->buildReplaceRevPtrsRequest());
checkReverseReplaceRequest(*name_add);
checkReplaceRevPtrsRequest(*name_add);
}
// Tests the readyHandler functionality.
......@@ -632,7 +632,7 @@ TEST_F(NameAddTransactionTest, addingFwdAddrsHandler_FwdOnlyAddOK) {
EXPECT_NO_THROW(name_add->addingFwdAddrsHandler());
// Verify that an update message was constructed properly.
checkForwardAddRequest(*name_add);
checkAddFwdAddressRequest(*name_add);
// Verify that we are still in this state and next event is NOP_EVT.
// This indicates we "sent" the message and are waiting for IO completion.
......@@ -943,7 +943,7 @@ TEST_F(NameAddTransactionTest, replacingFwdAddrsHandler_FwdOnlyAddOK) {
EXPECT_NO_THROW(name_add->replacingFwdAddrsHandler());
// Verify that an update message was constructed properly.
checkForwardReplaceRequest(*name_add);
checkReplaceFwdAddressRequest(*name_add);
// Verify that we are still in this state and next event is NOP_EVT.
// This indicates we "sent" the message and are waiting for IO completion.
......@@ -1366,7 +1366,7 @@ TEST_F(NameAddTransactionTest, replacingRevPtrsHandler_FwdOnlyAddOK) {
EXPECT_NO_THROW(name_add->replacingRevPtrsHandler());
// Verify that an update message was constructed properly.
checkReverseReplaceRequest(*name_add);
checkReplaceRevPtrsRequest(*name_add);
// Verify that we are still in this state and next event is NOP_EVT.
// This indicates we "sent" the message and are waiting for IO completion.
......
......@@ -36,7 +36,7 @@ public:
dhcp_ddns::NameChangeRequestPtr& ncr,
DdnsDomainPtr& forward_domain,
DdnsDomainPtr& reverse_domain)
: NameRemoveTransaction(io_service, ncr, forward_domain,
: NameRemoveTransaction(io_service, ncr, forward_domain,
reverse_domain),
simulate_send_exception_(false),
simulate_build_request_exception_(false) {
......@@ -245,10 +245,10 @@ public:
/// @param event value to post as the next event
/// @param change_mask determines which change directions are requested
/// @param family selects between an IPv4 (AF_INET) and IPv6 (AF_INET6)
/// transaction.
/// transaction.
NameRemoveStubPtr prepHandlerTest(unsigned int state, unsigned int event,
unsigned int change_mask
= FWD_AND_REV_CHG,
unsigned int change_mask
= FWD_AND_REV_CHG,
short family = AF_INET) {
NameRemoveStubPtr name_remove = (family == AF_INET ?
makeTransaction4(change_mask) :
......@@ -319,65 +319,64 @@ TEST_F(NameRemoveTransactionTest, dictionaryCheck) {
ASSERT_NO_THROW(name_remove->verifyStates());
}
#if 0
/// @brief Tests construction of a DNS update request for adding a forward
/// dns entry.
TEST_F(NameRemoveTransactionTest, buildForwardAdd) {
/// @brief Tests construction of a DNS update request for removing forward
/// DNS address RRs.
TEST_F(NameRemoveTransactionTest, buildRemoveFwdAddressRequest) {
// Create a IPv4 forward add transaction.
// Verify the request builds without error.
// and then verify the request contents.
NameRemoveStubPtr name_remove;
ASSERT_NO_THROW(name_remove = makeTransaction4());
ASSERT_NO_THROW(name_remove->buildAddFwdAddressRequest());
checkForwardAddRequest(*name_remove);
ASSERT_NO_THROW(name_remove = makeTransaction4(FORWARD_CHG));
(name_remove->buildRemoveFwdAddressRequest());
ASSERT_NO_THROW(name_remove->buildRemoveFwdAddressRequest());
checkRemoveFwdAddressRequest(*name_remove);
// Create a IPv6 forward add transaction.
// Verify the request builds without error.
// and then verify the request contents.
ASSERT_NO_THROW(name_remove = makeTransaction6());
ASSERT_NO_THROW(name_remove->buildAddFwdAddressRequest());
checkForwardAddRequest(*name_remove);
ASSERT_NO_THROW(name_remove = makeTransaction6(FORWARD_CHG));
ASSERT_NO_THROW(name_remove->buildRemoveFwdAddressRequest());
checkRemoveFwdAddressRequest(*name_remove);
}
/// @brief Tests construction of a DNS update request for replacing a forward
/// dns entry.
TEST_F(NameRemoveTransactionTest, buildReplaceFwdAddressRequest) {
/// @brief Tests construction of a DNS update request for removing forward
/// dns RR entries.
TEST_F(NameRemoveTransactionTest, buildRemoveFwdRRsRequest) {
// Create a IPv4 forward replace transaction.
// Verify the request builds without error.
// and then verify the request contents.
NameRemoveStubPtr name_remove;
ASSERT_NO_THROW(name_remove = makeTransaction4());
ASSERT_NO_THROW(name_remove->buildReplaceFwdAddressRequest());
checkForwardReplaceRequest(*name_remove);
ASSERT_NO_THROW(name_remove = makeTransaction4(FORWARD_CHG));
ASSERT_NO_THROW(name_remove->buildRemoveFwdRRsRequest());
checkRemoveFwdRRsRequest(*name_remove);
// Create a IPv6 forward replace transaction.
// Verify the request builds without error.
// and then verify the request contents.
ASSERT_NO_THROW(name_remove = makeTransaction6());
ASSERT_NO_THROW(name_remove->buildReplaceFwdAddressRequest());
checkForwardReplaceRequest(*name_remove);
ASSERT_NO_THROW(name_remove = makeTransaction6(FORWARD_CHG));
ASSERT_NO_THROW(name_remove->buildRemoveFwdRRsRequest());
checkRemoveFwdRRsRequest(*name_remove);
}
/// @brief Tests the construction of a DNS update request for replacing a
/// @brief Tests the construction of a DNS update request for removing a
/// reverse dns entry.
TEST_F(NameRemoveTransactionTest, buildReplaceRevPtrsRequest) {
TEST_F(NameRemoveTransactionTest, buildRemoveRevPtrsRequest) {
// Create a IPv4 reverse replace transaction.
// Verify the request builds without error.
// and then verify the request contents.
NameRemoveStubPtr name_remove;