]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5190] Replaced dhcpX-server with dhcpX and d2-server with d2 in CA config.
authorMarcin Siodelski <marcin@isc.org>
Fri, 2 Jun 2017 11:53:38 +0000 (13:53 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 2 Jun 2017 11:53:38 +0000 (13:53 +0200)
doc/examples/agent/simple.json
doc/guide/agent.xml
src/bin/agent/agent_lexer.ll
src/bin/agent/agent_parser.yy
src/bin/agent/ca_cfg_mgr.cc
src/bin/agent/simple_parser.cc
src/bin/agent/tests/ca_cfg_mgr_unittests.cc
src/bin/agent/tests/ca_controller_unittests.cc
src/bin/agent/tests/parser_unittests.cc
src/bin/agent/tests/testdata/get_config.json
src/bin/keactrl/kea-ca.conf.pre

index 1fafb4ca73388601dfc63ebf8b45198589a636c1..819ae8215450c83f30074354222b465642bbec95 100644 (file)
        "control-sockets":
        {
            // This is how the Agent can communicate with the DHCPv4 server.
-           "dhcp4-server":
+           "dhcp4":
            {
                "socket-type": "unix",
                "socket-name": "/path/to/the/unix/socket-v4"
            },
 
            // Location of the DHCPv6 command channel socket.
-           "dhcp6-server":
+           "dhcp6":
            {
                "socket-type": "unix",
                "socket-name": "/path/to/the/unix/socket-v6"
@@ -35,7 +35,7 @@
            // Currently DHCP-DDNS (nicknamed D2) does not support
            // command channel yet, but we hope this will change in the
            // future.
-           "d2-server":
+           "d2":
            {
                "socket-type": "unix",
                "socket-name": "/path/to/the/unix/socket-d2"
index c10d7e5eebe460af22882e6b3064d2d8764cf943..34b586ad341573728aef4189a16beb2aa0247aaf 100644 (file)
         "http-port": 8080,
 
         "control-sockets": {
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-type": "unix",
                 "socket-name": "/path/to/the/unix/socket-v4"
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-type": "unix",
                 "socket-name": "/path/to/the/unix/socket-v4"
             }
 
     <para>
       The CA uses unix domain sockets to forward control commands and receive
-      responses from other Kea services. The <command>dhcp4-server</command>,
-      <command>dhcp6-server</command> and <command>d2-server</command> maps
+      responses from other Kea services. The <command>dhcp4</command>,
+      <command>dhcp6</command> and <command>d2</command> maps
       specify the files to which unix domain sockets are bound. In case
       of the configuration above, the CA will connect to the DHCPv4 server
       via <filename>/path/to/the/unix/socket-v4</filename> to forward the
index b947a977853ec75a00bd3a0a08fbd80f209346b3..2f26545435b3396e7149f1dcb793ae23ac202f80 100644 (file)
@@ -205,30 +205,30 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"dhcp4-server\" {
+\"dhcp4\" {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_DHCP4_SERVER(driver.loc_);
     default:
-        return AgentParser::make_STRING("dhcp4-server", driver.loc_);
+        return AgentParser::make_STRING("dhcp4", driver.loc_);
     }
 }
 
-\"dhcp6-server\" {
+\"dhcp6\" {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_DHCP6_SERVER(driver.loc_);
     default:
-        return AgentParser::make_STRING("dhcp6-server", driver.loc_);
+        return AgentParser::make_STRING("dhcp6", driver.loc_);
     }
 }
 
-\"d2-server\" {
+\"d2\" {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_D2_SERVER(driver.loc_);
     default:
-        return AgentParser::make_STRING("d2-server", driver.loc_);
+        return AgentParser::make_STRING("d2", driver.loc_);
     }
 }
 
index da309b7b55cce78269eba23d268bcda3aa8103fb..fb69b4e685d399603eea1daa1f12b71b101e556c 100644 (file)
@@ -53,9 +53,9 @@ using namespace std;
   HTTP_PORT "http-port"
 
   CONTROL_SOCKETS "control-sockets"
-  DHCP4_SERVER "dhcp4-server"
-  DHCP6_SERVER "dhcp6-server"
-  D2_SERVER "d2-server"
+  DHCP4_SERVER "dhcp4"
+  DHCP6_SERVER "dhcp6"
+  D2_SERVER "d2"
   SOCKET_NAME "socket-name"
   SOCKET_TYPE "socket-type"
   UNIX "unix"
@@ -362,10 +362,10 @@ control_socket: dhcp4_server_socket
               | unknown_map_entry
               ;
 
-// That's an entry for dhcp4-server socket.
+// That's an entry for dhcp4 socket.
 dhcp4_server_socket: DHCP4_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
-    ctx.stack_.back()->set("dhcp4-server", m);
+    ctx.stack_.back()->set("dhcp4", m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
@@ -373,10 +373,10 @@ dhcp4_server_socket: DHCP4_SERVER {
     ctx.leave();
 };
 
-// That's an entry for dhcp6-server socket.
+// That's an entry for dhcp6 socket.
 dhcp6_server_socket: DHCP6_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
-    ctx.stack_.back()->set("dhcp6-server", m);
+    ctx.stack_.back()->set("dhcp6", m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
@@ -384,10 +384,10 @@ dhcp6_server_socket: DHCP6_SERVER {
     ctx.leave();
 };
 
-// That's an entry for d2-server socket.
+// That's an entry for d2 socket.
 d2_server_socket: D2_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
-    ctx.stack_.back()->set("d2-server", m);
+    ctx.stack_.back()->set("d2", m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
index 2028edc279782ecb31c17572187d2c0ec4a4a835..dd4d980512285c7022f497458c9355293196ce6e 100644 (file)
@@ -184,17 +184,17 @@ CtrlAgentCfgContext::toElement() const {
     ca->set("hooks-libraries", hooks_config_.toElement());
     // Set control-sockets
     ElementPtr control_sockets = Element::createMap();
-    // Set dhcp4-server
+    // Set dhcp4 server socket
     if (ctrl_sockets_[TYPE_DHCP4]) {
-        control_sockets->set("dhcp4-server", ctrl_sockets_[TYPE_DHCP4]);
+        control_sockets->set("dhcp4", ctrl_sockets_[TYPE_DHCP4]);
     }
-    // Set dhcp6-server
+    // Set dhcp6 server socket
     if (ctrl_sockets_[TYPE_DHCP6]) {
-        control_sockets->set("dhcp6-server", ctrl_sockets_[TYPE_DHCP6]);
+        control_sockets->set("dhcp6", ctrl_sockets_[TYPE_DHCP6]);
     }
-    // Set d2-server
+    // Set d2 server socket
     if (ctrl_sockets_[TYPE_D2]) {
-        control_sockets->set("d2-server", ctrl_sockets_[TYPE_D2]);
+        control_sockets->set("d2", ctrl_sockets_[TYPE_D2]);
     }
     ca->set("control-sockets", control_sockets);
     // Set Control-agent
index 8a6c279e3863b83dc4d1c77d892808ba3ce1534f..5ea36e9cba185568545c44f25c9acc7f25e5db90 100644 (file)
@@ -58,17 +58,17 @@ size_t AgentSimpleParser::setAllDefaults(const isc::data::ElementPtr& global) {
     // Now set the defaults for control-sockets, if any.
     ConstElementPtr sockets = global->get("control-sockets");
     if (sockets) {
-        ElementPtr d2 = boost::const_pointer_cast<Element>(sockets->get("d2-server"));
+        ElementPtr d2 = boost::const_pointer_cast<Element>(sockets->get("d2"));
         if (d2) {
             cnt += SimpleParser::setDefaults(d2, SOCKET_DEFAULTS);
         }
 
-        ElementPtr d4 = boost::const_pointer_cast<Element>(sockets->get("dhcp4-server"));
+        ElementPtr d4 = boost::const_pointer_cast<Element>(sockets->get("dhcp4"));
         if (d4) {
             cnt += SimpleParser::setDefaults(d4, SOCKET_DEFAULTS);
         }
 
-        ElementPtr d6 = boost::const_pointer_cast<Element>(sockets->get("dhcp6-server"));
+        ElementPtr d6 = boost::const_pointer_cast<Element>(sockets->get("dhcp6"));
         if (d6) {
             cnt += SimpleParser::setDefaults(d6, SOCKET_DEFAULTS);
         }
@@ -89,9 +89,9 @@ AgentSimpleParser::parse(const CtrlAgentCfgContextPtr& ctx,
     // Control sockets are second.
     ConstElementPtr ctrl_sockets = config->get("control-sockets");
     if (ctrl_sockets) {
-        ConstElementPtr d2_socket = ctrl_sockets->get("d2-server");
-        ConstElementPtr d4_socket = ctrl_sockets->get("dhcp4-server");
-        ConstElementPtr d6_socket = ctrl_sockets->get("dhcp6-server");
+        ConstElementPtr d2_socket = ctrl_sockets->get("d2");
+        ConstElementPtr d4_socket = ctrl_sockets->get("dhcp4");
+        ConstElementPtr d6_socket = ctrl_sockets->get("dhcp6");
 
         if (d2_socket) {
             ctx->setControlSocketInfo(d2_socket, CtrlAgentCfgContext::TYPE_D2);
index 9f5e26c2f984daf21b9f5a064d9f2af91d3684a5..044c87598866a0860d464cf8c5d365c676b96e45 100644 (file)
@@ -202,7 +202,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        }\n"
     "    }\n"
@@ -213,13 +213,13 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        },\n"
-    "        \"dhcp6-server\": {\n"
+    "        \"dhcp6\": {\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "        },\n"
-    "        \"d2-server\": {\n"
+    "        \"d2\": {\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "        }\n"
     "   }\n"
@@ -232,7 +232,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        }\n"
     "   },\n"
@@ -251,7 +251,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
-    "        \"d2-server\": {\n"
+    "        \"d2\": {\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "        }\n"
     "    }\n"
@@ -262,7 +262,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp6-server\": {\n"
+    "        \"dhcp6\": {\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "        }\n"
     "    }\n"
index 54e4f7cc551b8661ac29af7a97d9f595b35ebb25..edf82b5a030f0e5be9aa9979bcca444e3122b00a 100644 (file)
@@ -29,11 +29,11 @@ const char* valid_agent_config =
     "  \"http-host\": \"127.0.0.1\","
     "  \"http-port\": 8081,"
     "  \"control-sockets\": {"
-    "    \"dhcp4-server\": {"
+    "    \"dhcp4\": {"
     "      \"socket-type\": \"unix\","
     "      \"socket-name\": \"/first/dhcp4/socket\""
     "    },"
-    "    \"dhcp6-server\": {"
+    "    \"dhcp6\": {"
     "      \"socket-type\": \"unix\","
     "      \"socket-name\": \"/first/dhcp6/socket\""
     "    }"
@@ -276,11 +276,11 @@ TEST_F(CtrlAgentControllerTest, successfulConfigUpdate) {
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-port\": 8080,"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
@@ -330,11 +330,11 @@ TEST_F(CtrlAgentControllerTest, unsuccessfulConfigUpdate) {
         "  \"http-host\": \"1.1.1.1\","
         "  \"http-port\": 1,"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
@@ -384,11 +384,11 @@ TEST_F(CtrlAgentControllerTest, noListenerChange) {
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-port\": 8081,"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
index 316b38c8e010ba3f084e8d93a7cabcce883998d7..07d3a563300075510ee03df15c82c5f7a623d444 100644 (file)
@@ -124,15 +124,15 @@ TEST(ParserTest, keywordAgent) {
         "    \"http-host\": \"localhost\",\n"
         "    \"http-port\": 8000,\n"
         "    \"control-sockets\": {"
-        "        \"dhcp4-server\": {"
+        "        \"dhcp4\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "        },"
-        "        \"dhcp6-server\": {"
+        "        \"dhcp6\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "        },"
-        "        \"d2-server\": {"
+        "        \"d2\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "        }"
@@ -161,15 +161,15 @@ TEST(ParserTest, keywordSubAgent) {
         "    \"http-host\": \"localhost\",\n"
         "    \"http-port\": 8000,\n"
         "    \"control-sockets\": {"
-        "        \"dhcp4-server\": {"
+        "        \"dhcp4\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "        },"
-        "        \"dhcp6-server\": {"
+        "        \"dhcp6\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "        },"
-        "        \"d2-server\": {"
+        "        \"d2\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "        }"
@@ -196,7 +196,7 @@ TEST(ParserTest, bashComments) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
-                "    \"d2-server\": {\n"
+                "    \"d2\": {\n"
                 "# this is a comment\n"
                 "\"socket-type\": \"unix\", \n"
                 "# This socket is mine. I can name it whatever\n"
@@ -214,7 +214,7 @@ TEST(ParserTest, cppComments) {
                 "  \"control-sockets\": {\n"
                 "    // Let's try talking to D2. Sadly, it never talks"
                 "    // to us back :( Maybe he doesn't like his name?\n"
-                "    \"d2-server\": {"
+                "    \"d2\": {"
                 "\"socket-type\": \"unix\", \n"
                 "\"socket-name\": \"Hector\" \n"
                 "} } } }";
@@ -228,7 +228,7 @@ TEST(ParserTest, bashCommentsInline) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
-                "    \"d2-server\": {"
+                "    \"d2\": {"
                 "\"socket-type\": \"unix\", # Maybe Hector is not really a \n"
                 "\"socket-name\": \"Hector\" # Unix process?\n"
                 "# Oh no! He's a windows one and just pretending!\n"
@@ -242,12 +242,12 @@ TEST(ParserTest, multilineComments) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
-                "    \"dhcp4-server\": {\n"
+                "    \"dhcp4\": {\n"
                 "        \"socket-type\": \"unix\"\n"
                 "    }\n"
                 "  /* Ok, forget about it. If Hector doesn't want to talk,\n"
                 "     we won't talk to him either. We now have quiet days. */\n"
-                "  /* \"d2-server\": {"
+                "  /* \"d2\": {"
                 "  \"socket-type\": \"unix\",\n"
                 "\"socket-name\": \"Hector\"\n"
                 "}*/ } } }";
index cfac8d3eb347285743ab5d8e71eef5f3f961f8af..ba56901abb5b3e622f2d04fc6cab8ea7db9b0adf 100644 (file)
@@ -1,15 +1,15 @@
 {
     "Control-agent": {
         "control-sockets": {
-            "d2-server": {
+            "d2": {
                 "socket-name": "/path/to/the/unix/socket-d2",
                 "socket-type": "unix"
             },
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-name": "/path/to/the/unix/socket-v4",
                 "socket-type": "unix"
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-name": "/path/to/the/unix/socket-v6",
                 "socket-type": "unix"
             }
index 792dedd5aa4ef53677a241d53f98fe94366f7661..b788896702a23a9dacf8ca68def85f2ba34459a8 100644 (file)
@@ -9,11 +9,11 @@
         // should connect to forward commands to the DHCPv4 and DHCPv6
         // server via unix domain socket.
         "control-sockets": {
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-type": "unix",
                 "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-type": "unix",
                 "socket-name": "/tmp/kea-dhcp6-ctrl.sock"
             }