diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-02-08 10:28:48 +0200 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-02-08 10:28:48 +0200 |
commit | 24ac472c3694e2b64b1383265930c3f1dc36fdf8 (patch) | |
tree | f34300a226311838a87b66b035288b55407165cf /scripts/automation | |
parent | 61cb95bc8211b62aa5f8b6a2dc2d7147a0257f68 (diff) |
STL example of using IPv6 in automation
Change-Id: I976f38f491e5310ae708ff482f8cdf33df3c92d4
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/examples/stl_ipv6_tools.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_ipv6_tools.py b/scripts/automation/trex_control_plane/stl/examples/stl_ipv6_tools.py new file mode 100644 index 00000000..6a652795 --- /dev/null +++ b/scripts/automation/trex_control_plane/stl/examples/stl_ipv6_tools.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +import stl_path +from trex_stl_lib.api import * +import sys + +''' +Simple script that demonstrates: +1) Automatic discovery of IPv6 nodes +2) Ping first node in the list +''' + +c = STLClient(verbose_level = LoggerApi.VERBOSE_REGULAR_SYNC) +c.connect() +c.reset() +c.set_service_mode() + +results = c.scan6(ports = [0], timeout = 2, verbose = True)[0] + +if not results: + print('No devices found.') + sys.exit(0) + +# Setting default destination to MAC of first result and ping it + +c.set_l2_mode(port = 0, dst_mac = results[0]['mac']) + +c.ping_ip(src_port = 0, dst_ip = results[0]['ipv6']) + + +print('\nDone.\n')
\ No newline at end of file |