Updated integration to remove odl-aaa-all feature.
[integration/distribution.git] / distributions / base / src / assemble / resources / run.sh
1 #!/bin/bash
2
3 # Use same path for run.internal.sh
4 RUNSH_DIR=$(dirname $0)
5 CONTROLLER_RUNSH=${RUNSH_DIR}/run.internal.sh
6
7 OF_FILTER=
8 OF_PLUGIN_RUNTIME=
9 helparg=
10 # Added help for of13 before help from controller (this help common for intagration and controller)
11 function usage {
12     needParentHelp=true
13     if [ -n "${helparg}" ]; then
14        . functions.sh
15        harvestHelp ${helparg}
16        if (( $? == 0 )); then
17            needParentHelp=false
18            echo -e '\nFor more information type -help.\n'
19        fi
20     else
21         echo 'For more information on a specific command, type -help command-name.'
22         echo
23         echo '    Added option for integration:'
24         echo '    of13             [-of13]'
25         echo '    of10             [-of10]'
26         echo
27         echo '    Visit wiki for more information :'
28         echo
29         echo '    https://wiki.opendaylight.org/view/CrossProject:Integration_Group:Controller_Artifacts:run_sh'
30         echo
31         echo 'Common options: '
32     fi
33
34     if ${needParentHelp}; then
35         $CONTROLLER_RUNSH -help ${helparg}
36     fi
37     exit 1
38 }
39
40 OF13=1
41 BUNDLEFILTER=
42 while true ; do
43     (( i += 1 ))
44     case "${@:$i:1}" in
45         -of10) OF13=0 ; (( i += 1 ));;
46         -of13) OF13=1 ; (( i += 1 ));;
47         -bundlefilter) (( i += 1 )); BUNDLEFILTER="|${@:$i:1}";;
48         -help) (( i += 1 )); helparg=${@:$i:1}; usage ;;
49         "") break ;;
50     esac
51 done
52
53 # clean available optional configurations (links)
54 find ${RUNSH_DIR}/configuration/initial -type l -exec rm {} \;
55
56 ##of13
57 #of13             [-of13]
58 #   Option to run the OpenDaylight controller with the OpenFlow plugin (1.3).
59 ##
60 # OF Filter selection
61 OF_FILTER="org.opendaylight.(openflowplugin|openflowjava|controller.sal-compatibility|ovsdb.of-extension)"
62 OF_PLUGIN_RUNTIME="1.0"
63 if (( $OF13 != 0 )); then
64     OF_PLUGIN_RUNTIME="1.3"
65     OF_FILTER="org.opendaylight.controller.(thirdparty.org.openflow|protocol_plugins.openflow)"
66     while read ofConfig; do
67         ln -s ../initial.available/$(basename ${ofConfig}) ${RUNSH_DIR}/configuration/initial/
68     done < <(find ${RUNSH_DIR}/configuration/initial.available -name '*openflowplugin.xml')
69 fi
70
71 # Make sure we suck out our additional args so as to not confuse
72 # run.internal.sh
73 NEWARGS=`echo $@|sed 's/-of13//'|sed 's/-of10//'|sed 's/-bundlefilter[ ]*[^ ]*//'`
74
75 # Build the filter string
76 FILTERBEGINING='^(?!'
77 FILTERENDING=').*'
78 FILTER=${FILTERBEGINING}${OF_FILTER}${BUNDLEFILTER}${FILTERENDING}
79
80 # Run the command
81 $CONTROLLER_RUNSH -Dfelix.fileinstall.filter="$FILTER" -Dovsdb.of.version="$OF_PLUGIN_RUNTIME" $NEWARGS