Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
themeRDark
curl -k --header "Content-Type: application/json" -X POST -d @register-nbi-listeners httphttps://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" httphttps://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/hub

...

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

...

Code Block
languagebash
themeRDark
##
# 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';
		}


	}
}


Code Block
languagebash
themeMidnight
sudo /etc/init.d/nginx restart

...

Code Block
languagebash
themeRDark
sudo python3 app.py
curl http://localhost:50105000/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

Copy frontend to nginx root web dirBuild bss-fe

~/onap-bbs
Code Block
languagebash
themeRDark
Midnight
cd bss-fe-be/bss-fe$ sudo cp -fr * /var/www/html/

...

/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

Code Block
languagebash
themeRDark
vim /var/www/html/static/js/app.67221ea8b6f560de82d3.js 
search for "baseURL" and configure the IP e.g. baseURL:"http://172.30.0.130:5010"~/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

...