summaryrefslogtreecommitdiffstats
path: root/scripts/install_odl.sh
blob: 01eefc727b03fb8ba1417277ed7bd8557d691ea6 (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
#!/bin/bash
SCRIPT_DIR=$(dirname $0)
. $SCRIPT_DIR/lib.sh
service opendaylight stop
sleep 10
INSTALL_DIR=/opt
ODL_DIR=$INSTALL_DIR/opendaylight
ODL_TGZ_NAME=$1
cp $ODL_DIR/etc/jetty.xml $INSTALL_DIR
cp $ODL_DIR/etc/org.opendaylight.groupbasedpolicy.* $INSTALL_DIR
rm -rf $ODL_DIR
#mv opendaylight orig_opendaylight
ODL_DEFAULT_DIR_NAME=$(tar tf $ODL_TGZ_NAME | head -n1 | cut -d "/" -f 1)
echo "$HOSTNAME: unpacking odl"
tar -C $INSTALL_DIR -xf $ODL_TGZ_NAME
mv $INSTALL_DIR/$ODL_DEFAULT_DIR_NAME $INSTALL_DIR/opendaylight

#CHANGE PORT AND CONFIGURE:
echo "$HOSTNAME: configuring odl"
cp $INSTALL_DIR/jetty.xml $ODL_DIR/etc/
cp $INSTALL_DIR/org.opendaylight.groupbasedpolicy.* $ODL_DIR/etc/

#CONFIGURE LOGGING:
sed -i 's/log4j.appender.out.maxFileSize=.*/log4j.appender.out.maxFileSize=100MB/' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
sed -i 's/log4j.appender.out.maxBackupIndex=.*/log4j.appender.out.maxBackupIndex=10/' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.groupbasedpolicy.renderer.vpp = TRACE' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.groupbasedpolicy.neutron.mapper = TRACE' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.groupbasedpolicy.neutron.vpp.mapper = TRACE' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.vbd = TRACE' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.netconf.sal.connect.netconf = TRACE' $ODL_DIR/etc/org.ops4j.pax.logging.cfg
#sed -i '$alog4j.logger.org.opendaylight.netconf = DEBUG' $ODL_DIR/etc/org.ops4j.pax.logging.cfg

#ACL LOGGING
#sed -i '$alog4j.logger.org.opendaylight.groupbasedpolicy.renderer.vpp.policy.acl = INFO' $ODL_DIR/etc/org.ops4j.pax.logging.cfg

#INSTALL FEATURES
sed -i 's/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf,odl-netconf-all,odl-groupbasedpolicy-neutron-vpp-mapper,odl-vbd/' $ODL_DIR/etc/org.apache.karaf.features.cfg

#CHANGE OWNER AND RESTART DAEMON
echo "$HOSTNAME: changing owner to odl"
chown -R odl:odl $ODL_DIR
systemctl daemon-reload

#CONFIGURE CLUSTER
if [[ $2 == "-c" ]]
then
    NODE_NUMBER=$(hostname | grep -o [0-9])
    ((NODE_NUMBER++))
    ODL_IPS=$(grep -A 7 "listen opendaylight" /etc/haproxy/haproxy.cfg | grep server | grep -Eo "$IPV4_REGEX")
    echo "$HOSTNAME: configuring cluster with id $NODE_NUMBER and ips $ODL_IPS"
    $ODL_DIR/bin/configure_cluster.sh $NODE_NUMBER $ODL_IPS
fi

#START ODL
service opendaylight start