blob: b9e88a3e7449de7eb158ac8c5a01c54357553c94 [file] [log] [blame]
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06001*** Settings ***
2Resource ../lib/utils.robot
3Resource ../lib/connection_client.robot
4Resource ../lib/boot_utils.robot
5Library ../lib/gen_misc.py
6Library ../lib/utils.py
7Library ../lib/bmc_network_utils.py
8
9
10*** Keywords ***
11
12Get BMC IPv6 Info
13 [Documentation] Get system IPv6 address and prefix length.
14
15 # Get system IP address and prefix length details using "ip addr"
16 # Sample Output of "ip addr":
17 # 1: eth0: <BROADCAST,MULTIAST> mtu 1500 qdisc mq state UP qlen 1000
18 # link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
19 # inet xx.xx.xx.xx/24 brd xx.xx.xx.xx scope global eth0
20 # inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
21 # inet6 xxxx::xxxx:xxxx:xxxx:xxxx/64 scope global
22
23 ${cmd_output} ${stderr} ${rc}= BMC Execute Command /sbin/ip addr
24
25 # Get line having IPv6 address details.
26 ${lines}= Get Lines Containing String ${cmd_output} inet6
27
28 # List IP address details.
29 @{ip_components}= Split To Lines ${lines}
30
31 @{ipv6_data}= Create List
32
33 # Get all IP addresses and prefix lengths on system.
34 FOR ${ip_component} IN @{ip_components}
35 @{if_info}= Split String ${ip_component}
36 ${ip_n_prefix}= Get From List ${if_info} 1
37 Append To List ${ipv6_data} ${ip_n_prefix}
38 END
39
40 [Return] ${ipv6_data}
41
42
43Verify IPv6 On BMC
44 [Documentation] Verify IPv6 on BMC.
45 [Arguments] ${ipv6}
46
47 # Description of argument(s):
48 # ipv6 IPv6 address to be verified (e.g. "2001::1234:1234").
49
50 # Get IPv6 address details on BMC using IP command.
51 @{ip_data}= Get BMC IPv6 Info
52 Should Contain Match ${ip_data} ${ipv6}/*
53 ... msg=IPv6 address does not exist.