diff options
| -rw-r--r-- | python/vyos/configdep.py | 6 | ||||
| -rwxr-xr-x | smoketest/scripts/cli/test_vpp.py | 31 | ||||
| -rwxr-xr-x | src/services/vyos-commitd | 2 | ||||
| -rwxr-xr-x | src/services/vyos-configd | 2 |
4 files changed, 29 insertions, 12 deletions
diff --git a/python/vyos/configdep.py b/python/vyos/configdep.py index 80dbcf873..f0b52afea 100644 --- a/python/vyos/configdep.py +++ b/python/vyos/configdep.py @@ -257,6 +257,12 @@ def set_dependents_initial( ) +def clear_dependents_initial(): + """Drop initial dependents left over from a failed commit, so the next + commit does not run them.""" + dependency_list_initial.clear() + + def call_dependents_initial(): # pylint: disable=global-statement global dependency_list_initial diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index e4f04a4e4..e6b4362fa 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -112,6 +112,8 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): # drop any pre-existing custom MAC so the MAC test baseline is the # interface hardware address (hw-id) cls.cli_delete(cls, ['interfaces', 'ethernet', interface, 'mac']) + # drop any pre-existing MTU so tests start from the default MTU + cls.cli_delete(cls, ['interfaces', 'ethernet', interface, 'mtu']) def setUp(self): # always forward to base class @@ -130,9 +132,10 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.cli_delete(interfaces_path) self.cli_commit() - # delete address and any custom MAC for the Ethernet interface + # delete address and any custom MAC and MTU for the Ethernet interface self.cli_delete(['interfaces', 'ethernet', interface, 'address']) self.cli_delete(['interfaces', 'ethernet', interface, 'mac']) + self.cli_delete(['interfaces', 'ethernet', interface, 'mtu']) self.cli_commit() self.assertFalse(os.path.exists(VPP_CONF)) @@ -142,7 +145,8 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): def test_01_vpp_basic(self): poll_sleep = '0' - mtu = '2500' + # below 1500 so it fits any NIC limit (CI NICs are capped at 1500) + mtu = '1450' isolated_cores = get_isolated_cpus() self.cli_set(base_path + ['settings', 'poll-sleep-usec', poll_sleep]) @@ -639,7 +643,7 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): # MTU must be set on VLAN sub-interfaces and taps (vif inherits parent # unless set). - mtu = '2500' + mtu = '1450' vif_mtu = '1400' self.cli_set(bond_path + [interface_bond, 'mtu', mtu]) self.cli_set(bond_path + [interface_bond, 'vif', vlans[1], 'mtu', vif_mtu]) @@ -1971,7 +1975,10 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): # 'no-multi-seg' is auto-computed (T9146): enabled while the largest # VPP-interface MTU fits the buffer data-size, dropped otherwise (VPP # falls back to multi-seg so Jumbo frames still work) - mtu = '2500' + # MTUs stay at or below 1500 so they fit any NIC limit (CI NICs are + # capped at 1500); the buffer data-size is reduced instead + mtu = '1400' + data_size = '1500' self.cli_commit() @@ -1980,19 +1987,19 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): config = read_file(VPP_CONF) self.assertIn('no-multi-seg', config) - # Raising the MTU beyond the buffer drops it; the interface change - # triggers a VPP reconfigure on its own - self.cli_set(['interfaces', 'ethernet', interface, 'mtu', mtu]) + # Reducing the buffer below the default MTU frame drops it + self.cli_set( + base_path + + ['settings', 'resource-allocation', 'buffers', 'data-size', data_size] + ) self.cli_commit() config = read_file(VPP_CONF) self.assertNotIn('no-multi-seg', config) - # Sizing the buffer to fit the MTU brings it back - self.cli_set( - base_path - + ['settings', 'resource-allocation', 'buffers', 'data-size', '4096'] - ) + # Lowering the MTU so the frame fits the buffer brings it back; the + # interface change triggers a VPP reconfigure on its own + self.cli_set(['interfaces', 'ethernet', interface, 'mtu', mtu]) self.cli_commit() config = read_file(VPP_CONF) diff --git a/src/services/vyos-commitd b/src/services/vyos-commitd index 8a515446b..e231a2d65 100755 --- a/src/services/vyos-commitd +++ b/src/services/vyos-commitd @@ -44,6 +44,7 @@ from vyos.configsource import ConfigSourceCache from vyos.configsource import ConfigSourceError from vyos.configdiff import get_commit_scripts from vyos.config import Config +from vyos.configdep import clear_dependents_initial from vyos.frrender import FRRender from vyos.frrender import frr_render_lock from vyos.frrender import get_frrender_dict @@ -334,6 +335,7 @@ def process_call_data(call: Call, config: Config, last: bool = False) -> None: return config.dependency_list.clear() + clear_dependents_initial() tag_value = call.tag_value if call.tag_value is not None else '' os.environ['VYOS_TAGNODE_VALUE'] = tag_value diff --git a/src/services/vyos-configd b/src/services/vyos-configd index 8e0b1adec..5e626a229 100755 --- a/src/services/vyos-configd +++ b/src/services/vyos-configd @@ -38,6 +38,7 @@ from vyos.configsource import ConfigSourceString from vyos.configsource import ConfigSourceError from vyos.configdiff import get_commit_scripts from vyos.config import Config +from vyos.configdep import clear_dependents_initial from vyos.frrender import FRRender from vyos.frrender import frr_render_lock from vyos.frrender import get_frrender_dict @@ -204,6 +205,7 @@ def process_node_data(config_manager: ConfigManager, data) -> tuple[Response, st os.environ['VYOS_TAGNODE_VALUE'] = '' args = [] config.dependency_list.clear() + clear_dependents_initial() res = re.match(r'^(VYOS_TAGNODE_VALUE=[^/]+)?.*\/([^/]+).py(.*)', data) if res.group(1): |
