summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/service.rst24
-rw-r--r--yang-modules/adelie-services.yang131
2 files changed, 153 insertions, 2 deletions
diff --git a/doc/service.rst b/doc/service.rst
index 194b9c9..7770586 100644
--- a/doc/service.rst
+++ b/doc/service.rst
@@ -84,7 +84,7 @@ A service has at least the following properties:
* ``starting``: the service is in the process of starting up.
- * ``started``: the service is presently running.
+ * ``running``: the service is presently running.
* ``stopping``: the service is in the process of stopping.
@@ -223,4 +223,24 @@ restarted successfully, you must query the service's status.
YANG Model
==========
-TBD
+Data model
+----------
+
+The data model for system services has the following structure:
+
+::
+
+ +--rw services
+ +--rw service* [name]
+ +--rw name string
+ +--ro description? string
+ +--rw enabled boolean
+ +--ro status service-status
+ +--ro start-time? yang:date-and-time
+
+Module
+------
+
+See `adelie-services.yang`_.
+
+.. _`adelie-services.yang`: ../yang-modules/adelie-services.yang
diff --git a/yang-modules/adelie-services.yang b/yang-modules/adelie-services.yang
new file mode 100644
index 0000000..60761d3
--- /dev/null
+++ b/yang-modules/adelie-services.yang
@@ -0,0 +1,131 @@
+module adelie-services {
+ yang-version 1.1;
+ namespace 'https://netconf.adelielinux.org/ns/services';
+ prefix svcs;
+
+ import ietf-yang-types {
+ prefix yang;
+ }
+
+ organization "Adélie Software in the Public Benefit, Inc.";
+ contact
+ " Adélie Software in the Public Benefit, Inc.
+
+ Postal: Adélie Software
+ P.O. Box 701386
+ Tulsa, OK 74170
+ United States
+
+ Email: <mailto:netconf&lists.adelielinux.org>";
+
+ description
+ "This module contains a collection of YANG definitions for
+ managing network services on a device containing a NETCONF
+ server. This includes protocol operations for starting and
+ stopping services.
+
+ Copyright (c) 2020 Adélie Software and the persons identified
+ as authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the NCSA License set forth
+ in the LICENSE file contained in the NETCONF APK repository
+ (https://code.foxkit.us/adelie/netconfapk/blob/current/LICENSE).
+
+ This version of this YANG module is part of the NETCONF APK
+ 1.0 distribution; see the distributon for full legal notices.";
+
+ revision 2020-09-22 {
+ description
+ "Initial revision.";
+ reference
+ "Service Management Requirements for NETCONF APK
+ (https://da.gd/ncservice)";
+ }
+
+ typedef service-status {
+ type enumeration {
+ enum stopped {
+ description
+ "The service is not presently running.";
+ }
+ enum starting {
+ description
+ "The service is in the process of starting.";
+ }
+ enum running {
+ description
+ "The service is presently running.";
+ }
+ enum stopping {
+ description
+ "The service is in the process of stopping.";
+ }
+ enum crashed {
+ description
+ "The service was running, but stopped unexpectedly.";
+ }
+ }
+ description
+ "The status of a service.";
+ }
+
+ container services {
+ description
+ "Service configuration.";
+
+ list service {
+ key "name";
+
+ description
+ "The list of services on the device.";
+
+ leaf name {
+ type string;
+ description
+ "The name of the service.
+
+ Changing the name of the service may have surprising
+ consequences. It is not recommended.";
+ }
+
+ leaf description {
+ type string;
+ config false;
+ description
+ "A textual description of the service.
+
+ Depending on the service manager in use on the device,
+ this node may be empty or contain only the name of the
+ service.";
+ }
+
+ leaf enabled {
+ type boolean;
+ mandatory true;
+ description
+ "This leaf contains the desired state of the service.
+
+ When this leaf is true, the service will be started
+ automatically by the device during system bootup.";
+ }
+
+ leaf status {
+ type service-status;
+ config false;
+ mandatory true;
+ description
+ "The current status of the service.";
+ }
+
+ leaf start-time {
+ type yang:date-and-time;
+ config false;
+ when "./status = 'running'";
+ description
+ "The time that this service entered the running state.";
+ }
+ }
+ }
+}