diff mbox series

[ovs-dev,ovn] test: add more tests to IP-buffering unit-test

Message ID 484bb4139f2cdc32f72d969709239a5e40a92e41.1590760813.git.lorenzo.bianconi@redhat.com
State Accepted
Headers show
Series [ovs-dev,ovn] test: add more tests to IP-buffering unit-test | expand

Commit Message

Lorenzo Bianconi May 29, 2020, 2:01 p.m. UTC
Check the hv is sending the ICMP request using the FIP as src IP in
a DVR scenario. Update previous tests introducing source NAT for
distributed traffic cases

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 tests/ovn.at | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Comments

Ankur Sharma June 2, 2020, 4:05 a.m. UTC | #1
Hi Lorenzo,

Thanks a lot for the patch.
I will get back on this by EOD PST tomorrow.

Regards,
Ankur
Ankur Sharma June 3, 2020, 1:16 a.m. UTC | #2
Hi Lorenzo,

Please find my comments inline.

Regards,
Ankur
Lorenzo Bianconi June 3, 2020, 8:47 a.m. UTC | #3
On Jun 03, Ankur Sharma wrote:
> Hi Lorenzo,
> 
> Please find my comments inline.
> 
> Regards,
> Ankur
> 
> ________________________________
> From: dev <ovs-dev-bounces@openvswitch.org> on behalf of Ankur Sharma <ankur.sharma@nutanix.com>
> Sent: Monday, June 1, 2020 9:05 PM
> To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>; ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>
> Subject: Re: [ovs-dev] [PATCH ovn] test: add more tests to IP-buffering unit-test
> 
> Hi Lorenzo,
> 
> Thanks a lot for the patch.
> I will get back on this by EOD PST tomorrow.
> 
> Regards,
> Ankur
> ________________________________
> From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Sent: Friday, May 29, 2020 7:01 AM
> To: ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>
> Cc: Ankur Sharma <ankur.sharma@nutanix.com>; numans@ovn.org <numans@ovn.org>; dceara@redhat.com <dceara@redhat.com>
> Subject: [PATCH ovn] test: add more tests to IP-buffering unit-test
> 
> Check the hv is sending the ICMP request using the FIP as src IP in
> a DVR scenario. Update previous tests introducing source NAT for
> distributed traffic cases
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>  tests/ovn.at | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 15b40ca1e..57f632c4e 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -14873,7 +14873,7 @@ ovn_start
>  # Physical network:
>  # Tw0 hypervisors hv[12].
>  # hv1 hosts vif sw0-p0.
> -# hv1 hosts vif sw1-p0.
> +# hv2 hosts vif sw1-p0 and sw0-p1
> 
>  send_icmp_packet() {
>      local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_chksum=$7 data=$8
> @@ -14973,6 +14973,9 @@ ovn-nbctl lsp-add sw0 sw0-p1 \

[...]

> 
>  # Create FIP on sw0-p0, add a route on logical router pipeline and
>  # ARP request for a unkwon destination is sent using FIP MAC/IP
> +ovn-nbctl lr-nat-del lr0 snat
>  ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.16.1.2 192.168.1.3 sw0-p1 f0:00:00:01:02:04
>  ovn-nbctl lr-route-add lr0 172.16.2.0/24 172.16.1.11
> 
>  dst_ip=$(ip_to_hex 172 16 2 10)
>  fip_ip=$(ip_to_hex 172 16 1 2)
>  src_ip=$(ip_to_hex 192 168 1 3)
> -gw_router=$(ip_to_hex 172 16 1 11)
> -send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0000 $data
> -echo $(get_arp_req f00000010204 $fip_ip $gw_router) >> expected
> +gw_router_ip=$(ip_to_hex 172 16 1 11)
> +gw_router_mac=f00000010a0a
> +send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0c1b $data
> [ANKUR]: Confused by above line, ofport 2 on hv2 is sw1-p0, whereas i believe we wanted port to use sw0-p1, i.e ofport3

Hi Ankur,

we are using hv2-vif2 here, so sw0-p1

> +echo $(get_arp_req f00000010204 $fip_ip $gw_router_ip) >> expected
> +send_arp_reply 2 1 $gw_router_mac f00000010204 $gw_router_ip $fip_ip
> +echo "${gw_router_mac}f0000001020408004500001c00004000fe0121b4${fip_ip}${dst_ip}${data}" >> expected
> 
>  OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])
> 
> [ANKUR]: May be i am missing something, but how are we validating buffering here. We should be validating the pcap on some external endpoint right,
> For example, generate a icmp packet from internal port to an external endpoint, simulate an ARP reply and then look at tx pcap on destination.

this is what I am currently doing since:
- we are sending an ICMP request from an internal port(sw0-p1 -- hv2-vif2)
  for the external destination 172.16.2.10
- the logical router buffers the outgoing ICMP request and generates
  an ARP request using FIP IP/mac as src addresses (172.16.1.2/f0:00:00:01:02:04)
  for the external gw (172.16.1.11)
- we simulate an ARP reply from 172.16.1.11
- we checks in hv2/vif1-tx.pcap (hv2-vif1 is associated with the external
  interface) we have:
  - ARP request
  - ARP reply
  - ICMP request with L2 destination address resolved

is it what you are referring to?

Regards,
Lorenzo
  

> 
> 
> --
> 2.26.2
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=s883GpUCOChKOHiocYtGcg&r=mZwX9gFQgeJHzTg-68aCJgsODyUEVsHGFOfL90J6MJY&m=WlGoK4pEkybzFr5FvyLYn_x3hZuLSfQcHJVgmPbU548&s=UJvQpPo9180SVm6LdvHiFtsdKo6eGyatkCN8NxS4z4I&e=
Numan Siddique June 17, 2020, 10:13 a.m. UTC | #4
On Wed, Jun 3, 2020 at 2:18 PM Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
wrote:

> On Jun 03, Ankur Sharma wrote:
> > Hi Lorenzo,
> >
> > Please find my comments inline.
> >
> > Regards,
> > Ankur
> >
> > ________________________________
> > From: dev <ovs-dev-bounces@openvswitch.org> on behalf of Ankur Sharma <
> ankur.sharma@nutanix.com>
> > Sent: Monday, June 1, 2020 9:05 PM
> > To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>;
> ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>
> > Subject: Re: [ovs-dev] [PATCH ovn] test: add more tests to IP-buffering
> unit-test
> >
> > Hi Lorenzo,
> >
> > Thanks a lot for the patch.
> > I will get back on this by EOD PST tomorrow.
> >
> > Regards,
> > Ankur
> > ________________________________
> > From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> > Sent: Friday, May 29, 2020 7:01 AM
> > To: ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>
> > Cc: Ankur Sharma <ankur.sharma@nutanix.com>; numans@ovn.org <
> numans@ovn.org>; dceara@redhat.com <dceara@redhat.com>
> > Subject: [PATCH ovn] test: add more tests to IP-buffering unit-test
> >
> > Check the hv is sending the ICMP request using the FIP as src IP in
> > a DVR scenario. Update previous tests introducing source NAT for
> > distributed traffic cases
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>

Thanks Lorenzo and Ankur.

I applied this patch to master.

Numan


> > ---
> >  tests/ovn.at | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> >
> > diff --git a/tests/ovn.at b/tests/ovn.at
> > index 15b40ca1e..57f632c4e 100644
> > --- a/tests/ovn.at
> > +++ b/tests/ovn.at
> > @@ -14873,7 +14873,7 @@ ovn_start
> >  # Physical network:
> >  # Tw0 hypervisors hv[12].
> >  # hv1 hosts vif sw0-p0.
> > -# hv1 hosts vif sw1-p0.
> > +# hv2 hosts vif sw1-p0 and sw0-p1
> >
> >  send_icmp_packet() {
> >      local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6
> ip_chksum=$7 data=$8
> > @@ -14973,6 +14973,9 @@ ovn-nbctl lsp-add sw0 sw0-p1 \
>
> [...]
>
> >
> >  # Create FIP on sw0-p0, add a route on logical router pipeline and
> >  # ARP request for a unkwon destination is sent using FIP MAC/IP
> > +ovn-nbctl lr-nat-del lr0 snat
> >  ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.16.1.2 192.168.1.3 sw0-p1
> f0:00:00:01:02:04
> >  ovn-nbctl lr-route-add lr0 172.16.2.0/24 172.16.1.11
> >
> >  dst_ip=$(ip_to_hex 172 16 2 10)
> >  fip_ip=$(ip_to_hex 172 16 1 2)
> >  src_ip=$(ip_to_hex 192 168 1 3)
> > -gw_router=$(ip_to_hex 172 16 1 11)
> > -send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0000
> $data
> > -echo $(get_arp_req f00000010204 $fip_ip $gw_router) >> expected
> > +gw_router_ip=$(ip_to_hex 172 16 1 11)
> > +gw_router_mac=f00000010a0a
> > +send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0c1b
> $data
> > [ANKUR]: Confused by above line, ofport 2 on hv2 is sw1-p0, whereas i
> believe we wanted port to use sw0-p1, i.e ofport3
>
> Hi Ankur,
>
> we are using hv2-vif2 here, so sw0-p1
>
> > +echo $(get_arp_req f00000010204 $fip_ip $gw_router_ip) >> expected
> > +send_arp_reply 2 1 $gw_router_mac f00000010204 $gw_router_ip $fip_ip
> > +echo
> "${gw_router_mac}f0000001020408004500001c00004000fe0121b4${fip_ip}${dst_ip}${data}"
> >> expected
> >
> >  OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])
> >
> > [ANKUR]: May be i am missing something, but how are we validating
> buffering here. We should be validating the pcap on some external endpoint
> right,
> > For example, generate a icmp packet from internal port to an external
> endpoint, simulate an ARP reply and then look at tx pcap on destination.
>
> this is what I am currently doing since:
> - we are sending an ICMP request from an internal port(sw0-p1 -- hv2-vif2)
>   for the external destination 172.16.2.10
> - the logical router buffers the outgoing ICMP request and generates
>   an ARP request using FIP IP/mac as src addresses (
> 172.16.1.2/f0:00:00:01:02:04)
>   for the external gw (172.16.1.11)
> - we simulate an ARP reply from 172.16.1.11
> - we checks in hv2/vif1-tx.pcap (hv2-vif1 is associated with the external
>   interface) we have:
>   - ARP request
>   - ARP reply
>   - ICMP request with L2 destination address resolved
>
> is it what you are referring to?
>
> Regards,
> Lorenzo
>
>
> >
> >
> > --
> > 2.26.2
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=s883GpUCOChKOHiocYtGcg&r=mZwX9gFQgeJHzTg-68aCJgsODyUEVsHGFOfL90J6MJY&m=WlGoK4pEkybzFr5FvyLYn_x3hZuLSfQcHJVgmPbU548&s=UJvQpPo9180SVm6LdvHiFtsdKo6eGyatkCN8NxS4z4I&e=
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 15b40ca1e..57f632c4e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -14873,7 +14873,7 @@  ovn_start
 # Physical network:
 # Tw0 hypervisors hv[12].
 # hv1 hosts vif sw0-p0.
-# hv1 hosts vif sw1-p0.
+# hv2 hosts vif sw1-p0 and sw0-p1
 
 send_icmp_packet() {
     local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_chksum=$7 data=$8
@@ -14973,6 +14973,9 @@  ovn-nbctl lsp-add sw0 sw0-p1 \
 ovn-nbctl lsp-add sw1 sw1-p0 \
     -- lsp-set-addresses sw1-p0 unknown
 
+ovn-nbctl lr-nat-add lr0 snat 172.16.1.1 192.168.1.0/24
+ovn-nbctl lr-nat-add lr0 snat 2002::1 2001::/64
+
 OVN_POPULATE_ARP
 ovn-nbctl --wait=hv sync
 
@@ -14997,15 +15000,15 @@  dst_ip6=20020000000000000000000000000010
 
 data=0800bee4391a0001
 
-send_icmp_packet 1 1 $src_mac $router_mac0 $src_ip $dst_ip 0000 $data
+send_icmp_packet 1 1 $src_mac $router_mac0 $src_ip $dst_ip 0d1c $data
 send_arp_reply 2 1 $dst_mac $router_mac1 $dst_ip $router_ip
 echo $(get_arp_req $router_mac1 $router_ip $dst_ip) > expected
-echo "${dst_mac}${router_mac1}08004500001c00004000fe010100${src_ip}${dst_ip}${data}" >> expected
+echo "${dst_mac}${router_mac1}08004500001c00004000fe0122b5${router_ip}${dst_ip}${data}" >> expected
 
 OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])
 
 nd_ip=ff0200000000000000000001ff000010
-ip6_hdr=6000000000083afe${src_ip6}${dst_ip6}
+ip6_hdr=6000000000083afe${router_ip6}${dst_ip6}
 
 send_icmp6_packet 1 1 $src_mac $router_mac0 $src_ip6 $dst_ip6
 echo $(get_nd $router_mac1 $nd_src_ip6 $nd_ip $dst_ip6) >> expected
@@ -15016,15 +15019,19 @@  OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])
 
 # Create FIP on sw0-p0, add a route on logical router pipeline and
 # ARP request for a unkwon destination is sent using FIP MAC/IP
+ovn-nbctl lr-nat-del lr0 snat
 ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.16.1.2 192.168.1.3 sw0-p1 f0:00:00:01:02:04
 ovn-nbctl lr-route-add lr0 172.16.2.0/24 172.16.1.11
 
 dst_ip=$(ip_to_hex 172 16 2 10)
 fip_ip=$(ip_to_hex 172 16 1 2)
 src_ip=$(ip_to_hex 192 168 1 3)
-gw_router=$(ip_to_hex 172 16 1 11)
-send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0000 $data
-echo $(get_arp_req f00000010204 $fip_ip $gw_router) >> expected
+gw_router_ip=$(ip_to_hex 172 16 1 11)
+gw_router_mac=f00000010a0a
+send_icmp_packet 2 2 f00000110203 $router_mac0 $src_ip $dst_ip 0c1b $data
+echo $(get_arp_req f00000010204 $fip_ip $gw_router_ip) >> expected
+send_arp_reply 2 1 $gw_router_mac f00000010204 $gw_router_ip $fip_ip
+echo "${gw_router_mac}f0000001020408004500001c00004000fe0121b4${fip_ip}${dst_ip}${data}" >> expected
 
 OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])