[CORD-988] Adding GUI and REST config files
Updating apache cord config and using it in local vagrant
Change-Id: I634ccc75a119c7e0cdb9549c488dda95e36bd840
diff --git a/Vagrantfile b/Vagrantfile
index 29a0d6a..2202799 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -19,10 +19,32 @@
end
config.vm.provision "shell", privileged: false, inline: <<-SHELL
+ # Setup CORD tools
curl -o ~/cord-bootstrap.sh https://raw.githubusercontent.com/opencord/platform-install/master/scripts/cord-bootstrap.sh
bash cord-bootstrap.sh
ssh-keygen -t rsa -N "" -f .ssh/id_rsa
cp ~/.ssh/id_rsa node_key
+
+ # Install apache
+ sudo apt-get update
+ sudo apt-get install -y apache2 libapache2-mod-fastcgi apache2-mpm-worker
+ sudo a2enmod proxy_http
+ sudo a2enmod headers
+ sudo a2enmod rewrite
+ sudo a2enmod proxy_wstunnel
+
+ # Copy apache conf
+ sudo cp /home/vagrant/cord/build/platform-install/roles/head-prologue/files/cord-http.conf /etc/apache2/conf-enabled/cord-http.conf
+
+ # Reload Apache
+ sudo service apache2 reload
+
+ # Add hosts
+ echo "127.0.0.1 xos" | sudo tee --append /etc/hosts > /dev/null
+ echo "127.0.0.1 xos-spa-gui" | sudo tee --append /etc/hosts > /dev/null
+ echo "127.0.0.1 xos-rest-gw" | sudo tee --append /etc/hosts > /dev/null
+ echo "127.0.0.1 xos-chameleon" | sudo tee --append /etc/hosts > /dev/null
+ echo "127.0.0.1 xos-core" | sudo tee --append /etc/hosts > /dev/null
SHELL
end
diff --git a/profile_manifests/mock-ecord.yml b/profile_manifests/mock-ecord.yml
index eb94783..995ecd2 100644
--- a/profile_manifests/mock-ecord.yml
+++ b/profile_manifests/mock-ecord.yml
@@ -21,6 +21,11 @@
- mock-onos.yaml
- ecord-services.yaml
+# GUI Config [new GUI]
+gui_project_name: "E-CORD"
+gui_background: "cord-bg.jpg" # TODO find ecord image
+gui_payoff: "Your Enterprise VNF orchestrator"
+
# GUI branding
gui_branding_name: "ECORD"
gui_branding_icon: "/static/cord-logo.png"
diff --git a/profile_manifests/mock-mcord.yml b/profile_manifests/mock-mcord.yml
index 15634f3..b33b9ea 100644
--- a/profile_manifests/mock-mcord.yml
+++ b/profile_manifests/mock-mcord.yml
@@ -21,6 +21,22 @@
- management-net.yaml
- mock-mcord.yaml
+# GUI Config [new GUI]
+gui_project_name: "M-CORD"
+gui_payoff: "Your way toward 5G"
+gui_routes:
+ - label: "Slices"
+ state: "xos.core.slice"
+ - label: "Nodes"
+ state: "xos.core.node"
+ - label: "Instances"
+ state: "xos.core.instance"
+ - label: "MCORD"
+ state: "xos.mcord"
+ - label: "Topology"
+ state: "xos.mcord.topology"
+ parent: "xos.mcord"
+
# GUI branding
gui_branding_name: "M-CORD"
gui_branding_icon: "/static/cord-logo.png"
diff --git a/profile_manifests/mock-rcord.yml b/profile_manifests/mock-rcord.yml
index 3ca43a4..ef2dbc5 100644
--- a/profile_manifests/mock-rcord.yml
+++ b/profile_manifests/mock-rcord.yml
@@ -25,7 +25,27 @@
# - test-subscriber.yaml # broken? Missing lan_network config on vOLT ?
- volt-devices.yaml
-# GUI branding
+# GUI Config [new GUI]
+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"
+ - label: "AAAAAAA"
+ state: "xos.core.instance"
+ parent: "xos.core"
+
+# GUI branding [OLD GUI to be removed]
gui_branding_name: "CORD"
gui_branding_icon: "/static/cord-logo.png"
gui_branding_favicon: "/static/cord-favicon.png"
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>