Update Open vSwitch documentation.
[sliver-openvswitch.git] / xenserver / etc_profile.d_vswitch.sh
1 # Copyright (C) 2009, 2010 Nicira Networks, Inc.
2 #
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.  This file is offered as-is,
6 # without warranty of any kind.
7
8 alias vswitch='service vswitch'
9
10 function watchdp {
11         watch ovs-dpctl show "$@"
12 }
13
14 function watchdpflows {
15         local grep=""
16         local dp=$1
17         shift
18         if [ $# -gt 0 ]; then
19                 grep="| grep $@"
20         fi
21         watch "ovs-dpctl dump-flows $dp $grep"
22 }
23
24 function watchflows {
25         local grep=""
26         local dp=$1
27         shift
28         bridge=$(ovs-dpctl show $dp | grep 'port 0:' | cut -d' ' -f 3)
29         if [ $# -gt 0 ]; then
30                 grep="| grep $@"
31         fi
32         watch "ovs-ofctl dump-flows unix:/var/run/$bridge.mgmt $grep"
33 }
34
35 function monitorlogs {
36     local grep=""
37     if [ $# -gt 0 ]; then
38         grep="| grep --line-buffered '^==> .* <==$"
39         for i in "$@"; do
40             grep="$grep\|$i"
41         done
42         grep="$grep'"
43     fi
44     cmd="tail -F /var/log/messages /var/log/ovs-vswitchd.log /var/log/xensource.log $grep | tee /var/log/monitorlogs.out"
45     printf "cmd: $cmd\n"
46     eval "$cmd"
47 }