4 # Copyright 2016-2017 VMware Inc.
5 # This file is part of ETSI OSM
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
20 # For those usages not covered by the Apache License, Version 2.0 please
21 # contact: osslegalrouting@vmware.com
24 BASEDIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25 SSL_Cert_Dir
="${BASEDIR}/SSL_certificate"
26 Domain_Name
="www.vrops_webservice.com"
27 WebServiceFile
='vrops_webservice.py'
30 #################################################################
31 ##### Installing Require Packages #####
32 #################################################################'
34 #Function to install packages using apt-get
35 function install_packages
(){
36 [ -x /usr
/bin
/apt-get
] && apt-get
install -y $
*
38 #check properly installed
41 PACKAGE_INSTALLED
="no"
42 [ -x /usr
/bin
/apt-get
] && dpkg
-l $PACKAGE &>> /dev
/null
&& PACKAGE_INSTALLED
="yes"
43 if [ "$PACKAGE_INSTALLED" = "no" ]
45 echo "failed to install package '$PACKAGE'. Revise network connectivity and try again" >&2
51 apt-get update
# To get the latest package lists
53 [ "$_DISTRO" == "Ubuntu" ] && install_packages
"python-yaml python-bottle python-jsonschema python-requests libxml2-dev libxslt-dev python-dev python-pip openssl"
54 [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages
"python-jsonschema python-requests libxslt-devel libxml2-devel python-devel python-pip openssl"
55 #The only way to install python-bottle on Centos7 is with easy_install or pip
56 [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install
-U bottle
58 #required for vmware connector TODO move that to separete opt in install script
59 sudo pip
install --upgrade pip
60 sudo pip
install cherrypy
63 #################################################################
64 ##### Genrate SSL Certificate #####
65 #################################################################'
66 #Create SSL Certifcate folder and file
67 mkdir
"${SSL_Cert_Dir}"
69 openssl genrsa
-out "${SSL_Cert_Dir}/${Domain_Name}".key
2048
70 openssl req
-new -x509 -key "${SSL_Cert_Dir}/${Domain_Name}".key -out "${SSL_Cert_Dir}/${Domain_Name}".cert -days 3650 -subj /CN="${Domain_Name}"
73 #################################################################
74 ##### Start Web Service #####
75 #################################################################'
77 nohup python
"${WebServiceFile}" &
80 #################################################################
82 #################################################################'