import unittest
-from framework import VppTestCase, VppTestRunner
+from framework import VppTestCase, VppTestRunner, is_skip_aarch64_set, \
+ is_platform_aarch64
from vpp_object import VppObject
from vpp_neighbor import VppNeighbor
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable, \
from socket import AF_INET, AF_INET6
from scapy.utils import inet_pton, inet_ntop
-from util import mactobinary
from vpp_papi_provider import L2_VTR_OP
is_inside=0,
is_add=0)
+ def wait_for_ep_timeout(self, sw_if_index=None, ip=None, mac=None,
+ n_tries=100, s_time=1):
+ while (n_tries):
+ if not find_gbp_endpoint(self, sw_if_index, ip, mac):
+ return True
+ n_tries = n_tries - 1
+ self.sleep(s_time)
+ self.assertFalse(find_gbp_endpoint(self, sw_if_index, ip, mac))
+ return False
+
def test_gbp_learn_l2(self):
""" GBP L2 Endpoint Learning """
# If we sleep for the threshold time, the learnt endpoints should
# age out
#
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
#
# repeat. the do not learn bit is set so the EPs are not learnt
self.assertTrue(rx[VXLAN].gpflags.A)
self.assertFalse(rx[VXLAN].gpflags.D)
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- vx_tun_l2_1.sw_if_index,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
#
# repeat in the other EPG
#
# clean up
#
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- vx_tun_l2_1.sw_if_index,
- mac=l['mac']))
+ self.wait_for_ep_timeout(vx_tun_l2_1.sw_if_index,
+ mac=l['mac'])
self.pg2.unconfig_ip4()
self.pg3.unconfig_ip4()
self.logger.info(self.vapi.cli("sh int"))
self.logger.info(self.vapi.cli("sh gbp vxlan"))
+ @unittest.skipIf(is_skip_aarch64_set() and is_platform_aarch64(),
+ "test doesn't work on aarch64")
def test_gbp_learn_vlan_l2(self):
""" GBP L2 Endpoint w/ VLANs"""
self.pg2.unconfig_ip4()
self.pg3.unconfig_ip4()
+ @unittest.skipIf(is_skip_aarch64_set() and is_platform_aarch64(),
+ "test doesn't work on aarch64")
def test_gbp_learn_l3(self):
""" GBP L3 Endpoint Learning """
self.assertEqual(inner[IP].src, ep.ip4.address)
self.assertEqual(inner[IP].dst, l['ip'])
- self.sleep(2)
for l in learnt:
self.assertFalse(find_gbp_endpoint(self,
tep1_sw_if_index,
self.assertEqual(inner[IPv6].dst, l['ip6'])
self.logger.info(self.vapi.cli("sh gbp endpoint"))
- self.sleep(2)
for l in learnt:
- self.assertFalse(find_gbp_endpoint(self,
- tep1_sw_if_index,
- ip=l['ip']))
+ self.wait_for_ep_timeout(ip=l['ip'])
#
# Static sends to unknown EP with no route