Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 1cb7b84

Browse files
committed
T7175: VPP add sFlow smoketest
1 parent db307de commit 1cb7b84

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

smoketest/scripts/cli/test_vpp.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,30 @@ def test_17_vpp_nat(self):
13931393
_, out = rc_cmd('sudo vppctl show nat44 summary')
13941394
self.assertIn(f'max translations per thread: {sess_limit} fib 0', out)
13951395

1396+
def test_18_vpp_sflow(self):
1397+
base_sflow = ['system', 'sflow']
1398+
1399+
self.cli_set(base_path + ['sflow', 'interface', interface])
1400+
self.cli_set(base_sflow + ['interface', interface])
1401+
self.cli_set(base_sflow + ['server', '127.0.0.1'])
1402+
self.cli_set(base_sflow + ['vpp'])
1403+
self.cli_commit()
1404+
1405+
# Check sFlow
1406+
_, out = rc_cmd('sudo vppctl show sflow')
1407+
1408+
expected_entries = (
1409+
'sflow sampling-direction ingress',
1410+
f'sflow enable {interface}',
1411+
'interfaces enabled: 1',
1412+
)
1413+
1414+
for expected_entry in expected_entries:
1415+
self.assertIn(expected_entry, out)
1416+
1417+
self.cli_delete(base_sflow)
1418+
self.cli_commit()
1419+
13961420

13971421
if __name__ == '__main__':
13981422
unittest.main(verbosity=2)

src/conf_mode/vpp_sflow.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def verify(config):
9191
# Verify that all interfaces specified exist in VPP
9292
for interface in config['interface']:
9393
if interface not in config['vpp_ifaces']:
94-
raise ConfigError(f'{interface} must be a VPP interface for sFlow monitoring')
94+
raise ConfigError(
95+
f'{interface} must be a VPP interface for sFlow monitoring'
96+
)
9597

9698
# Verify sample rate is a positive integer
9799
if 'sample_rate' in config:
@@ -104,7 +106,9 @@ def verify(config):
104106

105107
# Verify that system sflow has enable-vpp defined
106108
if 'system_sflow' not in config or 'vpp' not in config.get('system_sflow', {}):
107-
raise ConfigError('sFlow enable-vpp must be defined under system sflow configuration')
109+
raise ConfigError(
110+
'sFlow enable-vpp must be defined under system sflow configuration'
111+
)
108112

109113

110114
def generate(config):

0 commit comments

Comments
 (0)