You could probably detect the version automatically: if there's a ":" char in the address, then it's 6.
On Mon, Oct 24, 2022 at 6:48 AM Felix Hüttner via dev <ovs-dev@openvswitch.org> wrote: > > in order to easily add future ipv6 test cases the common `ovn_attach` > function should also support ipv6 addresses. > > Signed-off-by: Felix Huettner <felix.huettner@mail.schwarz> > --- > tests/ovn-macros.at | 9 +++++---- > tests/ovn.at | 22 +++++++++++----------- > 2 files changed, 16 insertions(+), 15 deletions(-) > > diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at > index b234019a9..9c7f60113 100644 > --- a/tests/ovn-macros.at > +++ b/tests/ovn-macros.at > @@ -288,14 +288,14 @@ net_attach () { > || return 1 > } > > -# ovn_az_attach AZ NETWORK BRIDGE IP [MASKLEN] > +# ovn_az_attach AZ NETWORK BRIDGE IP [MASKLEN] [IPVERSION] [ENCAP] > ovn_az_attach() { > - local az=$1 net=$2 bridge=$3 ip=$4 masklen=${5-24} > encap=${6-geneve,vxlan} > + local az=$1 net=$2 bridge=$3 ip=$4 masklen=${5-24} ipversion=${6-4} > encap=${7-geneve,vxlan} > net_attach $net $bridge || return 1 > > mac=`ovs-vsctl get Interface $bridge mac_in_use | sed s/\"//g` > arp_table="$arp_table $sandbox,$bridge,$ip,$mac" > - ovs-appctl netdev-dummy/ip4addr $bridge $ip/$masklen >/dev/null || > return 1 > + ovs-appctl netdev-dummy/ip${ipversion}addr $bridge $ip/$masklen > >/dev/null || return 1 > ovs-appctl ovs/route/add $ip/$masklen $bridge >/dev/null || return 1 > > local ovn_remote > @@ -329,13 +329,14 @@ ovn_az_attach() { > start_daemon ovn-controller --enable-dummy-vif-plug || return 1 > } > > -# ovn_attach NETWORK BRIDGE IP [MASKLEN] > +# ovn_attach NETWORK BRIDGE IP [MASKLEN] [IPVERSION] [ENCAP] > # > # First, this command attaches BRIDGE to interconnection network NETWORK, > just > # like "net_attach NETWORK BRIDGE". Second, it configures (simulated) IP > # address IP (with network mask length MASKLEN, which defaults to 24) on > # BRIDGE. Finally, it configures the Open vSwitch database to work with OVN > # and starts ovn-controller. > +# IPVERSION must be set to 6 for ipv6 addresses. > ovn_attach() { > ovn_az_attach NONE $@ > } > diff --git a/tests/ovn.at b/tests/ovn.at > index 184fc0fdd..3d54c9153 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -3534,7 +3534,7 @@ for i in 1 2; do > as hv-$i > check ovs-vsctl add-br br-phys > check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > - ovn_attach net br-phys 192.168.0.$i 24 vxlan > + ovn_attach net br-phys 192.168.0.$i 24 4 vxlan > done > > check ovn-nbctl ls-add ls > @@ -3983,7 +3983,7 @@ ovn_start > net_add net > check ovs-vsctl add-br br-phys > check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > -ovn_attach net br-phys 192.168.0.1 24 vxlan > +ovn_attach net br-phys 192.168.0.1 24 4 vxlan > check ovn-nbctl --wait=sb sync > OVS_WAIT_UNTIL([ovn-sbctl get chassis main _uuid]) > > @@ -22432,7 +22432,7 @@ m4_define([DVR_N_S_ARP_HANDLING], > ovs-vsctl add-br br-phys > ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i" > - ovn_attach n1 br-phys 192.168.0.$i 24 $encap > + ovn_attach n1 br-phys 192.168.0.$i 24 4 $encap > > ovs-vsctl add-port br-int vif$i$i -- \ > set Interface vif$i$i external-ids:iface-id=lp$i$i \ > @@ -22473,14 +22473,14 @@ m4_define([DVR_N_S_ARP_HANDLING], > as hv3 ovs-vsctl add-br br-phys > as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > as hv3 ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:33" > - as hv3 ovn_attach n1 br-phys 192.168.0.3 24 $encap > + as hv3 ovn_attach n1 br-phys 192.168.0.3 24 4 $encap > > # Add 4th hypervisor > sim_add hv4 > as hv4 ovs-vsctl add-br br-phys > as hv4 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > as hv4 ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:44" > - as hv4 ovn_attach n1 br-phys 192.168.0.4 24 $encap > + as hv4 ovn_attach n1 br-phys 192.168.0.4 24 4 $encap > > as hv4 ovs-vsctl add-port br-int vif-north -- \ > set Interface vif-north external-ids:iface-id=lp-north \ > @@ -22704,7 +22704,7 @@ m4_define([DVR_N_S_PING], > ovs-vsctl add-br br-phys > ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i" > - ovn_attach n1 br-phys 192.168.0.$i 24 $encap > + ovn_attach n1 br-phys 192.168.0.$i 24 4 $encap > > ovs-vsctl add-port br-int vif$i$i -- \ > set Interface vif$i$i external-ids:iface-id=lp$i$i \ > @@ -22745,14 +22745,14 @@ m4_define([DVR_N_S_PING], > as hv3 ovs-vsctl add-br br-phys > as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > as hv3 ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:33" > - as hv3 ovn_attach n1 br-phys 192.168.0.3 24 $encap > + as hv3 ovn_attach n1 br-phys 192.168.0.3 24 4 $encap > > # Add 4th hypervisor > sim_add hv4 > as hv4 ovs-vsctl add-br br-phys > as hv4 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > as hv4 ovs-vsctl set open . > external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:44" > - as hv4 ovn_attach n1 br-phys 192.168.0.4 24 $encap > + as hv4 ovn_attach n1 br-phys 192.168.0.4 24 4 $encap > > as hv4 ovs-vsctl add-port br-int vif-north -- \ > set Interface vif-north external-ids:iface-id=lp-north \ > @@ -28487,7 +28487,7 @@ as hv1 > > ovs-vsctl add-br br-phys > # Just set the encap type to be geneve for this test. > -ovn_attach n1 br-phys 192.168.0.1 24 geneve > +ovn_attach n1 br-phys 192.168.0.1 24 4 geneve > > # Get the encap rec, should be just one - with geneve/192.168.0.1 > encap_rec=$(ovn-sbctl --data=bare --no-heading --column encaps list chassis > hv1) > @@ -31088,7 +31088,7 @@ for i in 1 2 3 4 5; do > as hv$i > ovs-vsctl add-br br-phys > ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > - ovn_attach n1 br-phys 192.168.0.$i 24 $encap > + ovn_attach n1 br-phys 192.168.0.$i 24 4 $encap > done > > # Add a vif on HV1 > @@ -32667,7 +32667,7 @@ for i in $(seq 1 $n_hv); do > as hv$i > check ovs-vsctl add-br br-phys > ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys > - ovn_attach n1 br-phys 192.168.0.$i 24 geneve > + ovn_attach n1 br-phys 192.168.0.$i 24 4 geneve > done > > check ovn-sbctl set connection . inactivity_probe=0 > -- > 2.38.0 > Diese E Mail enthält möglicherweise vertrauliche Inhalte und ist nur für die > Verwertung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der > vorgesehene Empfänger sein, setzen Sie den Absender bitte unverzüglich in > Kenntnis und löschen diese E Mail. Hinweise zum Datenschutz finden Sie > hier<https://www.datenschutz.schwarz>. > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev