On Mon, Oct 12, 2020 at 2:46 PM <[email protected]> wrote: > > From: Vladislav Odintsov <[email protected]>
Thanks. I applied this patch to master, branch-20.09 and branch-20.06 Numan > > port_binding_rec->mac array contains items with addresses (MAC, IP, ...) > delimited by whitespace. > In Unicast_Macs_Remote record should be only one mac address. > Now mac address extracts from port_binding_rec->mac[i]. > > Submitted-at: https://github.com/ovn-org/ovn/pull/48 > Signed-off-by: Vladislav Odintsov <[email protected]> > Signed-off-by: Numan Siddique <[email protected]> > --- > controller-vtep/vtep.c | 12 ++++++++++-- > tests/ovn-controller-vtep.at | 16 ++++++++++++++++ > 2 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/controller-vtep/vtep.c b/controller-vtep/vtep.c > index e2baca5a7..5538c7d6a 100644 > --- a/controller-vtep/vtep.c > +++ b/controller-vtep/vtep.c > @@ -20,6 +20,7 @@ > #include "lib/hash.h" > #include "openvswitch/hmap.h" > #include "openvswitch/shash.h" > +#include "lib/ovn-util.h" > #include "lib/smap.h" > #include "lib/sset.h" > #include "lib/util.h" > @@ -366,7 +367,13 @@ vtep_macs_run(struct ovsdb_idl_txn *vtep_idl_txn, struct > shash *ucast_macs_rmts, > for (i = 0; i < port_binding_rec->n_mac; i++) { > const struct vteprec_ucast_macs_remote *umr; > const struct sbrec_port_binding *conflict; > - char *mac = port_binding_rec->mac[i]; > + struct lport_addresses laddrs; > + > + if (!extract_lsp_addresses(port_binding_rec->mac[i], &laddrs)) { > + continue; > + }; > + > + char *mac = laddrs.ea_s; > > /* Checks for duplicate MAC in the same vtep logical switch. */ > conflict = shash_find_data(&ls_node->added_macs, mac); > @@ -384,7 +391,7 @@ vtep_macs_run(struct ovsdb_idl_txn *vtep_idl_txn, struct > shash *ucast_macs_rmts, > tnl_key); > umr = shash_find_data(ucast_macs_rmts, mac_ip_tnlkey); > /* If finds the 'umr' entry for the mac, ip, and tnl_key, deletes > - * the entry from shash so that it is not gargage collected. > + * the entry from shash so that it is not garbage collected. > * > * If not found, creates a new 'umr' entry. */ > if (umr && umr->logical_switch == ls_node->vtep_ls) { > @@ -395,6 +402,7 @@ vtep_macs_run(struct ovsdb_idl_txn *vtep_idl_txn, struct > shash *ucast_macs_rmts, > vteprec_ucast_macs_remote_set_locator(new_umr, pl); > } > free(mac_ip_tnlkey); > + destroy_lport_addresses(&laddrs); > } > } > > diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at > index 3092dd5ca..f0598fa4d 100644 > --- a/tests/ovn-controller-vtep.at > +++ b/tests/ovn-controller-vtep.at > @@ -383,6 +383,22 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote > | cut -d ':' -f2- | tr - > "f0:ab:cd:ef:01:03" > ]) > > +# adds MAC-IP pair to logical switch port. > +AT_CHECK([ovn-nbctl lsp-set-addresses vif0 "f0:ab:cd:ef:01:04 192.168.0.1"]) > +OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep > 'f0:ab:cd:ef:01:04'`"]) > +AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | > tr -d ' ' | sort], [0], [dnl > +"f0:ab:cd:ef:01:04" > +]) > + > +# adds another MAC-IP pair to logical switch port. > +AT_CHECK([ovn-nbctl lsp-set-addresses vif0 "f0:ab:cd:ef:01:04 192.168.0.1" > "f0:ab:cd:ef:01:05 192.168.0.2"]) > +OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep > 'f0:ab:cd:ef:01:05'`"]) > +AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | > tr -d ' ' | sort], [0], [dnl > + > +"f0:ab:cd:ef:01:04" > +"f0:ab:cd:ef:01:05" > +]) > + > # removes one mac to logical switch port. > AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03]) > OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | > grep 02`"]) > -- > 2.26.2 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
