一.opencontrail install:
https://github.com/Juniper/contrail-installer
cd contrail-installer
cp samples/localrc-all localrc
修改localrc中一些项:
CONTRAIL_DEFAULT_INSTALL - Set this to True for installation from OpenContrail binary packages. When set to False, trunk OpenContrail bits will be downloaded and compiled.
LAUNCHPAD_BRANCH=PPA - Applicable only when CONTRAIL_DEFAULT_INSTALL is set to True. It specifies to use released binary packages for installation. Default is to use latest snapshots as this knob is commented out by default in sample localrc.
PHYSICAL_INTERFACE - This is external interface Vrouter should bind to. It should have a valid IP address configured. For example eth0
INSTALL_PORFILE - Set this to ALL to for an all in one node.
USE_SCREEN - Set this to True to launch contrail modules in a screen session called "contrail". Connect to screen session for any troubleshooring of contrail modules.
LOGFILE - Specifiy logfile for contrail.sh runs. By default this is log/contrail.log in contrail-installer directory
安装步骤:
cd contrail-installer
cp samples/localrc-all localrc (edit localrc as needed)
sudo -E add-apt-repository -y cloud-archive:kilo
./contrail.sh build
由于被墙,手动下载repo放到/usr/bin 修改contrail.sh:
# basic dependencies
592 if ! which repo > /dev/null 2>&1 ; then
593 #wget http://commondatastorage.googleapis.com/git-repo-downloads/repo
594 chmod 0755 repo
595 #sudo mv repo /usr/bin
596 fi
添加公钥(ssh-keygen -t rsa), https://github.com/settings/ssh
git config --global user.email "liukuan73@gmail.com" git config --global user.name "lk"
$repo init -u git@github.com:Juniper/contrail-vnc
./contrail.sh install
./contrail.sh configure
./contrail.sh start
附我的localrc:
STACK_DIR=$(cd $(dirname $0) && pwd)
LOG_DIR=$STACK_DIR/log/screens
LOG=True
DEBUG=True
LOGFILE=$STACK_DIR/log/contrail.log
LOGDAYS=1
USE_SCREEN=True
PASSWORD=123456
DATABASE_PASSWORD=$PASSWORD
RABBIT_PASSWORD=$PASSWORD
SERVICE_TOKEN=$PASSWORD
SERVICE_PASSWORD=$PASSWORD
ADMIN_PASSWORD=$PASSWORD
#set loglevel to 1/2/3 . Always stderr into logfile,console.
#For LOG_LEVEL 1 stdout into logfile.
#For LOG_LEVEL 2 stdout into logfile and xtrace commands into console.
#For LOG_LEVEL 3 stdout and xtrace into logfile,console.
LOG_LEVEL=3
SERVICE_TIMEOUT=180
SERVICE_HOST=10.133.19.110
#use only when INSTALL_PROFILE=COMPUTE, provide IP of compute node
#COMPUTE_HOST_IP=<IP of compute-node>
INSTALL_PROFILE=ALL
PHYSICAL_INTERFACE=eth1
# to get source code make it as False
#CONTRAIL_DEFAULT_INSTALL=False
# to get the ppa packages uncomment
#LAUNCHPAD_BRANCH=r2.20
# repo proto is https or (default) ssh. Leave commented for ssh
# CONTRAIL_REPO_PROTO=https
# proto for openstack bits. Use HTTPS if git is firewalled
GIT_BASE=https://github.com
CASS_MAX_HEAP_SIZE=500M
CASS_HEAP_NEWSIZE=100M
# number of jobs used to build
# NB_JOBS=1
# target of the build debug/production
# TARGET=production
二.安装devstack:
1. Goto "/opt/stack/neutron", then clone or download "contrail-neutron-plugin"
#cd /opt/stack/neutron#git clone https://github.com/Juniper/contrail-neutron-plugin.git OR #wget https://github.com/Juniper/contrail-neutron-plugin/archive/v2.01.tar.gz
#tar -zxvf /opt/stack/neutron/v2.01.tar.gz
#cp -r contrail-neutron-plugin-2.01/neutron_plugin_contrail ./
2. 下载安装脚本到"devstack/lib/neutron_plugins/"
https://github.com/Juniper/contrail-installer/blob/master/devstack/lib/neutron_plugins/opencontrail
or
https://github.com/dsetia/devstack/blob/master/lib/neutron_plugins/contrail
3. Add following lines in localrc
VA_VIF_DRIVER=nova_contrail_vif.contrailvif.VRouterVIFDriver
APISERVER_IP=10.133.19.110
Q_HOST=10.133.19.109
HOST_IP=10.133.19.110
SERVICE_HOST=10.133.19.109
#OpenContrail API Server
APISERVER_IP=192.168.56.102#OpenContrail Plugin
Q_PLUGIN=opencontrail
#OpenContrail nova plugin
NOVA_VIF_DRIVER=nova_contrail_vif.contrailvif.VRouterVIFDriver
Example localrc
STACK_DIR=$(cd $(dirname $0) && pwd)
LOG_DIR=$STACK_DIR/log/screens
LOG=True
DEBUG=True
LOGFILE=$STACK_DIR/log/stack.log
LOGDAYS=1
SCREEN_LOGDIR=$LOG_DIR
disable_service n-net
enable_service q-svc
enable_service q-meta
#enable_service neutron
# not used by contrail
disable_service q-agt
disable_service q-dhcp
disable_service q-l3
DATABASE_PASSWORD=contrail123
RABBIT_PASSWORD=contrail123
SERVICE_TOKEN=contrail123
SERVICE_PASSWORD=contrail123
ADMIN_PASSWORD=contrail123
#OpenContrail API Server
APISERVER_IP=192.168.56.102
#OpenContrail Plugin
Q_PLUGIN=opencontrail
PHYSICAL_INTERFACE=eth1
# proto for openstack bits. Use HTTPS if git is firewalled
GIT_BASE=https://git.openstack.org
#OpenContrail nova plugin
NOVA_VIF_DRIVER=nova_contrail_vif.contrailvif.VRouterVIFDriver
4. Comment/delete following line from stack.sh(Optional Step)
create_neutron_initial_network
5. ./stack.sh
In this step, we just want to get /neutron.conf. There will be error when starting q-svc, but it doesn't matter.
6..Configure contrail api_extensions_path and core_plugin in /etc/neutron/neutron.conf
#vim /etc/neutron/neutron.conf
[DEFAULT]
api_extensions_path = extensions:/opt/stack/neutron/neutron_plugin_contrail/extensions
core_plugin = neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2
7.Enable contrail_extensions (Example ipam) in /etc/neutron/plugins/opencontrail/ContrailPlugin.ini
#vim /etc/neutron/plugins/opencontrail/ContrailPlugin.ini
[APISERVER]
contrail_extensions=ipam:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_ipam.NeutronPluginContrailIpam
8. ./unstack.sh ./clean.sh ./stack.sh
9. Verification
List all extensions and check for the "ipam" extension
#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:9696/v2.0/extensions | python -mjson.tool
OR
#neutron ext-list
http://fosshelp.blogspot.jp/2015/04/openstack-devstack-opencontrail-enable.html
http://fosshelp.blogspot.in/2015/04/openstack-devstack-opencontrail-localrc.html