STL example of using IPv6 in automation
authorYaroslav Brustinov <[email protected]>
Wed, 8 Feb 2017 08:28:48 +0000 (10:28 +0200)
committerYaroslav Brustinov <[email protected]>
Wed, 8 Feb 2017 08:28:48 +0000 (10:28 +0200)
Change-Id: I976f38f491e5310ae708ff482f8cdf33df3c92d4
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/automation/trex_control_plane/stl/examples/stl_ipv6_tools.py [new file with mode: 0644]

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 (file)
index 0000000..6a65279
--- /dev/null
@@ -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