Revision dd8b8dd7 ncclient/operations/edit.py
b/ncclient/operations/edit.py | ||
---|---|---|
29 | 29 |
|
30 | 30 |
def request(self, target, config, default_operation=None, test_option=None, |
31 | 31 |
error_option=None): |
32 |
""" |
|
33 |
:arg target: see :ref:`source_target` |
|
34 |
:type target: string |
|
35 |
|
|
36 |
:arg config: a config element in :ref:`dtree` |
|
37 |
:type config: `string` or `dict` or :class:`~xml.etree.ElementTree.Element` |
|
38 |
|
|
39 |
:arg default_operation: optional; one of {'merge', 'replace', 'none'} |
|
40 |
:type default_operation: `string` |
|
41 |
|
|
42 |
:arg error_option: optional; one of {'stop-on-error', 'continue-on-error', 'rollback-on-error'}. Last option depends on the *:rollback-on-error* capability |
|
43 |
:type error_option: string |
|
44 |
|
|
45 |
:arg test_option: optional; one of {'test-then-set', 'set'}. Depends on *:validate* capability. |
|
46 |
:type test_option: string |
|
47 |
|
|
48 |
:seealso: :ref:`return` |
|
49 |
""" |
|
32 |
#:arg default_operation: optional; one of {'merge', 'replace', 'none'} |
|
33 |
#:type default_operation: `string` |
|
34 |
# |
|
35 |
#:arg error_option: optional; one of {'stop-on-error', 'continue-on-error', 'rollback-on-error'}. Last option depends on the *:rollback-on-error* capability |
|
36 |
#:type error_option: string |
|
37 |
# |
|
38 |
#:arg test_option: optional; one of {'test-then-set', 'set'}. Depends on *:validate* capability. |
|
39 |
#:type test_option: string |
|
50 | 40 |
node = new_ele("edit-config") |
51 | 41 |
node.append(util.datastore_or_url("target", target, self._assert)) |
52 | 42 |
if error_option is not None: |
... | ... | |
68 | 58 |
"*<delete-config>* RPC" |
69 | 59 |
|
70 | 60 |
def request(self, target): |
71 |
""" |
|
72 |
:arg target: See :ref:`source_target` |
|
73 |
:type target: `string` or `dict` or :class:`~xml.etree.ElementTree.Element` |
|
74 |
|
|
75 |
:seealso: :ref:`return` |
|
76 |
""" |
|
77 | 61 |
node = new_ele("delete-config") |
78 | 62 |
node.append(util.datastore_or_url("target", target, self._assert)) |
79 | 63 |
return self._request(spec) |
... | ... | |
84 | 68 |
"*<copy-config>* RPC" |
85 | 69 |
|
86 | 70 |
def request(self, source, target): |
87 |
""" |
|
88 |
:arg source: See :ref:`source_target` |
|
89 |
:type source: `string` or `dict` or :class:`~xml.etree.ElementTree.Element` |
|
90 |
|
|
91 |
:arg target: See :ref:`source_target` |
|
92 |
:type target: `string` or `dict` or :class:`~xml.etree.ElementTree.Element` |
|
93 |
|
|
94 |
:seealso: :ref:`return` |
|
95 |
""" |
|
96 | 71 |
node = new_ele("copy-config") |
97 | 72 |
node.append(util.datastore_or_url("target", target, self._assert)) |
98 | 73 |
node.append(util.datastore_or_url("source", source, self._assert)) |
... | ... | |
106 | 81 |
DEPENDS = [':validate'] |
107 | 82 |
|
108 | 83 |
def request(self, source): |
109 |
""" |
|
110 |
:arg source: See :ref:`source_target` |
|
111 |
:type source: `string` or `dict` or :class:`~xml.etree.ElementTree.Element` |
|
112 |
|
|
113 |
:seealso: :ref:`return` |
|
114 |
""" |
|
115 | 84 |
node = new_ele("validate") |
116 | 85 |
try: |
117 | 86 |
src = validated_element(source, ("config", qualify("config"))) |
... | ... | |
132 | 101 |
""" |
133 | 102 |
Requires *:confirmed-commit* capability if *confirmed* argument is |
134 | 103 |
:const:`True`. |
135 |
|
|
136 |
:arg confirmed: optional; request a confirmed commit |
|
137 |
:type confirmed: `bool` |
|
138 |
|
|
139 |
:arg timeout: specify timeout for confirmed commit |
|
140 |
:type timeout: `int` |
|
141 |
|
|
142 |
:seealso: :ref:`return` |
|
143 | 104 |
""" |
105 |
#:arg confirmed: optional; request a confirmed commit |
|
106 |
#:type confirmed: `bool` |
|
107 |
# |
|
108 |
#:arg timeout: specify timeout for confirmed commit |
|
109 |
#:type timeout: `int` |
|
144 | 110 |
node = new_ele("commit") |
145 | 111 |
if confirmed: |
146 | 112 |
self._assert(":confirmed-commit") |
... | ... | |
158 | 124 |
DEPENDS = [":candidate"] |
159 | 125 |
|
160 | 126 |
def request(self): |
161 |
":seealso: :ref:`return`" |
|
162 | 127 |
return self._request(new_ele("discard-changes")) |
Also available in: Unified diff