Initial Commit for ODTN demo repo with demo scripts and demo app

Change-Id: I812c9fbe7a4b5d454038860acbb936fa9b189438
diff --git a/odtn-phase1-demo/src/resources/getResources.js b/odtn-phase1-demo/src/resources/getResources.js
new file mode 100644
index 0000000..d92b3f2
--- /dev/null
+++ b/odtn-phase1-demo/src/resources/getResources.js
@@ -0,0 +1,54 @@
+import {
+  getConnectivityServices,
+  getSipDetail,
+  getSips,
+} from './dcs'
+import {
+  getDevices,
+  getPorts,
+} from './onos'
+
+
+/**
+ * Provide onos port list along with sip uuid.
+ * @returns {Promise<*[]>}
+ */
+export function getResources() {
+
+  return Promise.all([getDevices(), getSips()])
+    .then(([devices, sips]) => {
+      if(!devices || !sips){
+        throw new Error('Device not found')
+      }
+      const promisePorts = Promise.all(devices.map(device => {
+        return getPorts(device.id)
+      }))
+      const promiseSipDetails = Promise.all(sips.map(sip => {
+        return getSipDetail(sip.uuid)
+      }))
+      return Promise.all([promisePorts, promiseSipDetails, getConnectivityServices()])
+    })
+    .then(([deviceDetails, sipDetails, connectivityService]) => {
+
+      const sipIdMap = sipDetails.reduce((_sipIdMap, sipDetail) => {
+        _sipIdMap[sipDetail.name.filter(kv => kv["value-name"] === "onos-cp")[0].value] = sipDetail.uuid
+        return _sipIdMap
+      }, {})
+      console.log(sipIdMap)
+
+      deviceDetails.forEach(deviceDetail => {
+        deviceDetail.ports.forEach(port => {
+          const key = `${port.element}/${port.port}`
+          if(sipIdMap[key]) {
+            port.sipId = sipIdMap[key]
+          }
+        })
+      })
+
+      return [ deviceDetails || [], connectivityService || [] ]
+    })
+    .catch(err => {
+      console.error(err)
+    })
+
+}
\ No newline at end of file