lib/network_utils.pm

network_utils

Functional methods to operate on network

setup_static_network

 setup_static_network(ip => '10.0.2.15', gw => '10.0.2.1');

Configure static IP on SUT with setting up default GW. Also doing test ping to 10.0.2.2 to check that network is alive Set DNS server defined via required variable STATIC_DNS_SERVER

iface

 iface([$quantity]);

Return first NIC which is not loopback

can_upload_logs

 can_upload_logs([$gw]);

Returns if can ping worker host gateway

recover_network

 recover_network([ip => $ip] [, gw => $gw]);

Recover network with static config if is feasible, returns if can ping GW. Main use case is post_fail_hook, to be able to upload logs.

Accepts following parameters :

ip => allowing to specify certain IP which would be used for recovery in case skiped '10.0.2.15/24' will be used as fallback.

gw => allowing to specify default gateway. Fallback to worker IP in case nothing specified.

ifc_exists

 ifc_exists([$ifc]);

Return if ifconfig exists.

ifc_is_up

 ifc_is_up([$ifc]);

Return only if network status is UP.