Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imp: use the new debian repository for ems #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vnfm.rabbitmq.durable=true
vnfm.rabbitmq.exclusive=false
vnfm.ems.queue.autodelete=true
vnfm.ems.queue.heartbeat=120
vnfm.ems.version=0.23
vnfm.ems.version=1.0.0
# Timeout in seconds for any sendAndReceive
vnfm.rabbitmq.sar.timeout=1000
# Timeout in seconds for waiting the EMS to boot
Expand Down
60 changes: 35 additions & 25 deletions src/main/resources/user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export ENDPOINT=

# Hostname/IP and path of the EMS repository
export UBUNTU_EMS_REPOSITORY_HOSTNAME_OR_IP="get.openbaton.org"
export UBUNTU_EMS_REPOSITORY_PATH="repos/apt/debian/"
export UBUNTU_EMS_REPOSITORY_PATH="repos/openbaton/"
export CENTOS_EMS_REPOSITORY_HOSTNAME_OR_IP="get.openbaton.org"
export CENTOS_EMS_REPOSITORY_PATH="repos/rpm/"
export CENTOS_EMS_REPOSITORY_PATH="repos/openbaton/"

export EMS_PROPERTIES_DIR="/etc/openbaton"
export EMS_PROPERTIES_FILE="${EMS_PROPERTIES_DIR}/openbaton-ems.properties"

export OS_DISTRIBUTION_RELEASE_MAJOR=

Expand All @@ -33,21 +36,27 @@ source /etc/bashrc
################

install_ems_on_ubuntu () {
result=$(dpkg -l | grep "ems" | grep -i "open baton\|openbaton" | wc -l)
OS_DISTRIBUTION_CODENAME="${1}"

result=$(dpkg -l | grep "openbaton-ems" | wc -l)
if [ ${result} -eq 0 ]; then
echo "Downloading EMS from ${UBUNTU_EMS_REPOSITORY_HOSTNAME_OR_IP}"
echo "deb http://${UBUNTU_EMS_REPOSITORY_HOSTNAME_OR_IP}/${UBUNTU_EMS_REPOSITORY_PATH} ems main" >> /etc/apt/sources.list
wget -O - http://get.openbaton.org/public.gpg.key | apt-key add -
echo "deb http://${UBUNTU_EMS_REPOSITORY_HOSTNAME_OR_IP}/${UBUNTU_EMS_REPOSITORY_PATH}/${OS_DISTRIBUTION_CODENAME}/release ${OS_DISTRIBUTION_CODENAME} main" >> /etc/apt/sources.list
wget -O - http://get.openbaton.org/keys/openbaton.public.key| apt-key add -
echo "Checking for running apt-get processes"
while [ ! -z "$(ps -A | grep apt-get | awk '{print $1}')" ];do
while [ ! -z "$(ps -A | grep apt-get | awk '{print $1}')" ]; do
echo "Waiting for running apt-get processes to finish"
sleep 5s
done
echo "Finished waiting for running apt-get processes"
apt-get update
cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime
apt-get install -y git
apt-get install -y --force-yes ems-$EMS_VERSION
if [ -z "${EMS_VERSION}" ]; then
apt-get install -y --force-yes openbaton-ems
else
apt-get install -y --force-yes openbaton-ems=${EMS_VERSION}
fi
else
echo "EMS is already installed"
fi
Expand All @@ -69,18 +78,18 @@ install_zabbix_on_ubuntu () {
################

install_ems_on_centos () {
result=$(yum list installed | grep "ems" | grep -i "open baton\|openbaton" | wc -l)
result=$(yum list installed | grep "openbaton-ems" | wc -l)
if [ ${result} -eq 0 ]; then
echo "Downloading EMS from ${CENTOS_EMS_REPOSITORY_HOSTNAME_OR_IP}"
echo "[openbaton]" >> /etc/yum.repos.d/OpenBaton.repo
echo "name=Open Baton Repository" >> /etc/yum.repos.d/OpenBaton.repo
echo "baseurl=http://${CENTOS_EMS_REPOSITORY_HOSTNAME_OR_IP}/${CENTOS_EMS_REPOSITORY_PATH}" >> /etc/yum.repos.d/OpenBaton.repo
echo "baseurl=http://${CENTOS_EMS_REPOSITORY_HOSTNAME_OR_IP}/${CENTOS_EMS_REPOSITORY_PATH}/centos" >> /etc/yum.repos.d/OpenBaton.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/OpenBaton.repo
echo "enabled=1" >> /etc/yum.repos.d/OpenBaton.repo
cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime
yum install -y git
yum install -y ems
systemctl enable ems
yum install -y openbaton-ems
systemctl enable openbaton-ems
#systemctl start ems
else
echo "EMS is already installed"
Expand All @@ -105,19 +114,19 @@ install_zabbix_on_centos () {
#############

configure_ems () {
mkdir -p /etc/openbaton/ems
echo [ems] > /etc/openbaton/ems/conf.ini
echo broker_ip=$BROKER_IP >> /etc/openbaton/ems/conf.ini
echo broker_port=$BROKER_PORT >> /etc/openbaton/ems/conf.ini
echo username=$USERNAME >> /etc/openbaton/ems/conf.ini
echo password=$PASSWORD >> /etc/openbaton/ems/conf.ini
echo exchange=$EXCHANGE_NAME >> /etc/openbaton/ems/conf.ini
echo heartbeat=$EMS_HEARTBEAT >> /etc/openbaton/ems/conf.ini
echo autodelete=$EMS_AUTODELETE >> /etc/openbaton/ems/conf.ini
echo type=$ENDPOINT >> /etc/openbaton/ems/conf.ini
echo hostname=$Hostname >> /etc/openbaton/ems/conf.ini

service ems restart
mkdir -p "${EMS_PROPERTIES_DIR}"
echo [ems] > "${EMS_PROPERTIES_FILE}"
echo broker_ip=$BROKER_IP >> "${EMS_PROPERTIES_FILE}"
echo broker_port=$BROKER_PORT >> "${EMS_PROPERTIES_FILE}"
echo username=$USERNAME >> "${EMS_PROPERTIES_FILE}"
echo password=$PASSWORD >> "${EMS_PROPERTIES_FILE}"
echo exchange=$EXCHANGE_NAME >> "${EMS_PROPERTIES_FILE}"
echo heartbeat=$EMS_HEARTBEAT >> "${EMS_PROPERTIES_FILE}"
echo autodelete=$EMS_AUTODELETE >> "${EMS_PROPERTIES_FILE}"
echo type=$ENDPOINT >> "${EMS_PROPERTIES_FILE}"
echo hostname=$Hostname >> "${EMS_PROPERTIES_FILE}"

service openbaton-ems restart
}


Expand Down Expand Up @@ -145,7 +154,8 @@ fi

case ${os} in
ubuntu)
install_ems_on_ubuntu
OS_DISTRIBUTION_CODENAME=$( lsb_release -a 2>/dev/null | grep "Codename" | sed "s/[ \t]*//g" | awk -F':' '{ print $2 }' )
install_ems_on_ubuntu "${OS_DISTRIBUTION_CODENAME}"
if [ -z "${MONITORING_IP}" ]; then
echo "No MONITORING_IP is defined, I will not download zabbix-agent"
else
Expand Down