Revision e769089a ncclient/capabilities.py

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):

Also available in: Unified diff