service: Update Attributes.interface.yaml

Update the Attributes.interface.yaml to be up to date with the implementation
in service-config-manager. Update README as well.

Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Change-Id: I32e6de5680169b78328ddc399330bc9398189213
diff --git a/xyz/openbmc_project/Control/Service/Attributes.interface.yaml b/xyz/openbmc_project/Control/Service/Attributes.interface.yaml
index e9bfc92..4d2dd08 100644
--- a/xyz/openbmc_project/Control/Service/Attributes.interface.yaml
+++ b/xyz/openbmc_project/Control/Service/Attributes.interface.yaml
@@ -1,36 +1,21 @@
 description: >
-    This interface exposes properties for service objects like
-    SSH, web, RMCP+ etc. under the service configuration manager.
-    This interface can be used to get/set of service properties.
+    Implement to expose the properties of service objects like bmcweb,
+    phosphor-ipmi-net etc. This interface can be used to get and set the
+    properties of the service.
 
 properties:
-    - name: State
-      type: enum[self.SupportedStates]
+    - name: Enabled
+      type: boolean
       description: >
-          Specifies the state of the service.
-    - name: Port
-      type: uint32
+          Specifies the current state of the service. This property can be used
+          to enable or disable the service.
+    - name: Masked
+      type: boolean
       description: >
-          Specifies the listening port number of service.
-          This property is used to get or set the service
-          listening port number.
-    - name: Channel
-      type: array[string]
+          Specifies whether the service is masked or not masked. This property
+          can be used to permanently enable or disable the service.
+    - name: Running
+      type: boolean
       description: >
-          Specifies the channel on which service allows client
-          connections. This property is used to get or set the
-          allowed channel interfaces in array of strings. It accepts
-          the interface names, which are created as objects in
-          network service and returns error if not found.
-
-enumerations:
-    - name: SupportedStates
-      description: >
-          State values.
-      values:
-        - name: 'enabled'
-          description: >
-            Service is enabled.
-        - name: 'disabled'
-          description: >
-            Service is disabled.
+          Specifies whether the service is running or not. This property can be
+          used to start or stop a service.
diff --git a/xyz/openbmc_project/Control/Service/README.md b/xyz/openbmc_project/Control/Service/README.md
index fd9f92c..55ffa94 100644
--- a/xyz/openbmc_project/Control/Service/README.md
+++ b/xyz/openbmc_project/Control/Service/README.md
@@ -2,35 +2,73 @@
 
 ## Overview
 Applications must use service manager daemon to configure services like
-phosphor-ipmi-net, web, SSH etc. service in the system, instead of
-directly controlling the same using 'systemd' or 'iptables'. This way client
+phosphor-ipmi-net, bmcweb, obmc-console etc in the system, instead of directly
+controlling the same using 'systemd' or 'iptables'. This way client
 applications doesn't need to change to configure services, when the
-implementations differ.
+implementations differ. The list of services supported are
+`"phosphor-ipmi-net", "bmcweb", "phosphor-ipmi-kcs", "start-ipkvm",
+"obmc-console"`.
 
-### Attributes Interface
-Service manager daemon, will create objects for configurable service
-in the system under object path `/xyz/openbmc_project/Control/Service/<object>`.
-Each service object can be handled through 'org.freedesktop.DBus.ObjectManager'.
-Service object will expose following properties.
+## Implementation Details
+
+Service manager daemon will create D-Bus objects for configurable services
+in the system under the object path `/xyz/openbmc_project/control/service`. For
+each instance of the service there will be a D-Bus object
+`/xyz/openbmc_project/control/service/<service-name>`.
+For example, if there are two instances of `phosphor-ipmi-net` then there
+will be two D-Bus objects
+`/xyz/openbmc_project/control/service/phosphor_2dipmi_2dnet_40eth0`
+and `/xyz/openbmc_project/control/service/phosphor_2dipmi_2dnet_40eth1`.
+The D-Bus object manages both the associated service and socket unit files.
+The D-Bus object implements the interface
+`xyz.openbmc_project.Control.Service.Attributes`. Network services like bmcweb,
+phosphor-ipmi-net also implements the
+`xyz.openbmc_project.Control.Service.SocketAttributes` interface.
+
+In order to update the property value of a service, `override.conf` file under
+`/etc/systemd/system/<Service unit name>/` is updated and the unit is restarted
+through `org.freedesktop.systemd1`.
 
 #### xyz.openbmc_project.Control.Service.Attributes interface
 ##### properties
-* State - State of the service. Enabled / Disabled.
-* Port - Port number to which the service is configured to listen.
-* Channel - Supported network interface objects, to which port has to bind.
 
-## Note
-Implementations can elect to implement service manager daemon either through
-'systemctl' (override.conf) or implement the same through 'iptables' logic, of
-disabling the port, updating the port etc.
+* Enabled - indicates whether the service is enabled or disabled, `true`
+            indicates the service will be started on the next boot and `false
+            indicates that service will not be started on the next boot. This
+            property can be used to change the service behaviour on the next
+            boot, `true` to start the service on the next boot and `false` to
+            not start the service on the next boot. Even if the service is
+            disabled, on the next boot it can be started if there are other
+            service dependencies to satisy. The service cannot be enabled if the
+            service is masked.
 
-## Example usage:
-Webserver can update the RMCP+ port number from default 623 to different one,
-by updating the `Port` property value under path `/xyz/openbmc_project/Control/
-Service/netipmid` through interface `xyz.openbmc_project.Control.Service.
-Attributes`.
+* Masked  - indicates whether the service is masked, `true` indicates the
+            service is permanently disabled and `false` indicates the service
+            is enabled. If the property is set to `true`, then the service is
+            permanently disabled and the service is stopped. If the property
+            is set to `false` then the service is enabled and starts running.
 
-## Systemd (override.conf) implementation
-In order to update the property value, `override.conf` file under `/etc/systemd
-/system/<Service unit name>/` has to be updated and service unit has to be
-restarted through `org.freedesktop.systemd1`.
+* Running - indicates the current state of the service, `true` if the service
+            is running and `false` if the service is not running. This property
+            can be used to change the running state of the service, to start the
+            service set to `true` and to stop the service set to `false`. The
+            service cannot be started if the service is Masked.
+
+#### xyz.openbmc_project.Control.Service.SocketAttributes interface
+##### properties
+
+* Port - Port number to which the service is configured to listen, if
+         applicable for service. Services like obmc-console will not
+         implement this interface.
+
+## Usage
+
+To permanently disable a service the `Masked` property under the interface
+`xyz.openbmc_project.Control.Service.Attributes` needs to be set to `true` and
+vice versa to enable a service.
+
+RMCP+ port number can be modified from the default port number 623 to a custom
+one by updating the `Port` property value under the interface
+`xyz.openbmc_project.Control.Service.SocketAttributes`.
+
+
diff --git a/xyz/openbmc_project/Control/Service/SocketAttributes.interface.yaml b/xyz/openbmc_project/Control/Service/SocketAttributes.interface.yaml
new file mode 100644
index 0000000..bf9699e
--- /dev/null
+++ b/xyz/openbmc_project/Control/Service/SocketAttributes.interface.yaml
@@ -0,0 +1,13 @@
+description: >

+    This interface defines the attributes of services which support socket-based

+    activation. Applications can expose the port number of a network service by

+    implementing this interface. For example, application like

+    service-config-manager will implement this interface for network services

+    like bmcweb and phosphor-ipmi-net and allow the port number to be configured.

+

+properties:

+    - name: Port

+      type: uint16

+      description: >

+          Specifies the port number on which the service is listening. This

+          property can be set to configure a port number for the service.