Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ipv6_to_binary to ptf #544

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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