Hey Ethan,

This is my bfd version of Paul's cfm patch.

Could you have a look? The 'core' is only 4-line change and rest is the
test.

Kind Regards,
Alex Wang,


On Thu, Aug 22, 2013 at 5:13 PM, Alex Wang <[email protected]> wrote:

> This commit retains the diagnostic code when bfd state is 'down'
> and 'forwarding_if_rx' is set.  This is to prevent the unwanted
> change of diagnostic code when the bfd goes down due to congestion.
> And, the diagnostic code can only be changed by the bfd control
> packet received.
>
> Signed-off-by: Alex Wang <[email protected]>
> ---
>  lib/bfd.c    |    4 +++-
>  tests/bfd.at |   57
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+), 1 deletion(-)
>
> diff --git a/lib/bfd.c b/lib/bfd.c
> index 7da6fd9..9e776c8 100644
> --- a/lib/bfd.c
> +++ b/lib/bfd.c
> @@ -985,7 +985,9 @@ bfd_set_state(struct bfd *bfd, enum state state, enum
> diag diag)
>
>          if (bfd->state <= STATE_DOWN) {
>              bfd->rmt_state = STATE_DOWN;
> -            bfd->rmt_diag = DIAG_NONE;
> +            if (!bfd->forwarding_if_rx) {
> +                bfd->rmt_diag = DIAG_NONE;
> +            }
>              bfd->rmt_min_rx = 1;
>              bfd->rmt_flags = 0;
>              bfd->rmt_disc = 0;
> diff --git a/tests/bfd.at b/tests/bfd.at
> index 0b2b7cc..fb554b7 100644
> --- a/tests/bfd.at
> +++ b/tests/bfd.at
> @@ -757,4 +757,61 @@ BFD_CHECK_TX([p0], [300ms], [300ms], [300ms])
>  BFD_CHECK_RX([p0], [1000ms], [1000ms], [300ms])
>
>  AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
> +AT_CLEANUP
> +
> +# bfd retain diagnostic code when state is 'down' and 'forwarding_if_rx'
> is set.
> +AT_SETUP([bfd - retain diagnostic code])
> +OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
> +                    add-port br1 p1 -- set Interface p1 type=patch \
> +                    options:peer=p0 ofport_request=2 -- \
> +                    add-port br0 p0 -- set Interface p0 type=patch \
> +                    options:peer=p1 ofport_request=1 -- \
> +                    set Interface p0 bfd:enable=true bfd:min_tx=300
> bfd:min_rx=300 -- \
> +                    set Interface p1 bfd:enable=true bfd:min_tx=500
> bfd:min_rx=500 bfd:cpath_down=true])
> +
> +ovs-appctl time/stop
> +# advance the clock, to stablize the states.
> +for i in `seq 0 19`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [false], [false], [none], [up], [No Diagnostic], [none],
> [up], [Concatenated Path Down])
> +BFD_CHECK([p1], [true], [true], [none], [up], [Concatenated Path Down],
> [none], [up], [No Diagnostic])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +# enable forwarding_if_rx.
> +AT_CHECK([ovs-vsctl set Interface p0 bfd:forwarding_if_rx=true], [0])
> +
> +# there should be no change of the forwarding flag, since
> +# the bfd on both ends is already up.
> +for i in `seq 0 9`
> +do
> +    ovs-appctl time/warp 500
> +    BFD_CHECK([p0], [false], [false], [none], [up], [No Diagnostic],
> [none], [up], [Concatenated Path Down])
> +done
> +
> +# disable the bfd at p1.
> +AT_CHECK([ovs-vsctl set interface p1 bfd:enable=false])
> +# wait for 1500, so bfd on p0 goes down.
> +for i in `seq 0 2`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection Time
> Expired], [none], [down], [Concatenated Path Down])
> +BFD_CHECK_TX([p0], [1000ms], [1000ms], [0ms])
> +BFD_CHECK_RX([p0], [300ms], [300ms], [1ms])
> +
> +# there should be no change to the forwarding flag even if there is
> packet received.
> +for i in `seq 0 9`
> +do
> +    AT_CHECK([ovs-ofctl packet-out br1 3 2
>  
> "90e2ba01475000101856b2e80806000108000604000100101856b2e80202020300000000000002020202"],
> +             [0], [stdout], [])
> +    ovs-appctl time/warp 100
> +    BFD_CHECK([p0], [false], [false], [none], [down], [Control Detection
> Time Expired], [none], [down], [Concatenated Path Down])
> +done
> +
> +# now turn bfd on p1 on and set cpath_down to false.
> +AT_CHECK([ovs-vsctl set interface p1 bfd:enable=true
> bfd:cpath_down=false])
> +for i in `seq 0 2`; do ovs-appctl time/warp 500; done
> +BFD_CHECK([p0], [true], [false], [none], [up], [Control Detection Time
> Expired], [none], [up], [No Diagnostic])
> +BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
> [up], [Control Detection Time Expired])
> +BFD_CHECK_TX([p0], [500ms], [300ms], [500ms])
> +BFD_CHECK_RX([p0], [500ms], [300ms], [500ms])
> +
> +AT_CHECK([ovs-vsctl del-br br1], [0], [ignore])
>  AT_CLEANUP
> \ No newline at end of file
> --
> 1.7.9.5
>
>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to