New file setup.py: builds a python package 48/1448/9
authormirabal <leonardo.mirabal@altran.com>
Fri, 31 Mar 2017 13:15:52 +0000 (15:15 +0200)
committermirabal <leonardo.mirabal@altran.com>
Tue, 4 Apr 2017 15:35:45 +0000 (17:35 +0200)
        - Allow to use all poenvim logic as a library by RO
        - Makefile will generate all the package need it and handle the lib instalation

Change-Id: I9735b130b47bd94fea12037e2b89eb8226d29d0e
Signed-off-by: mirabal <leonardo.mirabal@altran.com>
MANIFEST.in [new file with mode: 0644]
Makefile [new file with mode: 0644]
database_utils/init_vim_db.sh
database_utils/install-db-server.sh [new file with mode: 0755]
database_utils/migrate_vim_db.sh
ovim.py [changed mode: 0644->0755]
scripts/install-openvim.sh
setup.py [new file with mode: 0755]

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644 (file)
index 0000000..8cf96f0
--- /dev/null
@@ -0,0 +1,4 @@
+include openvimd.cfg
+recursive-include database_utils *
+recursive-include scripts *
+
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..5e49091
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+SHELL := /bin/bash
+
+all: clean build  pip install
+lite: clean build  pip install_lite
+
+prepare:
+       mkdir -p build
+       cp *.py build/
+       cp MANIFEST.in build/
+       cp openvimd.py build/openvimd
+       cp ovim.py build/ovim
+       cp openvim build/
+       cp openflow build/
+       cp openvimd.cfg build/
+       cp -r scripts build/
+       #cd build/scripts; mv service-openvim.sh service-openvim; mv openvim-report.sh openvim-report; mv initopenvim.sh initopenvim
+       cp -r database_utils build/
+
+build: prepare
+       python -m py_compile build/*.py
+
+clean:
+       rm -rf build
+
+pip:
+       cd build; ./setup.py sdist
+
+install:
+       cd build; python setup.py install
+
+install_lite:
+       cd build; python setup.py install --lite
+
+
+
index 16f34ea..1edaa68 100755 (executable)
@@ -97,7 +97,7 @@ DEF_EXTRA_FILE_PARAM="--defaults-extra-file=$TEMPFILE"
 if [ -z "${DBPASS}" ]
 then
     password_ok=""
-    echo -e "[client]\nuser='${DBUSER}'\npassword='vimpw'" > "$TEMPFILE"
+    echo -e "[client]\nuser='${DBUSER}'\npassword=vimpw" > "$TEMPFILE"
     mysql --defaults-extra-file="$TEMPFILE" $DBHOST_ $DBPORT_ $DBNAME -e "quit" >/dev/null 2>&1 && DBPASS="vimpw"
     echo -e "[client]\nuser='${DBUSER}'\npassword=''" > "$TEMPFILE"
     mysql --defaults-extra-file="$TEMPFILE" $DBHOST_ $DBPORT_ $DBNAME -e "quit" >/dev/null 2>&1 && DBPASS=""
@@ -128,6 +128,9 @@ echo "    loading ${DIRNAME}/vim_db_structure.sql"
 sed -e "s/vim_db/$DBNAME/" ${DIRNAME}/vim_db_structure.sql |  mysql $DEF_EXTRA_FILE_PARAM $DBHOST_ $DBPORT_
 
 echo "    migrage database version"
+#${DIRNAME}/migrate_vim_db.sh $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ -d$DBNAME $1
+DIRNAME=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
+echo "${DIRNAME}/migrate_vim_db.sh $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ -d$DBNAME $1"
 ${DIRNAME}/migrate_vim_db.sh $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ -d$DBNAME $1
 
 echo  "    loading ${DIRNAME}/host_ranking.sql"
diff --git a/database_utils/install-db-server.sh b/database_utils/install-db-server.sh
new file mode 100755 (executable)
index 0000000..e393395
--- /dev/null
@@ -0,0 +1,166 @@
+#!/usr/bin/env bash
+
+function usage(){
+    echo -e "usage: sudo $0 [OPTIONS]"
+    echo -e "Install openvim database server"
+    echo -e "  OPTIONS"
+    echo -e "     -U USER:    database admin user. 'root' by default. Prompts if needed"
+    echo -e "     -P PASS:    database admin password to be used or installed. Prompts if needed"
+    echo -e "     -d: d database name, default name  vim_db"
+    echo -e "     -u: database user, default name  vim"
+    echo -e "     -p: database pass, default name  vimpw"
+    echo -e "     -q --quiet: install in unattended mode"
+    echo -e "     -h --help:  show this help"
+    echo -e "     --forcedb:  reinstall vim_db DB, deleting previous database if exists and creating a new one"
+    echo -e "     --no-install-packages: <deprecate> use this option to skip updating and installing the requires packages. This avoid wasting time if you are sure requires packages are present e.g. because of a previous installation"
+
+
+}
+
+function _create_db(){
+    echo '
+    #################################################################
+    #####               CREATE DATABASE                         #####
+    #################################################################'
+    echo -e "\nCreating temporary file form MYSQL installation and initialization"
+    TEMPFILE="$(mktemp -q --tmpdir "installopenvim.XXXXXX")"
+    trap 'rm -f "$TEMPFILE"' EXIT
+    chmod 0600 "$TEMPFILE"
+    echo -e "[client]\n user='${DB_ADMIN_USER}'\n password='$DB_ADMIN_PASSWD'">"$TEMPFILE"
+
+    if db_exists $DB_NAME $TEMPFILE ; then
+        if [[ -n $FORCEDB ]]; then
+            DBDELETEPARAM=""
+            [[ -n $QUIET_MODE ]] && DBDELETEPARAM="-f"
+            mysqladmin  --defaults-extra-file=$TEMPFILE -s drop ${DB_NAME} $DBDELETEPARAM || ! echo "Could not delete ${DB_NAME} database" || exit 1
+            mysqladmin  --defaults-extra-file=$TEMPFILE -s create ${DB_NAME} || ! echo "1 Error creating ${DB_NAME} database" || exit 1
+            echo "CREATE USER $DB_USER@'localhost' IDENTIFIED BY '$DB_PASS';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "2 Failed while creating user vim at database"
+            echo "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO $DB_USER@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "3 Failed while creating user vim at database" || exit 1
+            echo " Database '${DB_NAME}' created, user $DB_USER password '$DB_PASS'"
+        else
+            echo "Database exists. Use option '--forcedb' to force the deletion of the existing one" && exit 1
+        fi
+    else
+        echo "mysqladmin -u$DB_ADMIN_USER $DBPASSWD_PARAM -s create ${DB_NAME}"
+
+        mysqladmin -u$DB_ADMIN_USER $DBPASSWD_PARAM -s create ${DB_NAME} || ! echo "4 Error creating ${DB_NAME} database" || exit 1
+        echo "CREATE USER $DB_USER@'localhost' IDENTIFIED BY '$DB_PASS';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database"
+        echo "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO $DB_USER@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed giving creating user vim at database" || exit 1
+        echo " Database '${DB_NAME}' created, user $DB_USER password '$DB_PASS'"
+    fi
+}
+
+function _init_db(){
+    echo '
+    #################################################################
+    #####        INIT DATABASE                                  #####
+    #################################################################'
+    DIRNAME=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
+    su $SUDO_USER -c "${DIRNAME}/init_vim_db.sh -u $DB_USER -p $DB_PASS -d ${DB_NAME}" || ! echo "Failed while initializing database" || exit 1
+}
+
+function db_exists() {
+    RESULT=`mysqlshow --defaults-extra-file="$2" | grep -v Wildcard | grep -o $1`
+    if [ "$RESULT" == "$1" ]; then
+        echo " DB $1 exists"
+        return 0
+    fi
+    echo " DB $1 does not exist"
+    return 1
+}
+DB_NAME='vim_db'
+DB_ADMIN_USER="root"
+DB_USER="vim"
+DB_PASS="vimpw"
+DB_ADMIN_PASSWD=""
+DBPASSWD_PARAM=""
+QUIET_MODE=""
+FORCEDB=""
+NO_PACKAGES=""
+while getopts ":U:P:d:u:p:hiq-:" o; do
+    case "${o}" in
+        U)
+            export DB_ADMIN_USER="$OPTARG"
+            ;;
+        P)
+            export DB_ADMIN_PASSWD="$OPTARG"
+            export DBPASSWD_PARAM="-p$OPTARG"
+            ;;
+        d)
+            export DB_NAME="$OPTARG"
+            ;;
+        u)
+            export DB_USER="$OPTARG"
+            ;;
+        p)
+            export DB_PASS="$OPTARG"
+            ;;
+        q)
+            export QUIET_MODE=yes
+            export DEBIAN_FRONTEND=noninteractive
+            ;;
+        h)
+            usage && exit 0
+            ;;
+        -)
+            [ "${OPTARG}" == "help" ] && usage && exit 0
+            [ "${OPTARG}" == "forcedb" ] && FORCEDB="y" && continue
+            [ "${OPTARG}" == "quiet" ] && export QUIET_MODE=yes && export DEBIAN_FRONTEND=noninteractive && continue
+            [ "${OPTARG}" == "no-install-packages" ] && export NO_PACKAGES=yes && continue
+            echo -e "Invalid option: '--$OPTARG'\nTry $0 --help for more information" >&2
+            exit 1
+            ;;
+        \?)
+            echo -e "Invalid option: '-$OPTARG'\nTry $0 --help for more information" >&2
+            exit 1
+            ;;
+        :)
+            echo -e "Option '-$OPTARG' requires an argument\nTry $0 --help for more information" >&2
+            exit 1
+            ;;
+        *)
+            usage >&2
+            exit 1
+            ;;
+    esac
+done
+
+HERE=$(realpath $(dirname $0))
+OPENVIM_BASEFOLDER=$(dirname $HERE)
+[ "$USER" != "root" ] && echo "Needed root privileges" >&2 && exit -1
+
+if [[ -z "$SUDO_USER" ]] || [[ "$SUDO_USER" = "root" ]]
+then
+    export SUDO_USER='root'
+fi
+
+#Discover Linux distribution
+#try redhat type
+[ -f /etc/redhat-release ] && _DISTRO=$(cat /etc/redhat-release 2>/dev/null | cut  -d" " -f1)
+#if not assuming ubuntu type
+[ -f /etc/redhat-release ] || _DISTRO=$(lsb_release -is  2>/dev/null)
+
+#check and ask for database user password. Must be done after database installation
+if [[ -n $QUIET_MODE ]]
+then
+    echo -e "\nCheking database connection and ask for credentials"
+    echo "mysqladmin -s -u$DB_ADMIN_USER $DBPASSWD_PARAM status >/dev/null"
+    while ! mysqladmin -s -u$DB_ADMIN_USER $DBPASSWD_PARAM status >/dev/null
+    do
+        [ -n "$logintry" ] &&  echo -e "\nInvalid database credentials!!!. Try again (Ctrl+c to abort)"
+        [ -z "$logintry" ] &&  echo -e "\nProvide database credentials"
+        read -e -p "database user? ($DB_ADMIN_USER) " DBUSER_
+        [ -n "$DBUSER_" ] && DB_ADMIN_USER=$DBUSER_
+        read -e -s -p "database password? (Enter for not using password) " DBPASSWD_
+        [ -n "$DBPASSWD_" ] && DB_ADMIN_PASSWD="$DBPASSWD_" && DBPASSWD_PARAM="-p$DBPASSWD_"
+        [ -z "$DBPASSWD_" ] && DB_ADMIN_PASSWD=""           && DBPASSWD_PARAM=""
+        logintry="yes"
+    done
+fi
+
+if [[ -z "$NO_PACKAGES" ]]
+then
+    _create_db
+    _init_db
+fi
+
index 1d24867..6a08a44 100755 (executable)
@@ -93,7 +93,7 @@ shift $((OPTIND-1))
 OPENVIM_VER="$1"
 if [ -z "$OPENVIM_VER" ]
 then 
-    OPENVIM_VER=`${DIRNAME}/../openvimd.py -v`
+    OPENVIM_VER=`ovim -v`
     OPENVIM_VER=${OPENVIM_VER%%-r*}
     OPENVIM_VER=${OPENVIM_VER##*version }
     echo "    Detected openvim version $OPENVIM_VER"
@@ -131,7 +131,7 @@ echo -e "[client]\nuser='${DBUSER}'\npassword='${DBPASS}'" > "$TEMPFILE"
 #check and ask for database user password
 while ! mysql "$DEF_EXTRA_FILE_PARAM" $DBHOST_ $DBPORT_ $DBNAME -e "quit" >/dev/null 2>&1
 do
-        [ -n "$logintry" ] &&  echo -e "\nInvalid database credentials!!!. Try again (Ctrl+c to abort)"
+        [ -n "$logintry" ] && echo -e "\nInvalid database credentials!!!. Try again (Ctrl+c to abort)"
         [ -z "$logintry" ] &&  echo -e "\nProvide database name and credentials"
         read -e -p "mysql database name($DBNAME): " KK
         [ -n "$KK" ] && DBNAME="$KK"
diff --git a/ovim.py b/ovim.py
old mode 100644 (file)
new mode 100755 (executable)
index 83a9742..bf1f311
--- a/ovim.py
+++ b/ovim.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 ##
@@ -35,7 +36,6 @@ database_version = "0.15"      #expected database schema version
 import threading
 import vim_db
 import logging
-import threading
 import imp
 import host_thread as ht
 import dhcp_thread as dt
@@ -43,6 +43,7 @@ import openflow_thread as oft
 from netaddr import IPNetwork
 from jsonschema import validate as js_v, exceptions as js_e
 import openflow_conn
+import argparse
 
 HTTP_Bad_Request =          400
 HTTP_Unauthorized =         401
@@ -1365,4 +1366,12 @@ class ovim():
         controller_host.create_dhcp_interfaces(vlan, first_ip, dhcp_netmask)
         controller_host.launch_dhcp_server(vlan, ip_range, dhcp_netmask, dhcp_path, gateway)
 
+if __name__ == "__main__":
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument("-v","--version", help="increase output verbosity", action="store_true")
+    args = parser.parse_args()
+    if args.version:
+        print ('openvimd version {} {}'.format(ovim.get_version(), ovim.get_version_date()))
+        print ('(c) Copyright Telefonica')
 
index 747c8e6..fa79436 100755 (executable)
@@ -37,10 +37,10 @@ function usage(){
     echo -e "     -q --quiet: install in an unattended mode"
     echo -e "     -h --help:  show this help"
     echo -e "     --develop:  install last version for developers, and do not configure as a service"
-    echo -e "     --forcedb:  reinstall vim_db DB, deleting previous database if exists and creating a new one"
     echo -e "     --force:    makes idenpotent, delete previous installations folders if needed"
     echo -e "     --noclone:  assumes that openvim was cloned previously and that this script is run from the local repo"
     echo -e "     --no-install-packages: use this option to skip updating and installing the requires packages. This avoid wasting time if you are sure requires packages are present e.g. because of a previous installation"
+    echo -e "     --no-db: do not insall mysql server"
 }
 
 function install_packages(){
@@ -78,10 +78,11 @@ DBPASSWD=""
 DBPASSWD_PARAM=""
 QUIET_MODE=""
 DEVELOP=""
-FORCEDB=""
 FORCE=""
 NOCLONE=""
 NO_PACKAGES=""
+NO_DB=""
+
 while getopts ":u:p:hiq-:" o; do
     case "${o}" in
         u)
@@ -101,11 +102,11 @@ while getopts ":u:p:hiq-:" o; do
         -)
             [ "${OPTARG}" == "help" ] && usage && exit 0
             [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
-            [ "${OPTARG}" == "forcedb" ] && FORCEDB="y" && continue
-            [ "${OPTARG}" == "force" ]   && FORCEDB="y" && FORCE="y" && continue
+            [ "${OPTARG}" == "force" ]   && FORCE="y" && continue
             [ "${OPTARG}" == "noclone" ] && NOCLONE="y" && continue
             [ "${OPTARG}" == "quiet" ] && export QUIET_MODE=yes && export DEBIAN_FRONTEND=noninteractive && continue
             [ "${OPTARG}" == "no-install-packages" ] && export NO_PACKAGES=yes && continue
+            [ "${OPTARG}" == "no-db" ] && NO_DB="y" && continue
             echo -e "Invalid option: '--$OPTARG'\nTry $0 --help for more information" >&2
             exit 1
             ;;
@@ -256,8 +257,20 @@ then
     done
 fi
 
+
+if [ -z "$NO_DB" ]; then
+    if [ -n "$QUIET_MODE" ]; then
+        DB_QUIET='-q'
+    fi
+
+    echo "!!!! install-db-server.sh: ${OPENVIM_BASEFOLDER}/scripts/install-db-server.sh -u $DBUSER $DBPASSWD_PARAM -n vim_db $DB_QUIET"
+    ${OPENVIM_BASEFOLDER}/scripts/install-db-server.sh -u $DBUSER $DBPASSWD_PARAM  $DB_QUIET  || exit 1
+fi
+
+
 if [[ -z "$NO_PACKAGES" ]]
 then
+
 echo '
 #################################################################
 #####               INSTALL PYTHON PACKAGES                 #####
@@ -301,44 +314,6 @@ if [[ -z $NOCLONE ]]; then
     [[ -z $DEVELOP ]] && su $SUDO_USER -c "git -C  ${OPENVIM_BASEFOLDER} checkout tags/v1.0.2"
 fi
 
-echo '
-#################################################################
-#####               CREATE DATABASE                         #####
-#################################################################'
-echo -e "\nCreating temporary file form MYSQL installation and initialization"
-TEMPFILE="$(mktemp -q --tmpdir "installopenvim.XXXXXX")"
-trap 'rm -f "$TEMPFILE"' EXIT
-chmod 0600 "$TEMPFILE"
-echo -e "[client]\n user='$DBUSER'\n password='$DBPASSWD'">"$TEMPFILE"
-
-if db_exists "vim_db" $TEMPFILE ; then
-    if [[ -n $FORCEDB ]]; then
-        echo "   Deleting previous database vim_db"
-        DBDELETEPARAM=""
-        [[ -n $QUIET_MODE ]] && DBDELETEPARAM="-f"
-        mysqladmin --defaults-extra-file=$TEMPFILE -s drop vim_db $DBDELETEPARAM || ! echo "Could not delete vim_db database" || exit 1
-        #echo "REVOKE ALL PRIVILEGES ON vim_db.* FROM 'vim'@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-        #echo "DELETE USER 'vim'@'localhost';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-        mysqladmin --defaults-extra-file=$TEMPFILE -s create vim_db || ! echo "Error creating vim_db database" || exit 1
-        echo "DROP USER 'vim'@'localhost';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-        echo "CREATE USER 'vim'@'localhost' identified by 'vimpw';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-        echo "GRANT ALL PRIVILEGES ON vim_db.* TO 'vim'@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-        echo " Database 'vim_db' created, user 'vim' password 'vimpw'"
-    else
-        echo "Database exists. Use option '--forcedb' to force the deletion of the existing one" && exit 1
-    fi
-else
-    mysqladmin -u$DBUSER $DBPASSWD_PARAM -s create vim_db || ! echo "Error creating vim_db database" || exit 1
-    echo "CREATE USER 'vim'@'localhost' identified by 'vimpw';"   | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-    echo "GRANT ALL PRIVILEGES ON vim_db.* TO 'vim'@'localhost';" | mysql --defaults-extra-file=$TEMPFILE -s || ! echo "Failed while creating user vim at database" || exit 1
-    echo " Database 'vim_db' created, user 'vim' password 'vimpw'"
-fi
-
-echo '
-#################################################################
-#####        INIT DATABASE                                  #####
-#################################################################'
-su $SUDO_USER -c "${OPENVIM_BASEFOLDER}/database_utils/init_vim_db.sh -u vim -p vimpw -d vim_db" || ! echo "Failed while initializing database" || exit 1
 
 
 if [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ]
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..642b5ad
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,145 @@
+#!/usr/bin/env python
+
+from setuptools import setup, find_packages
+from setuptools.command.install import install
+from os import system
+from setuptools import setup
+
+__name__ = 'lib-osm-openvim'
+__version__ = '1.0.0'
+__description__ = 'OSM Openvim library'
+__author__ = 'ETSI OSM'
+__author_email__ = 'alfonso.tiernosepulveda@telefonica.com'
+__maintainer__ = 'mirabal'
+__maintainer_email__ = 'leonardo.mirabal@altran.com'
+__license__ = 'Apache 2.0'
+__url__ = 'https://osm.etsi.org/gitweb/?p=osm/openvim.git;a=summary'
+
+
+__data_files__ = [('osm/openvim/', ['openvimd.cfg']),
+                  ('osm/openvim/database_utils/', ['database_utils/vim_db_structure.sql',
+                                                   'database_utils/nets.sql',
+                                                   'database_utils/of_ports_pci_correspondence.sql',
+                                                   'database_utils/host_ranking.sql',
+                                                   'database_utils/dump_db.sh',
+                                                   'database_utils/init_vim_db.sh',
+                                                   'database_utils/migrate_vim_db.sh',
+                                                   'database_utils/install-db-server.sh'
+                                                   ]),
+                  ('osm/openvim/scripts/', ['scripts/service-openvim.sh',
+                                            'scripts/openvim-report.sh',
+                                            'scripts/service-floodlight.sh',
+                                            'scripts/service-opendaylight.sh',
+                                            'scripts/initopenvim.sh'
+                                            ]),
+                  ]
+
+
+_req = [
+    "asn1crypto",
+    "cffi",
+    "enum34",
+    "functools32",
+    "idna",
+    "ipaddress",
+    "packaging",
+    "pbr",
+    "pkgconfig",
+    "pyasn1",
+    "pycparser",
+    "pycrypto",
+    "pyparsing",
+    "six",
+    "jsonschema",
+    "argcomplete",
+    "requests",
+    "PyYAML",
+    "requestsexceptions",
+    "netaddr",
+    "bottle",
+    "MySQL-python",
+    "paramiko",
+    "libvirt-python"
+]
+
+__scripts__ = ['openflow', 'ovim']
+
+
+class LibOpenvimInstaller(install):
+    lite = None
+    user_options = install.user_options + [('lite', None, "Don't install without Machine Learning modules.")]
+
+    def initialize_options(self):
+        self.lite = None
+        install.initialize_options(self)
+
+    def finalize_options(self):
+        install.finalize_options(self)
+
+    def run(self):
+
+        cmd = 'ln -sf -v /usr/local/osm/openvim/openvimd.cfg /etc/default/openvimd.cfg '
+        system(cmd)
+        cmd = 'ln -sf -v /usr/local/osm/openvim/openflow /usr/bin/openflow'
+        system(cmd)
+        cmd = 'ln -sf -v /usr/local/osm/openvim/ovim.py /usr/bin/ovim'
+        system(cmd)
+        if not self.lite:
+            __scripts__.append('openvim')
+            __scripts__.append('openvimd')
+
+            cmd = 'ln -sf -v /usr/local/osm/openvim/openvimd /usr/bin/openvimd'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/openvim /usr/bin/openvim'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/scripts/service-openvim.sh /usr/sbin/service-openvim'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/scripts/openvim-report.sh /usr/sbin/service-report'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/scripts/service-floodlight.sh /usr/sbin/service-floodlight'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/scripts/service-opendaylight.sh /usr/sbin/service-opendaylight'
+            system(cmd)
+            cmd = 'ln -sf -v /usr/local/osm/openvim/scripts/initopenvim.sh /usr/sbin/initopenvim'
+            system(cmd)
+
+        install.run(self)
+
+
+setup(name=__name__,
+      version=__version__,
+      description=__description__,
+      long_description=__description__,
+      author=__author__,
+      author_email=__author_email__,
+      license=__license__,
+      maintainer=__maintainer__,
+      maintainer_email=__maintainer_email__,
+      url=__url__,
+      py_modules=['ovim',
+                  'openvimd',
+                  'vim_db',
+                  'httpserver',
+                  'RADclass',
+                  'auxiliary_functions',
+                  'dhcp_thread',
+                  'definitionsClass',
+                  'host_thread',
+                  'vim_schema',
+                  'ovim',
+                  'openflow_thread',
+                  'onos',
+                  'ODL',
+                  'floodlight',
+                  ],
+      packages=find_packages() + ['database_utils'] + ['scripts'],
+      package_dir={__name__: __name__},
+      package_data={'database_utils': ['*'], 'scripts': ['*']},
+      scripts=__scripts__,
+      data_files=__data_files__,
+      include_package_data=True,
+      cmdclass={'install': LibOpenvimInstaller},
+      install_requires=_req
+      )
+
+