Skip to content

Commit fe653db

Browse files
siqbal1986mssonicbld
authored andcommitted
fixed a bug caused by pthon 3 migration. (sonic-net#12844)
1 parent 36daceb commit fe653db

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

ansible/roles/test/files/ptftests/py3/vxlan_traffic.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import os.path
4545
import json
4646
import base64
47+
import six
4748
from datetime import datetime
4849
import logging
4950
import random
@@ -84,18 +85,18 @@ def get_ip_address(af, hostid=1, netid=100):
8485
netid : The first octet in the Address.
8586
'''
8687
global Address_Count
87-
third_octet = Address_Count % 255
88-
second_octet = (Address_Count / 255) % 255
89-
first_octet = netid + (Address_Count / 65025)
88+
third_octet = int(Address_Count % 255)
89+
second_octet = int((Address_Count / 255) % 255)
90+
first_octet = int(netid + (Address_Count / 65025))
9091
Address_Count = Address_Count + 1
9192
if af == 'v4':
92-
return "{}.{}.{}.{}".format(
93-
first_octet, second_octet, third_octet, hostid).decode()
93+
return six.text_type("{}.{}.{}.{}".format(
94+
first_octet, second_octet, third_octet, hostid))
9495
if af == 'v6':
9596
# :0: gets removed in the IPv6 addresses.
9697
# Adding a to octets, to avoid it.
97-
return "fddd:a{}:a{}::a{}:{}".format(
98-
first_octet, second_octet, third_octet, hostid).decode()
98+
return six.text_type("fddd:a{}:a{}::a{}:{}".format(
99+
first_octet, second_octet, third_octet, hostid))
99100

100101

101102
def get_incremental_value(key):

0 commit comments

Comments
 (0)