From: Thomas Markwalder Date: Mon, 23 Nov 2015 18:22:56 +0000 (-0500) Subject: [4202] Replaced underscores with hypens in NCR JSON element names X-Git-Tag: trac4204fd_base~8^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=430fbc8832b1341699558f81406732bc549a78a3;p=thirdparty%2Fkea.git [4202] Replaced underscores with hypens in NCR JSON element names The NCR element names have also been changed to use hyphens. This touched quita a few unit tests. Files modified: src/bin/d2/tests/d2_process_unittests.cc src/bin/d2/tests/d2_queue_mgr_unittests.cc src/bin/d2/tests/d2_update_mgr_unittests.cc src/bin/d2/tests/nc_add_unittests.cc src/bin/d2/tests/nc_remove_unittests.cc src/bin/d2/tests/nc_test_utils.cc src/bin/d2/tests/nc_trans_unittests.cc src/bin/dhcp4/tests/d2_unittest.cc src/bin/dhcp6/tests/d2_unittest.cc src/lib/dhcp_ddns/libdhcp_ddns.dox src/lib/dhcp_ddns/ncr_msg.cc src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc src/lib/dhcp_ddns/tests/ncr_unittests.cc src/lib/dhcpsrv/tests/d2_udp_unittest.cc --- diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc index d0dac5d52f..139805fa09 100644 --- a/src/bin/d2/tests/d2_process_unittests.cc +++ b/src/bin/d2/tests/d2_process_unittests.cc @@ -274,14 +274,14 @@ TEST_F(D2ProcessTest, queueFullRecovery) { // Valid test message, contents are unimportant. const char* test_msg = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; // Start queue manager with known good config. @@ -515,14 +515,14 @@ TEST_F(D2ProcessTest, canShutdown) { const char* test_msg = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"fish.tmark.org\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; // Manually enqueue a request. This lets us test logic with queue diff --git a/src/bin/d2/tests/d2_queue_mgr_unittests.cc b/src/bin/d2/tests/d2_queue_mgr_unittests.cc index 5851d61082..397cb26693 100644 --- a/src/bin/d2/tests/d2_queue_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_queue_mgr_unittests.cc @@ -39,36 +39,36 @@ const char *valid_msgs[] = { // Valid Add. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Remove. "{" - " \"change_type\" : 1 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 1 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Add with IPv6 address "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " + " \"ip-address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}" }; diff --git a/src/bin/d2/tests/d2_update_mgr_unittests.cc b/src/bin/d2/tests/d2_update_mgr_unittests.cc index da74c5c88f..15a9ff0af6 100644 --- a/src/bin/d2/tests/d2_update_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_update_mgr_unittests.cc @@ -96,14 +96,14 @@ public: void makeCannedNcrs() { const char* msg_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"my.example.com.\" , " - " \"ip_address\" : \"192.168.1.2\" , " + " \"ip-address\" : \"192.168.1.2\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; const char* dhcids[] = { "111111", "222222", "333333", "444444"}; diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index e389ae70da..52e0896b89 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -274,14 +274,14 @@ TEST(NameAddTransaction, construction) { const char* msg_str = "{" - " \"change_type\" : 1 , " - " \"forward_change\" : true , " - " \"reverse_change\" : true , " + " \"change-type\" : 1 , " + " \"forward-change\" : true , " + " \"reverse-change\" : true , " " \"fqdn\" : \"example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; dhcp_ddns::NameChangeRequestPtr ncr; diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index 510b8ee48f..0d4197642d 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -276,14 +276,14 @@ TEST(NameRemoveTransaction, construction) { const char* msg_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : true , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : true , " " \"fqdn\" : \"example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; dhcp_ddns::NameChangeRequestPtr ncr; diff --git a/src/bin/d2/tests/nc_test_utils.cc b/src/bin/d2/tests/nc_test_utils.cc index 0cb021bb53..06db9b988a 100644 --- a/src/bin/d2/tests/nc_test_utils.cc +++ b/src/bin/d2/tests/nc_test_utils.cc @@ -242,14 +242,14 @@ TransactionTest::setupForIPv4Transaction(dhcp_ddns::NameChangeType chg_type, const TSIGKeyInfoPtr& tsig_key_info) { const char* msg_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : true , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : true , " " \"fqdn\" : \"my.forward.example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; // Create NameChangeRequest from JSON string. @@ -300,14 +300,14 @@ TransactionTest::setupForIPv6Transaction(dhcp_ddns::NameChangeType chg_type, const TSIGKeyInfoPtr& tsig_key_info) { const char* msg_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : true , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : true , " " \"fqdn\" : \"my6.forward.example.com.\" , " - " \"ip_address\" : \"2001:1::100\" , " + " \"ip-address\" : \"2001:1::100\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; // Create NameChangeRequest from JSON string. diff --git a/src/bin/d2/tests/nc_trans_unittests.cc b/src/bin/d2/tests/nc_trans_unittests.cc index 2e69e77634..aed7706904 100644 --- a/src/bin/d2/tests/nc_trans_unittests.cc +++ b/src/bin/d2/tests/nc_trans_unittests.cc @@ -374,14 +374,14 @@ TEST(NameChangeTransaction, construction) { const char* msg_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : true , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : true , " " \"fqdn\" : \"example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"0102030405060708\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}"; dhcp_ddns::NameChangeRequestPtr ncr; diff --git a/src/bin/dhcp4/tests/d2_unittest.cc b/src/bin/dhcp4/tests/d2_unittest.cc index ea76585d6b..1dec52473f 100644 --- a/src/bin/dhcp4/tests/d2_unittest.cc +++ b/src/bin/dhcp4/tests/d2_unittest.cc @@ -57,18 +57,18 @@ Dhcp4SrvD2Test::buildTestNcr(uint32_t dhcid_id_num) { stream << "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"myhost.example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"" << std::hex << std::setfill('0') << std::setw(16) << dhcid_id_num << "\" , " - " \"lease_expires_on\" : \"20140121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20140121132405\" , " + " \"lease-length\" : 1300 " "}"; return (dhcp_ddns::NameChangeRequest::fromJSON(stream.str())); diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc index d7f3b61787..6e7fcba2c0 100644 --- a/src/bin/dhcp6/tests/d2_unittest.cc +++ b/src/bin/dhcp6/tests/d2_unittest.cc @@ -59,18 +59,18 @@ Dhcp6SrvD2Test::buildTestNcr(uint32_t dhcid_id_num) { stream << "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"myhost.example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"" << std::hex << std::setfill('0') << std::setw(16) << dhcid_id_num << "\" , " - " \"lease_expires_on\" : \"20140121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20140121132405\" , " + " \"lease-length\" : 1300 " "}"; return (dhcp_ddns::NameChangeRequest::fromJSON(stream.str())); diff --git a/src/lib/dhcp_ddns/libdhcp_ddns.dox b/src/lib/dhcp_ddns/libdhcp_ddns.dox index 25392a36fe..b697c20b0a 100644 --- a/src/lib/dhcp_ddns/libdhcp_ddns.dox +++ b/src/lib/dhcp_ddns/libdhcp_ddns.dox @@ -21,18 +21,18 @@ This is a library of classes (in the isc::dhcp_ddns namespace) for sending and receiving requests used by ISC's DHCP-DDNS (aka D2) service to carry out DHCP-driven DNS updates. Each request contains the following information: - - change_type - indicates if this is a request to add or remove DNS entries - - forward_change - indicates if the forward DNS zone (the one that + - change-type - indicates if this is a request to add or remove DNS entries + - forward-change - indicates if the forward DNS zone (the one that contains name to address mappings) should be updated - - reverse_change - indicates if reverse DNS zone (which contains the + - reverse-change - indicates if reverse DNS zone (which contains the address to name mappings) should be updated - fqdn - the fully qualified domain name whose DNS entries should be updated - - ip_address - IP address (v4 or v6) leased to the client with the + - ip-address - IP address (v4 or v6) leased to the client with the given FQDN - dhcid - DHCID (a form of identification) of the client to whom the IP address is leased - - lease_expires_on - timestamp containing the date/time the lease expires - - lease_length - duration in seconds for which the lease is valid. + - lease-expires-on - timestamp containing the date/time the lease expires + - lease-length - duration in seconds for which the lease is valid. These requests are implemented in this library by the class, isc::dhcp_ddns::NameChangeRequest. This class provides services for diff --git a/src/lib/dhcp_ddns/ncr_msg.cc b/src/lib/dhcp_ddns/ncr_msg.cc index 85dc0ce184..e3314e7eef 100644 --- a/src/lib/dhcp_ddns/ncr_msg.cc +++ b/src/lib/dhcp_ddns/ncr_msg.cc @@ -323,28 +323,28 @@ NameChangeRequest::fromJSON(const std::string& json) { // content is lexically invalid. If the element is NOT found in the // map, getElement will throw NcrMessageError indicating the missing // member. Currently there are no optional values. - element = ncr->getElement("change_type", element_map); + element = ncr->getElement("change-type", element_map); ncr->setChangeType(element); - element = ncr->getElement("forward_change", element_map); + element = ncr->getElement("forward-change", element_map); ncr->setForwardChange(element); - element = ncr->getElement("reverse_change", element_map); + element = ncr->getElement("reverse-change", element_map); ncr->setReverseChange(element); element = ncr->getElement("fqdn", element_map); ncr->setFqdn(element); - element = ncr->getElement("ip_address", element_map); + element = ncr->getElement("ip-address", element_map); ncr->setIpAddress(element); element = ncr->getElement("dhcid", element_map); ncr->setDhcid(element); - element = ncr->getElement("lease_expires_on", element_map); + element = ncr->getElement("lease-expires-on", element_map); ncr->setLeaseExpiresOn(element); - element = ncr->getElement("lease_length", element_map); + element = ncr->getElement("lease-length", element_map); ncr->setLeaseLength(element); // All members were in the Element set and were correct lexically. Now @@ -363,16 +363,16 @@ NameChangeRequest::toJSON() const { // forward. std::ostringstream stream; - stream << "{\"change_type\":" << getChangeType() << "," - << "\"forward_change\":" + stream << "{\"change-type\":" << getChangeType() << "," + << "\"forward-change\":" << (isForwardChange() ? "true" : "false") << "," - << "\"reverse_change\":" + << "\"reverse-change\":" << (isReverseChange() ? "true" : "false") << "," << "\"fqdn\":\"" << getFqdn() << "\"," - << "\"ip_address\":\"" << getIpAddress() << "\"," + << "\"ip-address\":\"" << getIpAddress() << "\"," << "\"dhcid\":\"" << getDhcid().toStr() << "\"," - << "\"lease_expires_on\":\"" << getLeaseExpiresOnStr() << "\"," - << "\"lease_length\":" << getLeaseLength() << "}"; + << "\"lease-expires-on\":\"" << getLeaseExpiresOnStr() << "\"," + << "\"lease-length\":" << getLeaseLength() << "}"; return (stream.str()); } @@ -456,7 +456,7 @@ NameChangeRequest::setForwardChange(isc::data::ConstElementPtr element) { } catch (isc::data::TypeError& ex) { // We expect a boolean Element type, don't have one. isc_throw(NcrMessageError, - "Wrong data type for forward_change: " << ex.what()); + "Wrong data type for forward-change: " << ex.what()); } // Good to go, make the assignment. diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index 7992943356..13ff48dc11 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -39,36 +39,36 @@ const char *valid_msgs[] = { // Valid Add. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Remove. "{" - " \"change_type\" : 1 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 1 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Add with IPv6 address "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " + " \"ip-address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}" }; diff --git a/src/lib/dhcp_ddns/tests/ncr_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_unittests.cc index ffd257c667..f834df0349 100644 --- a/src/lib/dhcp_ddns/tests/ncr_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_unittests.cc @@ -33,36 +33,36 @@ const char *valid_msgs[] = { // Valid Add. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Remove. "{" - " \"change_type\" : 1 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 1 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Valid Add with IPv6 address "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " + " \"ip-address\" : \"fe80::2acf:e9ff:fe12:e56f\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}" }; @@ -72,135 +72,135 @@ const char *invalid_msgs[] = { // Invalid change type. "{" - " \"change_type\" : 7 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 7 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Invalid forward change. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : \"bogus\" , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : \"bogus\" , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Invalid reverse change. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : 500 , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : 500 , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Forward and reverse change both false. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : false , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : false , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Blank FQDN "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Malformed FQDN "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \".bad_name\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Bad IP address "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"xxxxxx\" , " + " \"ip-address\" : \"xxxxxx\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Blank DHCID "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Odd number of digits in DHCID "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Text in DHCID "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"THIS IS BOGUS!!!\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : 1300 " "}", // Invalid lease expiration string "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"Wed Jun 26 13:46:46 EDT 2013\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"Wed Jun 26 13:46:46 EDT 2013\" , " + " \"lease-length\" : 1300 " "}", // Non-integer for lease length. "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"walah.walah.com\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20130121132405\" , " - " \"lease_length\" : \"BOGUS\" " + " \"lease-expires-on\" : \"20130121132405\" , " + " \"lease-length\" : \"BOGUS\" " "}" }; @@ -470,14 +470,14 @@ TEST(NameChangeRequestTest, leftShiftOperation) { TEST(NameChangeRequestTest, basicJsonTest) { // Define valid JSON rendition of a request. std::string msg_str = "{" - "\"change_type\":1," - "\"forward_change\":true," - "\"reverse_change\":false," + "\"change-type\":1," + "\"forward-change\":true," + "\"reverse-change\":false," "\"fqdn\":\"walah.walah.com.\"," - "\"ip_address\":\"192.168.2.1\"," + "\"ip-address\":\"192.168.2.1\"," "\"dhcid\":\"010203040A7F8E3D\"," - "\"lease_expires_on\":\"20130121132405\"," - "\"lease_length\":1300" + "\"lease-expires-on\":\"20130121132405\"," + "\"lease-length\":1300" "}"; // Verify that a NameChangeRequests can be instantiated from the @@ -555,14 +555,14 @@ TEST(NameChangeRequestTest, validMsgChecks) { TEST(NameChangeRequestTest, toFromBufferTest) { // Define a string containing a valid JSON NameChangeRequest rendition. std::string msg_str = "{" - "\"change_type\":1," - "\"forward_change\":true," - "\"reverse_change\":false," + "\"change-type\":1," + "\"forward-change\":true," + "\"reverse-change\":false," "\"fqdn\":\"walah.walah.com.\"," - "\"ip_address\":\"192.168.2.1\"," + "\"ip-address\":\"192.168.2.1\"," "\"dhcid\":\"010203040A7F8E3D\"," - "\"lease_expires_on\":\"20130121132405\"," - "\"lease_length\":1300" + "\"lease-expires-on\":\"20130121132405\"," + "\"lease-length\":1300" "}"; // Create a request from JSON directly. diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc index a734b99791..0cee2d680a 100644 --- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc @@ -184,14 +184,14 @@ public: // Build an NCR from json string. const char* ncr_str = "{" - " \"change_type\" : 0 , " - " \"forward_change\" : true , " - " \"reverse_change\" : false , " + " \"change-type\" : 0 , " + " \"forward-change\" : true , " + " \"reverse-change\" : false , " " \"fqdn\" : \"myhost.example.com.\" , " - " \"ip_address\" : \"192.168.2.1\" , " + " \"ip-address\" : \"192.168.2.1\" , " " \"dhcid\" : \"010203040A7F8E3D\" , " - " \"lease_expires_on\" : \"20140121132405\" , " - " \"lease_length\" : 1300 " + " \"lease-expires-on\" : \"20140121132405\" , " + " \"lease-length\" : 1300 " "}"; return (dhcp_ddns::NameChangeRequest::fromJSON(ncr_str));