From: Numan Siddique <num...@ovn.org> Signed-off-by: Numan Siddique <num...@ovn.org> --- br-controller/en-lflow.c | 19 +++++++++++++++++++ tests/ovn-br-controller.at | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
diff --git a/br-controller/en-lflow.c b/br-controller/en-lflow.c index 00e24de805..147554c3c6 100644 --- a/br-controller/en-lflow.c +++ b/br-controller/en-lflow.c @@ -63,6 +63,7 @@ struct lookup_port_aux { const struct ovn_bridge *br; }; +static void br_controller_extend_symtab(struct shash *symtab); static struct expr *convert_match_to_expr( const struct ovnbrrec_logical_flow *lflow, struct expr **prereqs, struct shash *symtab); @@ -92,6 +93,7 @@ void *en_lflow_output_init(struct engine_node *node OVS_UNUSED, struct ed_type_lflow_output_data *lflow_data = xzalloc(sizeof *lflow_data); ovn_init_symtab(&lflow_data->pd.symtab); lflow_conj_ids_init(&lflow_data->conj_ids); + br_controller_extend_symtab(&lflow_data->pd.symtab); return lflow_data; } @@ -125,6 +127,23 @@ en_lflow_output_run(struct engine_node *node OVS_UNUSED, void *data_) /* Static functions. */ +static void +br_controller_extend_symtab(struct shash *symtab) +{ + expr_symtab_add_field(symtab, "ct_snat_zone", MFF_LOG_SNAT_ZONE, + NULL, false); + expr_symtab_add_field(symtab, "ct_dnat_zone", MFF_LOG_DNAT_ZONE, + NULL, false); + expr_symtab_add_field(symtab, "metadata", MFF_METADATA, NULL, false); + expr_symtab_add_field(symtab, "tun.id", MFF_TUN_ID, NULL, false); + expr_symtab_add_field(symtab, "tun_ip4.src", MFF_TUN_SRC, "ip4", false); + expr_symtab_add_field(symtab, "tun_ip4.dst", MFF_TUN_DST, "ip4", false); + expr_symtab_add_field(symtab, "tun_ip6.src", MFF_TUN_IPV6_SRC, + "ip6", false); + expr_symtab_add_field(symtab, "tun_ip6.dst", MFF_TUN_IPV6_DST, + "ip6", false); +} + static void init_lflow_ctx(struct engine_node *node, struct ed_type_bridge_data *bridge_data, diff --git a/tests/ovn-br-controller.at b/tests/ovn-br-controller.at index bb10e5bd10..7a71b7c24b 100644 --- a/tests/ovn-br-controller.at +++ b/tests/ovn-br-controller.at @@ -183,6 +183,34 @@ AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0 | ofctl_strip_all], [0], [dnl NXST_FLOW reply: ]) +check ovs-vsctl add-port br0 eth1 -- set interface eth1 ofport-request=4 +check as ovn-br ovn-brctl add-flow br0 3 100 "ip4 && metadata == 1000" "ct_snat_zone = 100; ct_snat;" +check as ovn-br ovn-brctl add-flow br0 3 100 "ip4 && metadata == 1001" "ct_dnat_zone = 101; ct_dnat;" +check as ovn-br ovn-brctl add-flow br0 4 100 "ip4 && metadata == 1000 && ip4.dst == 52.92.128.0/17" "tun.id = 1000; tun_ip4.dst = 10.100.100.1; eth.dst = 4c:96:14:14:01:b0; outport = \"eth1\"; output;" +check as ovn-br ovn-brctl add-flow br0 4 101 "ip6 && metadata == 1000" "tun.id = 1000; tun_ip6.src = aef0::3; tun_ip6.dst = bef0::4; eth.dst = 4c:96:14:14:01:b0; outport = \"eth1\"; output;" + +OVS_WAIT_UNTIL([test `ovs-ofctl dump-flows br0 | grep -v NXST_FLOW | wc -l` -eq 15]) + +AT_CHECK_UNQUOTED([ovs-ofctl dump-flows br0 | ofctl_strip_all], [0], [dnl + priority=0 actions=NORMAL + priority=100,in_port=2 actions=load:0x2->NXM_NX_REG14[[]],resubmit(,8) + priority=100,in_port=4 actions=load:0x4->NXM_NX_REG14[[]],resubmit(,8) + table=10, priority=1000 actions=resubmit(,64) + table=11, priority=100,ip,metadata=0x3e8 actions=load:0x64->NXM_NX_REG12[[]],ct(table=12,zone=NXM_NX_REG12[[0..15]],nat) + table=11, priority=100,ip,metadata=0x3e9 actions=load:0x65->NXM_NX_REG11[[]],ct(table=12,zone=NXM_NX_REG11[[0..15]],nat) + table=12, priority=100,ip,metadata=0x3e8,nw_dst=52.92.128.0/17 actions=load:0x3e8->NXM_NX_TUN_ID[[]],load:0xa646401->NXM_NX_TUN_IPV4_DST[[]],mod_dl_dst:4c:96:14:14:01:b0,load:0x4->NXM_NX_REG15[[]],resubmit(,64) + table=12, priority=101,ipv6,metadata=0x3e8 actions=load:0x3e8->NXM_NX_TUN_ID[[]],load:0x3->NXM_NX_TUN_IPV6_SRC[[0..63]],load:0xaef0000000000000->NXM_NX_TUN_IPV6_SRC[[64..127]],load:0x4->NXM_NX_TUN_IPV6_DST[[0..63]],load:0xbef0000000000000->NXM_NX_TUN_IPV6_DST[[64..127]],mod_dl_dst:4c:96:14:14:01:b0,load:0x4->NXM_NX_REG15[[]],resubmit(,64) + table=64, priority=0 actions=resubmit(,65) + table=65, priority=0 actions=NORMAL + table=65, priority=100,reg15=0x2 actions=output:2 + table=65, priority=100,reg15=0x4 actions=output:4 + table=8, priority=1000,reg14=0x2 actions=resubmit(,9) + table=9, priority=1000,ip actions=resubmit(,10) + table=9, priority=1000,tcp actions=push:NXM_OF_IP_DST[[]],push:NXM_OF_IP_SRC[[]],pop:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],mod_tp_dst:8080,resubmit(,10) +NXST_FLOW reply: +]) + + check ovs-vsctl add-br br1 check ovs-vsctl add-port br1 br1-p1 -- set interface br1-p1 ofport-request=1 check ovs-vsctl add-port br1 br1-p2 -- set interface br1-p2 ofport-request=2 -- 2.50.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev