CI: Add FOU to test.
Sample run ``` :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Test :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 21:17:51 ] :: [ LOG ] :: ip fou tests :: [ 21:17:51 ] :: [ LOG ] :: ip fou tests :: [ 21:17:51 ] :: [ BEGIN ] :: Running '/usr/bin/python3 /usr/bin/ip-fou-tests.py' test_configure_fou_receive_port_gre (__main__.IPFOUTests) Configure a FOU receive port for GRE bound to 7777 ... port 7777 ipproto 47 ok test_configure_fou_receive_port_gue (__main__.IPFOUTests) Configure a GUE receive port bound to 9999 ... port 9999 gue ok test_configure_fou_receive_port_ipip (__main__.IPFOUTests) Configure a FOU receive port for IPIP bound to 8888 ... port 8888 ipproto 4 ok test_configure_fou_with_ipip (__main__.IPFOUTests) IP over UDP tunnel ... port 9000 ipproto 4 ok ---------------------------------------------------------------------- Ran 4 tests in 0.048s OK ```
This commit is contained in:
parent
fd68e09fe1
commit
d4c9cc3ea7
47
tests/ip-fou-sanity-test/Makefile
Normal file
47
tests/ip-fou-sanity-test/Makefile
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~
|
||||||
|
# runtest.sh of /CoreOS/iproute/Sanity/ip-fou-sanity-test
|
||||||
|
# Description: Test basic ip fou funcionality
|
||||||
|
#
|
||||||
|
# Author: Susant Sahani <susant@redhat.com>
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
#~~~
|
||||||
|
|
||||||
|
export TEST=/CoreOS/iproute/Sanity/ip-address-sanity-test
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
|
||||||
|
BUILT_FILES=
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
test -x runtest.sh || chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Susant Sahani <susant@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Test basic ip fou funcionality" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 15m" >> $(METADATA)
|
||||||
|
@echo "RunFor: iproute" >> $(METADATA)
|
||||||
|
@echo "Requires: iproute" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/ip-fou-sanity-test/PURPOSE
Normal file
3
tests/ip-fou-sanity-test/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE of /CoreOS/iproute/Sanity/ip-fou-sanity-test
|
||||||
|
Description: Test basic ip fou funcionality
|
||||||
|
Author: Susant Sahani <susant@redhat.com>
|
74
tests/ip-fou-sanity-test/ip-fou-tests.py
Executable file
74
tests/ip-fou-sanity-test/ip-fou-tests.py
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~
|
||||||
|
# runtest.sh of /CoreOS/iproute/Sanity/ip-fou-sanity-test
|
||||||
|
# Description: Test basic ip fou funcionality
|
||||||
|
#
|
||||||
|
# Author: Susant Sahani <susant@redhat.com>
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
# ~~~
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import unittest
|
||||||
|
import subprocess
|
||||||
|
import signal
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
def setUpModule():
|
||||||
|
|
||||||
|
if shutil.which('ip') is None:
|
||||||
|
raise OSError(errno.ENOENT, 'ip not found')
|
||||||
|
|
||||||
|
class IPFOUTests(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_configure_fou_receive_port_gre(self):
|
||||||
|
''' Configure a FOU receive port for GRE bound to 7777'''
|
||||||
|
|
||||||
|
subprocess.call(" ip fou add port 7777 ipproto 47", shell=True)
|
||||||
|
output=subprocess.check_output(['ip', 'fou', 'show']).rstrip().decode('utf-8')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, "port 7777 ipproto 47")
|
||||||
|
|
||||||
|
subprocess.call("ip fou del port 7777", shell=True)
|
||||||
|
|
||||||
|
def test_configure_fou_receive_port_ipip(self):
|
||||||
|
''' Configure a FOU receive port for IPIP bound to 8888'''
|
||||||
|
|
||||||
|
subprocess.call("ip fou add port 8888 ipproto 4", shell=True)
|
||||||
|
output=subprocess.check_output(['ip', 'fou', 'show']).rstrip().decode('utf-8')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, "port 8888 ipproto 4")
|
||||||
|
|
||||||
|
subprocess.call("ip fou del port 8888", shell=True)
|
||||||
|
|
||||||
|
def test_configure_fou_receive_port_gue(self):
|
||||||
|
''' Configure a GUE receive port bound to 9999 '''
|
||||||
|
|
||||||
|
subprocess.call("ip fou add port 9999 gue", shell=True)
|
||||||
|
output=subprocess.check_output(['ip', 'fou', 'show']).rstrip().decode('utf-8')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, "port 9999 gue")
|
||||||
|
|
||||||
|
subprocess.call("ip fou del port 9999", shell=True)
|
||||||
|
|
||||||
|
def test_configure_fou_with_ipip(self):
|
||||||
|
''' IP over UDP tunnel '''
|
||||||
|
|
||||||
|
subprocess.call("ip fou add port 9000 ipproto 4", shell=True)
|
||||||
|
output=subprocess.check_output(['ip', 'fou', 'show']).rstrip().decode('utf-8')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, "port 9000 ipproto 4")
|
||||||
|
|
||||||
|
subprocess.call("ip link add name tunudp type ipip remote 192.168.2.2 local 192.168.2.1 ttl 225 encap fou encap-sport auto encap-dport 9000", shell=True)
|
||||||
|
output=subprocess.check_output(['ip', '-d', 'link', 'show', 'tunudp']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, "encap fou")
|
||||||
|
|
||||||
|
subprocess.call("ip link del tunudp", shell=True)
|
||||||
|
subprocess.call("ip fou del port 9000", shell=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout,
|
||||||
|
verbosity=2))
|
35
tests/ip-fou-sanity-test/runtest.sh
Executable file
35
tests/ip-fou-sanity-test/runtest.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~
|
||||||
|
# runtest.sh of /CoreOS/iproute/Sanity/ip-fou-sanity-test
|
||||||
|
# Description: Test basic ip address label funcionality
|
||||||
|
#
|
||||||
|
# Author: Susant Sahani <susant@redhat.com>
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
#~~~
|
||||||
|
|
||||||
|
# Include Beaker environment
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
PACKAGE="iproute"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlAssertRpm $PACKAGE
|
||||||
|
rlRun "modprobe fou"
|
||||||
|
rlRun "cp ip-fou-tests.py /usr/bin"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest
|
||||||
|
rlLog "ip fou tests"
|
||||||
|
rlRun "/usr/bin/python3 /usr/bin/ip-fou-tests.py"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "rm /usr/bin/ip-fou-tests.py"
|
||||||
|
rlLog "ip fou tests done"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
||||||
|
|
||||||
|
rlGetTestState
|
@ -13,6 +13,7 @@
|
|||||||
- ip-link-sanity-test
|
- ip-link-sanity-test
|
||||||
- ip-address-sanity-test
|
- ip-address-sanity-test
|
||||||
- ip-address-label-sanity-test
|
- ip-address-label-sanity-test
|
||||||
|
- ip-fou-sanity-test
|
||||||
required_packages:
|
required_packages:
|
||||||
- iproute
|
- iproute
|
||||||
- bridge-utils
|
- bridge-utils
|
||||||
|
Loading…
Reference in New Issue
Block a user