[svn] commit: r348 - in /branches/jelte-datadef/src: bin/bigtool/run_bigtool.py bin/bind10/bind10.py bin/parkinglot/ccsession.cc bin/parkinglot/parkinglot.spec lib/bigtool/bigtool.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Dec 4 10:19:53 UTC 2009
Author: jelte
Date: Fri Dec 4 10:19:53 2009
New Revision: 348
Log:
example direct module command, these do not go through the config manager but directly to modules
Modified:
branches/jelte-datadef/src/bin/bigtool/run_bigtool.py
branches/jelte-datadef/src/bin/bind10/bind10.py
branches/jelte-datadef/src/bin/parkinglot/ccsession.cc
branches/jelte-datadef/src/bin/parkinglot/parkinglot.spec
branches/jelte-datadef/src/lib/bigtool/bigtool.py
Modified: branches/jelte-datadef/src/bin/bigtool/run_bigtool.py
==============================================================================
--- branches/jelte-datadef/src/bin/bigtool/run_bigtool.py (original)
+++ branches/jelte-datadef/src/bin/bigtool/run_bigtool.py Fri Dec 4 10:19:53 2009
@@ -33,7 +33,7 @@
desc = "same here")
for command in module_commands:
cmd = CommandInfo(name = command["command_name"],
- desc = "todo2",
+ desc = command["command_description"],
need_inst_param = False)
for arg in command["command_args"]:
param = ParamInfo(name = arg["item_name"],
Modified: branches/jelte-datadef/src/bin/bind10/bind10.py
==============================================================================
--- branches/jelte-datadef/src/bin/bind10/bind10.py (original)
+++ branches/jelte-datadef/src/bin/bind10/bind10.py Fri Dec 4 10:19:53 2009
@@ -100,7 +100,8 @@
self.c_channel_port)
c_channel_env = { "ISC_MSGQ_PORT": str(self.c_channel_port), }
try:
- c_channel = ProcessInfo("msgq", "msgq", c_channel_env, True)
+ #c_channel = ProcessInfo("msgq", "msgq", c_channel_env, True)
+ c_channel = ProcessInfo("msgq", "msgq", c_channel_env)
except Exception as e:
return "Unable to start msgq; " + str(e)
self.processes[c_channel.pid] = c_channel
Modified: branches/jelte-datadef/src/bin/parkinglot/ccsession.cc
==============================================================================
--- branches/jelte-datadef/src/bin/parkinglot/ccsession.cc (original)
+++ branches/jelte-datadef/src/bin/parkinglot/ccsession.cc Fri Dec 4 10:19:53 2009
@@ -131,9 +131,23 @@
if (cmd != NULL) {
return std::pair<string, ElementPtr>("delzone", cmd);
}
+ // todo: common interface for config updates?
cmd = data->get("config_update");
if (cmd != NULL) {
return std::pair<string, ElementPtr>("config_update", cmd);
+ }
+ // todo: common interface for command handling
+ cmd = data->get("command");
+ // the format is defined partly by convention;
+ // { "command": [ "module", "command", args... ]
+ // args is defined in the .spec file
+ // we could do checking here as well if we want
+ if (cmd != NULL && cmd->get(1)->string_value() == "print_message") {
+ cout << "[parkinglot] " << cmd->get(2)->string_value() << endl;
+ ElementPtr answer = Element::create_from_string("{ \"result\": [0] }");
+ cout << "[XX] sending reply: " << answer << endl;
+ session_.reply(routing, answer);
+ cout << "[XX] reply sent" << endl;
}
}
Modified: branches/jelte-datadef/src/bin/parkinglot/parkinglot.spec
==============================================================================
--- branches/jelte-datadef/src/bin/parkinglot/parkinglot.spec (original)
+++ branches/jelte-datadef/src/bin/parkinglot/parkinglot.spec Fri Dec 4 10:19:53 2009
@@ -23,18 +23,10 @@
],
"commands": [
{
- "command_name": "zone_add",
+ "command_name": "print_message",
+ "command_description": "Print the given message to stdout",
"command_args": [ {
- "item_name": "zone_name",
- "item_type": "string",
- "item_optional": False,
- "item_default": ""
- } ]
- },
- {
- "command_name": "zone_delete",
- "command_args": [ {
- "item_name": "zone_name",
+ "item_name": "message",
"item_type": "string",
"item_optional": False,
"item_default": ""
Modified: branches/jelte-datadef/src/lib/bigtool/bigtool.py
==============================================================================
--- branches/jelte-datadef/src/lib/bigtool/bigtool.py (original)
+++ branches/jelte-datadef/src/lib/bigtool/bigtool.py Fri Dec 4 10:19:53 2009
@@ -315,7 +315,7 @@
if not self.cc:
return
- groupName = (cmd.module == 'boss') and 'Boss' or 'ConfigManager'
+ groupName = cmd.module
content = [cmd.module, cmd.command]
values = cmd.params.values()
if len(values) > 0:
@@ -323,9 +323,12 @@
msg = {"command":content}
print("begin to send the message...")
+
+ # XXTODO: remove this with new msgq
+ self.cc.group_subscribe(groupName)
try:
- self.cc.group_sendmsg(msg, groupName, instance = 'boss')
+ self.cc.group_sendmsg(msg, groupName)
print("waiting for %s reply..." % groupName)
reply, env = self.cc.group_recvmsg(False)
@@ -335,3 +338,4 @@
+
More information about the bind10-changes
mailing list