[CORD-988] Adding GUI and REST config files
Updating apache cord config and using it in local vagrant

Change-Id: I634ccc75a119c7e0cdb9549c488dda95e36bd840
diff --git a/roles/cord-profile/defaults/main.yml b/roles/cord-profile/defaults/main.yml
index a5d2ce8..bede32d 100644
--- a/roles/cord-profile/defaults/main.yml
+++ b/roles/cord-profile/defaults/main.yml
@@ -37,6 +37,23 @@
 
 xos_other_templates: []
 
+# GUI Config [new GUI], used in app.config.js.j2 and style.config.js.j2
+gw_port: 3000
+gui_api_endpoint: "/xosapi/v1"
+gui_websocket: "/"
+gui_project_name: "R-CORD"
+gui_favicon: "cord-favicon.png"
+gui_background: "cord-bg.jpg"
+gui_payoff: "Your VNF orchestrator"
+gui_logo: "cord-logo.png"
+gui_routes:
+  - label: "Slices"
+    state: "xos.core.slice"
+  - label: "Nodes"
+    state: "xos.core.node"
+  - label: "Instances"
+    state: "xos.core.instance"
+
 # GUI branding, used in xos_common_config.j2
 disable_minidashboard: "True"
 gui_branding_name: "OpenCloud"
diff --git a/roles/cord-profile/tasks/main.yml b/roles/cord-profile/tasks/main.yml
index aa17d52..2f3fd95 100644
--- a/roles/cord-profile/tasks/main.yml
+++ b/roles/cord-profile/tasks/main.yml
@@ -92,6 +92,8 @@
     - onboard-xos-gui.yaml
     - onboard-xos-rest-gw.yaml
     - gateway-config.yml
+    - style.config.js
+    - app.config.js
 
 - name: Create profile specific templated TOSCA config files
   template:
diff --git a/roles/cord-profile/templates/app.config.js.j2 b/roles/cord-profile/templates/app.config.js.j2
new file mode 100644
index 0000000..e72aa5e
--- /dev/null
+++ b/roles/cord-profile/templates/app.config.js.j2
@@ -0,0 +1,5 @@
+angular.module('app')
+  .constant('AppConfig', {
+    apiEndpoint: '{{ gui_api_endpoint }}',
+    websocketClient: '{{ gui_websocket }}'
+  });
diff --git a/roles/cord-profile/templates/gateway-config.yml.j2 b/roles/cord-profile/templates/gateway-config.yml.j2
index 0e70f01..3b4a4bd 100644
--- a/roles/cord-profile/templates/gateway-config.yml.j2
+++ b/roles/cord-profile/templates/gateway-config.yml.j2
@@ -1,9 +1,9 @@
 default:
   xos:
     host: xos
-    port: 9000
+    port: {{ xos_ui_port }}
   redis:
     host: redis
     port: 6379
   gateway:
-    port: 3000
\ No newline at end of file
+    port: {{ gw_port }}
\ No newline at end of file
diff --git a/roles/cord-profile/templates/onboard-xos-gui.yaml.j2 b/roles/cord-profile/templates/onboard-xos-gui.yaml.j2
index 48dcc1b..e2dd0d3 100644
--- a/roles/cord-profile/templates/onboard-xos-gui.yaml.j2
+++ b/roles/cord-profile/templates/onboard-xos-gui.yaml.j2
@@ -15,6 +15,28 @@
         image: xosproject/xos-gui
         ports: 4000:4000
 
+    # UI App Config
+    /var/www/dist/app.config.js:
+      type: tosca.nodes.ComponentVolume
+      properties:
+          host_path: {{ cord_profile_dir }}/app.config.js
+          read_only: false
+      requirements:
+          - xos:
+             node: xos-spa-gui
+             relationship: tosca.relationships.VolumeOfComponent
+
+    # UI Style Config
+    /var/www/dist/style.config.js:
+      type: tosca.nodes.ComponentVolume
+      properties:
+          host_path: {{ cord_profile_dir }}/style.config.js
+          read_only: false
+      requirements:
+          - xos:
+             node: xos-spa-gui
+             relationship: tosca.relationships.VolumeOfComponent
+
     gui-to-chameleon:
       type: tosca.nodes.ComponentLink
       properties:
diff --git a/roles/cord-profile/templates/style.config.js.j2 b/roles/cord-profile/templates/style.config.js.j2
new file mode 100644
index 0000000..01a7624
--- /dev/null
+++ b/roles/cord-profile/templates/style.config.js.j2
@@ -0,0 +1,19 @@
+angular.module('app')
+  .constant('StyleConfig', {
+    projectName: '{{ gui_project_name }}',
+    favicon: '{{ gui_favicon }}',
+    background: '{{ gui_background }}',
+    payoff: '{{ gui_payoff }}',
+    logo: '{{ gui_logo }}',
+    routes: [
+    {% for route in gui_routes %}
+    {
+            label: '{{ route.label }}',
+            state: '{{ route.state }}',
+            {% if route.parent is defined %}
+            parent: '{{ route.parent }}'
+            {% endif %}
+    },
+    {% endfor %}
+    ]
+});
\ No newline at end of file
diff --git a/roles/head-prologue/files/cord-http.conf b/roles/head-prologue/files/cord-http.conf
index f83c8d9..896e10c 100644
--- a/roles/head-prologue/files/cord-http.conf
+++ b/roles/head-prologue/files/cord-http.conf
@@ -29,7 +29,6 @@
 
     # Cord SPA and rest-gw
     ProxyPass /spa http://xos-spa-gui:4000
-    ProxyPass /spa/api http://xos-rest-gw:3000/api
     ProxyPass /spa/socket.io http://xos-rest-gw:3000/socket.io
     ProxyPass /socket.io http://xos-rest-gw:3000/socket.io
     <Location /socket.io>