summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-11-18 14:44:07 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-11-18 14:44:07 -0600
commit8a48c830b2091e21f2be5ef73c34a4cdd9d106cd (patch)
tree6d8407b093e929764d105b7a139487f8cc98960e
parent110edd19082ba995b2006e117bd73307bf4dad11 (diff)
downloadnetconfapk-8a48c830b2091e21f2be5ef73c34a4cdd9d106cd.tar.gz
netconfapk-8a48c830b2091e21f2be5ef73c34a4cdd9d106cd.tar.bz2
netconfapk-8a48c830b2091e21f2be5ef73c34a4cdd9d106cd.tar.xz
netconfapk-8a48c830b2091e21f2be5ef73c34a4cdd9d106cd.zip
NMSA: Make it possible to remove interfaces
-rw-r--r--doc/network.rst7
-rw-r--r--ncserver/module/nms_ifupdownng.py9
2 files changed, 16 insertions, 0 deletions
diff --git a/doc/network.rst b/doc/network.rst
index 3c86d4f..37c67b7 100644
--- a/doc/network.rst
+++ b/doc/network.rst
@@ -145,6 +145,13 @@ interface.
+``remove_interface(iface)``
+---------------------------
+
+Entirely remove a configured interface from the configuration store.
+
+
+
Transactions
------------
diff --git a/ncserver/module/nms_ifupdownng.py b/ncserver/module/nms_ifupdownng.py
index 55405d4..23795f6 100644
--- a/ncserver/module/nms_ifupdownng.py
+++ b/ncserver/module/nms_ifupdownng.py
@@ -132,6 +132,15 @@ def interface_list():
return tuple(_CONFIG.keys())
+def remove_interface(iface: str):
+ """Completely remove configuration for +iface+."""
+ if iface in _CONFIG.keys():
+ del _CONFIG[iface]
+
+ if not _TRANSACTION:
+ _save()
+
+
def begin_transaction():
"""Begin a transaction."""
global _TRANSACTION # pylint: disable=W0603