Add tests according to the CI
justification
Adds tests according to the CI wiki specifically the standard test interface in the spec.
The playbook includes Tier1 level test cases that have been tested in the following contexts and
is passing reliably: Classic. Test logs are stored in the artifacts directory.
The following steps are used to execute the tests using the standard test interface:
Test enveronment
Make sure you have installed packages from the spec
```
ansible-2.4.1.0-2.fc28.noarch
python2-dnf-2.7.5-1.fc28.noarch
libselinux-python-2.7-2.fc28.x86_64
standard-test-roles-2.5-1.fc28.noarch
Run tests for Classic
Snip of the example test run for Classic tests:
```
```
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
lldpad-1.0.1-9.git036e314.fc28.x86_64
:: [ 09:17:11 ] :: [ PASS ] :: Checking for the presence of lldpad rpm
:: [ 09:17:11 ] :: [ LOG ] :: Package versions:
:: [ 09:17:11 ] :: [ LOG ] :: lldpad-1.0.1-9.git036e314.fc28.x86_64
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'systemctl stop firewalld'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'systemctl stop firewalld' (Expected 0,5, got 0)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'setenforce 0'
setenforce: SELinux is disabled
:: [ 09:17:11 ] :: [ PASS ] :: Command 'setenforce 0' (Expected 0,1, got 1)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'mkdir -p /run/systemd/network'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'mkdir -p /run/systemd/network' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'cp lldp.network /run/systemd/network/'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp lldp.network /run/systemd/network/' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'cp tcpdumpd.service /run/systemd/system'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp tcpdumpd.service /run/systemd/system' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'systemctl daemon-reload'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ BEGIN ] :: Running 'cp lldpad-test.py /usr/bin/'
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp lldpad-test.py /usr/bin/' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 0s
:: Assertions: 8 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:17:11 ] :: [ LOG ] :: lldpad tests
:: [ 09:17:11 ] :: [ BEGIN ] :: Running '/usr/bin/python3 /usr/bin/lldpad-test.py'
test_lldpad_configured (__main__.lldpadTests)
Verify lldpad-peer interface configured ... ok
test_lldpad_trasmitted_packets (__main__.lldpadTests)
verify at the other end of veth(lldpad) lldpad has trasmitted packets. Extract from tcpdump ... reading from file /tmp/lldpad-tcp-dump.pcap, link-type EN10MB (Ethernet)
ok
test_lldptool_get_tlv (__main__.lldpadTests)
Verify lldpad got the packet transmitted from lldpad-peer interface ... ok
test_management_address (__main__.lldpadTests)
Test Get/Set a Management Address ... ok
test_systemd_networkd_lldp (__main__.lldpadTestsViaNetworkd)
Receive LLDP packets via networkd ... ok
----------------------------------------------------------------------
Ran 5 tests in 99.310s
OK
:: [ 09:18:50 ] :: [ PASS ] :: Command '/usr/bin/python3 /usr/bin/lldpad-test.py' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 99s
:: Assertions: 1 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:18:51 ] :: [ BEGIN ] :: Running 'rm /usr/bin/lldpad-test.py /run/systemd/network/lldp.network /run/systemd/system/tcpdumpd.service'
:: [ 09:18:51 ] :: [ PASS ] :: Command 'rm /usr/bin/lldpad-test.py /run/systemd/network/lldp.network /run/systemd/system/tcpdumpd.service' (Expected 0, got 0)
:: [ 09:18:51 ] :: [ BEGIN ] :: Running 'systemctl daemon-reload'
:: [ 09:18:51 ] :: [ PASS ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [ 09:18:51 ] :: [ BEGIN ] :: Running 'setenforce 1'
setenforce: SELinux is disabled
:: [ 09:18:51 ] :: [ PASS ] :: Command 'setenforce 1' (Expected 0,1, got 1)
:: [ 09:18:51 ] :: [ LOG ] :: lldpad tests done
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 0s
:: Assertions: 3 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: TEST PROTOCOL
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Package : lldpad
Installed : lldpad-1.0.1-9.git036e314.fc28.x86_64
beakerlib RPM : beakerlib-1.17-13.fc28.noarch
Test started : 2018-06-10 09:17:10 IST
Test finished : 2018-06-10 09:18:51 IST (still running)
Test duration : 101 seconds
Test name : unknown
Distro : Fedora release 28 (Twenty Eight)
Hostname : Zeus
Architecture : x86_64
CPUs : 8 x Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
RAM size : 15731 MB
HDD size : 226.83 GB
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:17:11 ] :: [ PASS ] :: Checking for the presence of lldpad rpm
:: [ 09:17:11 ] :: [ LOG ] :: Package versions:
:: [ 09:17:11 ] :: [ LOG ] :: lldpad-1.0.1-9.git036e314.fc28.x86_64
:: [ 09:17:11 ] :: [ PASS ] :: Command 'systemctl stop firewalld' (Expected 0,5, got 0)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'setenforce 0' (Expected 0,1, got 1)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'mkdir -p /run/systemd/network' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp lldp.network /run/systemd/network/' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp tcpdumpd.service /run/systemd/system' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [ 09:17:11 ] :: [ PASS ] :: Command 'cp lldpad-test.py /usr/bin/' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 0s
:: Assertions: 8 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:17:11 ] :: [ LOG ] :: lldpad tests
:: [ 09:18:50 ] :: [ PASS ] :: Command '/usr/bin/python3 /usr/bin/lldpad-test.py' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 99s
:: Assertions: 1 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:18:51 ] :: [ PASS ] :: Command 'rm /usr/bin/lldpad-test.py /run/systemd/network/lldp.network /run/systemd/system/tcpdumpd.service' (Expected 0, got 0)
:: [ 09:18:51 ] :: [ PASS ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [ 09:18:51 ] :: [ PASS ] :: Command 'setenforce 1' (Expected 0,1, got 1)
:: [ 09:18:51 ] :: [ LOG ] :: lldpad tests done
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 0s
:: Assertions: 3 good, 0 bad
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: unknown
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 09:18:51 ] :: [ LOG ] :: JOURNAL XML: /var/tmp/beakerlib-RRyct40/journal.xml
:: [ 09:18:51 ] :: [ LOG ] :: JOURNAL TXT: /var/tmp/beakerlib-RRyct40/journal.txt
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 101s
:: Phases: 3 good, 0 bad
:: OVERALL RESULT: PASS
```