blob: 7398217e641b841ce3803950c0ee923f203ab14d [file] [log] [blame]
Khen Nursimulu3869d8d2016-11-28 20:44:28 -05001# -*- coding: utf-8 -*-#
2#
3# December 23 2014, Christian Hopps <chopps@gmail.com>
4#
5# Copyright (c) 2015, Deutsche Telekom AG
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19from __future__ import absolute_import, division, unicode_literals, print_function, nested_scopes
20from lxml.etree import register_namespace
21
22MAXSSHBUF = 16 * 1024
23NSMAP = { }
24
25
26def nsmap_add (prefix, namespace):
27 "Add a prefix namespace mapping to the modules mapping dictionary"
28 NSMAP[prefix] = namespace
29 register_namespace(prefix, namespace)
30
31
32def nsmap_update (nsdict):
33 "Add a dicitonary of prefx namespace mappings to the modules mapping dictionary"
34 NSMAP.update(nsdict)
35 for key, val in nsdict.items():
36 register_namespace(key, val)
37
38
39def qmap (key):
40 return "{" + NSMAP[key] + "}"
41
42
43# Add base spec namespace
44nsmap_add('nc', "urn:ietf:params:xml:ns:netconf:base:1.0")