Revision 53e1a046 ncclient/operations/retrieve.py

b/ncclient/operations/retrieve.py
84 84
        node.append(util.datastore_or_url("source", source, self._assert))
85 85
        if filter is not None:
86 86
            node.append(util.build_filter(filter))
87
        return self._request(node)
88

  
89
class Dispatch(RPC):
90
    """Generic retrieving wrapper. Eg. dispatch('clear-arp-table') or dispatch element  
91
    like :
92
    xsd_fetch = new_ele('get-xnm-information')
93
    sub_ele(xsd_fetch, 'type').text="xml-schema"
94
    sub_ele(xsd_fetch, 'namespace').text="junos-configuration
95
    dispatch(xsd_fetch)    
96
    to fetch entire xsd sxhema file from Juniper
97
    """
98
    
99
    REPLY_CLS = GetReply
100
    
101
    def request(self, rpc_command, source=None, filter=None):
102
        if ET.iselement(rpc_command):
103
            node = rpc_command
104
        else:
105
            node = new_ele(rpc_command)
106
        if source is not None:
107
            node.append(util.datastore_or_url("source", source, self._assert))
108
        if filter is not None:
109
            node.append(util.build_filter(filter))
87 110
        return self._request(node)

Also available in: Unified diff