@@ -44,8 +44,6 @@ lib_libovn_la_SOURCES = \
lib/inc-proc-eng.h \
lib/lb.c \
lib/lb.h \
- lib/static-mac-binding-index.c \
- lib/static-mac-binding-index.h \
lib/stopwatch-names.h \
lib/vif-plug-provider.h \
lib/vif-plug-provider.c \
deleted file mode 100644
@@ -1,43 +0,0 @@
-/* Copyright (c) 2021
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <config.h>
-
-#include "lib/static-mac-binding-index.h"
-#include "lib/ovn-sb-idl.h"
-
-struct ovsdb_idl_index *
-static_mac_binding_index_create(struct ovsdb_idl *idl)
-{
- return ovsdb_idl_index_create2(idl,
- &sbrec_static_mac_binding_col_logical_port,
- &sbrec_static_mac_binding_col_ip);
-}
-
-const struct sbrec_static_mac_binding *
-static_mac_binding_lookup(struct ovsdb_idl_index *smb_index,
- const char *logical_port, const char *ip)
-{
- struct sbrec_static_mac_binding *target =
- sbrec_static_mac_binding_index_init_row(smb_index);
- sbrec_static_mac_binding_index_set_logical_port(target, logical_port);
- sbrec_static_mac_binding_index_set_ip(target, ip);
-
- struct sbrec_static_mac_binding *smb =
- sbrec_static_mac_binding_index_find(smb_index, target);
- sbrec_static_mac_binding_index_destroy_row(target);
-
- return smb;
-}
deleted file mode 100644
@@ -1,27 +0,0 @@
-/* Copyright (c) 2021
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OVN_STATIC_MAC_BINDING_INDEX_H
-#define OVN_STATIC_MAC_BINDING_INDEX_H 1
-
-struct ovsdb_idl;
-
-struct ovsdb_idl_index *static_mac_binding_index_create(struct ovsdb_idl *);
-const struct sbrec_static_mac_binding *static_mac_binding_lookup(
- struct ovsdb_idl_index *smb_index,
- const char *logical_port,
- const char *ip);
-
-#endif /* lib/static-mac-binding-index.h */
@@ -57,10 +57,6 @@ northd_get_input_data(struct engine_node *node,
engine_ovsdb_node_get_index(
engine_get_input("SB_ip_multicast", node),
"sbrec_ip_mcast_by_dp");
- input_data->sbrec_static_mac_binding_by_lport_ip =
- engine_ovsdb_node_get_index(
- engine_get_input("SB_static_mac_binding", node),
- "sbrec_static_mac_binding_by_lport_ip");
input_data->sbrec_fdb_by_dp_and_port =
engine_ovsdb_node_get_index(
engine_get_input("SB_fdb", node),
@@ -20,7 +20,6 @@
#include "chassis-index.h"
#include "ip-mcast-index.h"
-#include "static-mac-binding-index.h"
#include "lib/inc-proc-eng.h"
#include "lib/mac-binding-index.h"
#include "lib/ovn-nb-idl.h"
@@ -359,8 +358,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
ip_mcast_index_create(sb->idl);
struct ovsdb_idl_index *sbrec_chassis_by_hostname =
chassis_hostname_index_create(sb->idl);
- struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
- = static_mac_binding_index_create(sb->idl);
struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
= mac_binding_by_datapath_index_create(sb->idl);
struct ovsdb_idl_index *fdb_by_dp_key =
@@ -383,9 +380,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
engine_ovsdb_node_add_index(&en_sb_ip_multicast,
"sbrec_ip_mcast_by_dp",
sbrec_ip_mcast_by_dp);
- engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
- "sbrec_static_mac_binding_by_lport_ip",
- sbrec_static_mac_binding_by_lport_ip);
engine_ovsdb_node_add_index(&en_sb_mac_binding,
"sbrec_mac_binding_by_datapath",
sbrec_mac_binding_by_datapath);
@@ -34,7 +34,6 @@
#include "lb.h"
#include "lib/chassis-index.h"
#include "lib/ip-mcast-index.h"
-#include "lib/static-mac-binding-index.h"
#include "lib/copp.h"
#include "lib/mcast-group-index.h"
#include "lib/ovn-l7.h"
@@ -18776,29 +18775,11 @@ build_mcast_groups(const struct sbrec_igmp_group_table *sbrec_igmp_group_table,
}
}
-static const struct nbrec_static_mac_binding *
-static_mac_binding_by_port_ip(
- const struct nbrec_static_mac_binding_table *nbrec_static_mb_table,
- const char *logical_port, const char *ip)
-{
- const struct nbrec_static_mac_binding *nb_smb = NULL;
-
- NBREC_STATIC_MAC_BINDING_TABLE_FOR_EACH (nb_smb, nbrec_static_mb_table) {
- if (!strcmp(nb_smb->logical_port, logical_port) &&
- !strcmp(nb_smb->ip, ip)) {
- break;
- }
- }
-
- return nb_smb;
-}
-
static void
build_static_mac_binding_table(
struct ovsdb_idl_txn *ovnsb_txn,
const struct nbrec_static_mac_binding_table *nbrec_static_mb_table,
const struct sbrec_static_mac_binding_table *sbrec_static_mb_table,
- struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip,
struct hmap *lr_ports)
{
/* Cleanup SB Static_MAC_Binding entries which do not have corresponding
@@ -18808,9 +18789,8 @@ build_static_mac_binding_table(
const struct sbrec_static_mac_binding *sb_smb;
SBREC_STATIC_MAC_BINDING_TABLE_FOR_EACH_SAFE (sb_smb,
sbrec_static_mb_table) {
- nb_smb = static_mac_binding_by_port_ip(nbrec_static_mb_table,
- sb_smb->logical_port,
- sb_smb->ip);
+ nb_smb = nbrec_static_mac_binding_table_get_for_uuid(
+ nbrec_static_mb_table, &sb_smb->header_.uuid);
if (!nb_smb) {
sbrec_static_mac_binding_delete(sb_smb);
continue;
@@ -18830,13 +18810,14 @@ build_static_mac_binding_table(
if (op && op->nbrp) {
struct ovn_datapath *od = op->od;
if (od && od->sb) {
+ const struct uuid *nb_uuid = &nb_smb->header_.uuid;
const struct sbrec_static_mac_binding *mb =
- static_mac_binding_lookup(
- sbrec_static_mac_binding_by_lport_ip,
- nb_smb->logical_port, nb_smb->ip);
+ sbrec_static_mac_binding_table_get_for_uuid(
+ sbrec_static_mb_table, nb_uuid);
if (!mb) {
/* Create new entry */
- mb = sbrec_static_mac_binding_insert(ovnsb_txn);
+ mb = sbrec_static_mac_binding_insert_persist_uuid(
+ ovnsb_txn, nb_uuid);
sbrec_static_mac_binding_set_logical_port(
mb, nb_smb->logical_port);
sbrec_static_mac_binding_set_ip(mb, nb_smb->ip);
@@ -19117,7 +19098,6 @@ ovnnb_db_run(struct northd_input *input_data,
build_static_mac_binding_table(ovnsb_txn,
input_data->nbrec_static_mac_binding_table,
input_data->sbrec_static_mac_binding_table,
- input_data->sbrec_static_mac_binding_by_lport_ip,
&data->lr_ports);
stopwatch_stop(BUILD_LFLOWS_CTX_STOPWATCH_NAME, time_msec());
stopwatch_start(CLEAR_LFLOWS_CTX_STOPWATCH_NAME, time_msec());
@@ -68,7 +68,6 @@ struct northd_input {
struct ovsdb_idl_index *sbrec_chassis_by_hostname;
struct ovsdb_idl_index *sbrec_ha_chassis_grp_by_name;
struct ovsdb_idl_index *sbrec_ip_mcast_by_dp;
- struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip;
struct ovsdb_idl_index *sbrec_fdb_by_dp_and_port;
};
@@ -8122,7 +8122,9 @@ ovn-nbctl static-mac-binding-add lr0-p0 192.168.10.100 00:00:22:33:44:55
wait_row_count nb:Static_MAC_Binding 2 logical_port=lr0-p0
wait_row_count Static_MAC_Binding 1 logical_port=lr0-p0 ip=192.168.10.10 mac="00\:00\:11\:22\:33\:44"
+check_column "$(fetch_column nb:Static_MAC_Binding _uuid logical_port=lr0-p0 ip=192.168.10.10)" sb:Static_MAC_Binding _uuid logical_port=lr0-p0 ip=192.168.10.10
wait_row_count Static_MAC_Binding 1 logical_port=lr0-p0 ip=192.168.10.100 mac="00\:00\:22\:33\:44\:55"
+check_column "$(fetch_column nb:Static_MAC_Binding _uuid logical_port=lr0-p0 ip=192.168.10.100)" sb:Static_MAC_Binding _uuid logical_port=lr0-p0 ip=192.168.10.100
ovn-nbctl static-mac-binding-add lr0-p1 10.0.0.10 00:00:33:44:55:66
wait_row_count nb:Static_MAC_Binding 1 logical_port=lr0-p1