lib/wickedbase.pm

wicked_command

wicked_command($action => [ifup|ifdown|ifreaload], $iface)

Executes wicked command given the action on the corresponding interface.

The mandatory parameter action specifies the action [ifup|ifdown|ifreaload]. The mandatory parameter iface specifies the interface which action will be executed on. This function saves the command and the stdout and stderr to a file to be uploaded later.

get_wicked_version

get_wicked_version()

Return the current installed wicked version

check_wicked_version

check_wicked_version('>=0.6.66')

assert_wicked_state

assert_wicked_state([wicked_client_down => 0, interfaces_down => 0,
                     wicked_daemon_down => 0, $ping_ip, $iface])

Check that wicked processes are as expected by input arguments. 'Up' by default.

The optional parameters wicked_client_down is given normally with interfaces_down => 1 to verify that wicked.service process is down. The optional argument wicked_daemon_down is given to verify that wickedd.service is down. The optional argument ping_ip checks that the IP is reachable. The optinal argument iface allows to print the output of the command 'ip address show'. With no arguments, it will check that wicked.service and wickedd.service are up.

valgrind_get_services

valgrind_get_services()

Retrieves the list of wicked services where valgrind is enabled for. It read the `WICKED_VALGRIND` variable.

valgrind_cmd

valgrind_cmd([$service])

Retrieves the valgrind command. If the $service is given, the log file will contain the name of it. It used `WICKED_VALGRIND_CMD` variable to build the command.

valgrind_enable

valgrind_enable()

Modify all systemd service units, to enable valgrind for all binarys which where specified via WICKED_VALGRIND.

valgrind_prerun()

Run before test-module. Simple cleanup of left-overs.

valgrind_postrun

valgrind_postrun()

Check for valgrind errors in one of the valgrind enabled binaries valgrind-logs.

get_remote_ip

get_remote_ip(type => $type [, netmask => 0])

Calls internally get_ip() and retrieves the corresponding IP of the remote site.

get_ip

get_ip(type => [host|gre1|sit1|tunl1|tun1|br0|vlan|vlan_changed] [, is_wicked_ref => check_var('IS_WICKED_REF', '1'), netmask => 0])

Retrives IP address as string in IPv4 or IPv6 format and netmask prefix if netmask is set.

The mandatory parameter type specify the interfaces type. If parameter netmask is set, the IP address contains the /xx netmask prefix, if specified. With is_wicked_ref you can specify which IP address you like to retrives. If is_wicked_ref isn't set the job variable IS_WICKED_REF will be used. See also get_remote_ip().

get_current_ip

get_current_ip(ifc => $interface [, ip_version => 'v4'])

Gets the IP of a given interface by ifc.

The parameter ip_version chould be one of the values 'v4' or 'v6'.

download_data_dir

Download all files from data/wicked into WICKED_DATA_DIR. This method is used by before_test.pm.

get_from_data

get_from_data($source, $target [, executable => 0, add_suffix => 0])

Downloads to the current VM a file from the data directory given by source and stores it in target.

If the parameter add_suffix is set to 1, it will append 'ref' or 'sut' at the end of the filename. If the parameter executable is set to 1, it will grant execution permissions to the file.

ping_with_timeout

ping_with_timeout(type => $type[, ip => $ip, timeout => 60, ip_version => 'v4', proceed_on_failure => 0])

Pings a given IP with a given timeout. ip_version defines the ping command to be used, 'ping' by default and 'ping6' for 'v6'. IP could be specified directly via ip or using type variable. In case of type variable it will be bypassed to get_remote_ip function to get IP by label. If ping fails, command die unless you specify proceed_on_failure.

setup_tuntap

setup_tuntap($config, $type => [tun1|tap1])

Setups a TUN or TAP interface from a config file with the keywords 'local_ip' and 'remote_ip' which will be replaced with the corresponding IPs. The mandatory parameter type determines if it will configure a TUN device or a TAP device. The interface will be brought up using a wicked command.

setup_tunnel

setup_tunnel($config, $type => [gre1|sit1|tunl1|tun1])

Setups a tunnel interface from a config file with the keywords 'local_ip', 'remote_ip' and 'tunnel_ip' which will be replaced with the corresponding IPs. The mandatory parameter type should determine the interface to be configured. The interface will be brought up using a wicked command.

create_tunnel_with_commands

create_tunnel_with_commands($type => [gre1|sit1|tunl1|tun1], $mode => [gre|sit|ipip|tun], $sub_mask)

Setups a TUNL interface with IP commands (no wicked commands!). The parameter type determines the interface to be configured and mode the type of tunnel. Supported tunnels in this function are GRE, SIT, IPIP, TUN.

setup_bridge

setup_bridge($config, $command => [ifup, ifdown, ifreload] [, $dummy])

Setups a bridge interface from a config file with the keywords 'local_ip' which will be replaced with the corresponding IP. If dummy is given, it will also configure the dummy interface using the config file given by this parameter. command determines the wicked command to bring up/down the interface

setup_openvpn_client

setup_openvpn_client($device => [tun1, tap1])

Setups the openvpn client using the interface given by device

get_test_result

get_test_result($type, $ip_version => v4)

It returns FAILED or PASSED if the ping to the remote IP of a certain interface type given by type is reachable or not. The parameter ip_version chould be one of the values 'v4' or 'v6'.

upload_log_file

The wicked way of uploading a file using the serial console. This method does not throw and error. On failing we only put a <record_info(result = fail)>>

$self->upload_log_file($src [, $dst]);

upload_wicked_logs

upload_wicked_logs($prefix => [pre|post])

Gathers all the needed wicked information and compiles a compressed file that get's uploaded to the openqa instance. This function is normally called before and after a test is executed, the parameter prefix is used to to be appended to the file name to be uploaded. Normally 'pre' or 'post', but could be any string.

do_barrier_create

do_barrier_create(<barrier_postfix> [, <test_name>] )

Create a barier which can be later used to syncronize the wicked tests for SUT and REF. This function can be called statically. In this case the test_name parameter is mandatory.

do_barrier

do_barrier(<barrier_postfix>)

Used to syncronize the wicked tests for SUT and REF creating the corresponding mutex locks.

setup_vlan

setup_vlan($ip_type)

Creating VLAN using only ip commands. Getting ip alias name for wickedbase::get_ip function

sync_start_of

sync_start_of($service, $mutex, [,$timeout])

Start $service within defined $timeout ( default is 60). After succesfully service start will create mutex with $mutex which can be used by parallel test to catch this event

write_cfg

write_cfg($filename, $content[, env => {}, encode_base64 => 0 ]);

Write all data at once to the file. Replace all ocurance of {{name}}. First lookup is the given c<$env> hash and if it doesn't exists it try to lookup a member function with the given c<name> and replace the string with return value