]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3003] Added output-options alias
authorFrancis Dupont <fdupont@isc.org>
Fri, 4 Aug 2023 13:17:00 +0000 (15:17 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 7 Aug 2023 15:41:54 +0000 (17:41 +0200)
src/bin/agent/agent_lexer.ll
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/d2_lexer.ll
src/bin/d2/tests/parser_unittest.cc
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/tests/parser_unittest.cc
src/bin/netconf/netconf_lexer.ll
src/bin/netconf/tests/parser_unittests.cc

index 79d70a8bf33ff2a4b6a6bb789c7bd39cbe051cde..8d8fd1ed0c26c4d20dceae63fb9ded4a0724f25c 100644 (file)
@@ -471,6 +471,16 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+/* Add the dash        alias */
+\"output-options\" {
+    switch(driver.ctx_) {
+    case ParserContext::LOGGERS:
+        return AgentParser::make_OUTPUT_OPTIONS(driver.loc_);
+    default:
+        return AgentParser::make_STRING("output-options", driver.loc_);
+    }
+}
+
 \"output\" {
     switch(driver.ctx_) {
     case ParserContext::OUTPUT_OPTIONS:
index df80ab250a5d9294cbac3056a539286742100094..a9eecc7890a13375c7332d7b1d967378c8078998 100644 (file)
@@ -286,6 +286,17 @@ TEST(ParserTest, embbededComments) {
     testParser(txt, ParserContext::PARSER_AGENT, false);
 }
 
+// Test that output-options is an alias of output_options.
+TEST(ParserTest, outputDashOptions) {
+    string txt= "{ \"Control-agent\": {"
+                " \"loggers\": [ { "
+                "     \"name\": \"kea-ctrl-agent\","
+                "     \"output-options\": [ { \"output\": \"stdout\" } ],"
+                "     \"severity\": \"INFO\" } ]"
+                "} }";
+    testParser(txt, ParserContext::PARSER_AGENT, false);
+}
+
 /// @brief Loads specified example config file
 ///
 /// This test loads specified example file twice: first, using the legacy
index c89168c532ffc53d3717bd0422472e53b2326d00..33fb515248fdd510faeaac397a990775931a1a93 100644 (file)
@@ -470,6 +470,16 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+/* Add the dash        alias */
+\"output-options\" {
+    switch(driver.ctx_) {
+    case isc::d2::D2ParserContext::LOGGERS:
+        return isc::d2::D2Parser::make_OUTPUT_OPTIONS(driver.loc_);
+    default:
+        return isc::d2::D2Parser::make_STRING("output-options", driver.loc_);
+    }
+}
+
 \"output\" {
     switch(driver.ctx_) {
     case isc::d2::D2ParserContext::OUTPUT_OPTIONS:
index a049b9147ef2beb80f313db925dee076d4ac81d3..5d4068918c273f1f86861c333830e2e5242170fc 100644 (file)
@@ -240,6 +240,20 @@ TEST(ParserTest, embbededComments) {
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
 
+// Test that output-options is an alias of output_options.
+TEST(ParserTest, outputDashOptions) {
+    string txt=
+        "{ \"DhcpDdns\" : \n"
+            "{ \n"
+            "\"loggers\": [ {\n"
+            "    \"name\": \"kea-dhcp-ddns\",\n"
+            "    \"output-options\": [ { \"output\": \"stdout\" } ],\n"
+            "    \"severity\": \"INFO\" } ]\n"
+            "} \n"
+        "} \n";
+    testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
+}
+
 /// @brief Loads specified example config file
 ///
 /// This test loads specified example file twice: first, using the legacy
index 63556bddf8955f7da22ecdc70b9b8db9187d8e11..cce22946c7178cc855385292b994932f3221f276 100644 (file)
@@ -1296,6 +1296,16 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+/* Add the dash alias */
+\"output-options\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::LOGGERS:
+        return isc::dhcp::Dhcp4Parser::make_OUTPUT_OPTIONS(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("output-options", driver.loc_);
+    }
+}
+
 \"output\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::OUTPUT_OPTIONS:
index 426cf8e72429a00e484cfbc41bfe5eaa0b7065e0..96ef8b2d54aa7808b9a7f653db1d184561ebf5d8 100644 (file)
@@ -241,6 +241,22 @@ TEST(ParserTest, embbededComments) {
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
+// Test that output-options is an alias of output_options.
+TEST(ParserTest, outputDashOptions) {
+    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
+                "  \"interfaces\": [ \"*\" ]"
+                "},\n"
+                "\"rebind-timer\": 2000,\n"
+                "\"renew-timer\": 1000, \n"
+                "\"valid-lifetime\": 4000,\n"
+                "\"loggers\": [ { "
+                "    \"name\": \"kea-dhcp4\","
+                "    \"output-options\": [ { \"output\": \"stdout\" } ],"
+                "    \"severity\": \"INFO\" } ]\n"
+                "} }";
+    testParser(txt, Parser4Context::PARSER_DHCP4, false);
+}
+
 /// @brief Loads specified example config file
 ///
 /// This test loads specified example file twice: first, using the legacy
index f2b27eb936436644f113d6156ead8cf633dd303b..50bb040db7d454fde3593e05730676d9e451e3c8 100644 (file)
@@ -1638,6 +1638,16 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+/* Add the dash        alias */
+\"output-options\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::LOGGERS:
+        return isc::dhcp::Dhcp6Parser::make_OUTPUT_OPTIONS(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("output-options", driver.loc_);
+    }
+}
+
 \"output\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::OUTPUT_OPTIONS:
index 4ea7a282c07fe5987b280ff8c681d2d83a06b4b7..68be5cf8705f5a884f8e9f26d2313c45f3891ca5 100644 (file)
@@ -246,6 +246,23 @@ TEST(ParserTest, embbededComments) {
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
+// Test that output-options is an alias of output_options.
+TEST(ParserTest, outputDashOptions) {
+    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
+                "  \"interfaces\": [ \"*\" ]"
+                "},\n"
+                "\"preferred-lifetime\": 3000,\n"
+                "\"rebind-timer\": 2000,\n"
+                "\"renew-timer\": 1000, \n"
+                "\"valid-lifetime\": 4000,\n"
+                "\"loggers\": [ { "
+                "    \"name\": \"kea-dhcp6\","
+                "    \"output-options\": [ { \"output\": \"stdout\" } ],"
+                "    \"severity\": \"INFO\" } ]\n"
+                "} }";
+    testParser(txt, Parser6Context::PARSER_DHCP6, false);
+}
+
 /// @brief Loads specified example config file
 ///
 /// This test loads specified example file twice: first, using the legacy
index 768efe34791461b56ff47b7b9ea67f8eb239e077..8036f04f8e0ec45aec86cb1c323ce7e2ec98145a 100644 (file)
@@ -409,6 +409,16 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+/* Add the dash        alias */
+\"output-options\" {
+    switch(driver.ctx_) {
+    case ParserContext::LOGGERS:
+        return NetconfParser::make_OUTPUT_OPTIONS(driver.loc_);
+    default:
+        return NetconfParser::make_STRING("output-options", driver.loc_);
+    }
+}
+
 \"output\" {
     switch(driver.ctx_) {
     case ParserContext::OUTPUT_OPTIONS:
index ddb37d34e58249ba709ac1664a704bd2f1463b43..7cc5eaf2941bf843678b21b75609936d2036c936 100644 (file)
@@ -346,6 +346,17 @@ TEST(ParserTest, embbededComments) {
     testParser(txt, ParserContext::PARSER_NETCONF, false);
 }
 
+// Test that output-options is an alias of output_options.
+TEST(ParserTest, outputDashOptions) {
+    string txt= "{ \"Netconf\": {"
+                " \"loggers\": [ { "
+                "     \"name\": \"kea-netconf\","
+                "     \"output-options\": [ { \"output\": \"stdout\" } ],"
+                "     \"severity\": \"INFO\" } ]"
+                "} }";
+    testParser(txt, ParserContext::PARSER_NETCONF, false);
+}
+
 /// @brief Loads specified example config file
 ///
 /// This test loads specified example file twice: first, using the legacy