diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-12-08 19:17:56 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-12-08 19:17:56 -0600 |
commit | d570f9d051b8445be5fc764d827de1cab424a5b8 (patch) | |
tree | 4ee7e22c8f719ac646c45af02a9270f61e680f82 /ncserver/module/ip.py | |
parent | e81aa9c354a1103b0e964b8873bb3321579dcf37 (diff) | |
download | netconfapk-d570f9d051b8445be5fc764d827de1cab424a5b8.tar.gz netconfapk-d570f9d051b8445be5fc764d827de1cab424a5b8.tar.bz2 netconfapk-d570f9d051b8445be5fc764d827de1cab424a5b8.tar.xz netconfapk-d570f9d051b8445be5fc764d827de1cab424a5b8.zip |
Factor get_nmsa into a util module for DRY
Diffstat (limited to 'ncserver/module/ip.py')
-rw-r--r-- | ncserver/module/ip.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/ncserver/module/ip.py b/ncserver/module/ip.py index e6a2de1..cd4cde0 100644 --- a/ncserver/module/ip.py +++ b/ncserver/module/ip.py @@ -15,8 +15,8 @@ import logging from lxml.etree import QName # pylint: disable=E0611 from netconf import util -from ncserver.base.modman import MODMAN from ncserver.base.util import _ +from ncserver.util import get_nmsa LOGGER = logging.getLogger(__name__) @@ -76,14 +76,6 @@ def _get_ifaces(node): return ifaces -def _get_nmsa(): - """Retrieve our NMSA module handle.""" - nmsa_ns = "http://netconf.adelielinux.org/ns/netmgmt" - nmsa = MODMAN._module_for_ns(nmsa_ns) # pylint: disable=W0212 - - return nmsa - - def from_bool(value: bool) -> str: """Turn a Python bool into an XML bool.""" return str(value).lower() @@ -141,7 +133,7 @@ def _add_ipv6(iface, getter): def running(node): """Retrieve the IP configuration for this device.""" ifaces = _get_ifaces(node) - nmsa = _get_nmsa() + nmsa = get_nmsa() if None in (ifaces, nmsa): # We can't retrieve configuration unless both the ietf-interfaces and @@ -183,7 +175,7 @@ def running(node): def operational(node): """Retrieve the IP state for this device.""" ifaces = _get_ifaces(node) - nmsa = _get_nmsa() + nmsa = get_nmsa() if None in (ifaces, nmsa): # We can't retrieve configuration unless both the ietf-interfaces and |