moving forward
[ncclient] / ncclient / operations / edit.py
1 # Copyright 2009 Shikhar Bhushan
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from ncclient.rpc import RPC
16
17 # TODO
18
19
20 '''
21 notes
22 -> editconfig and copyconfig <running> target depends on :writable-running
23 -> 
24
25 '''
26
27 class EditConfig(RPC):
28     
29     SPEC = {
30         'tag': 'edit-config',
31         'children': [
32             { 'target': None }
33         ]
34     }
35     
36     def request(self):
37         pass
38
39 class CopyConfig(RPC):
40     
41     SPEC = {
42         
43     }
44     
45     def request(self):
46         pass
47
48 class DeleteConfig(RPC):
49     
50     SPEC = {
51         'tag': 'delete-config',
52         'children': [
53             'tag': 'target',
54             'children': {'tag': None }
55         ]
56     }
57     
58     def request(self, target=None, targeturl=None):
59         spec = deepcopy(DeleteConfig.SPEC)
60         
61
62 class Validate(RPC):
63     
64     DEPENDS = ['urn:ietf:params:netconf:capability:validate:1.0']
65     SPEC = {}
66     
67     def request(self):
68         pass
69
70
71 class Commit(RPC):
72     
73     SPEC = {'tag': 'commit'}
74     
75     def request(self):
76         return self._request(Commit.SPEC)
77
78
79 class DiscardChanges(RPC):
80     
81     DEPENDS = ['urn:ietf:params:netconf:capability:candidate:1.0']
82     SPEC = {'tag': 'discard-changes'}
83     
84     def request(self):
85         return self._request(DiscardChanges.SPEC)