Skip to content
Open
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
6 changes: 6 additions & 0 deletions proto/ptf/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def ipv4_to_binary(addr):
# check for that here.
return "".join(chr(b) for b in bytes_)

def ipv6_to_binary(addr):
""" Accepts IPv6 address in colon format.
e.g., 2001:dead:beef::2
"""
return socket.inet_pton(socket.AF_INET6, addr)

def mac_to_binary(addr):
"""Take an argument 'addr' containing an Ethernet MAC address written
as a string in hexadecimal notation, with each byte separated by a
Expand Down