[ovs-dev] [PATCH 3/3] tests: Avoid race conditions, by letting the kernel choose ports to bind.

Neil Mckee neil.mckee at inmon.com
Thu Apr 4 03:03:52 UTC 2013


Yes,  that makes sense.  Thanks.

Neil


On Apr 3, 2013, at 6:47 PM, Ben Pfaff wrote:

> On Wed, Apr 03, 2013 at 05:01:40PM -0700, Neil Mckee wrote:
>> "parse-listening-port" seems to return the port that the server was
>> told to listen on(?)  
> 
> Yes, it returns the port that the server is listening on.
> 
>> But that bears no relation to the UDP port that sFlow or NetFlow might
>> be sent out to.  The way you have it now will probably work, but only
>> by accident: because you can usually open UDP port X at the same time
>> as someone else has opened TCP port X.
>> 
>> Or did I miss something?
> 
> I hope so.  Let me walk through one of the tests after this commit.
> 
> This starts up ovs-vswitchd and ovsdb-server:
> 
>    AT_SETUP([ofproto-dpif - NetFlow flow expiration])
> 
>    OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
>    ADD_OF_PORTS([br0], 1, 2)
> 
> This starts test-netflow listening on some kernel-selected (UDP) port
> and then stores the port that it's actually listening on in
> NETFLOW_PORT:
> 
>    ON_EXIT([kill `cat test-netflow.pid`])
>    AT_CHECK([test-netflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > netflow.log], [0], [], [ignore])
>    AT_CAPTURE_FILE([netflow.log])
>    NETFLOW_PORT=`parse_listening_port < test-netflow.log`
> 
> This configures the OVS netflow implementation to send its records to
> localhost on the port that we just determined test-netflow was listening
> on:
> 
>    ovs-vsctl \
>       set Bridge br0 netflow=@nf -- \
>       --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
>         engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
> 
> and the rest of the test just tests stuff.
> 
> Does it make sense?
> 
> Thanks,
> 
> Ben.




More information about the dev mailing list