Screenshot Customer View

Screenshot Operator View


Installation

The installation has been tested on Ubuntu 18.04.2 LTS

Make sure /etc/hosts is properly configured with ONAP FQDNs e.g.

172.30.0.115 nbi.api.simpledemo.onap.org
172.30.0.127 mr.api.simpledemo.openecomp.org
etc.

Install python3, curl, python3-pip, nginx

apt-get install python3 curl python3-pip nginx

Clone both fe and be (credentials are needed, contact michail salichos )

git clone https://gitlab.com/onap-bbs/bss-fe.git
git clone https://gitlab.com/onap-bbs/bss-be.git

Create NBI listeners, mind the IP of the endpoint which will be listening for NBI status updates

curl -k --header "Content-Type: application/json" -X POST -d @register-nbi-listeners https://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/hub

e.g. cat register-nbi-listeners
{
"callback": "http://172.30.0.130:5000/serviceOrderStateListener/listener/v1/",
"query":"eventType = ServiceOrderStateChangeNotification,ServiceOrderCreationNotification,ServiceOrderItemStateChangeNotification,ServiceCreationNotification,ServiceAttributeValueChangeNotification,ServiceRemoveNotification"
}
Right after posting your endpoint to NBI make sure it's configured properly by running
curl --header "Content-Type: application/json" https://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/hub

Create a configuration file named bng.conf under /tmp with this content

cat /tmp/bng.conf 
[DEFAULT]
db-username = root
db-password = root
db-host = 0.0.0.0
db-database = bbs
onap-nbi-url = https://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/
onap-dcae-ves-collector-url = https://172.30.0.93:30417/eventListener/v5/
onap-message-router = https://mr.api.simpledemo.openecomp.org:30226/events/AAI-EVENT/T/T2?timeout=10000&limit=1

Update config file of nginx /etc/nginx/sites-available/default with this content. A reverse proxy is needed to avoid CORS issues

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
 
# Default server configuration
#
server {
	listen 80 default_server;
	listen [::]:80 default_server;
	 
	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;
	 
	root /var/www/html;
	 
	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;
	 
	server_name _;
	 
	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
		 
		if ($request_method = 'OPTIONS') {
			add_header 'Access-Control-Allow-Origin' '*';
			#
			# Om nom nom cookies
			#
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			#
			# Custom headers and headers various browsers *should* be OK with but aren't
			#
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			#
			# Tell client that this pre-flight info is valid for 20 days
			#
			add_header 'Access-Control-Max-Age' 1728000;
			add_header 'Content-Type' 'text/plain charset=UTF-8';
			add_header 'Content-Length' 0;
			return 204;
		}
		if ($request_method = 'POST') {
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
		}
		if ($request_method = 'GET') {
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
		}
	}
}
 
server {
	listen 5000;
	server_name default_server;
	location / {
		proxy_pass http://127.0.0.1:5010/;
		proxy_redirect off;
		 
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		 
		#proxy_set_header Host $host;
		#proxy_set_header X-Real-IP $remote_addr;
		#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		 
		client_max_body_size 10m;
		client_body_buffer_size 128k;
		 
		proxy_connect_timeout 90;
		proxy_send_timeout 90;
		proxy_read_timeout 90;
		 
		proxy_buffer_size 4k;
		proxy_buffers 4 32k;
		proxy_busy_buffers_size 64k;
		proxy_temp_file_write_size 64k;
		 
		if ($request_method = 'OPTIONS') {
			add_header 'Access-Control-Allow-Origin' '*';
			#
			# Om nom nom cookies
			#
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			#
			# Custom headers and headers various browsers *should* be OK with but aren't
			#
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			#
			# Tell client that this pre-flight info is valid for 20 days
			#
			add_header 'Access-Control-Max-Age' 1728000;
			add_header 'Content-Type' 'text/plain charset=UTF-8';
			add_header 'Content-Length' 0;
			return 204;
		}
		if ($request_method = 'POST') {
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
		}
		if ($request_method = 'GET') {
			add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
		}
	}
}
sudo /etc/init.d/nginx restart


Install latest docker daemon e.g.
https://linuxize.com/post/how-to-install-and-use-docker-on-ubuntu-18-04/

Install mysql docker server

sudo docker run --name bbs-mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 --volume=/var/lib/mysqlbackup:/var/lib/mysql -d mysql


Create database

mysql -u root -proot -e "create database bbs"

Import database schema, either with "docker cp .." or get into the container e.g.

sudo docker cp ./db.sql bbs-mysql:/tmp/db.sql
sudo docker exec -it bbs-mysql sh -c 'exec mysql -u root -proot bbs < /tmp/db.sql'

Install mysql-connector-python, flask and gunicorn

sudo pip3 install mysql-connector-python flask gunicorn

Test running bss backend and access using curl

sudo python3 app.py
curl http://localhost:5000/products

If you get "error-1698-28000-access-denied-for-user-rootlocalhost" check this
https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost

Build bss-fe

cd bss-fe/source

# install dependencies
npm install

# configure
Ensure "baseURL" is set to the correct IP in config/prod.env.js

# build for production with minification
npm run build

For a detailed explanation on how things work, check out the guide and docs for vue-loader.


Copy frontend to nginx root web dir

~/onap-bbs-fe-be/bss-fe/dist/$ sudo cp -fr * /var/www/html/

Open app.py and set the template_id / service_id UUID, and user

Line 106, replace "TemplateID" value with "Service BBS_E2E_Service:UUID"


Line 197
"relatedParty": [ { "id": "6f486438-87b5-4bee-8f85-30090c760501" (global-customer-id)
"serviceSpecification": { "id": "0187be8c-8efb-4531-97fa-dbe984ed9cdb" (Service BBS_E2E_Service:UUID)


Run bss backend with gunicorn, make sure you update to point to the right path

~/onap-bbs-fe-be/bss-be$ ./start.sh

Run AAI events consumer in the background

sudo nohup python3 events.py &

Verify if both processes are running

ubuntu@onap-rancher-daily:~/onap-bbs-fe-be/bss-be$ ps aux | grep -i guni
ubuntu 22003 0.1 0.2 62020 18808 ? S 08:59 0:00 /usr/bin/python3 /usr/local/bin/gunicorn -w 2 -b 0.0.0.0:5010 --access-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-access.log --error-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-error.log app:app --daemon
ubuntu 22006 4.1 0.5 137016 42700 ? S 08:59 0:00 /usr/bin/python3 /usr/local/bin/gunicorn -w 2 -b 0.0.0.0:5010 --access-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-access.log --error-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-error.log app:app --daemon
ubuntu 22008 3.6 0.5 137020 42688 ? S 08:59 0:00 /usr/bin/python3 /usr/local/bin/gunicorn -w 2 -b 0.0.0.0:5010 --access-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-access.log --error-logfile /home/ubuntu/onap-bbs-fe-be/bss-be/gunicorn-error.log app:app --daemon
ubuntu 22013 0.0 0.0 14856 1008 pts/1 R+ 08:59 0:00 grep --color=auto -i guni
ubuntu@onap-rancher-daily:~/onap-bbs-fe-be/bss-be$ 
ubuntu@onap-rancher-daily:~/onap-bbs-fe-be/bss-be$ 
ubuntu@onap-rancher-daily:~/onap-bbs-fe-be/bss-be$ ps aux | grep -i event
root 21992 0.0 0.0 63972 4304 pts/1 S 08:58 0:00 sudo nohup python3 events.py
root 21993 0.2 0.4 114084 35952 pts/1 S 08:58 0:00 python3 events.py
ubuntu 22015 0.0 0.0 14856 1048 pts/1 R+ 08:59 0:00 grep --color=auto -i event
  • No labels