Browse Source

[5190] Replaced dhcpX-server with dhcpX and d2-server with d2 in CA config.

Marcin Siodelski 8 years ago
parent
commit
97d73a1eb4

+ 3 - 3
doc/examples/agent/simple.json

@@ -19,14 +19,14 @@
 	"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"

+ 4 - 4
doc/guide/agent.xml

@@ -65,11 +65,11 @@
         "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"
             }
@@ -128,8 +128,8 @@
 
     <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

+ 6 - 6
src/bin/agent/agent_lexer.ll

@@ -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_);
     }
 }
 

+ 9 - 9
src/bin/agent/agent_parser.yy

@@ -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 {

+ 6 - 6
src/bin/agent/ca_cfg_mgr.cc

@@ -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

+ 6 - 6
src/bin/agent/simple_parser.cc

@@ -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);

+ 7 - 7
src/bin/agent/tests/ca_cfg_mgr_unittests.cc

@@ -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"

+ 8 - 8
src/bin/agent/tests/ca_controller_unittests.cc

@@ -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\""
         "    }"

+ 11 - 11
src/bin/agent/tests/parser_unittests.cc

@@ -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"
                 "}*/ } } }";

+ 3 - 3
src/bin/agent/tests/testdata/get_config.json

@@ -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"
             }

+ 2 - 2
src/bin/keactrl/kea-ca.conf.pre

@@ -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"
             }