Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions ansible/roles/test/files/ptftests/py3/vxlan_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import os.path
import json
import base64
import six
from datetime import datetime
import logging
import random
Expand Down Expand Up @@ -84,18 +85,18 @@ def get_ip_address(af, hostid=1, netid=100):
netid : The first octet in the Address.
'''
global Address_Count
third_octet = Address_Count % 255
second_octet = (Address_Count / 255) % 255
first_octet = netid + (Address_Count / 65025)
third_octet = int(Address_Count % 255)
second_octet = int((Address_Count / 255) % 255)
first_octet = int(netid + (Address_Count / 65025))
Address_Count = Address_Count + 1
if af == 'v4':
return "{}.{}.{}.{}".format(
first_octet, second_octet, third_octet, hostid).decode()
return six.text_type("{}.{}.{}.{}".format(
first_octet, second_octet, third_octet, hostid))
if af == 'v6':
# :0: gets removed in the IPv6 addresses.
# Adding a to octets, to avoid it.
return "fddd:a{}:a{}::a{}:{}".format(
first_octet, second_octet, third_octet, hostid).decode()
return six.text_type("fddd:a{}:a{}::a{}:{}".format(
first_octet, second_octet, third_octet, hostid))


def get_incremental_value(key):
Expand Down