@@ -1238,6 +1238,56 @@ flow_output_sb_port_binding_handler(struct engine_node *node)
return true;
}
+static bool
+flow_output_sb_multicast_group_handler(struct engine_node *node)
+{
+ struct ed_type_runtime_data *data =
+ (struct ed_type_runtime_data *)engine_get_input(
+ "runtime_data", node)->data;
+ struct hmap *local_datapaths = &data->local_datapaths;
+ struct simap *ct_zones = &data->ct_zones;
+
+ struct ed_type_mff_ovn_geneve *ed_mff_ovn_geneve =
+ (struct ed_type_mff_ovn_geneve *)engine_get_input(
+ "mff_ovn_geneve", node)->data;
+ enum mf_field_id mff_ovn_geneve = ed_mff_ovn_geneve->mff_ovn_geneve;
+
+ struct ovsrec_open_vswitch_table *ovs_table =
+ (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET(
+ engine_get_input("OVS_open_vswitch", node));
+ struct ovsrec_bridge_table *bridge_table =
+ (struct ovsrec_bridge_table *)EN_OVSDB_GET(
+ engine_get_input("OVS_bridge", node));
+ const struct ovsrec_bridge *br_int = get_br_int(bridge_table, ovs_table);
+ const char *chassis_id = get_chassis_id(ovs_table);
+
+ struct ovsdb_idl_index *sbrec_chassis_by_name =
+ engine_ovsdb_node_get_index(
+ engine_get_input("SB_chassis", node),
+ "name");
+ const struct sbrec_chassis *chassis = NULL;
+ if (chassis_id) {
+ chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id);
+ }
+ ovs_assert(br_int && chassis);
+
+ struct ed_type_flow_output *fo =
+ (struct ed_type_flow_output *)node->data;
+ struct ovn_desired_flow_table *flow_table = &fo->flow_table;
+
+ struct sbrec_multicast_group_table *multicast_group_table =
+ (struct sbrec_multicast_group_table *)EN_OVSDB_GET(
+ engine_get_input("SB_multicast_group", node));
+
+ physical_handle_mc_group_changes(multicast_group_table,
+ mff_ovn_geneve, chassis, ct_zones, local_datapaths,
+ flow_table);
+
+ node->changed = true;
+ return true;
+
+}
+
struct ovn_controller_exit_args {
bool *exiting;
bool *restart;
@@ -1356,7 +1406,8 @@ main(int argc, char *argv[])
engine_add_input(&en_flow_output, &en_sb_chassis, NULL);
engine_add_input(&en_flow_output, &en_sb_encap, NULL);
- engine_add_input(&en_flow_output, &en_sb_multicast_group, NULL);
+ engine_add_input(&en_flow_output, &en_sb_multicast_group,
+ flow_output_sb_multicast_group_handler);
engine_add_input(&en_flow_output, &en_sb_port_binding,
flow_output_sb_port_binding_handler);
engine_add_input(&en_flow_output, &en_sb_mac_binding, NULL);
@@ -1010,6 +1010,29 @@ void physical_handle_port_binding_changes(
}
void
+physical_handle_mc_group_changes(
+ const struct sbrec_multicast_group_table *multicast_group_table,
+ enum mf_field_id mff_ovn_geneve,
+ const struct sbrec_chassis *chassis,
+ const struct simap *ct_zones,
+ const struct hmap *local_datapaths,
+ struct ovn_desired_flow_table *flow_table)
+{
+ const struct sbrec_multicast_group *mc;
+ SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_TRACKED (mc, multicast_group_table) {
+ if (sbrec_multicast_group_is_deleted(mc)) {
+ ofctrl_remove_flows(flow_table, &mc->header_.uuid);
+ } else {
+ if (!sbrec_multicast_group_is_new(mc)) {
+ ofctrl_remove_flows(flow_table, &mc->header_.uuid);
+ }
+ consider_mc_group(mff_ovn_geneve, ct_zones, local_datapaths,
+ chassis, mc, flow_table);
+ }
+ }
+}
+
+void
physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_multicast_group_table *multicast_group_table,
const struct sbrec_port_binding_table *port_binding_table,
@@ -64,4 +64,11 @@ void physical_handle_port_binding_changes(
struct sset *active_tunnels,
struct ovn_desired_flow_table *);
+void physical_handle_mc_group_changes(
+ const struct sbrec_multicast_group_table *,
+ enum mf_field_id mff_ovn_geneve,
+ const struct sbrec_chassis *,
+ const struct simap *ct_zones,
+ const struct hmap *local_datapaths,
+ struct ovn_desired_flow_table *);
#endif /* ovn/physical.h */