You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
I was trying to force an Error to acquire Link VLANs and I ended acquiring the same VLAN number for multiple requests.
First I used a test_concurrently decorator to create a unit test.
I added a time.sleep(0.0001) between get_next_available_tag and use_tag to force a delay.
def test_vlans(self):
switch_a = Switch('00:00:00:00:00:01')
switch_b = Switch('00:00:00:00:00:02')
endpoint_a = Interface('eth0', 1, switch_a)
endpoint_b = Interface('eth1', 2, switch_b)
linkA = Link(endpoint_a, endpoint_b)
@test_concurrently(10)
def toggle_call_your_method_here():
# perform the code you want to test here; it must be thread-safe
vlan = linkA.get_next_available_tag()
time.sleep(0.0001)
linkA.use_tag(vlan)
print('Link %s using %s vlan' % (linkA, vlan.value))
toggle_call_your_method_here()
The result was:
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 1 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 2 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 3 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 4 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 4 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 5 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 5 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 6 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 5 vlan
Link <kytos.core.link.Link object at 0x7f9a3def3be0> using 6 vlan
The text was updated successfully, but these errors were encountered:
I was trying to force an Error to acquire Link VLANs and I ended acquiring the same VLAN number for multiple requests.
First I used a test_concurrently decorator to create a unit test.
I added a time.sleep(0.0001) between get_next_available_tag and use_tag to force a delay.
The result was:
The text was updated successfully, but these errors were encountered: