Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions api/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ py_binary(
name = "tap2pcap",
srcs = ["tap2pcap.py"],
licenses = ["notice"], # Apache 2
python_version = "PY2",
visibility = ["//visibility:public"],
deps = ["//envoy/data/tap/v2alpha:pkg_py_proto"],
)
Expand All @@ -16,7 +15,6 @@ py_test(
"data/tap2pcap_h2_ipv4.pb_text",
"data/tap2pcap_h2_ipv4.txt",
],
python_version = "PY2",
# Don't run this by default, since we don't want to force local dependency on Wireshark/tshark,
# will explicitly invoke in CI.
tags = ["manual"],
Expand Down
8 changes: 4 additions & 4 deletions api/tools/tap2pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from __future__ import print_function

import datetime
import io
import socket
import StringIO
import subprocess as sp
import sys
import time
Expand All @@ -32,14 +32,14 @@


def DumpEvent(direction, timestamp, data):
dump = StringIO.StringIO()
dump = io.StringIO()
dump.write('%s\n' % direction)
# Adjust to local timezone
adjusted_dt = timestamp.ToDatetime() - datetime.timedelta(seconds=time.altzone)
dump.write('%s\n' % adjusted_dt)
od = sp.Popen(['od', '-Ax', '-tx1', '-v'], stdout=sp.PIPE, stdin=sp.PIPE, stderr=sp.PIPE)
packet_dump = od.communicate(data)[0]
dump.write(packet_dump)
dump.write(packet_dump.decode())
return dump.getvalue()


Expand Down Expand Up @@ -78,7 +78,7 @@ def Tap2Pcap(tap_path, pcap_path):
'%d,%d' % (remote_port, local_port), '-', pcap_path
]
text2pcap = sp.Popen(text2pcap_args, stdout=sp.PIPE, stdin=sp.PIPE)
text2pcap.communicate('\n'.join(dumps))
text2pcap.communicate('\n'.join(dumps).encode())


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion api/tools/tap2pcap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

tap2pcap.Tap2Pcap(tap_path, pcap_path)
actual_output = sp.check_output(['tshark', '-r', pcap_path, '-d', 'tcp.port==10000,http2', '-P'])
with open(expected_path, 'r') as f:
with open(expected_path, 'rb') as f:
expected_output = f.read()
if actual_output != expected_output:
print('Mismatch')
Expand Down
1 change: 0 additions & 1 deletion test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ py_binary(
name = "capture_fuzz_gen",
srcs = ["capture_fuzz_gen.py"],
licenses = ["notice"], # Apache 2
python_version = "PY3",
visibility = ["//visibility:public"],
deps = [
":capture_fuzz_proto_py_proto",
Expand Down
1 change: 0 additions & 1 deletion tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ py_library(
srcs = [
"run_command.py",
],
srcs_version = "PY3",
visibility = ["//visibility:public"],
)

Expand Down
2 changes: 0 additions & 2 deletions tools/protodoc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ licenses(["notice"]) # Apache 2
py_binary(
name = "generate_empty",
srcs = ["generate_empty.py"],
python_version = "PY3",
visibility = ["//visibility:public"],
deps = [":protodoc"],
)

py_binary(
name = "protodoc",
srcs = ["protodoc.py"],
python_version = "PY3",
visibility = ["//visibility:public"],
deps = [
"//tools/api_proto_plugin",
Expand Down