Revision e769089a

b/ncclient/capabilities.py
13 13
# limitations under the License.
14 14

  
15 15
def _abbreviate(uri):
16
    if uri.startswith("urn:ietf:params:netconf:"):
16
    if uri.startswith("urn:ietf:params") and ":netconf:" in uri:
17 17
        splitted = uri.split(":")
18 18
        if ":capability:" in uri:
19
            name, version = splitted[5], splitted[6]
19
            if uri.startswith("urn:ietf:params:xml:ns:netconf"):
20
                name, version = splitted[7], splitted[8]
21
            else:
22
                name, version = splitted[5], splitted[6]
20 23
            return [ ":" + name, ":" + name + ":" + version ]
21 24
        elif ":base:" in uri:
22
            return [ ":base", ":base" + ":" + splitted[5] ]
25
            if uri.startswith("urn:ietf:params:xml:ns:netconf"):
26
                return [ ":base", ":base" + ":" + splitted[7] ]
27
            else:
28
                return [ ":base", ":base" + ":" + splitted[5] ]
23 29
    return []
24 30

  
25 31
def schemes(url_uri):
b/ncclient/transport/session.py
194 194

  
195 195
    def callback(self, root, raw):
196 196
        tag, attrs = root
197
        if tag == qualify("hello"):
197
        if (tag == qualify("hello")) or (tag == "hello"):
198 198
            try:
199 199
                id, capabilities = HelloHandler.parse(raw)
200 200
            except Exception as e:
......
220 220
        sid, capabilities = 0, []
221 221
        root = to_ele(raw)
222 222
        for child in root.getchildren():
223
            if child.tag == qualify("session-id"):
223
            if child.tag == qualify("session-id") or child.tag == "session-id":
224 224
                sid = child.text
225
            elif child.tag == qualify("capabilities"):
225
            elif child.tag == qualify("capabilities") or child.tag == "capabilities" :
226 226
                for cap in child.getchildren():
227
                    if cap.tag == qualify("capability"):
227
                    if cap.tag == qualify("capability") or cap.tag == "capability":
228 228
                        capabilities.append(cap.text)
229 229
        return sid, Capabilities(capabilities)

Also available in: Unified diff