Revision dd225c7a ncclient/capabilities.py

b/ncclient/capabilities.py
12 12
# See the License for the specific language governing permissions and
13 13
# limitations under the License.
14 14

  
15
_capability_map = {
16
    'urn:liberouter:params:netconf:capability:power-control:1.0':
17
        [':power-control', ':power-control:1.0']
18
}
19

  
15 20
def _abbreviate(uri):
16 21
    if uri.startswith('urn:ietf:params:netconf:'):
17 22
        splitted = uri.split(':')
......
19 24
            return [ ':' + splitted[5], ':' + splitted[5] + ':' + splitted[6] ]
20 25
        elif ':base:' in uri:
21 26
            return [ ':base', ':base' + ':'+ splitted[5] ]
22
        else:
23
            return []
24
    else:
25
        return []
27
    elif uri in _capability_map:
28
        return _capability_map[uri]
29
    return []
26 30

  
27 31
def schemes(url_uri):
28 32
    """Given a URI that has a *scheme* query string (i.e. *:url* capability
......
87 91
        """
88 92
        return key in self
89 93

  
90
    def get_uris(self, shorthand):
91
        return [uri for uri, abbrs in self._dict.items() if shorthand in abbrs]
94
    def get_uri(self, shorthand):
95
        for uri, abbrs in self._dict.items():
96
            if shorthand in abbrs:
97
                return uri
92 98

  
93 99
#: :class:`Capabilities` object representing the capabilities currently supported by NCClient
94 100
CAPABILITIES = Capabilities([
......
101 107
    'urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file,https,sftp',
102 108
    'urn:ietf:params:netconf:capability:validate:1.0',
103 109
    'urn:ietf:params:netconf:capability:xpath:1.0',
110
    'urn:liberouter:params:netconf:capability:power-control:1.0'
104 111
    #'urn:ietf:params:netconf:capability:notification:1.0', # TODO
105 112
    #'urn:ietf:params:netconf:capability:interleave:1.0' # theoretically already supported
106 113
])

Also available in: Unified diff