address issue 8
authorShikhar Bhushan <shikhar@schmizz.net>
Tue, 15 Sep 2009 15:28:26 +0000 (15:28 +0000)
committerShikhar Bhushan <shikhar@schmizz.net>
Tue, 15 Sep 2009 15:28:26 +0000 (15:28 +0000)
git-svn-id: http://ncclient.googlecode.com/svn/trunk@175 6dbcf712-26ac-11de-a2f3-1373824ab735

ncclient/manager.py
ncclient/operations/__init__.py

index f1cb766..0705b9e 100644 (file)
@@ -35,6 +35,23 @@ def connect_ssh(*args, **kwds):
 #: Same as :meth:`connect_ssh`
 connect = connect_ssh
 
+OPERATIONS = {
+    "get": operations.Get,
+    "get_config": operations.GetConfig,
+    "edit_config": operations.EditConfig,
+    "copy_config": operations.CopyConfig,
+    "validate": operations.Validate,
+    "commit": operations.Commit,
+    "discard_changes": operations.DiscardChanges,
+    "delete_config": operations.DeleteConfig,
+    "lock": operations.Lock,
+    "unlock": operations.Unlock,
+    "close_session": operations.CloseSession,
+    "kill_session": operations.KillSession,
+    "poweroff_machine": operations.PoweroffMachine,
+    "reboot_machine": operations.RebootMachine
+}
+
 class Manager(object):
 
     """API for NETCONF operations.
@@ -56,7 +73,7 @@ class Manager(object):
         return False
 
     def __getattr__(self, name):
-        op = operations.INDEX.get(name, None)
+        op = OPERATIONS.get(name, None)
         if op is None:
             raise AttributeError
         else:
index 7648891..df50258 100644 (file)
@@ -23,28 +23,10 @@ from lock import Lock, Unlock, LockContext
 # others...
 from flowmon import PoweroffMachine, RebootMachine
 
-INDEX = {
-    'get': Get,
-    'get_config': GetConfig,
-    'edit_config': EditConfig,
-    'copy_config': CopyConfig,
-    'validate': Validate,
-    'commit': Commit,
-    'discard_changes': DiscardChanges,
-    'delete_config': DeleteConfig,
-    'lock': Lock,
-    'unlock': Unlock,
-    'close_session': CloseSession,
-    'kill_session': KillSession,
-    'poweroff_machine': PoweroffMachine,
-    'reboot_machine': RebootMachine
-}
-
 __all__ = [
     'RPC',
     'RPCReply',
     'RPCError',
-    'OPERATIONS',
     'Get',
     'GetConfig',
     'GetReply',