summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/roadmap.rst16
-rw-r--r--ncserver/module/interfaces.py78
2 files changed, 89 insertions, 5 deletions
diff --git a/doc/roadmap.rst b/doc/roadmap.rst
index 4850948..25b6e95 100644
--- a/doc/roadmap.rst
+++ b/doc/roadmap.rst
@@ -260,20 +260,26 @@ of system network interfaces.
Outstanding TBDs
````````````````
+* How do we retrieve ``last-change``?
+
+Resolved TBDs
+`````````````
* We support ``arbitrary-names``, right? Pretty sure GRE / tuntap / etc all
let you name things whatever you want.
+ **Resolution**: No. We do not, as some Linux network tooling cannot properly
+ handle UTF-8 names.
+
* Do we support ``pre-provisioning``? It would make sense, since /e/n/i and
/e/c/n both let you just specify whatever configuration you want for whatever
interfaces you want.
-* Where do we store interface ``description``?
+ **Resolution**: Yes.
-* How do we retrieve ``last-change``?
+* Where do we store interface ``description``?
-Resolved TBDs
-`````````````
-* None.
+ **Resolution**: /e/n/i can do ``netconf-description`` keyword, /e/c/n (if
+ we support it) can do ``description_$IFACE``.
diff --git a/ncserver/module/interfaces.py b/ncserver/module/interfaces.py
new file mode 100644
index 0000000..f8c4f45
--- /dev/null
+++ b/ncserver/module/interfaces.py
@@ -0,0 +1,78 @@
+"""
+NETCONF for APK Distributions server:
+ ietf-interfaces module
+
+Copyright © 2020 Adélie Software in the Public Benefit, Inc.
+
+Released under the terms of the NCSA license. See the LICENSE file included
+with this source distribution for more information.
+
+SPDX-License-Identifier: NCSA
+"""
+
+import logging
+import os
+import subprocess
+
+from lxml import etree
+from netconf import error, util
+
+from ncserver.base.util import _, yang_dt_for_timestamp
+
+
+QName = etree.QName # pylint: disable=I1101
+
+
+LOGGER = logging.getLogger(__name__)
+"""The object used for logging informational messages."""
+
+
+M_ABI_VERSION = 1
+"""The ABI version of this NETCONF module."""
+
+
+M_PREFIX = "if"
+"""The XML tag prefix for this module's tags."""
+
+
+M_NS = "urn:ietf:params:xml:ns:yang:ietf-interfaces"
+"""The XML namespace for this module."""
+
+
+M_NAME = "ietf-interfaces"
+"""The YANG model name for this module."""
+
+
+M_REVISION = "2018-02-20"
+"""The YANG revision date for this module."""
+
+
+M_IMPORTS = {
+ 'ietf-yang-types@2013-07-15': {
+ 'ns': "urn:ietf:params:xml:ns:yang:ietf-yang-types", 'prefix': "yang"
+ }
+}
+"""The imported YANG modules for this module."""
+
+
+def _add_running_contents(ifaces):
+ """Retrieve the interface configuration for this device.
+
+ Allows returning the 'config true' data for both datastores."""
+ # foo
+
+
+def running(node):
+ """Retrieve the service configuration for this device."""
+ ifaces = util.subelm(node, 'if:interfaces')
+ _add_running_contents(ifaces)
+
+
+def operational(node):
+ """Retrieve the service state for this device."""
+ ifaces = util.subelm(node, 'if:interfaces')
+ _add_running_contents(ifaces)
+
+
+def edit(session, rpc, node, def_op):
+ """Edit the interface configuration for this device."""