On Sat, Jun 25, 2016 at 04:12:04AM +0000, Daniel Ye wrote:
> It’s because of the "packet send error" statistic. The test of checking IPFIX 
> statistics set collector as “127.0.0.1:4739”.
> Test code:
> -----------------------------------------------------
> dnl Sample every packet using bridge-based sampling.
> AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
>                     --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
>                               sampling=1], [0], [ignore])
> ——————————————————————————
> 
> We expect “ tx errs=12” because we don’t listen on port 4739 on local host.
> Test code:
> -----------------------------------------------------
> AT_CHECK([ovs-ofctl dump-ipfix-bridge br0], [0], [dnl
> NXST_IPFIX_BRIDGE reply (xid=0x2):
>   bridge ipfix: flows=20, current flows=0, sampled pkts=20, ipv4 ok=0, ipv6 
> ok=0, tx pkts=12
>                 pkts errs=20, ipv4 errs=20, ipv6 errs=0, tx errs=12
> ])
> ——————————————————————————
> 
> As I talked with Wenyu, she has listened on port 4739 for testing. If port 
> 4739 on the local host is listened, there will
> be no "tx errs”.
> 
> Should we remove "tx errs” check?

OK, that's a bug in the test then.  The tests shouldn't depend on or
require listening on any fixed port numbers.  A lot of tests use the
PARSE_LISTENING_PORT macro to avoid the need to listen on a fixed port.
Here's the definition from ofproto-macros.at:

    # PARSE_LISTENING_PORT LOGFILE VARIABLE
    #
    # Parses the TCP or SSL port on which a server is listening from
    # LOGFILE, given that the server was told to listen on a kernel-chosen
    # port, and assigns the port number to shell VARIABLE.  You should
    # specify the listening remote as ptcp:0:127.0.0.1 or
    # pssl:0:127.0.0.1, or the equivalent with [::1] instead of 127.0.0.1.
    #
    # Here's an example of how to use this with ovsdb-server:
    #
    #    ovsdb-server --log-file --remote=ptcp:0:127.0.0.1 ...
    #    PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
    #    # Now $TCP_PORT holds the listening port.
    m4_define([PARSE_LISTENING_PORT],
        [OVS_WAIT_UNTIL([$2=`sed -n 's/.*0:.*: listening on port 
\([[0-9]]*\)$/\1/p' "$1"` && test X != X"[$]$2"])])

    start_daemon () {
        "$@" -vconsole:off --detach --no-chdir --pidfile --log-file
        pid=`cat "$OVS_RUNDIR"/$1.pid`
        on_exit "kill $pid"
    }

You can find several examples of its use in the tests directory.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to