Skip to content

Commit

Permalink
[testfix]Fixed failures caused by python 3 conversion. (#9969)
Browse files Browse the repository at this point in the history
* Fixed failures caused by python 3 conversion.
  • Loading branch information
siqbal1986 authored and mssonicbld committed Sep 22, 2023
1 parent 64cad21 commit 125a083
Show file tree
Hide file tree
Showing 2 changed files with 325 additions and 321 deletions.
15 changes: 9 additions & 6 deletions ansible/roles/test/files/ptftests/py3/vxlan_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import os.path
import json
import base64
from datetime import datetime
import logging
import random
Expand Down Expand Up @@ -416,7 +417,7 @@ def test_encap(
vxlan_vni=vni,
inner_frame=exp_pkt,
**options_v6)
send_packet(self, ptf_port, str(pkt))
send_packet(self, ptf_port, pkt)

# After we sent all packets, wait for the responses.
if expect_success:
Expand Down Expand Up @@ -481,8 +482,6 @@ def test_encap(
else:
masked_exp_pkt.set_do_not_care_scapy(scapy.IPv6,
"hlim")
masked_exp_pkt.set_do_not_care_scapy(scapy.IPv6,
"chksum")
masked_exp_pkt.set_do_not_care_scapy(scapy.IPv6,
"dst")
masked_exp_pkt.set_do_not_care_scapy(scapy.UDP,
Expand Down Expand Up @@ -513,7 +512,9 @@ def test_encap(
self.downed_endpoints)

pkt.load = '0' * 60 + str(len(self.packets))
self.packets.append((ptf_port, str(pkt).encode("base64")))
b = base64.b64encode(bytes(str(pkt), 'utf-8')) # bytes
base64_str = b.decode('utf-8') # convert bytes to string
self.packets.append((ptf_port, base64_str))

finally:
Logger.info("")
Expand Down Expand Up @@ -671,7 +672,7 @@ def test_encap(
vxlan_vni=vni,
inner_frame=exp_pkt,
**options_v6)
send_packet(self, ptf_port, str(pkt))
send_packet(self, ptf_port, pkt)

# After we sent all packets, wait for the responses.
if expect_success:
Expand Down Expand Up @@ -768,7 +769,9 @@ def test_encap(
self.downed_endpoints)

pkt.load = '0' * 60 + str(len(self.packets))
self.packets.append((ptf_port, str(pkt).encode("base64")))
b = base64.b64encode(bytes(str(pkt), 'utf-8')) # bytes
base64_str = b.decode('utf-8') # convert bytes to string
self.packets.append((ptf_port, base64_str))

finally:
Logger.info("")
Loading

0 comments on commit 125a083

Please sign in to comment.