1#!/usr/bin/python
2import stl_path
3from trex_stl_lib.api import *
4import sys
5
6'''
7Simple script that demonstrates:
81) Automatic discovery of IPv6 nodes
92) Ping first node in the list
10'''
11
12c = STLClient(verbose_level = LoggerApi.VERBOSE_REGULAR_SYNC)
13c.connect()
14c.reset()
15c.set_service_mode()
16
17results = c.scan6(ports = [0], timeout = 2, verbose = True)[0]
18
19if not results:
20    print('No devices found.')
21    sys.exit(0)
22
23# Setting default destination to MAC of first result and ping it
24
25c.set_l2_mode(port = 0, dst_mac = results[0]['mac'])
26
27c.ping_ip(src_port = 0, dst_ip = results[0]['ipv6'])
28
29
30print('\nDone.\n')