summaryrefslogtreecommitdiffstats
path: root/build/test_ovs_rpm.sh
blob: fce5ca43646ca002bde11553fcfe9802cb5e0b5a (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
#!/bin/bash
##############################################################################
# Copyright (c) 2016 Red Hat Inc. and others.
# therbert@redhat.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -e
declare -i CNT

echo "==============================="
echo executing $0 $@
echo executing on machine `uname -a`


usage() {
    echo run BuildAndTest -h for help
}

while getopts "dg:hkp:u:v" opt; do
    case "$opt" in
        d)
            DPDK="yes"
            ;;
        g)
            TAG=${OPTARG}
            ;;
        h|\?)
            usage
            exit 1
            ;;
        k)
            kmod="yes"
            ;;
        u)
            OVS_REPO_URL=${OPTARG}
            ;;
        v)
            verbose="yes"
            ;;
    esac
done

HOME=`pwd`
TOPDIR=$HOME
TMPDIR=$TOPDIR/ovsrpm

if [ -d $TMPDIR ]
then
    rm -rf $TMPDIR
fi

mkdir -p $TMPDIR

cd $TMPDIR

mkdir -p $HOME/rpmbuild/RPMS
mkdir -p $HOME/rpmbuild/SOURCES
mkdir -p $HOME/rpmbuild/SPECS
mkdir -p $HOME/rpmbuild/SRPMS

RPMDIR=$HOME/rpmbuild

echo " Testing installation of kmod RPM"
if [ ! -z $kmod ]; then
    echo "Install kernel module"
    sudo rpm -ivh $RPMDIR/RPMS/x86_64/openvswitch-kmod*.rpm
    echo " Kernel RPM installed."
fi
echo "Testing User Space RPM"
sudo rpm -ivh $RPMDIR/RPMS/x86_64/openvswitch-2*.rpm

sudo service openvswitch start

sudo ovs-vsctl show
sudo ovs-vsctl add-br br1
sudo ovs-ofctl dump-flows br1

exit 0