Revision 0b7d3b31 ncclient/operations/edit.py

b/ncclient/operations/edit.py
18 18

  
19 19
import util
20 20

  
21
import logging
22
logger = logging.getLogger('ncclient.operations.edit')
23

  
24

  
25

  
21 26
"Operations related to changing device configuration"
22 27

  
23 28
class EditConfig(RPC):
......
87 92

  
88 93
class CopyConfig(RPC):
89 94

  
95
    # TESTED
96

  
90 97
    "*<copy-config>* RPC"
91 98

  
92 99
    SPEC = {'tag': 'copy-config', 'subtree': []}
......
102 109
        :seealso: :ref:`return`
103 110
        """
104 111
        spec = CopyConfig.SPEC.copy()
105
        spec['subtree'].append(util.store_or_url('source', source, self._assert))
106 112
        spec['subtree'].append(util.store_or_url('target', target, self._assert))
113
        spec['subtree'].append(util.store_or_url('source', source, self._assert))
107 114
        return self._request(spec)
108 115

  
109 116

  
110 117
class Validate(RPC):
111 118

  
119
    # TESTED
120

  
112 121
    "*<validate>* RPC. Depends on the *:validate* capability."
113 122

  
114 123
    DEPENDS = [':validate']
......
124 133
        """
125 134
        spec = Validate.SPEC.copy()
126 135
        try:
127
            spec['subtree'].append({
128
                'tag': 'source',
129
                'subtree':
130
                    content.validated_element(
131
                        config, ('config', content.qualify('config')))
132
                })
133
        except:
134
            spec['subtree'].append(util.store_or_url('source', source, self._assert))
136
            src = content.validated_element(source, ('config', content.qualify('config')))
137
        except Exception as e:
138
            logger.debug(e)
139
            src = util.store_or_url('source', source, self._assert)
140
        spec['subtree'].append({
141
            'tag': 'source',
142
            'subtree': src
143
            })
135 144
        return self._request(spec)
136 145

  
137 146

  
......
178 187
    DEPENDS = [':candidate']
179 188

  
180 189
    SPEC = {'tag': 'discard-changes'}
190

  
191
    def request(self):
192
        ":seealso: :ref:`return`"
193
        return self._request(DiscardChanges.SPEC)

Also available in: Unified diff