From: Francis Dupont Date: Fri, 16 Dec 2016 22:17:48 +0000 (+0100) Subject: [5017] Fixed port from dhcp6 X-Git-Tag: trac5088_base~1^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=366e0307283f1f919dab0f071fb76a1888978380;p=thirdparty%2Fkea.git [5017] Fixed port from dhcp6 --- diff --git a/src/bin/dhcp4/tests/parser_unittest.cc b/src/bin/dhcp4/tests/parser_unittest.cc index 46b0dfea68..73c5897465 100644 --- a/src/bin/dhcp4/tests/parser_unittest.cc +++ b/src/bin/dhcp4/tests/parser_unittest.cc @@ -120,26 +120,25 @@ TEST(ParserTest, keywordDhcp4) { "\"rebind-timer\": 2000, \n" "\"renew-timer\": 1000, \n" "\"subnet4\": [ { " - " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ]," - " \"subnet\": \"2001:db8:1::/48\", " - " \"interface\": \"test\" } ],\n" + " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," + " \"subnet\": \"192.0.2.0/24\", " + " \"interface\": \"test\" } ],\n" "\"valid-lifetime\": 4000 } }"; testParser2(txt, Parser4Context::PARSER_DHCP4); } TEST(ParserTest, bashComments) { - string txt= "{ \"Dhcp6\": { \"interfaces-config\": {" + string txt= "{ \"Dhcp4\": { \"interfaces-config\": {" " \"interfaces\": [ \"*\" ]" "},\n" - "\"preferred-lifetime\": 3000,\n" "# this is a comment\n" "\"rebind-timer\": 2000, \n" "# lots of comments here\n" "# and here\n" "\"renew-timer\": 1000, \n" - "\"subnet6\": [ { " - " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ]," - " \"subnet\": \"2001:db8:1::/48\", " + "\"subnet4\": [ { " + " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," + " \"subnet\": \"192.0.2.0/24\", " " \"interface\": \"eth0\"" " } ]," "\"valid-lifetime\": 4000 } }"; @@ -147,15 +146,14 @@ TEST(ParserTest, bashComments) { } TEST(ParserTest, cComments) { - string txt= "{ \"Dhcp6\": { \"interfaces-config\": {" + string txt= "{ \"Dhcp4\": { \"interfaces-config\": {" " \"interfaces\": [ \"*\" ]" "},\n" - "\"preferred-lifetime\": 3000, // this is a comment \n" "\"rebind-timer\": 2000, // everything after // is ignored\n" "\"renew-timer\": 1000, // this will be ignored, too\n" - "\"subnet6\": [ { " - " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ]," - " \"subnet\": \"2001:db8:1::/48\", " + "\"subnet4\": [ { " + " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," + " \"subnet\": \"192.0.2.0/24\", " " \"interface\": \"eth0\"" " } ]," "\"valid-lifetime\": 4000 } }"; @@ -163,15 +161,14 @@ TEST(ParserTest, cComments) { } TEST(ParserTest, bashCommentsInline) { - string txt= "{ \"Dhcp6\": { \"interfaces-config\": {" + string txt= "{ \"Dhcp4\": { \"interfaces-config\": {" " \"interfaces\": [ \"*\" ]" "},\n" - "\"preferred-lifetime\": 3000, # this is a comment \n" "\"rebind-timer\": 2000, # everything after # is ignored\n" "\"renew-timer\": 1000, # this will be ignored, too\n" - "\"subnet6\": [ { " - " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ]," - " \"subnet\": \"2001:db8:1::/48\", " + "\"subnet4\": [ { " + " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," + " \"subnet\": \"192.0.2.0/24\", " " \"interface\": \"eth0\"" " } ]," "\"valid-lifetime\": 4000 } }"; @@ -179,16 +176,16 @@ TEST(ParserTest, bashCommentsInline) { } TEST(ParserTest, multilineComments) { - string txt= "{ \"Dhcp6\": { \"interfaces-config\": {" + string txt= "{ \"Dhcp4\": { \"interfaces-config\": {" " \"interfaces\": [ \"*\" ]" "},\n" - "\"preferred-lifetime\": 3000, /* this is a C style comment\n" + " /* this is a C style comment\n" "that\n can \n span \n multiple \n lines */ \n" "\"rebind-timer\": 2000,\n" "\"renew-timer\": 1000, \n" - "\"subnet6\": [ { " - " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ]," - " \"subnet\": \"2001:db8:1::/48\", " + "\"subnet4\": [ { " + " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," + " \"subnet\": \"192.0.2.0/24\", " " \"interface\": \"eth0\"" " } ]," "\"valid-lifetime\": 4000 } }"; @@ -223,7 +220,7 @@ void testFile(const std::string& fname, bool print) { // This test loads all available existing files. Each config is loaded // twice: first with the existing Element::fromJSONFile() and then -// the second time with Parser6. Both JSON trees are then compared. +// the second time with Parser4. Both JSON trees are then compared. TEST(ParserTest, file) { vector configs; configs.push_back("backends.json"); @@ -250,14 +247,14 @@ void testError(const std::string& txt, try { Parser4Context ctx; ConstElementPtr parsed = ctx.parseString(txt, parser_type); - FAIL() << "Expected Dhcp6ParseError but nothing was raised (expected: " + FAIL() << "Expected Dhcp4ParseError but nothing was raised (expected: " << msg << ")"; } catch (const Dhcp4ParseError& ex) { EXPECT_EQ(msg, ex.what()); } catch (...) { - FAIL() << "Expected Dhcp6ParseError but something else was raised"; + FAIL() << "Expected Dhcp4ParseError but something else was raised"; } }