| Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Resource                ../lib/utils.robot | 
|  | 3 | Resource                ../lib/connection_client.robot | 
|  | 4 | Resource                ../lib/boot_utils.robot | 
|  | 5 | Library                 ../lib/gen_misc.py | 
|  | 6 | Library                 ../lib/utils.py | 
|  | 7 | Library                 ../lib/bmc_network_utils.py | 
|  | 8 |  | 
|  | 9 |  | 
|  | 10 | *** Keywords *** | 
|  | 11 |  | 
|  | 12 | Get 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 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 40 | RETURN  ${ipv6_data} | 
| Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 41 |  | 
|  | 42 |  | 
|  | 43 | Verify 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. | 
| Prashanth Katti | 2c73abc | 2021-03-17 07:42:25 -0500 | [diff] [blame] | 54 |  | 
|  | 55 |  | 
|  | 56 | Verify IPv6 Default Gateway On BMC | 
|  | 57 | [Documentation]  Verify IPv6 default gateway on BMC. | 
| Prashanth Katti | 3270fd0 | 2021-06-11 08:02:22 -0500 | [diff] [blame] | 58 | [Arguments]  ${gateway_ip}=0:0:0:0:0:0:0:0 | 
| Prashanth Katti | 2c73abc | 2021-03-17 07:42:25 -0500 | [diff] [blame] | 59 |  | 
|  | 60 | # Description of argument(s): | 
|  | 61 | # gateway_ip  Gateway IPv6 address. | 
|  | 62 |  | 
|  | 63 | ${route_info}=  Get BMC IPv6 Route Info | 
|  | 64 |  | 
|  | 65 | # If gateway IP is empty it will not have route entry. | 
|  | 66 |  | 
| Murali Devarapu | b8f4aeb | 2025-07-21 23:55:23 -0500 | [diff] [blame] | 67 | IF  '${gateway_ip}' == '0:0:0:0:0:0:0:0' | 
|  | 68 | Pass Execution  Gateway IP is not configured. | 
|  | 69 | ELSE | 
|  | 70 | Should Contain  ${route_info}  ${gateway_ip}  msg=Gateway IP address not matching. | 
|  | 71 | END | 
| Prashanth Katti | 2c73abc | 2021-03-17 07:42:25 -0500 | [diff] [blame] | 72 |  | 
|  | 73 |  | 
|  | 74 | Get BMC IPv6 Route Info | 
|  | 75 | [Documentation]  Get IPv6 route info on BMC. | 
|  | 76 |  | 
|  | 77 | # Sample output of "ip -6 route": | 
|  | 78 | # unreachable ::/96 dev lo metric 1024 error -113 | 
|  | 79 | # unreachable ::ffff:0.0.0.0/96 dev lo metric 1024 error -113 | 
|  | 80 | # 2xxx:xxxx:0:1::/64 dev eth0 proto kernel metric 256 | 
|  | 81 | # fe80::/64 dev eth1 proto kernel metric 256 | 
|  | 82 | # fe80::/64 dev eth0 proto kernel metric 256 | 
|  | 83 | # fe80::/64 dev eth2 proto kernel metric 256 | 
|  | 84 |  | 
|  | 85 |  | 
|  | 86 | ${cmd_output}  ${stderr}  ${rc}=  BMC Execute Command | 
|  | 87 | ...  /sbin/ip -6 route | 
|  | 88 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 89 | RETURN  ${cmd_output} |