|
@@ -33,36 +33,36 @@ const char *valid_msgs[] =
|
|
{
|
|
{
|
|
// Valid Add.
|
|
// Valid Add.
|
|
"{"
|
|
"{"
|
|
- " \"change_type\" : 0 , "
|
|
|
|
- " \"forward_change\" : true , "
|
|
|
|
- " \"reverse_change\" : false , "
|
|
|
|
|
|
+ " \"change-type\" : 0 , "
|
|
|
|
+ " \"forward-change\" : true , "
|
|
|
|
+ " \"reverse-change\" : false , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Valid Remove.
|
|
// Valid Remove.
|
|
"{"
|
|
"{"
|
|
- " \"change_type\" : 1 , "
|
|
|
|
- " \"forward_change\" : true , "
|
|
|
|
- " \"reverse_change\" : false , "
|
|
|
|
|
|
+ " \"change-type\" : 1 , "
|
|
|
|
+ " \"forward-change\" : true , "
|
|
|
|
+ " \"reverse-change\" : false , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Valid Add with IPv6 address
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"fe80::2acf:e9ff:fe12:e56f\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"fe80::2acf:e9ff:fe12:e56f\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"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.
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Invalid forward change.
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Invalid reverse change.
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Forward and reverse change both false.
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Blank FQDN
|
|
// Blank FQDN
|
|
"{"
|
|
"{"
|
|
- " \"change_type\" : 0 , "
|
|
|
|
- " \"forward_change\" : true , "
|
|
|
|
- " \"reverse_change\" : false , "
|
|
|
|
|
|
+ " \"change-type\" : 0 , "
|
|
|
|
+ " \"forward-change\" : true , "
|
|
|
|
+ " \"reverse-change\" : false , "
|
|
" \"fqdn\" : \"\" , "
|
|
" \"fqdn\" : \"\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Malformed FQDN
|
|
// Malformed FQDN
|
|
"{"
|
|
"{"
|
|
- " \"change_type\" : 0 , "
|
|
|
|
- " \"forward_change\" : true , "
|
|
|
|
- " \"reverse_change\" : false , "
|
|
|
|
|
|
+ " \"change-type\" : 0 , "
|
|
|
|
+ " \"forward-change\" : true , "
|
|
|
|
+ " \"reverse-change\" : false , "
|
|
" \"fqdn\" : \".bad_name\" , "
|
|
" \"fqdn\" : \".bad_name\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Bad IP address
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"xxxxxx\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"xxxxxx\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Blank DHCID
|
|
// Blank DHCID
|
|
"{"
|
|
"{"
|
|
- " \"change_type\" : 0 , "
|
|
|
|
- " \"forward_change\" : true , "
|
|
|
|
- " \"reverse_change\" : false , "
|
|
|
|
|
|
+ " \"change-type\" : 0 , "
|
|
|
|
+ " \"forward-change\" : true , "
|
|
|
|
+ " \"reverse-change\" : false , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"\" , "
|
|
" \"dhcid\" : \"\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Odd number of digits in DHCID
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Text in DHCID
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"THIS IS BOGUS!!!\" , "
|
|
" \"dhcid\" : \"THIS IS BOGUS!!!\" , "
|
|
- " \"lease_expires_on\" : \"20130121132405\" , "
|
|
|
|
- " \"lease_length\" : 1300 "
|
|
|
|
|
|
+ " \"lease-expires-on\" : \"20130121132405\" , "
|
|
|
|
+ " \"lease-length\" : 1300 "
|
|
"}",
|
|
"}",
|
|
// Invalid lease expiration string
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"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.
|
|
// 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\" , "
|
|
" \"fqdn\" : \"walah.walah.com\" , "
|
|
- " \"ip_address\" : \"192.168.2.1\" , "
|
|
|
|
|
|
+ " \"ip-address\" : \"192.168.2.1\" , "
|
|
" \"dhcid\" : \"010203040A7F8E3D\" , "
|
|
" \"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) {
|
|
TEST(NameChangeRequestTest, basicJsonTest) {
|
|
// Define valid JSON rendition of a request.
|
|
// Define valid JSON rendition of a request.
|
|
std::string msg_str = "{"
|
|
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.\","
|
|
"\"fqdn\":\"walah.walah.com.\","
|
|
- "\"ip_address\":\"192.168.2.1\","
|
|
|
|
|
|
+ "\"ip-address\":\"192.168.2.1\","
|
|
"\"dhcid\":\"010203040A7F8E3D\","
|
|
"\"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
|
|
// Verify that a NameChangeRequests can be instantiated from the
|
|
@@ -555,14 +555,14 @@ TEST(NameChangeRequestTest, validMsgChecks) {
|
|
TEST(NameChangeRequestTest, toFromBufferTest) {
|
|
TEST(NameChangeRequestTest, toFromBufferTest) {
|
|
// Define a string containing a valid JSON NameChangeRequest rendition.
|
|
// Define a string containing a valid JSON NameChangeRequest rendition.
|
|
std::string msg_str = "{"
|
|
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.\","
|
|
"\"fqdn\":\"walah.walah.com.\","
|
|
- "\"ip_address\":\"192.168.2.1\","
|
|
|
|
|
|
+ "\"ip-address\":\"192.168.2.1\","
|
|
"\"dhcid\":\"010203040A7F8E3D\","
|
|
"\"dhcid\":\"010203040A7F8E3D\","
|
|
- "\"lease_expires_on\":\"20130121132405\","
|
|
|
|
- "\"lease_length\":1300"
|
|
|
|
|
|
+ "\"lease-expires-on\":\"20130121132405\","
|
|
|
|
+ "\"lease-length\":1300"
|
|
"}";
|
|
"}";
|
|
|
|
|
|
// Create a request from JSON directly.
|
|
// Create a request from JSON directly.
|