Parcourir la source

Renamed bigtool to bindctl.
Moved some directories for this and edited files
to change BIGTOOL, BigTool, bigtool to
BINDCTL, BindCtl, bindctl respectively.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@488 e5f2f494-b856-4b98-b285-d166d9295462

Jeremy C. Reed il y a 15 ans
Parent
commit
9f56fe9d7b

+ 5 - 5
README

@@ -37,11 +37,11 @@ The server will listen on port 5300 for DNS requests.
 
 CONFIGURATION
 
-Commands can be given through the tool bigtool;
-cd src/bin/bigtool
-sh run_bigtool
+Commands can be given through the tool bindctl;
+cd src/bin/bindctl
+sh run_bindctl
 
-The server must be running for bigtool to work.
+The server must be running for bindctl to work.
 
 The following configuration commands are available
 
@@ -66,7 +66,7 @@ config commit: Commit all changes
 
 EXAMPLE SESSION
 
-~> sh run_bigtool
+~> sh run_bindctl
 > config show
 ParkingLot/	module	
 > config show ParkingLot/

+ 3 - 3
configure.ac

@@ -113,8 +113,8 @@ AC_SUBST(GTEST_LDADD)
 AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/bin/Makefile
-                 src/bin/bigtool/Makefile
                  src/bin/bind10/Makefile
+                 src/bin/bindctl/Makefile
                  src/bin/host/Makefile
                  src/bin/msgq/Makefile
                  src/bin/parkinglot/Makefile
@@ -124,16 +124,16 @@ AC_CONFIG_FILES([Makefile
                  src/lib/dns/Makefile
                ])
 AC_OUTPUT([src/bin/bind-cfgd/bind-cfgd
-           src/bin/bigtool/run_bigtool
            src/bin/bind10/bind10
            src/bin/bind10/bind10_test
+           src/bin/bindctl/run_bindctl
 	   src/bin/msgq/msgq
 	   src/bin/msgq/msgq_test
            src/bin/parkinglot/config.h
           ], [
            chmod +x src/bin/bind-cfgd/bind-cfgd
-           chmod +x src/bin/bigtool/run_bigtool
            chmod +x src/bin/bind10/bind10
+           chmod +x src/bin/bindctl/run_bindctl
            chmod +x src/bin/msgq/msgq
            chmod +x src/bin/msgq/msgq_test
           ])

+ 1 - 1
src/bin/Makefile.am

@@ -1 +1 @@
-SUBDIRS = bigtool bind10 msgq parkinglot host
+SUBDIRS = bind10 bindctl msgq parkinglot host

+ 0 - 2
src/bin/bigtool/Makefile.am

@@ -1,2 +0,0 @@
-bin_SCRIPTS = run_bigtool run_bigtool.py
-man_MANS = bindctl.1

+ 0 - 10
src/bin/bigtool/run_bigtool.in

@@ -1,10 +0,0 @@
-#! /bin/sh
-
-PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
-BIGTOOL_PATH=.
-
-PYTHONPATH=../../lib/cc/python:../../lib/bigtool/
-export PYTHONPATH
-
-cd ${BIGTOOL_PATH}
-exec ${PYTHON_EXEC} -O run_bigtool.py $*

+ 2 - 0
src/bin/bindctl/Makefile.am

@@ -0,0 +1,2 @@
+bin_SCRIPTS = run_bindctl run_bindctl.py
+man_MANS = bindctl.1

+ 1 - 1
src/bin/bigtool/bindctl.1

@@ -26,7 +26,7 @@ connection.
 If this connection is not established,
 .Nm
 will exit.
-.\" TODO: what if msgq is running but no BigTool or Boss groups?
+.\" TODO: what if msgq is running but no BindCtl or Boss groups?
 .Pp
 The command-line prompt shows
 .Dq "\*[Gt] " .

+ 10 - 0
src/bin/bindctl/run_bindctl.in

@@ -0,0 +1,10 @@
+#! /bin/sh
+
+PYTHON_EXEC=${PYTHON_EXEC:-@PYTHON@}
+BINDCTL_PATH=.
+
+PYTHONPATH=../../lib/cc/python:../../lib/bindctl/
+export PYTHONPATH
+
+cd ${BINDCTL_PATH}
+exec ${PYTHON_EXEC} -O run_bindctl.py $*

+ 9 - 9
src/bin/bigtool/run_bigtool.py

@@ -1,9 +1,9 @@
 from moduleinfo  import *
-from bigtool import *
+from bindctl import *
 import ISC
 
 
-def _prepare_fake_data(bigtool):
+def _prepare_fake_data(bindctl):
     shutdown_param = ParamInfo(name = "module_name", desc = "the name of module")
     shutdown_cmd = CommandInfo(name = 'shutdown', desc = "stop bind10",
                                need_inst_param = False)
@@ -11,13 +11,13 @@ def _prepare_fake_data(bigtool):
     boss_module = ModuleInfo(name = "boss", desc = "boss of bind10")
     boss_module.add_command(shutdown_cmd)               
 
-    bigtool.add_module_info(boss_module)
+    bindctl.add_module_info(boss_module)
 
-def prepare_commands(bigtool, command_spec):
+def prepare_commands(bindctl, command_spec):
     for module_name in command_spec.keys():
-        bigtool.prepare_module_commands(module_name, command_spec[module_name])
+        bindctl.prepare_module_commands(module_name, command_spec[module_name])
 
-def prepare_config_commands(bigtool):
+def prepare_config_commands(bindctl):
     module = ModuleInfo(name = "config", desc = "Configuration commands")
     cmd = CommandInfo(name = "show", desc = "Show configuration", need_inst_param = False)
     param = ParamInfo(name = "identifier", type = "string", optional=True)
@@ -61,16 +61,16 @@ def prepare_config_commands(bigtool):
     cmd.add_param(param)
     module.add_command(cmd)
 
-    bigtool.add_module_info(module)
+    bindctl.add_module_info(module)
     
 
 if __name__ == '__main__':
     try:
         cc = ISC.CC.Session()
-        cc.group_subscribe("BigTool", "*")
+        cc.group_subscribe("BindCtl", "*")
         cc.group_subscribe("Boss", "*")
 
-        tool = BigTool(cc)
+        tool = BindCtl(cc)
         cc.group_sendmsg({ "command": ["get_commands"] }, "ConfigManager")
         command_spec, env =  cc.group_recvmsg(False)
         prepare_commands(tool, command_spec["result"][1])

+ 0 - 10
src/lib/bigtool/run_unittest

@@ -1,10 +0,0 @@
-#! /bin/sh
-
-PYTHON_EXEC=python3
-BIGTOOL_PATH=.
-
-PYTHONPATH=../../lib/cc/python:../../lib/bigtool/
-export PYTHONPATH
-
-cd ${BIGTOOL_PATH}
-exec ${PYTHON_EXEC} -O unittest_bigtool.py $*

+ 2 - 2
src/lib/bind-cfgd/python/bind-cfgd.py

@@ -171,10 +171,10 @@ class ConfigManager:
             spec = msg["data_specification"]
             if "config_data" in spec:
                 self.set_config(spec["module_name"], spec["config_data"])
-                self.cc.group_sendmsg({ "specification_update": [ spec["module_name"], spec["config_data"] ] }, "BigTool")
+                self.cc.group_sendmsg({ "specification_update": [ spec["module_name"], spec["config_data"] ] }, "BindCtl")
             if "commands" in spec:
                 self.set_commands(spec["module_name"], spec["commands"])
-                self.cc.group_sendmsg({ "commands_update": [ spec["module_name"], spec["commands"] ] }, "BigTool")
+                self.cc.group_sendmsg({ "commands_update": [ spec["module_name"], spec["commands"] ] }, "BindCtl")
             answer["result"] = [ 0 ]
         else:
             print("[bind-cfgd] unknown message: " + str(msg))

+ 1 - 1
src/lib/bigtool/__init__.py

@@ -1 +1 @@
-__all__ = ['mycollections', 'exception', 'moduleinfo', 'command', 'bigtool']
+__all__ = ['mycollections', 'exception', 'moduleinfo', 'command', 'bindctl']

+ 11 - 11
src/lib/bigtool/bigtool.py

@@ -3,7 +3,7 @@ import readline
 from cmd import Cmd
 from exception import *
 from moduleinfo import *
-from command import BigToolCmd
+from command import BindCtlCmd
 from xml.dom import minidom
 import ISC
 import ISC.CC.data
@@ -14,18 +14,18 @@ except ImportError:
     from mycollections import OrderedDict
 
 
-CONST_BIGTOOL_HELP = """Bigtool, verstion 0.1
+CONST_BINDCTL_HELP = """BindCtl, verstion 0.1
 usage: <module name> <command name> [param1 = value1 [, param2 = value2]]
 Type Tab character to get the hint of module/command/paramters.
-Type \"help(? h)\" for help on bigtool.
+Type \"help(? h)\" for help on bindctl.
 Type \"<module_name> help\" for help on the specific module.
 Type \"<module_name> <command_name> help\" for help on the specific command.
 \nAvailable module names: """
 
 CONST_COMMAND_NODE = "command"
 
-class BigTool(Cmd):
-    """simple bigtool example."""    
+class BindCtl(Cmd):
+    """simple bindctl example."""    
 
     def __init__(self, session = None):
         Cmd.__init__(self)
@@ -34,7 +34,7 @@ class BigTool(Cmd):
         self.prompt = self.prompt_end
         self.ruler = '-'
         self.modules = OrderedDict()
-        self.add_module_info(ModuleInfo("help", desc = "Get help for bigtool"))
+        self.add_module_info(ModuleInfo("help", desc = "Get help for bindctl"))
         self.cc = session
         self.config_data = ISC.CC.data.UIConfigData("", session)
 
@@ -135,7 +135,7 @@ class BigTool(Cmd):
             return True
             
     def do_help(self, name):
-        print(CONST_BIGTOOL_HELP)
+        print(CONST_BINDCTL_HELP)
         for k in self.modules.keys():
             print("\t", self.modules[k])
                 
@@ -157,7 +157,7 @@ class BigTool(Cmd):
             hints = []
             cur_line = readline.get_line_buffer()            
             try:
-                cmd = BigToolCmd(cur_line)
+                cmd = BindCtlCmd(cur_line)
                 if not cmd.params and text:
                     hints = self._get_command_startswith(cmd.module, text)
                 else:                       
@@ -185,7 +185,7 @@ class BigTool(Cmd):
             except CmdParamFormatError as e:
                 hints = self._get_param_startswith(e.module, e.command, text)
 
-            except BigToolException:
+            except BindCtlException:
                 hints = []
 
             self.hint = hints
@@ -261,10 +261,10 @@ class BigTool(Cmd):
         # check if there's anything on the cc first
         self.check_cc_messages()
         try:
-            cmd = BigToolCmd(line)
+            cmd = BindCtlCmd(line)
             self.validate_cmd(cmd)
             self._handle_cmd(cmd)
-        except BigToolException as e:
+        except BindCtlException as e:
             print("Error! ", e)
             self._print_correct_usage(e)
             

+ 1 - 1
src/lib/bigtool/command.py

@@ -18,7 +18,7 @@ PARAM_PATTERN = re.compile(param_name_str + param_value_str + next_params_str)
 # Used for module and command name
 NAME_PATTERN = re.compile("^\s*(?P<name>[\w]+)(?P<blank>\s*)(?P<others>.*)$")
 
-class BigToolCmd:
+class BindCtlCmd:
     """ This class will parse the command line usr input into three part
     module name, cmmand, parameters
     the first two parts are strings and parameter is one hash, 

+ 4 - 4
src/lib/bigtool/exception.py

@@ -1,11 +1,11 @@
-class BigToolException(Exception):
-    """Abstract base class shared by all bigtool exceptions"""
+class BindCtlException(Exception):
+    """Abstract base class shared by all bindctl exceptions"""
     def __str__(self):
         return "Big tool has problem"
 
 # Begin define Format exception
 
-class CmdFormatError(BigToolException):
+class CmdFormatError(BindCtlException):
     """Command is malformed"""
     def __str__(self):
         return "Command is malformed"
@@ -50,7 +50,7 @@ class CmdParamFormatError(CmdFormatError):
         
 # Begin define the exception for syntax
 
-class CmdSyntaxError(BigToolException):
+class CmdSyntaxError(BindCtlException):
     """Command line has syntax error"""
     
     def __str__(self):

src/lib/bigtool/moduleinfo.py → src/lib/bindctl/moduleinfo.py


src/lib/bigtool/mycollections.py → src/lib/bindctl/mycollections.py


+ 10 - 0
src/lib/bindctl/run_unittest

@@ -0,0 +1,10 @@
+#! /bin/sh
+
+PYTHON_EXEC=python3
+BINDCTL_PATH=.
+
+PYTHONPATH=../../lib/cc/python:../../lib/bindctl/
+export PYTHONPATH
+
+cd ${BINDCTL_PATH}
+exec ${PYTHON_EXEC} -O unittest_bindctl.py $*

+ 19 - 19
src/lib/bigtool/unittest_bigtool.py

@@ -1,6 +1,6 @@
 import unittest
 import command
-import bigtool
+import bindctl
 from moduleinfo import *
 from exception import *    
 try:
@@ -11,11 +11,11 @@ except ImportError:
 class TestCmdLex(unittest.TestCase):
     
     def my_assert_raise(self, exception_type, cmd_line):
-        self.assertRaises(exception_type, command.BigToolCmd, cmd_line)
+        self.assertRaises(exception_type, command.BindCtlCmd, cmd_line)
 
 
     def testCommandWithoutParameter(self):
-        cmd = command.BigToolCmd("zone add")
+        cmd = command.BindCtlCmd("zone add")
         assert cmd.module == "zone"
         assert cmd.command == "add"
         self.assertEqual(len(cmd.params), 0)
@@ -27,7 +27,7 @@ class TestCmdLex(unittest.TestCase):
                  "zone add zone_name = 'cnnic.cn\", file ='cnnic.cn.file' master=1.1.1.1, " }
         
         for cmd_line in lines:
-            cmd = command.BigToolCmd(cmd_line)
+            cmd = command.BindCtlCmd(cmd_line)
             assert cmd.module == "zone"
             assert cmd.command == "add"
             assert cmd.params["zone_name"] == "cnnic.cn"
@@ -36,15 +36,15 @@ class TestCmdLex(unittest.TestCase):
             
             
     def testCommandWithListParam(self):
-            cmd = command.BigToolCmd("zone set zone_name='cnnic.cn', master='1.1.1.1, 2.2.2.2'")
+            cmd = command.BindCtlCmd("zone set zone_name='cnnic.cn', master='1.1.1.1, 2.2.2.2'")
             assert cmd.params["master"] == '1.1.1.1, 2.2.2.2'            
         
         
     def testCommandWithHelpParam(self):
-        cmd = command.BigToolCmd("zone add help")
+        cmd = command.BindCtlCmd("zone add help")
         assert cmd.params["help"] == "help"
         
-        cmd = command.BigToolCmd("zone add help *&)&)*&&$#$^%")
+        cmd = command.BindCtlCmd("zone add help *&)&)*&&$#$^%")
         assert cmd.params["help"] == "help"
         self.assertEqual(len(cmd.params), 1)
         
@@ -82,10 +82,10 @@ class TestCmdLex(unittest.TestCase):
 
 class TestCmdSyntax(unittest.TestCase):
     
-    def _create_bigtool(self):
-        """Create one bigtool"""
+    def _create_bindctl(self):
+        """Create one bindctl"""
         
-        tool = bigtool.BigTool()        
+        tool = bindctl.BindCtl()        
         zone_file_param = ParamInfo(name = "zone_file")
         load_cmd = CommandInfo(name = "load")
         load_cmd.add_param(zone_file_param)
@@ -108,17 +108,17 @@ class TestCmdSyntax(unittest.TestCase):
         
         
     def setUp(self):
-        self.bigtool = self._create_bigtool()
+        self.bindctl = self._create_bindctl()
         
         
     def no_assert_raise(self, cmd_line):
-        cmd = command.BigToolCmd(cmd_line)
-        self.bigtool.validate_cmd(cmd) 
+        cmd = command.BindCtlCmd(cmd_line)
+        self.bindctl.validate_cmd(cmd) 
         
         
     def my_assert_raise(self, exception_type, cmd_line):
-        cmd = command.BigToolCmd(cmd_line)
-        self.assertRaises(exception_type, self.bigtool.validate_cmd, cmd)  
+        cmd = command.BindCtlCmd(cmd_line)
+        self.assertRaises(exception_type, self.bindctl.validate_cmd, cmd)  
         
         
     def testValidateSuccess(self):
@@ -156,12 +156,12 @@ class TestNameSequence(unittest.TestCase):
     Test if the module/command/parameters is saved in the order creation
     """
     
-    def _create_bigtool(self):
-        """Create one bigtool"""     
+    def _create_bindctl(self):
+        """Create one bindctl"""     
         
         self._cmd = CommandInfo(name = "load")
         self.module = ModuleInfo(name = "zone")
-        self.tool = bigtool.BigTool()        
+        self.tool = bindctl.BindCtl()        
         for random_str in self.random_names:
             self._cmd.add_param(ParamInfo(name = random_str))
             self.module.add_command(CommandInfo(name = random_str))
@@ -169,7 +169,7 @@ class TestNameSequence(unittest.TestCase):
         
     def setUp(self):
         self.random_names = ['1erdfeDDWsd', '3fe', '2009erd', 'Fe231', 'tere142', 'rei8WD']
-        self._create_bigtool()
+        self._create_bindctl()
         
     def testSequence(self):        
         param_names = self._cmd.get_param_names()