sdbus++: add enumeration parsing

Change-Id: I6d02574942b38adbe2dc537f5279721cde2c8bc7
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/example/net/poettering/Calculator.interface.yaml b/tools/example/net/poettering/Calculator.interface.yaml
index 3c70cbc..7932aed 100644
--- a/tools/example/net/poettering/Calculator.interface.yaml
+++ b/tools/example/net/poettering/Calculator.interface.yaml
@@ -50,6 +50,11 @@
       default: 0
       description: >
         The result of the most recent calculation.
+    - name: Status
+      type: enum[self.State]
+      default: Success
+      description: >
+        The current state of the Calculator.
 signals:
     - name: Cleared
       description: >
@@ -59,4 +64,14 @@
         - type: int64
           description: >
             Value of LastReset prior to Clear.
-
+enumerations:
+    - name: State
+      description: >
+        Identifies if the service has encountered an error or not.
+      values:
+        - name: Success
+          description: >
+            No error has been encountered.
+        - name: Error
+          description: >
+            The service has encountered an error.
diff --git a/tools/sdbusplus/enum.py b/tools/sdbusplus/enum.py
new file mode 100644
index 0000000..a5feda7
--- /dev/null
+++ b/tools/sdbusplus/enum.py
@@ -0,0 +1,11 @@
+from .namedelement import NamedElement
+from .property import Property
+
+""" Class for parsing 'enum' definition elements from an interface.
+"""
+class Enum(NamedElement):
+    def __init__(self, **kwargs):
+        self.values = \
+            [Property(**v) for v in kwargs.pop('values', [])]
+
+        super(Enum, self).__init__(**kwargs)
diff --git a/tools/sdbusplus/interface.py b/tools/sdbusplus/interface.py
index bf1b8ba..b9def8d 100644
--- a/tools/sdbusplus/interface.py
+++ b/tools/sdbusplus/interface.py
@@ -4,6 +4,7 @@
 from .property import Property
 from .method import Method
 from .signal import Signal
+from .enum import Enum
 from .renderer import Renderer
 
 
@@ -26,6 +27,8 @@
             [Method(**m) for m in kwargs.pop('methods', [])]
         self.signals = \
             [Signal(**s) for s in kwargs.pop('signals', [])]
+        self.enums = \
+            [Enum(**e) for e in kwargs.pop('enumerations', [])]
 
         super(Interface, self).__init__(**kwargs)