Browse Source

[master] Merge branch 'trac5190'

Marcin Siodelski 7 years ago
parent
commit
fc67885022

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

@@ -19,14 +19,14 @@
 	"control-sockets":
 	"control-sockets":
 	{
 	{
 	    // This is how the Agent can communicate with the DHCPv4 server.
 	    // This is how the Agent can communicate with the DHCPv4 server.
-	    "dhcp4-server":
+	    "dhcp4":
 	    {
 	    {
 		"socket-type": "unix",
 		"socket-type": "unix",
 		"socket-name": "/path/to/the/unix/socket-v4"
 		"socket-name": "/path/to/the/unix/socket-v4"
 	    },
 	    },
 
 
 	    // Location of the DHCPv6 command channel socket.
 	    // Location of the DHCPv6 command channel socket.
-	    "dhcp6-server":
+	    "dhcp6":
 	    {
 	    {
 		"socket-type": "unix",
 		"socket-type": "unix",
 		"socket-name": "/path/to/the/unix/socket-v6"
 		"socket-name": "/path/to/the/unix/socket-v6"
@@ -35,7 +35,7 @@
 	    // Currently DHCP-DDNS (nicknamed D2) does not support
 	    // Currently DHCP-DDNS (nicknamed D2) does not support
 	    // command channel yet, but we hope this will change in the
 	    // command channel yet, but we hope this will change in the
 	    // future.
 	    // future.
-	    "d2-server":
+	    "d2":
 	    {
 	    {
 		"socket-type": "unix",
 		"socket-type": "unix",
 		"socket-name": "/path/to/the/unix/socket-d2"
 		"socket-name": "/path/to/the/unix/socket-d2"

+ 19 - 4
doc/guide/agent.xml

@@ -65,11 +65,11 @@
         "http-port": 8080,
         "http-port": 8080,
 
 
         "control-sockets": {
         "control-sockets": {
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-type": "unix",
                 "socket-type": "unix",
                 "socket-name": "/path/to/the/unix/socket-v4"
                 "socket-name": "/path/to/the/unix/socket-v4"
             },
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-type": "unix",
                 "socket-type": "unix",
                 "socket-name": "/path/to/the/unix/socket-v4"
                 "socket-name": "/path/to/the/unix/socket-v4"
             }
             }
@@ -128,8 +128,8 @@
 
 
     <para>
     <para>
       The CA uses unix domain sockets to forward control commands and receive
       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
       specify the files to which unix domain sockets are bound. In case
       of the configuration above, the CA will connect to the DHCPv4 server
       of the configuration above, the CA will connect to the DHCPv4 server
       via <filename>/path/to/the/unix/socket-v4</filename> to forward the
       via <filename>/path/to/the/unix/socket-v4</filename> to forward the
@@ -141,6 +141,21 @@
       configuration is specified for the DHCPv4 and DHCPv6 services.
       configuration is specified for the DHCPv4 and DHCPv6 services.
     </para>
     </para>
 
 
+    <warning>
+      <simpara>
+        We have renamed "dhcp4-server", "dhcp6-server" and "d2-server"
+        to "dhcp4", "dhcp6" and "d2" respectively after release of Kea 1.2.
+        If you are migrating from Kea 1.2 you need to tweak your CA config
+        to use this new naming convention. We have made this incompatible
+        change to facilitate future use cases where it will be possible to
+        specify additional values of the "service" parameter to point to
+        the particular instances of the Kea servers, e.g. "dhcp4/3"
+        pointing to the 3rd instance of the DHCPv4 server in the
+        multi-processed configuration. This is not yet supported but the
+        current renaming lays the ground for it.
+      </simpara>
+    </warning>
+
     <para>
     <para>
       Hooks libraries can be attached to the Control Agent just like to
       Hooks libraries can be attached to the Control Agent just like to
       DHCPv4 and DHCPv6 servers. It currently supports one hook point
       DHCPv4 and DHCPv6 servers. It currently supports one hook point

File diff suppressed because it is too large
+ 475 - 517
src/bin/agent/agent_lexer.cc


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

@@ -205,30 +205,30 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
     }
 }
 }
 
 
-\"dhcp4-server\" {
+\"dhcp4\" {
     switch(driver.ctx_) {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_DHCP4_SERVER(driver.loc_);
         return AgentParser::make_DHCP4_SERVER(driver.loc_);
     default:
     default:
-        return AgentParser::make_STRING("dhcp4-server", driver.loc_);
+        return AgentParser::make_STRING("dhcp4", driver.loc_);
     }
     }
 }
 }
 
 
-\"dhcp6-server\" {
+\"dhcp6\" {
     switch(driver.ctx_) {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_DHCP6_SERVER(driver.loc_);
         return AgentParser::make_DHCP6_SERVER(driver.loc_);
     default:
     default:
-        return AgentParser::make_STRING("dhcp6-server", driver.loc_);
+        return AgentParser::make_STRING("dhcp6", driver.loc_);
     }
     }
 }
 }
 
 
-\"d2-server\" {
+\"d2\" {
     switch(driver.ctx_) {
     switch(driver.ctx_) {
     case ParserContext::CONTROL_SOCKETS:
     case ParserContext::CONTROL_SOCKETS:
         return AgentParser::make_D2_SERVER(driver.loc_);
         return AgentParser::make_D2_SERVER(driver.loc_);
     default:
     default:
-        return AgentParser::make_STRING("d2-server", driver.loc_);
+        return AgentParser::make_STRING("d2", driver.loc_);
     }
     }
 }
 }
 
 

+ 11 - 12
src/bin/agent/agent_parser.cc

@@ -967,7 +967,7 @@ namespace isc { namespace agent {
 #line 366 "agent_parser.yy" // lalr1.cc:859
 #line 366 "agent_parser.yy" // lalr1.cc:859
     {
     {
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
-    ctx.stack_.back()->set("dhcp4-server", m);
+    ctx.stack_.back()->set("dhcp4", m);
     ctx.stack_.push_back(m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 }
 }
@@ -987,7 +987,7 @@ namespace isc { namespace agent {
 #line 377 "agent_parser.yy" // lalr1.cc:859
 #line 377 "agent_parser.yy" // lalr1.cc:859
     {
     {
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
-    ctx.stack_.back()->set("dhcp6-server", m);
+    ctx.stack_.back()->set("dhcp6", m);
     ctx.stack_.push_back(m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 }
 }
@@ -1007,7 +1007,7 @@ namespace isc { namespace agent {
 #line 388 "agent_parser.yy" // lalr1.cc:859
 #line 388 "agent_parser.yy" // lalr1.cc:859
     {
     {
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
     ElementPtr m(new MapElement(ctx.loc2pos(yystack_[0].location)));
-    ctx.stack_.back()->set("d2-server", m);
+    ctx.stack_.back()->set("d2", m);
     ctx.stack_.push_back(m);
     ctx.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 }
 }
@@ -1771,14 +1771,13 @@ namespace isc { namespace agent {
   {
   {
   "\"end of file\"", "error", "$undefined", "\",\"", "\":\"", "\"[\"",
   "\"end of file\"", "error", "$undefined", "\",\"", "\":\"", "\"[\"",
   "\"]\"", "\"{\"", "\"}\"", "\"null\"", "\"Control-agent\"",
   "\"]\"", "\"{\"", "\"}\"", "\"null\"", "\"Control-agent\"",
-  "\"http-host\"", "\"http-port\"", "\"control-sockets\"",
-  "\"dhcp4-server\"", "\"dhcp6-server\"", "\"d2-server\"",
-  "\"socket-name\"", "\"socket-type\"", "\"unix\"", "\"hooks-libraries\"",
-  "\"library\"", "\"parameters\"", "\"Logging\"", "\"loggers\"",
-  "\"name\"", "\"output_options\"", "\"output\"", "\"debuglevel\"",
-  "\"severity\"", "\"flush\"", "\"maxsize\"", "\"maxver\"", "\"Dhcp4\"",
-  "\"Dhcp6\"", "\"DhcpDdns\"", "START_JSON", "START_AGENT",
-  "START_SUB_AGENT", "\"constant string\"", "\"integer\"",
+  "\"http-host\"", "\"http-port\"", "\"control-sockets\"", "\"dhcp4\"",
+  "\"dhcp6\"", "\"d2\"", "\"socket-name\"", "\"socket-type\"", "\"unix\"",
+  "\"hooks-libraries\"", "\"library\"", "\"parameters\"", "\"Logging\"",
+  "\"loggers\"", "\"name\"", "\"output_options\"", "\"output\"",
+  "\"debuglevel\"", "\"severity\"", "\"flush\"", "\"maxsize\"",
+  "\"maxver\"", "\"Dhcp4\"", "\"Dhcp6\"", "\"DhcpDdns\"", "START_JSON",
+  "START_AGENT", "START_SUB_AGENT", "\"constant string\"", "\"integer\"",
   "\"floating point\"", "\"boolean\"", "$accept", "start", "$@1", "$@2",
   "\"floating point\"", "\"boolean\"", "$accept", "start", "$@1", "$@2",
   "$@3", "sub_agent", "$@4", "json", "value", "map", "$@5", "map_content",
   "$@3", "sub_agent", "$@4", "json", "value", "map", "$@5", "map_content",
   "not_empty_map", "list_generic", "$@6", "list_content", "not_empty_list",
   "not_empty_map", "list_generic", "$@6", "list_content", "not_empty_list",
@@ -1853,7 +1852,7 @@ namespace isc { namespace agent {
 
 
 #line 14 "agent_parser.yy" // lalr1.cc:1167
 #line 14 "agent_parser.yy" // lalr1.cc:1167
 } } // isc::agent
 } } // isc::agent
-#line 1857 "agent_parser.cc" // lalr1.cc:1167
+#line 1856 "agent_parser.cc" // lalr1.cc:1167
 #line 592 "agent_parser.yy" // lalr1.cc:1168
 #line 592 "agent_parser.yy" // lalr1.cc:1168
 
 
 
 

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

@@ -53,9 +53,9 @@ using namespace std;
   HTTP_PORT "http-port"
   HTTP_PORT "http-port"
 
 
   CONTROL_SOCKETS "control-sockets"
   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_NAME "socket-name"
   SOCKET_TYPE "socket-type"
   SOCKET_TYPE "socket-type"
   UNIX "unix"
   UNIX "unix"
@@ -362,10 +362,10 @@ control_socket: dhcp4_server_socket
               | unknown_map_entry
               | unknown_map_entry
               ;
               ;
 
 
-// That's an entry for dhcp4-server socket.
+// That's an entry for dhcp4 socket.
 dhcp4_server_socket: DHCP4_SERVER {
 dhcp4_server_socket: DHCP4_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
     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.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
@@ -373,10 +373,10 @@ dhcp4_server_socket: DHCP4_SERVER {
     ctx.leave();
     ctx.leave();
 };
 };
 
 
-// That's an entry for dhcp6-server socket.
+// That's an entry for dhcp6 socket.
 dhcp6_server_socket: DHCP6_SERVER {
 dhcp6_server_socket: DHCP6_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
     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.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
@@ -384,10 +384,10 @@ dhcp6_server_socket: DHCP6_SERVER {
     ctx.leave();
     ctx.leave();
 };
 };
 
 
-// That's an entry for d2-server socket.
+// That's an entry for d2 socket.
 d2_server_socket: D2_SERVER {
 d2_server_socket: D2_SERVER {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
     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.stack_.push_back(m);
     ctx.enter(ctx.SERVER);
     ctx.enter(ctx.SERVER);
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
 } COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {

+ 27 - 63
src/bin/agent/ca_cfg_mgr.cc

@@ -24,30 +24,9 @@ CtrlAgentCfgContext::CtrlAgentCfgContext()
 }
 }
 
 
 CtrlAgentCfgContext::CtrlAgentCfgContext(const CtrlAgentCfgContext& orig)
 CtrlAgentCfgContext::CtrlAgentCfgContext(const CtrlAgentCfgContext& orig)
-    : DCfgContextBase(),http_host_(orig.http_host_), http_port_(orig.http_port_),
+    : DCfgContextBase(), ctrl_sockets_(orig.ctrl_sockets_),
+      http_host_(orig.http_host_), http_port_(orig.http_port_),
       hooks_config_(orig.hooks_config_) {
       hooks_config_(orig.hooks_config_) {
-
-    // We're copying pointers here only. The underlying data will be shared by
-    // old and new context. That's how shared pointers work and I see no reason
-    // why it would be different in this particular here.
-    ctrl_sockets_[TYPE_D2] = orig.ctrl_sockets_[TYPE_D2];
-    ctrl_sockets_[TYPE_DHCP4] = orig.ctrl_sockets_[TYPE_DHCP4];
-    ctrl_sockets_[TYPE_DHCP6] = orig.ctrl_sockets_[TYPE_DHCP6];
-}
-
-CtrlAgentCfgContext::ServerType
-CtrlAgentCfgContext::toServerType(const std::string& service) {
-    if (service == "dhcp4") {
-        return (CtrlAgentCfgContext::TYPE_DHCP4);
-
-    } else if (service == "dhcp6") {
-        return (CtrlAgentCfgContext::TYPE_DHCP6);
-
-    } else if (service == "d2") {
-        return (CtrlAgentCfgContext::TYPE_D2);
-    }
-
-    isc_throw(isc::BadValue, "invalid service value " << service);
 }
 }
 
 
 CtrlAgentCfgMgr::CtrlAgentCfgMgr()
 CtrlAgentCfgMgr::CtrlAgentCfgMgr()
@@ -68,25 +47,7 @@ CtrlAgentCfgMgr::getConfigSummary(const uint32_t /*selection*/) {
       << ctx->getHttpPort() << ", control sockets: ";
       << ctx->getHttpPort() << ", control sockets: ";
 
 
     // Then print the control-sockets
     // Then print the control-sockets
-    bool socks = false;
-    if (ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2)) {
-        s << "d2 ";
-        socks = true;
-    }
-    if (ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4)) {
-        s << "dhcp4 ";
-        socks = true;
-    }
-    if (ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6)) {
-        s << "dhcp6 ";
-        socks = true;
-    }
-    if (!socks) {
-        // That's uncommon, but correct scenario. CA can respond to some
-        // commands on its own. Further down the road we will possibly get the
-        // capability to tell CA to start other servers.
-        s << "none";
-    }
+    s << ctx->getControlSocketInfoSummary();
 
 
     // Finally, print the hook libraries names
     // Finally, print the hook libraries names
     const isc::hooks::HookLibsCollection libs = ctx->getHooksConfig().get();
     const isc::hooks::HookLibsCollection libs = ctx->getHooksConfig().get();
@@ -156,21 +117,33 @@ CtrlAgentCfgMgr::parse(isc::data::ConstElementPtr config_set, bool check_only) {
     return (answer);
     return (answer);
 }
 }
 
 
-const data::ConstElementPtr
-CtrlAgentCfgContext::getControlSocketInfo(ServerType type) const {
-    if (type > MAX_TYPE_SUPPORTED) {
-        isc_throw(BadValue, "Invalid server type");
-    }
-    return (ctrl_sockets_[static_cast<uint8_t>(type)]);
+data::ConstElementPtr
+CtrlAgentCfgContext::getControlSocketInfo(const std::string& service) const {
+    auto si = ctrl_sockets_.find(service);
+    return ((si != ctrl_sockets_.end()) ? si->second : ConstElementPtr());
 }
 }
 
 
 void
 void
 CtrlAgentCfgContext::setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
 CtrlAgentCfgContext::setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
-                                          ServerType type) {
-    if (type > MAX_TYPE_SUPPORTED) {
-        isc_throw(BadValue, "Invalid server type");
+                                          const std::string& service) {
+    ctrl_sockets_[service] = control_socket;
+}
+
+std::string
+CtrlAgentCfgContext::getControlSocketInfoSummary() const {
+    std::ostringstream s;
+    for (auto si = ctrl_sockets_.cbegin(); si != ctrl_sockets_.end(); ++si) {
+        if (s.tellp() != 0) {
+            s << " ";
+        }
+        s << si->first;
+    }
+
+    if (s.tellp() == 0) {
+        s << "none";
     }
     }
-    ctrl_sockets_[static_cast<uint8_t>(type)] = control_socket;
+
+    return (s.str());
 }
 }
 
 
 ElementPtr
 ElementPtr
@@ -184,17 +157,8 @@ CtrlAgentCfgContext::toElement() const {
     ca->set("hooks-libraries", hooks_config_.toElement());
     ca->set("hooks-libraries", hooks_config_.toElement());
     // Set control-sockets
     // Set control-sockets
     ElementPtr control_sockets = Element::createMap();
     ElementPtr control_sockets = Element::createMap();
-    // Set dhcp4-server
-    if (ctrl_sockets_[TYPE_DHCP4]) {
-        control_sockets->set("dhcp4-server", ctrl_sockets_[TYPE_DHCP4]);
-    }
-    // Set dhcp6-server
-    if (ctrl_sockets_[TYPE_DHCP6]) {
-        control_sockets->set("dhcp6-server", ctrl_sockets_[TYPE_DHCP6]);
-    }
-    // Set d2-server
-    if (ctrl_sockets_[TYPE_D2]) {
-        control_sockets->set("d2-server", ctrl_sockets_[TYPE_D2]);
+    for (auto si = ctrl_sockets_.cbegin(); si != ctrl_sockets_.cend(); ++si) {
+        control_sockets->set(si->first, si->second);
     }
     }
     ca->set("control-sockets", control_sockets);
     ca->set("control-sockets", control_sockets);
     // Set Control-agent
     // Set Control-agent

+ 10 - 20
src/bin/agent/ca_cfg_mgr.h

@@ -11,6 +11,7 @@
 #include <hooks/hooks_config.h>
 #include <hooks/hooks_config.h>
 #include <process/d_cfg_mgr.h>
 #include <process/d_cfg_mgr.h>
 #include <boost/pointer_cast.hpp>
 #include <boost/pointer_cast.hpp>
+#include <map>
 #include <string>
 #include <string>
 
 
 namespace isc {
 namespace isc {
@@ -33,21 +34,6 @@ public:
     /// @brief Default constructor
     /// @brief Default constructor
     CtrlAgentCfgContext();
     CtrlAgentCfgContext();
 
 
-    /// @brief Specifies type of the server being controlled.
-    enum ServerType {
-        TYPE_DHCP4 = 0, ///< kea-dhcp4
-        TYPE_DHCP6 = 1, ///< kea-dhcp6
-        TYPE_D2 = 2     ///< kea-dhcp-ddns
-    };
-
-    /// @brief Used check that specified ServerType is within valid range.
-    static const uint32_t MAX_TYPE_SUPPORTED = TYPE_D2;
-
-    /// @brief Converts service specified as a string to ServerType.
-    ///
-    /// @param service Service value as a string: 'dhcp4', 'dhcp6', 'd2'.
-    static ServerType toServerType(const std::string& service);
-
     /// @brief Creates a clone of this context object.
     /// @brief Creates a clone of this context object.
     ///
     ///
     /// Note this method does not do deep copy the information about control sockets.
     /// Note this method does not do deep copy the information about control sockets.
@@ -65,9 +51,10 @@ public:
     /// server type). This information is expected to be compatible with
     /// server type). This information is expected to be compatible with
     /// data passed to @ref isc::config::CommandMgr::openCommandSocket.
     /// data passed to @ref isc::config::CommandMgr::openCommandSocket.
     ///
     ///
-    /// @param type type of the server being controlled
+    /// @param service server being controlled
     /// @return pointer to the Element that holds control-socket map (or NULL)
     /// @return pointer to the Element that holds control-socket map (or NULL)
-    const isc::data::ConstElementPtr getControlSocketInfo(ServerType type) const;
+    isc::data::ConstElementPtr
+    getControlSocketInfo(const std::string& service) const;
 
 
     /// @brief Sets information about the control socket
     /// @brief Sets information about the control socket
     ///
     ///
@@ -76,9 +63,12 @@ public:
     /// data passed to @ref isc::config::CommandMgr::openCommandSocket.
     /// data passed to @ref isc::config::CommandMgr::openCommandSocket.
     ///
     ///
     /// @param control_socket Element that holds control-socket map
     /// @param control_socket Element that holds control-socket map
-    /// @param type type of the server being controlled
+    /// @param service server being controlled
     void setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
     void setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
-                              ServerType type);
+                              const std::string& service);
+
+    /// @brief Returns socket configuration summary in a textual format.
+    std::string getControlSocketInfoSummary() const;
 
 
     /// @brief Sets http-host parameter
     /// @brief Sets http-host parameter
     ///
     ///
@@ -149,7 +139,7 @@ private:
     CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs);
     CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs);
 
 
     /// Socket information will be stored here (for all supported servers)
     /// Socket information will be stored here (for all supported servers)
-    isc::data::ConstElementPtr ctrl_sockets_[MAX_TYPE_SUPPORTED + 1];
+    std::map<std::string, isc::data::ConstElementPtr> ctrl_sockets_;
 
 
     /// Hostname the CA should listen on.
     /// Hostname the CA should listen on.
     std::string http_host_;
     std::string http_host_;

+ 1 - 12
src/bin/agent/ca_command_mgr.cc

@@ -171,21 +171,10 @@ CtrlAgentCommandMgr::forwardCommand(const std::string& service,
                   " Control Agent configuration information");
                   " Control Agent configuration information");
     }
     }
 
 
-    // Convert the service to the server type values. Make sure the client
-    // provided right value.
-    CtrlAgentCfgContext::ServerType server_type;
-    try {
-        server_type = CtrlAgentCfgContext::toServerType(service);
-
-    } catch (const std::exception& ex) {
-        // Invalid value in service list. Can't proceed.
-        isc_throw(CommandForwardingError, ex.what());
-    }
-
     // Now that we know what service it should be forwarded to, we should
     // Now that we know what service it should be forwarded to, we should
     // find a matching forwarding socket. If this socket is not configured,
     // find a matching forwarding socket. If this socket is not configured,
     // we have to communicate it to the client.
     // we have to communicate it to the client.
-    ConstElementPtr socket_info = ctx->getControlSocketInfo(server_type);
+    ConstElementPtr socket_info = ctx->getControlSocketInfo(service);
     if (!socket_info) {
     if (!socket_info) {
         isc_throw(CommandForwardingError, "forwarding socket is not configured"
         isc_throw(CommandForwardingError, "forwarding socket is not configured"
                   " for the server type " << service);
                   " for the server type " << service);

+ 1 - 1
src/bin/agent/location.hh

@@ -1,4 +1,4 @@
-// Generated 201705171457
+// Generated 201706021241
 // A Bison parser, made by GNU Bison 3.0.4.
 // A Bison parser, made by GNU Bison 3.0.4.
 
 
 // Locations for Bison parsers in C++
 // Locations for Bison parsers in C++

+ 1 - 1
src/bin/agent/position.hh

@@ -1,4 +1,4 @@
-// Generated 201705171457
+// Generated 201706021241
 // A Bison parser, made by GNU Bison 3.0.4.
 // A Bison parser, made by GNU Bison 3.0.4.
 
 
 // Positions for Bison parsers in C++
 // Positions for Bison parsers in C++

+ 6 - 17
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.
     // Now set the defaults for control-sockets, if any.
     ConstElementPtr sockets = global->get("control-sockets");
     ConstElementPtr sockets = global->get("control-sockets");
     if (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) {
         if (d2) {
             cnt += SimpleParser::setDefaults(d2, SOCKET_DEFAULTS);
             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) {
         if (d4) {
             cnt += SimpleParser::setDefaults(d4, SOCKET_DEFAULTS);
             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) {
         if (d6) {
             cnt += SimpleParser::setDefaults(d6, SOCKET_DEFAULTS);
             cnt += SimpleParser::setDefaults(d6, SOCKET_DEFAULTS);
         }
         }
@@ -89,20 +89,9 @@ AgentSimpleParser::parse(const CtrlAgentCfgContextPtr& ctx,
     // Control sockets are second.
     // Control sockets are second.
     ConstElementPtr ctrl_sockets = config->get("control-sockets");
     ConstElementPtr ctrl_sockets = config->get("control-sockets");
     if (ctrl_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");
-
-        if (d2_socket) {
-            ctx->setControlSocketInfo(d2_socket, CtrlAgentCfgContext::TYPE_D2);
-        }
-
-        if (d4_socket) {
-            ctx->setControlSocketInfo(d4_socket, CtrlAgentCfgContext::TYPE_DHCP4);
-        }
-
-        if (d6_socket) {
-            ctx->setControlSocketInfo(d6_socket, CtrlAgentCfgContext::TYPE_DHCP6);
+        auto sockets_map = ctrl_sockets->mapValue();
+        for (auto cs = sockets_map.cbegin(); cs != sockets_map.cend(); ++cs) {
+            ctx->setControlSocketInfo(cs->second, cs->first);
         }
         }
     }
     }
 
 

+ 1 - 1
src/bin/agent/stack.hh

@@ -1,4 +1,4 @@
-// Generated 201705171457
+// Generated 201706021241
 // A Bison parser, made by GNU Bison 3.0.4.
 // A Bison parser, made by GNU Bison 3.0.4.
 
 
 // Stack handling for Bison parsers in C++
 // Stack handling for Bison parsers in C++

+ 43 - 55
src/bin/agent/tests/ca_cfg_mgr_unittests.cc

@@ -28,18 +28,6 @@ public:
     using CtrlAgentCfgMgr::parse;
     using CtrlAgentCfgMgr::parse;
 };
 };
 
 
-// Tests conversion of the 'service' parameter to ServerType.
-TEST(CtrlAgentCfgContextTest, toServerType) {
-    EXPECT_EQ(CtrlAgentCfgContext::TYPE_DHCP4,
-              CtrlAgentCfgContext::toServerType("dhcp4"));
-    EXPECT_EQ(CtrlAgentCfgContext::TYPE_DHCP6,
-              CtrlAgentCfgContext::toServerType("dhcp6"));
-    EXPECT_EQ(CtrlAgentCfgContext::TYPE_D2,
-              CtrlAgentCfgContext::toServerType("d2"));
-    EXPECT_THROW(CtrlAgentCfgContext::toServerType("other"),
-                 isc::BadValue);
-}
-
 // Tests construction of CtrlAgentCfgMgr class.
 // Tests construction of CtrlAgentCfgMgr class.
 TEST(CtrlAgentCfgMgr, construction) {
 TEST(CtrlAgentCfgMgr, construction) {
     boost::scoped_ptr<CtrlAgentCfgMgr> cfg_mgr;
     boost::scoped_ptr<CtrlAgentCfgMgr> cfg_mgr;
@@ -84,9 +72,9 @@ TEST(CtrlAgentCfgMgr, contextSocketInfo) {
 
 
     // Check control socket parameters
     // Check control socket parameters
     // By default, there are no control sockets stored.
     // By default, there are no control sockets stored.
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
+    EXPECT_FALSE(ctx.getControlSocketInfo("d2"));
+    EXPECT_FALSE(ctx.getControlSocketInfo("dhcp4"));
+    EXPECT_FALSE(ctx.getControlSocketInfo("dhcp6"));
 
 
     ConstElementPtr socket1 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
     ConstElementPtr socket1 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
                                                 "  \"socket-name\": \"socket1\" }");
                                                 "  \"socket-name\": \"socket1\" }");
@@ -95,26 +83,26 @@ TEST(CtrlAgentCfgMgr, contextSocketInfo) {
     ConstElementPtr socket3 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
     ConstElementPtr socket3 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
                                                 "  \"socket-name\": \"socket3\" }");
                                                 "  \"socket-name\": \"socket3\" }");
     // Ok, now set the control socket for D2
     // Ok, now set the control socket for D2
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket1, CtrlAgentCfgContext::TYPE_D2));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket1, "d2"));
 
 
     // Now check the values returned
     // Now check the values returned
-    EXPECT_EQ(socket1, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
+    EXPECT_EQ(socket1, ctx.getControlSocketInfo("d2"));
+    EXPECT_FALSE(ctx.getControlSocketInfo("dhcp4"));
+    EXPECT_FALSE(ctx.getControlSocketInfo("dhcp6"));
 
 
     // Now set the v6 socket and sanity check again
     // Now set the v6 socket and sanity check again
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket2, CtrlAgentCfgContext::TYPE_DHCP6));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket2, "dhcp6"));
 
 
     // Should be possible to retrieve two sockets.
     // Should be possible to retrieve two sockets.
-    EXPECT_EQ(socket1, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
-    EXPECT_EQ(socket2, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
-    EXPECT_FALSE(ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
+    EXPECT_EQ(socket1, ctx.getControlSocketInfo("d2"));
+    EXPECT_EQ(socket2, ctx.getControlSocketInfo("dhcp6"));
+    EXPECT_FALSE(ctx.getControlSocketInfo("dhcp4"));
 
 
     // Finally, set the third control socket.
     // Finally, set the third control socket.
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket3, CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_EQ(socket1, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
-    EXPECT_EQ(socket2, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
-    EXPECT_EQ(socket3, ctx.getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket3, "dhcp4"));
+    EXPECT_EQ(socket1, ctx.getControlSocketInfo("d2"));
+    EXPECT_EQ(socket2, ctx.getControlSocketInfo("dhcp6"));
+    EXPECT_EQ(socket3, ctx.getControlSocketInfo("dhcp4"));
 }
 }
 
 
 // Tests if copied context retains all parameters.
 // Tests if copied context retains all parameters.
@@ -129,9 +117,9 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
     ConstElementPtr socket3 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
     ConstElementPtr socket3 = Element::fromJSON("{ \"socket-type\": \"unix\",\n"
                                                 "  \"socket-name\": \"socket3\" }");
                                                 "  \"socket-name\": \"socket3\" }");
     // Ok, now set the control sockets
     // Ok, now set the control sockets
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket1, CtrlAgentCfgContext::TYPE_D2));
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket2, CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket3, CtrlAgentCfgContext::TYPE_DHCP6));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket1, "d2"));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket2, "dhcp4"));
+    EXPECT_NO_THROW(ctx.setControlSocketInfo(socket3, "dhcp6"));
 
 
     EXPECT_NO_THROW(ctx.setHttpPort(12345));
     EXPECT_NO_THROW(ctx.setHttpPort(12345));
     EXPECT_NO_THROW(ctx.setHttpHost("bellatrix"));
     EXPECT_NO_THROW(ctx.setHttpHost("bellatrix"));
@@ -151,12 +139,12 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
     EXPECT_EQ("bellatrix", copy->getHttpHost());
     EXPECT_EQ("bellatrix", copy->getHttpHost());
 
 
     // Check socket info
     // Check socket info
-    ASSERT_TRUE(copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
-    ASSERT_TRUE(copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
-    ASSERT_TRUE(copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
-    EXPECT_EQ(socket1->str(), copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2)->str());
-    EXPECT_EQ(socket2->str(), copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4)->str());
-    EXPECT_EQ(socket3->str(), copy->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6)->str());
+    ASSERT_TRUE(copy->getControlSocketInfo("d2"));
+    ASSERT_TRUE(copy->getControlSocketInfo("dhcp4"));
+    ASSERT_TRUE(copy->getControlSocketInfo("dhcp6"));
+    EXPECT_EQ(socket1->str(), copy->getControlSocketInfo("d2")->str());
+    EXPECT_EQ(socket2->str(), copy->getControlSocketInfo("dhcp4")->str());
+    EXPECT_EQ(socket3->str(), copy->getControlSocketInfo("dhcp6")->str());
 
 
     // Check hook libs
     // Check hook libs
     const HookLibsCollection& libs2 = copy->getHooksConfig().get();
     const HookLibsCollection& libs2 = copy->getHooksConfig().get();
@@ -202,7 +190,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        }\n"
     "        }\n"
     "    }\n"
     "    }\n"
@@ -213,13 +201,13 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        },\n"
     "        },\n"
-    "        \"dhcp6-server\": {\n"
+    "        \"dhcp6\": {\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "        },\n"
     "        },\n"
-    "        \"d2-server\": {\n"
+    "        \"d2\": {\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "        }\n"
     "        }\n"
     "   }\n"
     "   }\n"
@@ -232,7 +220,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp4-server\": {\n"
+    "        \"dhcp4\": {\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "            \"socket-name\": \"/tmp/socket-v4\"\n"
     "        }\n"
     "        }\n"
     "   },\n"
     "   },\n"
@@ -251,7 +239,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
     "    \"control-sockets\": {\n"
-    "        \"d2-server\": {\n"
+    "        \"d2\": {\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "            \"socket-name\": \"/tmp/socket-d2\"\n"
     "        }\n"
     "        }\n"
     "    }\n"
     "    }\n"
@@ -262,7 +250,7 @@ const char* AGENT_CONFIGS[] = {
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-host\": \"betelguese\",\n"
     "    \"http-port\": 8001,\n"
     "    \"http-port\": 8001,\n"
     "    \"control-sockets\": {\n"
     "    \"control-sockets\": {\n"
-    "        \"dhcp6-server\": {\n"
+    "        \"dhcp6\": {\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "            \"socket-name\": \"/tmp/socket-v6\"\n"
     "        }\n"
     "        }\n"
     "    }\n"
     "    }\n"
@@ -327,12 +315,12 @@ TEST_F(AgentParserTest, configParseSocketDhcp4) {
 
 
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     ASSERT_TRUE(ctx);
     ASSERT_TRUE(ctx);
-    ConstElementPtr socket = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4);
+    ConstElementPtr socket = ctx->getControlSocketInfo("dhcp4");
     ASSERT_TRUE(socket);
     ASSERT_TRUE(socket);
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-v4\", \"socket-type\": \"unix\" }",
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-v4\", \"socket-type\": \"unix\" }",
               socket->str());
               socket->str());
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
+    EXPECT_FALSE(ctx->getControlSocketInfo("dhcp6"));
+    EXPECT_FALSE(ctx->getControlSocketInfo("d2"));
 }
 }
 
 
 // Tests if a single socket can be configured. BTW this test also checks
 // Tests if a single socket can be configured. BTW this test also checks
@@ -343,13 +331,13 @@ TEST_F(AgentParserTest, configParseSocketD2) {
 
 
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     ASSERT_TRUE(ctx);
     ASSERT_TRUE(ctx);
-    ConstElementPtr socket = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2);
+    ConstElementPtr socket = ctx->getControlSocketInfo("d2");
     ASSERT_TRUE(socket);
     ASSERT_TRUE(socket);
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-d2\", \"socket-type\": \"unix\" }",
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-d2\", \"socket-type\": \"unix\" }",
               socket->str());
               socket->str());
 
 
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6));
+    EXPECT_FALSE(ctx->getControlSocketInfo("dhcp4"));
+    EXPECT_FALSE(ctx->getControlSocketInfo("dhcp6"));
 }
 }
 
 
 // Tests if a single socket can be configured. BTW this test also checks
 // Tests if a single socket can be configured. BTW this test also checks
@@ -360,12 +348,12 @@ TEST_F(AgentParserTest, configParseSocketDhcp6) {
 
 
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     ASSERT_TRUE(ctx);
     ASSERT_TRUE(ctx);
-    ConstElementPtr socket = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6);
+    ConstElementPtr socket = ctx->getControlSocketInfo("dhcp6");
     ASSERT_TRUE(socket);
     ASSERT_TRUE(socket);
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-v6\", \"socket-type\": \"unix\" }",
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-v6\", \"socket-type\": \"unix\" }",
               socket->str());
               socket->str());
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4));
-    EXPECT_FALSE(ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2));
+    EXPECT_FALSE(ctx->getControlSocketInfo("dhcp4"));
+    EXPECT_FALSE(ctx->getControlSocketInfo("d2"));
 }
 }
 
 
 // This tests if all 3 sockets can be configured and makes sure the parser
 // This tests if all 3 sockets can be configured and makes sure the parser
@@ -374,9 +362,9 @@ TEST_F(AgentParserTest, configParse3Sockets) {
     configParse(AGENT_CONFIGS[3], 0);
     configParse(AGENT_CONFIGS[3], 0);
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     CtrlAgentCfgContextPtr ctx = cfg_mgr_.getCtrlAgentCfgContext();
     ASSERT_TRUE(ctx);
     ASSERT_TRUE(ctx);
-    ConstElementPtr socket2 = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_D2);
-    ConstElementPtr socket4 = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4);
-    ConstElementPtr socket6 = ctx->getControlSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6);
+    ConstElementPtr socket2 = ctx->getControlSocketInfo("d2");
+    ConstElementPtr socket4 = ctx->getControlSocketInfo("dhcp4");
+    ConstElementPtr socket6 = ctx->getControlSocketInfo("dhcp6");
     ASSERT_TRUE(socket2);
     ASSERT_TRUE(socket2);
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-d2\", \"socket-type\": \"unix\" }",
     EXPECT_EQ("{ \"socket-name\": \"/tmp/socket-d2\", \"socket-type\": \"unix\" }",
               socket2->str());
               socket2->str());

+ 15 - 20
src/bin/agent/tests/ca_command_mgr_unittests.cc

@@ -154,17 +154,16 @@ public:
 
 
     /// @brief Adds configuration of the control socket.
     /// @brief Adds configuration of the control socket.
     ///
     ///
-    /// @param server_type Server type for which socket configuration is to
-    /// be added.
+    /// @param service Service for which socket configuration is to be added.
     void
     void
-    configureControlSocket(const CtrlAgentCfgContext::ServerType& server_type) {
+    configureControlSocket(const std::string& service) {
         CtrlAgentCfgContextPtr ctx = getCtrlAgentCfgContext();
         CtrlAgentCfgContextPtr ctx = getCtrlAgentCfgContext();
         ASSERT_TRUE(ctx);
         ASSERT_TRUE(ctx);
 
 
         ElementPtr control_socket = Element::createMap();
         ElementPtr control_socket = Element::createMap();
         control_socket->set("socket-name",
         control_socket->set("socket-name",
                             Element::create(unixSocketFilePath()));
                             Element::create(unixSocketFilePath()));
-        ctx->setControlSocketInfo(control_socket, server_type);
+        ctx->setControlSocketInfo(control_socket, service);
     }
     }
 
 
     /// @brief Create and bind server side socket.
     /// @brief Create and bind server side socket.
@@ -216,7 +215,7 @@ public:
     /// server socket after which the IO service should be stopped.
     /// server socket after which the IO service should be stopped.
     /// @param expected_responses Number of responses after which the test finishes.
     /// @param expected_responses Number of responses after which the test finishes.
     /// @param server_response Stub response to be sent by the server.
     /// @param server_response Stub response to be sent by the server.
-    void testForward(const CtrlAgentCfgContext::ServerType& server_type,
+    void testForward(const std::string& configured_service,
                      const std::string& service,
                      const std::string& service,
                      const int expected_result0,
                      const int expected_result0,
                      const int expected_result1 = -1,
                      const int expected_result1 = -1,
@@ -224,7 +223,7 @@ public:
                      const size_t expected_responses = 1,
                      const size_t expected_responses = 1,
                      const std::string& server_response = "{ \"result\": 0 }") {
                      const std::string& server_response = "{ \"result\": 0 }") {
         // Configure client side socket.
         // Configure client side socket.
-        configureControlSocket(server_type);
+        configureControlSocket(configured_service);
         // Create server side socket.
         // Create server side socket.
         bindServerSocket(server_response, true);
         bindServerSocket(server_response, true);
 
 
@@ -283,37 +282,33 @@ TEST_F(CtrlAgentCommandMgrTest, listCommands) {
 
 
 /// Check that control command is successfully forwarded to the DHCPv4 server.
 /// Check that control command is successfully forwarded to the DHCPv4 server.
 TEST_F(CtrlAgentCommandMgrTest, forwardToDHCPv4Server) {
 TEST_F(CtrlAgentCommandMgrTest, forwardToDHCPv4Server) {
-    testForward(CtrlAgentCfgContext::TYPE_DHCP4, "dhcp4",
-                isc::config::CONTROL_RESULT_SUCCESS);
+    testForward("dhcp4", "dhcp4", isc::config::CONTROL_RESULT_SUCCESS);
 }
 }
 
 
 /// Check that control command is successfully forwarded to the DHCPv6 server.
 /// Check that control command is successfully forwarded to the DHCPv6 server.
 TEST_F(CtrlAgentCommandMgrTest, forwardToDHCPv6Server) {
 TEST_F(CtrlAgentCommandMgrTest, forwardToDHCPv6Server) {
-    testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp6",
-                isc::config::CONTROL_RESULT_SUCCESS);
+    testForward("dhcp6", "dhcp6", isc::config::CONTROL_RESULT_SUCCESS);
 }
 }
 
 
 /// Check that the same command is forwarded to multiple servers.
 /// Check that the same command is forwarded to multiple servers.
 TEST_F(CtrlAgentCommandMgrTest, forwardToBothDHCPServers) {
 TEST_F(CtrlAgentCommandMgrTest, forwardToBothDHCPServers) {
-    configureControlSocket(CtrlAgentCfgContext::TYPE_DHCP6);
+    configureControlSocket("dhcp6");
 
 
-    testForward(CtrlAgentCfgContext::TYPE_DHCP4, "dhcp4,dhcp6",
-                isc::config::CONTROL_RESULT_SUCCESS,
-                isc::config::CONTROL_RESULT_SUCCESS,
-                -1, 2);
+    testForward("dhcp4", "dhcp4,dhcp6", isc::config::CONTROL_RESULT_SUCCESS,
+                isc::config::CONTROL_RESULT_SUCCESS, -1, 2);
 }
 }
 
 
 /// Check that the command may forwarded to the second server even if
 /// Check that the command may forwarded to the second server even if
 /// forwarding to a first server fails.
 /// forwarding to a first server fails.
 TEST_F(CtrlAgentCommandMgrTest, failForwardToServer) {
 TEST_F(CtrlAgentCommandMgrTest, failForwardToServer) {
-    testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp4,dhcp6",
+    testForward("dhcp6", "dhcp4,dhcp6",
                 isc::config::CONTROL_RESULT_ERROR,
                 isc::config::CONTROL_RESULT_ERROR,
                 isc::config::CONTROL_RESULT_SUCCESS);
                 isc::config::CONTROL_RESULT_SUCCESS);
 }
 }
 
 
 /// Check that control command is not forwarded if the service is not specified.
 /// Check that control command is not forwarded if the service is not specified.
 TEST_F(CtrlAgentCommandMgrTest, noService) {
 TEST_F(CtrlAgentCommandMgrTest, noService) {
-    testForward(CtrlAgentCfgContext::TYPE_DHCP6, "",
+    testForward("dhcp6", "",
                 isc::config::CONTROL_RESULT_COMMAND_UNSUPPORTED,
                 isc::config::CONTROL_RESULT_COMMAND_UNSUPPORTED,
                 -1, -1, 0);
                 -1, -1, 0);
 }
 }
@@ -321,7 +316,7 @@ TEST_F(CtrlAgentCommandMgrTest, noService) {
 /// Check that error is returned to the client when the server to which the
 /// Check that error is returned to the client when the server to which the
 /// command was forwarded sent an invalid message.
 /// command was forwarded sent an invalid message.
 TEST_F(CtrlAgentCommandMgrTest, invalidAnswer) {
 TEST_F(CtrlAgentCommandMgrTest, invalidAnswer) {
-    testForward(CtrlAgentCfgContext::TYPE_DHCP6, "dhcp6",
+    testForward("dhcp6", "dhcp6",
                 isc::config::CONTROL_RESULT_ERROR, -1, -1, 1,
                 isc::config::CONTROL_RESULT_ERROR, -1, -1, 1,
                 "{ \"result\": }");
                 "{ \"result\": }");
 }
 }
@@ -351,7 +346,7 @@ TEST_F(CtrlAgentCommandMgrTest, noClientSocket) {
 /// Check that error is returned to the client if the remote server to
 /// Check that error is returned to the client if the remote server to
 /// which the control command is to be forwarded is not available.
 /// which the control command is to be forwarded is not available.
 TEST_F(CtrlAgentCommandMgrTest, noServerSocket) {
 TEST_F(CtrlAgentCommandMgrTest, noServerSocket) {
-    configureControlSocket(CtrlAgentCfgContext::TYPE_DHCP6);
+    configureControlSocket("dhcp6");
 
 
     ConstElementPtr command = createCommand("foo", "dhcp6");
     ConstElementPtr command = createCommand("foo", "dhcp6");
     ConstElementPtr answer = mgr_.handleCommand("foo", ConstElementPtr(),
     ConstElementPtr answer = mgr_.handleCommand("foo", ConstElementPtr(),
@@ -364,7 +359,7 @@ TEST_F(CtrlAgentCommandMgrTest, noServerSocket) {
 // value is specified.
 // value is specified.
 TEST_F(CtrlAgentCommandMgrTest, forwardListCommands) {
 TEST_F(CtrlAgentCommandMgrTest, forwardListCommands) {
     // Configure client side socket.
     // Configure client side socket.
-    configureControlSocket(CtrlAgentCfgContext::TYPE_DHCP4);
+    configureControlSocket("dhcp4");
     // Create server side socket.
     // Create server side socket.
     bindServerSocket("{ \"result\" : 3 }", true);
     bindServerSocket("{ \"result\" : 3 }", true);
 
 

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

@@ -29,11 +29,11 @@ const char* valid_agent_config =
     "  \"http-host\": \"127.0.0.1\","
     "  \"http-host\": \"127.0.0.1\","
     "  \"http-port\": 8081,"
     "  \"http-port\": 8081,"
     "  \"control-sockets\": {"
     "  \"control-sockets\": {"
-    "    \"dhcp4-server\": {"
+    "    \"dhcp4\": {"
     "      \"socket-type\": \"unix\","
     "      \"socket-type\": \"unix\","
     "      \"socket-name\": \"/first/dhcp4/socket\""
     "      \"socket-name\": \"/first/dhcp4/socket\""
     "    },"
     "    },"
-    "    \"dhcp6-server\": {"
+    "    \"dhcp6\": {"
     "      \"socket-type\": \"unix\","
     "      \"socket-type\": \"unix\","
     "      \"socket-name\": \"/first/dhcp6/socket\""
     "      \"socket-name\": \"/first/dhcp6/socket\""
     "    }"
     "    }"
@@ -79,14 +79,14 @@ public:
     /// @brief Tests that socket info structure contains 'unix' socket-type
     /// @brief Tests that socket info structure contains 'unix' socket-type
     /// value and the expected socket-name.
     /// value and the expected socket-name.
     ///
     ///
-    /// @param type Server type.
+    /// @param service Service type.
     /// @param exp_socket_name Expected socket name.
     /// @param exp_socket_name Expected socket name.
-    void testUnixSocketInfo(const CtrlAgentCfgContext::ServerType& type,
+    void testUnixSocketInfo(const std::string& service,
                             const std::string& exp_socket_name) {
                             const std::string& exp_socket_name) {
         CtrlAgentCfgContextPtr ctx = getCtrlAgentCfgContext();
         CtrlAgentCfgContextPtr ctx = getCtrlAgentCfgContext();
         ASSERT_TRUE(ctx);
         ASSERT_TRUE(ctx);
 
 
-        ConstElementPtr sock_info = ctx->getControlSocketInfo(type);
+        ConstElementPtr sock_info = ctx->getControlSocketInfo(service);
         ASSERT_TRUE(sock_info);
         ASSERT_TRUE(sock_info);
         ASSERT_TRUE(sock_info->contains("socket-type"));
         ASSERT_TRUE(sock_info->contains("socket-type"));
         EXPECT_EQ("unix", sock_info->get("socket-type")->stringValue());
         EXPECT_EQ("unix", sock_info->get("socket-type")->stringValue());
@@ -276,11 +276,11 @@ TEST_F(CtrlAgentControllerTest, successfulConfigUpdate) {
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-port\": 8080,"
         "  \"http-port\": 8080,"
         "  \"control-sockets\": {"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
         "    }"
@@ -304,8 +304,8 @@ TEST_F(CtrlAgentControllerTest, successfulConfigUpdate) {
     EXPECT_EQ(8080, ctx->getHttpPort());
     EXPECT_EQ(8080, ctx->getHttpPort());
 
 
     // The forwarding configuration should have been updated too.
     // The forwarding configuration should have been updated too.
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4, "/second/dhcp4/socket");
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6, "/second/dhcp6/socket");
+    testUnixSocketInfo("dhcp4", "/second/dhcp4/socket");
+    testUnixSocketInfo("dhcp6", "/second/dhcp6/socket");
 
 
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     ASSERT_TRUE(process);
     ASSERT_TRUE(process);
@@ -330,11 +330,11 @@ TEST_F(CtrlAgentControllerTest, unsuccessfulConfigUpdate) {
         "  \"http-host\": \"1.1.1.1\","
         "  \"http-host\": \"1.1.1.1\","
         "  \"http-port\": 1,"
         "  \"http-port\": 1,"
         "  \"control-sockets\": {"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
         "    }"
@@ -359,8 +359,8 @@ TEST_F(CtrlAgentControllerTest, unsuccessfulConfigUpdate) {
     EXPECT_EQ(8081, ctx->getHttpPort());
     EXPECT_EQ(8081, ctx->getHttpPort());
 
 
     // Same for forwarding.
     // Same for forwarding.
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4, "/first/dhcp4/socket");
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6, "/first/dhcp6/socket");
+    testUnixSocketInfo("dhcp4", "/first/dhcp4/socket");
+    testUnixSocketInfo("dhcp6", "/first/dhcp6/socket");
 
 
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     ASSERT_TRUE(process);
     ASSERT_TRUE(process);
@@ -384,11 +384,11 @@ TEST_F(CtrlAgentControllerTest, noListenerChange) {
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-host\": \"127.0.0.1\","
         "  \"http-port\": 8081,"
         "  \"http-port\": 8081,"
         "  \"control-sockets\": {"
         "  \"control-sockets\": {"
-        "    \"dhcp4-server\": {"
+        "    \"dhcp4\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "      \"socket-name\": \"/second/dhcp4/socket\""
         "    },"
         "    },"
-        "    \"dhcp6-server\": {"
+        "    \"dhcp6\": {"
         "      \"socket-type\": \"unix\","
         "      \"socket-type\": \"unix\","
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "      \"socket-name\": \"/second/dhcp6/socket\""
         "    }"
         "    }"
@@ -412,8 +412,8 @@ TEST_F(CtrlAgentControllerTest, noListenerChange) {
     EXPECT_EQ(8081, ctx->getHttpPort());
     EXPECT_EQ(8081, ctx->getHttpPort());
 
 
     // The forwarding configuration should have been updated.
     // The forwarding configuration should have been updated.
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP4, "/second/dhcp4/socket");
-    testUnixSocketInfo(CtrlAgentCfgContext::TYPE_DHCP6, "/second/dhcp6/socket");
+    testUnixSocketInfo("dhcp4", "/second/dhcp4/socket");
+    testUnixSocketInfo("dhcp6", "/second/dhcp6/socket");
 
 
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     CtrlAgentProcessPtr process = getCtrlAgentProcess();
     ASSERT_TRUE(process);
     ASSERT_TRUE(process);

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

@@ -124,15 +124,15 @@ TEST(ParserTest, keywordAgent) {
         "    \"http-host\": \"localhost\",\n"
         "    \"http-host\": \"localhost\",\n"
         "    \"http-port\": 8000,\n"
         "    \"http-port\": 8000,\n"
         "    \"control-sockets\": {"
         "    \"control-sockets\": {"
-        "        \"dhcp4-server\": {"
+        "        \"dhcp4\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "        },"
         "        },"
-        "        \"dhcp6-server\": {"
+        "        \"dhcp6\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "        },"
         "        },"
-        "        \"d2-server\": {"
+        "        \"d2\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "        }"
         "        }"
@@ -161,15 +161,15 @@ TEST(ParserTest, keywordSubAgent) {
         "    \"http-host\": \"localhost\",\n"
         "    \"http-host\": \"localhost\",\n"
         "    \"http-port\": 8000,\n"
         "    \"http-port\": 8000,\n"
         "    \"control-sockets\": {"
         "    \"control-sockets\": {"
-        "        \"dhcp4-server\": {"
+        "        \"dhcp4\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "            \"socket-name\": \"/path/to/the/unix/socket-v4\""
         "        },"
         "        },"
-        "        \"dhcp6-server\": {"
+        "        \"dhcp6\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "            \"socket-name\": \"/path/to/the/unix/socket-v6\""
         "        },"
         "        },"
-        "        \"d2-server\": {"
+        "        \"d2\": {"
         "            \"socket-type\": \"unix\","
         "            \"socket-type\": \"unix\","
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "            \"socket-name\": \"/path/to/the/unix/socket-d2\""
         "        }"
         "        }"
@@ -196,7 +196,7 @@ TEST(ParserTest, bashComments) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
                 "  \"control-sockets\": {\n"
-                "    \"d2-server\": {\n"
+                "    \"d2\": {\n"
                 "# this is a comment\n"
                 "# this is a comment\n"
                 "\"socket-type\": \"unix\", \n"
                 "\"socket-type\": \"unix\", \n"
                 "# This socket is mine. I can name it whatever\n"
                 "# This socket is mine. I can name it whatever\n"
@@ -214,7 +214,7 @@ TEST(ParserTest, cppComments) {
                 "  \"control-sockets\": {\n"
                 "  \"control-sockets\": {\n"
                 "    // Let's try talking to D2. Sadly, it never talks"
                 "    // Let's try talking to D2. Sadly, it never talks"
                 "    // to us back :( Maybe he doesn't like his name?\n"
                 "    // to us back :( Maybe he doesn't like his name?\n"
-                "    \"d2-server\": {"
+                "    \"d2\": {"
                 "\"socket-type\": \"unix\", \n"
                 "\"socket-type\": \"unix\", \n"
                 "\"socket-name\": \"Hector\" \n"
                 "\"socket-name\": \"Hector\" \n"
                 "} } } }";
                 "} } } }";
@@ -228,7 +228,7 @@ TEST(ParserTest, bashCommentsInline) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
                 "  \"control-sockets\": {\n"
-                "    \"d2-server\": {"
+                "    \"d2\": {"
                 "\"socket-type\": \"unix\", # Maybe Hector is not really a \n"
                 "\"socket-type\": \"unix\", # Maybe Hector is not really a \n"
                 "\"socket-name\": \"Hector\" # Unix process?\n"
                 "\"socket-name\": \"Hector\" # Unix process?\n"
                 "# Oh no! He's a windows one and just pretending!\n"
                 "# Oh no! He's a windows one and just pretending!\n"
@@ -242,12 +242,12 @@ TEST(ParserTest, multilineComments) {
                 "  \"http-host\": \"localhost\","
                 "  \"http-host\": \"localhost\","
                 "  \"http-port\": 9000,\n"
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
                 "  \"control-sockets\": {\n"
-                "    \"dhcp4-server\": {\n"
+                "    \"dhcp4\": {\n"
                 "        \"socket-type\": \"unix\"\n"
                 "        \"socket-type\": \"unix\"\n"
                 "    }\n"
                 "    }\n"
                 "  /* Ok, forget about it. If Hector doesn't want to talk,\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"
                 "     we won't talk to him either. We now have quiet days. */\n"
-                "  /* \"d2-server\": {"
+                "  /* \"d2\": {"
                 "  \"socket-type\": \"unix\",\n"
                 "  \"socket-type\": \"unix\",\n"
                 "\"socket-name\": \"Hector\"\n"
                 "\"socket-name\": \"Hector\"\n"
                 "}*/ } } }";
                 "}*/ } } }";

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

@@ -1,15 +1,15 @@
 {
 {
     "Control-agent": {
     "Control-agent": {
         "control-sockets": {
         "control-sockets": {
-            "d2-server": {
+            "d2": {
                 "socket-name": "/path/to/the/unix/socket-d2",
                 "socket-name": "/path/to/the/unix/socket-d2",
                 "socket-type": "unix"
                 "socket-type": "unix"
             },
             },
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-name": "/path/to/the/unix/socket-v4",
                 "socket-name": "/path/to/the/unix/socket-v4",
                 "socket-type": "unix"
                 "socket-type": "unix"
             },
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-name": "/path/to/the/unix/socket-v6",
                 "socket-name": "/path/to/the/unix/socket-v6",
                 "socket-type": "unix"
                 "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
         // should connect to forward commands to the DHCPv4 and DHCPv6
         // server via unix domain socket.
         // server via unix domain socket.
         "control-sockets": {
         "control-sockets": {
-            "dhcp4-server": {
+            "dhcp4": {
                 "socket-type": "unix",
                 "socket-type": "unix",
                 "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
                 "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
             },
             },
-            "dhcp6-server": {
+            "dhcp6": {
                 "socket-type": "unix",
                 "socket-type": "unix",
                 "socket-name": "/tmp/kea-dhcp6-ctrl.sock"
                 "socket-name": "/tmp/kea-dhcp6-ctrl.sock"
             }
             }