gating: remove networkd tests

Also add gating yaml file

Signed-off-by: Hangbin Liu <haliu@redhat.com>
This commit is contained in:
Hangbin Liu 2024-07-30 13:57:53 +08:00
parent fd8a9dfdd1
commit 941a83af52
3 changed files with 12 additions and 73 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,6 +1,6 @@
Name: lldpd Name: lldpd
Version: 1.0.18 Version: 1.0.18
Release: 2%{?dist} Release: 3%{?dist}
Summary: ISC-licensed implementation of LLDP Summary: ISC-licensed implementation of LLDP
License: ISC License: ISC
@ -114,6 +114,9 @@ exit 0
%changelog %changelog
* Tue Jul 30 2024 Hangbin Liu <haliu@redhat.com> - 1.0.18-3
- Remove networkd tests from gating test
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.0.18-2 * Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.0.18-2
- Bump release for June 2024 mass rebuild - Bump release for June 2024 mass rebuild

View File

@ -91,14 +91,6 @@ WantedBy=multi-user.target
unit.write(contents) unit.write(contents)
self.addCleanup(os.remove, unit_path) self.addCleanup(os.remove, unit_path)
def WriteNetworkFile(self, unit_name, contents):
"""Write a networkd unit file, and queue it to be removed."""
unit_path = os.path.join(NETWORK_UNITDIR, unit_name)
with open(unit_path, 'w') as unit:
unit.write(contents)
self.addCleanup(os.remove, unit_path)
def FindProtocolFieldsinTCPDump(self, **kwargs): def FindProtocolFieldsinTCPDump(self, **kwargs):
"""Look attributes in lldpd logs.""" """Look attributes in lldpd logs."""
@ -107,70 +99,6 @@ WantedBy=multi-user.target
for key in kwargs: for key in kwargs:
self.assertRegex(contents, kwargs[key]) self.assertRegex(contents, kwargs[key])
class lldpdTestsViaNetworkd(unittest.TestCase, lldpdUtilities):
def setUp(self):
""" Setup veth interface """
self.WriteNetworkFile('lldpd-veth.netdev', '''\
[NetDev]
Name=lldpd
Kind=veth
MACAddress=12:34:56:78:9a:bc
[Peer]
Name=lldpd-peer
MACAddress=12:34:56:78:9a:bd
''')
""" Receive LLDP packets via networkd """
self.WriteNetworkFile('lldp.network', '''\
[Match]
Name=lldpd
[Network]
DHCP=no
IPv6AcceptRA=false
LLDP=yes
EmitLLDP=yes
''')
""" Receive LLDP packets via networkd """
self.WriteNetworkFile('lldp-peer.network', '''\
[Match]
Name=lldpd-peer
''')
subprocess.check_output(['systemctl', 'restart', 'systemd-networkd'])
time.sleep(5)
def tearDown(self):
self.Stoplldpd()
subprocess.check_output(['ip', 'link', 'del', 'lldpd'])
def test_lldpd_received_lldp_packets_sent_by_systemd_networkd(self):
self.Startlldpd()
time.sleep(10)
''' Test whether lldpd receved LLDP packets from networkd '''
output=subprocess.check_output(['lldpctl']).rstrip().decode('utf-8')
self.assertRegex(output, "ifname lldpd")
self.assertRegex(output, socket.gethostname())
def test_systemd_networkd_received_lldp_packets(self):
self.Startlldpd()
time.sleep(10)
# lldpd 02:01:02:03:04:09 [hostname] 02:01:02:03:04:09 lldpd-peer
output=subprocess.check_output(['networkctl', 'lldp', '--no-legend', '--no-pager']).rstrip().decode('utf-8')
self.assertRegex(output, "lldpd")
self.assertRegex(output, "lldpd-peer")
self.assertRegex(output, "12:34:56:78:9a:bd")
self.assertRegex(output, socket.gethostname())
# Port ID and Chasiss id count should be 2
self.assertEqual(2, output.count("12:34:56:78:9a:bd"))
class lldpdTests(unittest.TestCase, lldpdUtilities): class lldpdTests(unittest.TestCase, lldpdUtilities):
def setUp(self): def setUp(self):
@ -185,6 +113,7 @@ class lldpdTests(unittest.TestCase, lldpdUtilities):
""" verify at the other end of veth received LLDP packets that contains attibutes (link address, hostname, TTL, system desc). tcpdump """ """ verify at the other end of veth received LLDP packets that contains attibutes (link address, hostname, TTL, system desc). tcpdump """
self.StartCaptureLLDPPackets() self.StartCaptureLLDPPackets()
time.sleep(5)
self.Startlldpd() self.Startlldpd()
""" capture for 10 seconds """ """ capture for 10 seconds """
@ -204,6 +133,7 @@ class lldpdTests(unittest.TestCase, lldpdUtilities):
""" verify at the other end of veth ifname lldpd has received LLDP packets. tcpdump """ """ verify at the other end of veth ifname lldpd has received LLDP packets. tcpdump """
self.StartCaptureLLDPPackets() self.StartCaptureLLDPPackets()
time.sleep(5)
self.Startlldpd() self.Startlldpd()
""" capture for 10 seconds """ """ capture for 10 seconds """