more doc updates
[ncclient] / ncclient / operations / retrieve.py
index 3d09327..2c155a9 100644 (file)
 
 from rpc import RPC, RPCReply
 
-from ncclient import content
-from copy import deepcopy
+from ncclient.xml_ import *
 
 import util
 
 class GetReply(RPCReply):
 
-    # TESTED
-
-    """Adds attributes for the *<data>* element to :class:`RPCReply`, which
-    pertains to the :class:`Get` and :class:`GetConfig` operations."""
+    """Adds attributes for the *data* element to `RPCReply`."""
 
     def _parsing_hook(self, root):
         self._data = None
         if not self._errors:
-            self._data = content.find(root, 'data',
-                                      nslist=[content.BASE_NS,
-                                              content.CISCO_BS])
-
+            self._data = root.find(qualify("data"))
+    
     @property
     def data_ele(self):
-        "*<data>* element as an :class:`~xml.etree.ElementTree.Element`"
+        "*data* element as an :class:`~xml.etree.ElementTree.Element`"
         if not self._parsed:
             self.parse()
         return self._data
 
     @property
     def data_xml(self):
-        "*<data>* element as an XML string"
+        "*data* element as an XML string"
         if not self._parsed:
             self.parse()
-        return content.ele2xml(self._data)
-
-    @property
-    def data_dtree(self):
-        "*<data>* element in :ref:`dtree`"
-        return content.ele2dtree(self._data)
-
-    #: Same as :attr:`data_ele`
+        return to_xml(self._data)
+    
     data = data_ele
+    "Same as :attr:`data_ele`"
 
 
 class Get(RPC):
 
-    # TESTED
-
-    "The *<get>* RPC"
-
-    SPEC = {'tag': 'get', 'subtree': []}
+    "The *get* RPC."
 
     REPLY_CLS = GetReply
+    "See :class:`GetReply`."
 
     def request(self, filter=None):
-        """
-        :arg filter: optional; see :ref:`filter`
+        """Retrieve running configuration and device state information.
+
+        *filter* specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
 
-        :seealso: :ref:`return`
+        :seealso: :ref:`filter_params`
         """
-        spec = deepcopy(Get.SPEC)
+        node = new_ele("get")
         if filter is not None:
-            spec['subtree'].append(util.build_filter(filter))
-        return self._request(spec)
+            node.append(util.build_filter(filter))
+        return self._request(node)
 
 
 class GetConfig(RPC):
 
-    # TESTED
-
-    "The *<get-config>* RPC"
-
-    SPEC = {'tag': 'get-config', 'subtree': []}
+    "The *get-config* RPC."
 
     REPLY_CLS = GetReply
+    "See :class:`GetReply`."
 
     def request(self, source, filter=None):
-        """
-        :arg source: See :ref:`source_target`
+        """Retrieve all or part of a specified configuration.
 
-        :arg filter: optional; see :ref:`filter`
+        *source* name of the configuration datastore being queried
 
-        :seealso: :ref:`return`
-        """
-        spec = deepcopy(GetConfig.SPEC)
-        spec['subtree'].append(util.store_or_url('source', source, self._assert))
+        *filter* specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
+
+        :seealso: :ref:`filter_params`"""
+        node = new_ele("get-config")
+        node.append(util.datastore_or_url("source", source, self._assert))
         if filter is not None:
-            spec['subtree'].append(util.build_filter(filter))
-        return self._request(spec)
+            node.append(util.build_filter(filter))
+        return self._request(node)
\ No newline at end of file