Statistics
| Branch: | Tag: | Revision:

root / ncclient / content / rpc.py @ 35ad9d81

History | View | Annotate | Download (1.3 kB)

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 xml.etree import cElementTree as ElementTree
16

    
17
from . import NETCONF_NS
18
from .util import qualify as _
19

    
20
def make(id, op):
21
    return '<rpc message-id="%s" xmlns="%s">%s</rpc>' % (id, NETCONF_NS, op)
22

    
23
#def parse(raw):
24
#    
25
#    class RootElementParser:
26
#        
27
#        def __init__(self):
28
#            self.id = 0
29
#            self.is_notification = False
30
#            
31
#        def start(self, tag, attrib):
32
#            if tag == _('rpc'):
33
#                self.id = int(attrib['message-id'])
34
#            elif tag == _('notification'):
35
#                self.is_notification = True
36
#    
37
#    target = RootElementParser()
38
#    parser = ElementTree.XMLTreeBuilder(target=target)
39
#    parser.feed(raw)
40
#    return target.id, target.is_notification
41
#