]> git.proxmox.com Git - ovs.git/blob - xenserver/etc_profile.d_openvswitch.sh
dpctl: Fix dpctl process command parameter error.
[ovs.git] / xenserver / etc_profile.d_openvswitch.sh
1 # Copyright (C) 2009, 2010, 2011 Nicira, 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 openvswitch'
9 alias openvswitch='service openvswitch'
10
11 function watchdp {
12 watch ovs-dpctl show "$@"
13 }
14
15 function watchdpflows {
16 local grep=""
17 local dp=$1
18 shift
19 if [ $# -gt 0 ]; then
20 grep="| grep $@"
21 fi
22 watch "ovs-dpctl dump-flows $dp $grep"
23 }
24
25 function watchflows {
26 local grep=""
27 local dp=$1
28 shift
29 bridge=$(ovs-dpctl show $dp | grep 'port 0:' | cut -d' ' -f 3)
30 if [ $# -gt 0 ]; then
31 grep="| grep $@"
32 fi
33 watch "ovs-ofctl dump-flows unix:/var/run/$bridge.mgmt $grep"
34 }
35
36 function monitorlogs {
37 local grep=""
38 if [ $# -gt 0 ]; then
39 grep="| grep --line-buffered '^==> .* <==$"
40 for i in "$@"; do
41 grep="$grep\|$i"
42 done
43 grep="$grep'"
44 fi
45 cmd="tail -F /var/log/messages /var/log/openvswitch/ovs-vswitchd.log /var/log/openvswitch/ovsdb-server /var/log/xensource.log $grep | tee /var/log/monitorlogs.out"
46 printf "cmd: $cmd\n"
47 eval "$cmd"
48 }