1*** 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. 54 55 56Verify IPv6 Default Gateway On BMC 57 [Documentation] Verify IPv6 default gateway on BMC. 58 [Arguments] ${gateway_ip}=0:0:0:0:0:0:0:0 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 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 72 73 74Get 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 89 RETURN ${cmd_output} 90 91 92Get Address Origin List And Address For Type 93 [Documentation] Get address origin list and address for type. 94 [Arguments] ${ipv6_address_type} 95 96 # Description of the argument(s): 97 # ipv6_address_type Type of IPv6 address to be checked. 98 99 ${active_channel_config}= Get Active Channel Config 100 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 101 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 102 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses 103 104 ${ipv6_addressorigin_list}= Create List 105 ${ipv6_slaac_addr}= Set Variable ${None} 106 FOR ${ipv6_address} IN @{ipv6_addresses} 107 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin 108 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin} 109 IF '${ipv6_addressorigin}' == '${ipv6_address_type}' 110 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']} 111 END 112 END 113 Should Contain ${ipv6_addressorigin_list} ${ipv6_address_type} 114 Should Not Be Empty ${ipv6_type_addr} msg=${ipv6_address_type} address is not present 115 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr} 116