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 THISHOST
=$
(hostname
-f)
27 Domain_Name
="${THISHOST}"
28 #Domain_Name="www.vrops_webservice.com"
29 WebServiceFile
="${BASEDIR}/vrops_webservice"
32 #################################################################
33 ##### Installing Require Packages #####
34 #################################################################'
36 #Function to install packages using apt-get
37 function install_packages
(){
38 [ -x /usr
/bin
/apt-get
] && apt-get
install -y $
*
40 #check properly installed
43 PACKAGE_INSTALLED
="no"
44 [ -x /usr
/bin
/apt-get
] && dpkg
-l $PACKAGE &>> /dev
/null
&& PACKAGE_INSTALLED
="yes"
45 if [ "$PACKAGE_INSTALLED" = "no" ]
47 echo "failed to install package '$PACKAGE'. Revise network connectivity and try again" >&2
53 apt-get update
# To get the latest package lists
55 [ "$_DISTRO" == "Ubuntu" ] && install_packages
"python3-yaml python3-bottle python3-jsonschema python3-requests libxml2-dev libxslt-dev python3-dev python3-pip openssl"
56 [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages
"python3-jsonschema python3-requests libxslt-devel libxml2-devel python3-devel python3-pip openssl"
57 #The only way to install python-bottle on Centos7 is with easy_install or pip
58 [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install
-U bottle
60 #required for vmware connector TODO move that to separete opt in install script
61 pip3
install pip
==9.0.3
65 #################################################################
66 ##### Genrate SSL Certificate #####
67 #################################################################'
68 #Create SSL Certifcate folder and file
69 mkdir
"${SSL_Cert_Dir}"
71 openssl genrsa
-out "${SSL_Cert_Dir}/${Domain_Name}".key
2048
72 openssl req
-new -x509 -key "${SSL_Cert_Dir}/${Domain_Name}".key -out "${SSL_Cert_Dir}/${Domain_Name}".cert -days 3650 -subj /CN="${Domain_Name}"
75 #################################################################
76 ##### Start Web Service #####
77 #################################################################'
79 nohup python3
"${WebServiceFile}" &
82 #################################################################
84 #################################################################'