Defining TOSCA resource for NetworkDevice

Change-Id: I1bf5397b12ccb0bd9af3f9d07f3e527c1c3eade8
diff --git a/xos/metronet.m4 b/xos/metronet.m4
index a32c200..784af54 100644
--- a/xos/metronet.m4
+++ b/xos/metronet.m4
@@ -16,3 +16,25 @@
         properties:
             xos_base_props
             xos_base_service_props
+
+    tosca.nodes.MetroNetworkDevice:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The Metro Network Device.
+        properties:
+            xos_base_props
+            restCtrlUrl:
+                type: string
+                required: true
+            username:
+                type: string
+                required: true
+            password:
+                type: string
+                required: true
+            administrativeState:
+                type: string
+                required: true
+            authType:
+                type: string
+                required: false
diff --git a/xos/metronet.yaml b/xos/metronet.yaml
index aac50ea..368cb42 100644
--- a/xos/metronet.yaml
+++ b/xos/metronet.yaml
@@ -79,3 +79,40 @@
                 type: string
                 required: false
                 description: Version number of Service.
+
+    tosca.nodes.MetroNetworkDevice:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The Metro Network Device.
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            restCtrlUrl:
+                type: string
+                required: true
+            username:
+                type: string
+                required: true
+            password:
+                type: string
+                required: true
+            administrativeState:
+                type: string
+                required: true
+            authType:
+                type: string
+                required: false
diff --git a/xos/models.py b/xos/models.py
index adaad3d..3abb3cb 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -81,6 +81,7 @@
     # serialNumber = models.CharField(unique=True, verbose_name="Serial Number", max_length=256, editable=False)
     # chassisId = models.CharField(unique=False, verbose_name="Chassis ID", max_length=256, editable=False)
 
+    name = models.CharField(max_length=20, help_text="Device friendly name", null=True, blank=True)
     restCtrlUrl = models.CharField(unique=True,
                                verbose_name="RestCtrlURL",
                                max_length=256,
diff --git a/xos/tosca/resources/metronetservice.py b/xos/tosca/resources/metronetservice.py
index c488d97..7d898c3 100644
--- a/xos/tosca/resources/metronetservice.py
+++ b/xos/tosca/resources/metronetservice.py
@@ -5,11 +5,19 @@
 sys.path.append("/opt/tosca")
 from translator.toscalib.tosca_template import ToscaTemplate
 
-from services.metronetwork.models import MetroNetworkService
+from services.metronetwork.models import MetroNetworkService, NetworkDevice
 
 from service import XOSService
+from xosresource import XOSResource
+
 
 class XOSMetroNetworkService(XOSService):
     provides = "tosca.nodes.MetroNetworkService"
     xos_model = MetroNetworkService
     copyin_props = ["view_url", "icon_url", "enabled", "published", "versionNumber"]
+
+
+class MetroNetworkDevice(XOSResource):
+    provides = "tosca.nodes.MetroNetworkDevice"
+    xos_model = NetworkDevice
+    copyin_props = ["name", "administrativeState", "username", "password", "authType", "restCtrlUrl"]