geneve: Fix the byte swapping for the VNI

Type: fix

- swipe away the vomit indent left last time.
- add tests for VNIs > 16bit

Change-Id: I2d1f591bfb9d7a18996c38969365a509168d4193
Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
Neale Ranns
2020-04-03 07:46:28 +00:00
committed by Damjan Marion
parent ae9c45938b
commit 91fd910d7d
10 changed files with 66 additions and 80 deletions

View File

@ -187,7 +187,7 @@ class TestGtpu(BridgeDomain, VppTestCase):
# Pick first received frame and check if it's correctly encapsulated. # Pick first received frame and check if it's correctly encapsulated.
out = self.pg0.get_capture(1) out = self.pg0.get_capture(1)
pkt = out[0] pkt = out[0]
self.check_encapsulation(pkt, self.single_tunnel_bd) self.check_encapsulation(pkt, self.single_tunnel_vni)
# payload = self.decapsulate(pkt) # payload = self.decapsulate(pkt)
# self.assert_eq_pkts(payload, self.frame_reply) # self.assert_eq_pkts(payload, self.frame_reply)
@ -343,13 +343,14 @@ class TestGtpu(BridgeDomain, VppTestCase):
# Create GTPU VTEP on VPP pg0, and put gtpu_tunnel0 and pg1 # Create GTPU VTEP on VPP pg0, and put gtpu_tunnel0 and pg1
# into BD. # into BD.
cls.single_tunnel_bd = 11 cls.single_tunnel_bd = 11
cls.single_tunnel_vni = 11
r = cls.vapi.gtpu_add_del_tunnel( r = cls.vapi.gtpu_add_del_tunnel(
is_add=True, is_add=True,
mcast_sw_if_index=0xFFFFFFFF, mcast_sw_if_index=0xFFFFFFFF,
decap_next_index=0xFFFFFFFF, decap_next_index=0xFFFFFFFF,
src_address=cls.pg0.local_ip4, src_address=cls.pg0.local_ip4,
dst_address=cls.pg0.remote_ip4, dst_address=cls.pg0.remote_ip4,
teid=cls.single_tunnel_bd) teid=cls.single_tunnel_vni)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=cls.single_tunnel_bd) bd_id=cls.single_tunnel_bd)
cls.vapi.sw_interface_set_l2_bridge( cls.vapi.sw_interface_set_l2_bridge(

View File

@ -213,7 +213,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4) if (is_ip4)
{ {
key4_0.remote = ip4_0->src_address.as_u32; key4_0.remote = ip4_0->src_address.as_u32;
key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */ /* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64)) if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
@ -248,7 +248,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_0->dst_address))) (ip4_address_is_multicast (&ip4_0->dst_address)))
{ {
key4_0.remote = ip4_0->dst_address.as_u32; key4_0.remote = ip4_0->dst_address.as_u32;
key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */ /* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64); p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64);
if (PREDICT_TRUE (p0 != NULL)) if (PREDICT_TRUE (p0 != NULL))
@ -266,7 +266,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0]; key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1]; key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1];
key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */ /* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE if (PREDICT_FALSE
@ -303,7 +303,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0]; key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1]; key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1];
key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0); p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0);
if (PREDICT_TRUE (p0 != NULL)) if (PREDICT_TRUE (p0 != NULL))
{ {
@ -380,7 +380,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4) if (is_ip4)
{ {
key4_1.remote = ip4_1->src_address.as_u32; key4_1.remote = ip4_1->src_address.as_u32;
key4_1.vni = vnet_get_geneve_vni_bigendian (geneve1); key4_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */ /* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */
if (PREDICT_FALSE (key4_1.as_u64 != last_key4.as_u64)) if (PREDICT_FALSE (key4_1.as_u64 != last_key4.as_u64))
@ -415,7 +415,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_1->dst_address))) (ip4_address_is_multicast (&ip4_1->dst_address)))
{ {
key4_1.remote = ip4_1->dst_address.as_u32; key4_1.remote = ip4_1->dst_address.as_u32;
key4_1.vni = vnet_get_geneve_vni_bigendian (geneve1); key4_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */ /* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p1 = hash_get (vxm->geneve4_tunnel_by_key, key4_1.as_u64); p1 = hash_get (vxm->geneve4_tunnel_by_key, key4_1.as_u64);
if (PREDICT_TRUE (p1 != NULL)) if (PREDICT_TRUE (p1 != NULL))
@ -433,7 +433,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_1.remote.as_u64[0] = ip6_1->src_address.as_u64[0]; key6_1.remote.as_u64[0] = ip6_1->src_address.as_u64[0];
key6_1.remote.as_u64[1] = ip6_1->src_address.as_u64[1]; key6_1.remote.as_u64[1] = ip6_1->src_address.as_u64[1];
key6_1.vni = vnet_get_geneve_vni_bigendian (geneve1); key6_1.vni = vnet_get_geneve_vni_network_order (geneve1);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */ /* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE if (PREDICT_FALSE
@ -472,7 +472,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_1.remote.as_u64[0] = ip6_1->dst_address.as_u64[0]; key6_1.remote.as_u64[0] = ip6_1->dst_address.as_u64[0];
key6_1.remote.as_u64[1] = ip6_1->dst_address.as_u64[1]; key6_1.remote.as_u64[1] = ip6_1->dst_address.as_u64[1];
key6_1.vni = vnet_get_geneve_vni_bigendian (geneve1); key6_1.vni = vnet_get_geneve_vni_network_order (geneve1);
p1 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_1); p1 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_1);
if (PREDICT_TRUE (p1 != NULL)) if (PREDICT_TRUE (p1 != NULL))
{ {
@ -618,7 +618,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4) if (is_ip4)
{ {
key4_0.remote = ip4_0->src_address.as_u32; key4_0.remote = ip4_0->src_address.as_u32;
key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */ /* Make sure unicast GENEVE tunnel exist by packet SIP and VNI */
if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64)) if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
@ -653,7 +653,7 @@ geneve_input (vlib_main_t * vm,
(ip4_address_is_multicast (&ip4_0->dst_address))) (ip4_address_is_multicast (&ip4_0->dst_address)))
{ {
key4_0.remote = ip4_0->dst_address.as_u32; key4_0.remote = ip4_0->dst_address.as_u32;
key4_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key4_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */ /* Make sure mcast GENEVE tunnel exist by packet DIP and VNI */
p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64); p0 = hash_get (vxm->geneve4_tunnel_by_key, key4_0.as_u64);
if (PREDICT_TRUE (p0 != NULL)) if (PREDICT_TRUE (p0 != NULL))
@ -671,7 +671,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0]; key6_0.remote.as_u64[0] = ip6_0->src_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1]; key6_0.remote.as_u64[1] = ip6_0->src_address.as_u64[1];
key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
/* Make sure GENEVE tunnel exist according to packet SIP and VNI */ /* Make sure GENEVE tunnel exist according to packet SIP and VNI */
if (PREDICT_FALSE if (PREDICT_FALSE
@ -708,7 +708,7 @@ geneve_input (vlib_main_t * vm,
{ {
key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0]; key6_0.remote.as_u64[0] = ip6_0->dst_address.as_u64[0];
key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1]; key6_0.remote.as_u64[1] = ip6_0->dst_address.as_u64[1];
key6_0.vni = vnet_get_geneve_vni_bigendian (geneve0); key6_0.vni = vnet_get_geneve_vni_network_order (geneve0);
p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0); p0 = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6_0);
if (PREDICT_TRUE (p0 != NULL)) if (PREDICT_TRUE (p0 != NULL))
{ {
@ -1240,24 +1240,17 @@ VLIB_NODE_FN (ip4_geneve_bypass_node) (vlib_main_t * vm,
/* *INDENT-OFF* */ /* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip4_geneve_bypass_node) = VLIB_REGISTER_NODE (ip4_geneve_bypass_node) =
{ {
.name = "ip4-geneve-bypass",.vector_size = .name = "ip4-geneve-bypass",
sizeof (u32),.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes = .vector_size = sizeof (u32),
.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes =
{ {
[IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop", [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
[IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve4-input",} [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve4-input",
,.format_buffer = format_ip4_header,.format_trace = },
format_ip4_forward_next_trace,}; .format_buffer = format_ip4_header,
.format_trace = format_ip4_forward_next_trace,
#ifndef CLIB_MARCH_VARIANT };
/* Dummy init function to get us linked in. */
clib_error_t *ip4_geneve_bypass_init (vlib_main_t * vm)
{
return 0;
}
VLIB_INIT_FUNCTION (ip4_geneve_bypass_init);
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif /* CLIB_MARCH_VARIANT */
VLIB_NODE_FN (ip6_geneve_bypass_node) (vlib_main_t * vm, VLIB_NODE_FN (ip6_geneve_bypass_node) (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_node_runtime_t * node,
@ -1269,26 +1262,19 @@ VLIB_NODE_FN (ip6_geneve_bypass_node) (vlib_main_t * vm,
/* *INDENT-OFF* */ /* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_geneve_bypass_node) = VLIB_REGISTER_NODE (ip6_geneve_bypass_node) =
{ {
.name = "ip6-geneve-bypass",.vector_size = .name = "ip6-geneve-bypass",
sizeof (u32),.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,.next_nodes = .vector_size = sizeof (u32),
.n_next_nodes = IP_GENEVE_BYPASS_N_NEXT,
.next_nodes =
{ {
[IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop", [IP_GENEVE_BYPASS_NEXT_DROP] = "error-drop",
[IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve6-input",} [IP_GENEVE_BYPASS_NEXT_GENEVE] = "geneve6-input",
,.format_buffer = format_ip6_header,.format_trace = },
format_ip6_forward_next_trace,}; .format_buffer = format_ip6_header,
.format_trace = format_ip6_forward_next_trace,
};
/* *INDENT-ON* */ /* *INDENT-ON* */
#ifndef CLIB_MARCH_VARIANT
/* Dummy init function to get us linked in. */
clib_error_t *
ip6_geneve_bypass_init (vlib_main_t * vm)
{
return 0;
}
VLIB_INIT_FUNCTION (ip6_geneve_bypass_init);
#endif /* CLIB_MARCH_VARIANT */
/* /*
* fd.io coding-style-patch-verification: ON * fd.io coding-style-patch-verification: ON
* *

View File

@ -292,14 +292,15 @@ geneve_decap_next_is_valid (geneve_main_t * vxm, u32 is_ip6,
return decap_next_index < r->n_next_nodes; return decap_next_index < r->n_next_nodes;
} }
typedef CLIB_PACKED (union typedef union
{ {
struct struct
{ {
fib_node_index_t mfib_entry_index; fib_node_index_t mfib_entry_index;
adj_index_t mcast_adj_index; adj_index_t mcast_adj_index;
}; u64 as_u64; };
}) mcast_shared_t; u64 as_u64;
} __clib_packed mcast_shared_t;
static inline mcast_shared_t static inline mcast_shared_t
mcast_shared_get (ip46_address_t * ip) mcast_shared_get (ip46_address_t * ip)
@ -352,15 +353,13 @@ int vnet_geneve_add_del_tunnel
if (!is_ip6) if (!is_ip6)
{ {
key4.remote = a->remote.ip4.as_u32; key4.remote = a->remote.ip4.as_u32;
key4.vni = key4.vni = clib_host_to_net_u32 (a->vni << GENEVE_VNI_SHIFT);
clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK);
p = hash_get (vxm->geneve4_tunnel_by_key, key4.as_u64); p = hash_get (vxm->geneve4_tunnel_by_key, key4.as_u64);
} }
else else
{ {
key6.remote = a->remote.ip6; key6.remote = a->remote.ip6;
key6.vni = key6.vni = clib_host_to_net_u32 (a->vni << GENEVE_VNI_SHIFT);
clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK);
p = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6); p = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6);
} }

View File

@ -137,21 +137,14 @@ typedef struct
static inline u32 static inline u32
vnet_get_geneve_vni (geneve_header_t * h) vnet_get_geneve_vni (geneve_header_t * h)
{ {
return (clib_net_to_host_u32 (h->vni_rsvd & GENEVE_VNI_MASK) >> return ((clib_net_to_host_u32 (h->vni_rsvd) & GENEVE_VNI_MASK) >>
GENEVE_VNI_SHIFT); GENEVE_VNI_SHIFT);
} }
/*
* Return the VNI in network-byte order
*
* To be used in the DECAP phase to create the lookup key (IP + VNI)
*/
static inline u32 static inline u32
vnet_get_geneve_vni_bigendian (geneve_header_t * h) vnet_get_geneve_vni_network_order (geneve_header_t * h)
{ {
u32 vni_host = vnet_get_geneve_vni (h); return (h->vni_rsvd & clib_net_to_host_u32 (GENEVE_VNI_MASK));
return clib_host_to_net_u32 ((vni_host << GENEVE_VNI_SHIFT) &
GENEVE_VNI_MASK);
} }
static inline void static inline void

View File

@ -74,7 +74,7 @@ class BridgeDomain(object):
""" """
encapsulated_pkt = self.encapsulate(self.frame_request, encapsulated_pkt = self.encapsulate(self.frame_request,
self.single_tunnel_bd) self.single_tunnel_vni)
self.pg0.add_stream([encapsulated_pkt, ]) self.pg0.add_stream([encapsulated_pkt, ])
@ -102,7 +102,7 @@ class BridgeDomain(object):
# Pick first received frame and check if it's correctly encapsulated. # Pick first received frame and check if it's correctly encapsulated.
out = self.pg0.get_capture(1) out = self.pg0.get_capture(1)
pkt = out[0] pkt = out[0]
self.check_encapsulation(pkt, self.single_tunnel_bd) self.check_encapsulation(pkt, self.single_tunnel_vni)
payload = self.decapsulate(pkt) payload = self.decapsulate(pkt)
self.assert_eq_pkts(payload, self.frame_reply) self.assert_eq_pkts(payload, self.frame_reply)

View File

@ -182,10 +182,11 @@ class TestGeneve(BridgeDomain, VppTestCase):
# Create GENEVE VTEP on VPP pg0, and put geneve_tunnel0 and pg1 # Create GENEVE VTEP on VPP pg0, and put geneve_tunnel0 and pg1
# into BD. # into BD.
cls.single_tunnel_vni = 0xabcde
cls.single_tunnel_bd = 1 cls.single_tunnel_bd = 1
r = cls.vapi.geneve_add_del_tunnel( r = cls.vapi.geneve_add_del_tunnel(
local_address=cls.pg0.local_ip4, local_address=cls.pg0.local_ip4,
remote_address=cls.pg0.remote_ip4, vni=cls.single_tunnel_bd) remote_address=cls.pg0.remote_ip4, vni=cls.single_tunnel_vni)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=cls.single_tunnel_bd) bd_id=cls.single_tunnel_bd)
cls.vapi.sw_interface_set_l2_bridge( cls.vapi.sw_interface_set_l2_bridge(

View File

@ -200,9 +200,11 @@ class TestVxlan(BridgeDomain, VppTestCase):
super(TestVxlan, self).setUp() super(TestVxlan, self).setUp()
# Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1 # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1
# into BD. # into BD.
self.single_tunnel_vni = 0x12345
self.single_tunnel_bd = 1 self.single_tunnel_bd = 1
r = VppVxlanTunnel(self, src=self.pg0.local_ip4, r = VppVxlanTunnel(self, src=self.pg0.local_ip4,
dst=self.pg0.remote_ip4, vni=self.single_tunnel_bd) dst=self.pg0.remote_ip4,
vni=self.single_tunnel_vni)
r.add_vpp_config() r.add_vpp_config()
self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=self.single_tunnel_bd) bd_id=self.single_tunnel_bd)
@ -264,7 +266,7 @@ class TestVxlan(BridgeDomain, VppTestCase):
ether = out[0] ether = out[0]
pkt = reassemble4(out) pkt = reassemble4(out)
pkt = ether / pkt pkt = ether / pkt
self.check_encapsulation(pkt, self.single_tunnel_bd) self.check_encapsulation(pkt, self.single_tunnel_vni)
payload = self.decapsulate(pkt) payload = self.decapsulate(pkt)
# TODO: Scapy bug? # TODO: Scapy bug?

View File

@ -147,9 +147,11 @@ class TestVxlan6(BridgeDomain, VppTestCase):
super(TestVxlan6, self).setUp() super(TestVxlan6, self).setUp()
# Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1 # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1
# into BD. # into BD.
self.single_tunnel_vni = 0x12345
self.single_tunnel_bd = 1 self.single_tunnel_bd = 1
r = VppVxlanTunnel(self, src=self.pg0.local_ip6, r = VppVxlanTunnel(self, src=self.pg0.local_ip6,
dst=self.pg0.remote_ip6, vni=self.single_tunnel_bd) dst=self.pg0.remote_ip6,
vni=self.single_tunnel_vni)
r.add_vpp_config() r.add_vpp_config()
self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=self.single_tunnel_bd) bd_id=self.single_tunnel_bd)

View File

@ -145,11 +145,12 @@ class TestVxlanGbp(VppTestCase):
# Create VXLAN GBP VTEP on VPP pg0, and put vxlan_gbp_tunnel0 and # Create VXLAN GBP VTEP on VPP pg0, and put vxlan_gbp_tunnel0 and
# pg1 into BD. # pg1 into BD.
cls.single_tunnel_bd = 1 cls.single_tunnel_bd = 1
cls.single_tunnel_vni = 0xabcde
r = cls.vapi.vxlan_gbp_tunnel_add_del( r = cls.vapi.vxlan_gbp_tunnel_add_del(
tunnel={ tunnel={
'src': cls.pg0.local_ip4, 'src': cls.pg0.local_ip4,
'dst': cls.pg0.remote_ip4, 'dst': cls.pg0.remote_ip4,
'vni': cls.single_tunnel_bd, 'vni': cls.single_tunnel_vni,
'instance': INVALID_INDEX, 'instance': INVALID_INDEX,
'mcast_sw_if_index': INVALID_INDEX, 'mcast_sw_if_index': INVALID_INDEX,
'mode': 1, 'mode': 1,
@ -197,7 +198,7 @@ class TestVxlanGbp(VppTestCase):
Verify receipt of decapsulated frames on pg1 Verify receipt of decapsulated frames on pg1
""" """
encapsulated_pkt = self.encapsulate(self.frame_request, encapsulated_pkt = self.encapsulate(self.frame_request,
self.single_tunnel_bd) self.single_tunnel_vni)
self.pg0.add_stream([encapsulated_pkt, ]) self.pg0.add_stream([encapsulated_pkt, ])
@ -225,7 +226,7 @@ class TestVxlanGbp(VppTestCase):
# Pick first received frame and check if it's correctly encapsulated. # Pick first received frame and check if it's correctly encapsulated.
out = self.pg0.get_capture(1) out = self.pg0.get_capture(1)
pkt = out[0] pkt = out[0]
self.check_encapsulation(pkt, self.single_tunnel_bd) self.check_encapsulation(pkt, self.single_tunnel_vni)
payload = self.decapsulate(pkt) payload = self.decapsulate(pkt)
self.assert_eq_pkts(payload, self.frame_reply) self.assert_eq_pkts(payload, self.frame_reply)
@ -269,7 +270,7 @@ class TestVxlanGbp(VppTestCase):
# Pick first received frame and check if it's correctly encapsulated. # Pick first received frame and check if it's correctly encapsulated.
out = self.pg0.get_capture(2) out = self.pg0.get_capture(2)
pkt = reassemble4_ether(out) pkt = reassemble4_ether(out)
self.check_encapsulation(pkt, self.single_tunnel_bd) self.check_encapsulation(pkt, self.single_tunnel_vni)
payload = self.decapsulate(pkt) payload = self.decapsulate(pkt)
self.assert_eq_pkts(payload, frame) self.assert_eq_pkts(payload, frame)

View File

@ -190,11 +190,12 @@ class TestVxlanGpe(BridgeDomain, VppTestCase):
# Create VXLAN-GPE VTEP on VPP pg0, and put vxlan_gpe_tunnel0 # Create VXLAN-GPE VTEP on VPP pg0, and put vxlan_gpe_tunnel0
# and pg1 into BD. # and pg1 into BD.
cls.single_tunnel_vni = 0xabcde
cls.single_tunnel_bd = 11 cls.single_tunnel_bd = 11
r = cls.vapi.vxlan_gpe_add_del_tunnel( r = cls.vapi.vxlan_gpe_add_del_tunnel(
src_addr=cls.pg0.local_ip4n, src_addr=cls.pg0.local_ip4n,
dst_addr=cls.pg0.remote_ip4n, dst_addr=cls.pg0.remote_ip4n,
vni=cls.single_tunnel_bd) vni=cls.single_tunnel_vni)
cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
bd_id=cls.single_tunnel_bd) bd_id=cls.single_tunnel_bd)
cls.vapi.sw_interface_set_l2_bridge( cls.vapi.sw_interface_set_l2_bridge(