summaryrefslogtreecommitdiffstats
path: root/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh
blob: 17cd29338f1f14f6f93a3508d1b2e4298a278883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
# Copyright 2015-2016 AT&T Intellectual Property, Inc
#  
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#  
# http://www.apache.org/licenses/LICENSE-2.0
#  
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# What this is: Installer for an OpenStack API test environment for Congress.
# Status: this is a work in progress, under test.
#
# Prequisite: OPFNV installed per JOID or Apex installer
# On jumphost:
# - Congress installed through install_congress_1.sh
# - admin-openrc.sh downloaded from Horizon
# - env.sh and admin-openrc.sh in the current folder
# How to use:
#   Retrieve the copper install script as below, optionally specifying the 
#   branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra
# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/test-webapp/setup/install_congress_cli_test_environment.sh
# $ source install_congress_testserver.sh [copper-branch openstack-branch]
#   optionally specifying the branch identifier to use for copper and OpenStack

set -x

if [ $# -eq 1 ]; then
  echo 1>&2 "$0: specify both copper-branch and openstack-branch"
  set +x
  return 2
fi
if [ $# -eq 2 ]; then
  cubranch=$1
  osbranch=$2
fi

cubranch=$1
osbranch=$2

echo "Install prerequisites"
dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`

if [ "$dist" == "Ubuntu" ]; then
  echo "Update the base server"
  set -x
  sudo apt-get update
  #apt-get -y upgrade
  echo "Install pip"
  sudo apt-get install -y python-pip
  echo "Install java"
  sudo apt-get install -y default-jre
  echo "Install other dependencies"
  apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl
else
  echo "Add epel repo"
  sudo yum install epel-release -y
  echo "install pip"
  sudo yum install python-pip -y
  echo "install other dependencies"
  sudo yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y
fi

echo "Install python dependencies"
sudo pip install --upgrade pip virtualenv setuptools pbr tox

echo "Create virtualenv"
mkdir /tmp/copper
cd /tmp/copper
virtualenv venv
source venv/bin/activate

echo "Clone copper"
git clone https://gerrit.opnfv.org/gerrit/copper
cd copper
if [ $# -eq 2 ]; then git checkout $1; fi

echo "Setup OpenStack environment variables per your OPNFV install"
source env.sh
source admin-openrc.sh

echo "Clone congress"
git clone https://github.com/openstack/congress.git
cd congress
if [ $# -eq 2 ]; then git checkout $2; fi

echo "Install OpenStack client"
cd /tmp/copper
git clone https://github.com/openstack/python-openstackclient.git
cd python-openstackclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

echo "Install Congress client"
cd /tmp/copper
git clone https://github.com/openstack/python-congressclient.git
cd python-congressclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

echo "Install Glance client"
cd /tmp/copper
git clone https://github.com/openstack/python-glanceclient.git
cd python-glanceclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

echo "Install Neutron client"
cd /tmp/copper
git clone https://github.com/openstack/python-neutronclient.git
cd python-neutronclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

echo "Install Nova client"
cd /tmp/copper
git clone https://github.com/openstack/python-novaclient.git
cd python-novaclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

echo "Install Keystone client"
cd /tmp/copper
git clone https://github.com/openstack/python-keystoneclient.git
cd python-keystoneclient
if [ $# -eq 2 ]; then git checkout $2; fi
pip install -r requirements.txt
pip install .

cd /tmp/copper/copper/tests
ls

echo "You can run tests individually, or as a collection with run.sh"

set +x