Skip to content

fix: Add require_installed decorator to FreeBsdIP methods for interfa…#41

Merged
abaczek merged 1 commit intomainfrom
del_all_ips
Mar 5, 2026
Merged

fix: Add require_installed decorator to FreeBsdIP methods for interfa…#41
abaczek merged 1 commit intomainfrom
del_all_ips

Conversation

@adrianlasota
Copy link
Copy Markdown
Contributor

This pull request introduces a new decorator to ensure that IP-related operations on FreeBSD network interfaces are only performed when the interface is installed. The decorator is applied to several methods in the FreeBsdIP class, and corresponding unit tests are added to verify this behavior.

Decorator for interface installation state:

  • Added a require_installed decorator in freebsd.py to check if the network interface is installed before executing key IP management methods. If the interface is not installed, an IPFeatureException is raised.
  • Applied the @require_installed decorator to the following methods in FreeBsdIP: get_ips, add_ip, del_ip, enable_dynamic_ip, set_ipv6_autoconf, has_tentative_address, wait_till_tentative_exit, and get_ipv6_autoconf, ensuring these operations cannot proceed on uninstalled interfaces. [1] [2] [3] [4] [5] [6] [7] [8]

Testing:

  • Added a unit test (test_installed_wrapper) to verify that attempting to add an IP address to an uninstalled interface raises the expected IPFeatureException.

Copilot AI review requested due to automatic review settings January 23, 2026 12:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds validation to ensure that IP-related operations on FreeBSD network interfaces can only be performed when the interface is installed. A new decorator enforces this check across multiple methods, preventing operations on uninstalled interfaces.

Changes:

  • Introduced a require_installed decorator that validates interface installation status before executing IP management methods
  • Applied the decorator to eight methods in the FreeBsdIP class: get_ips, add_ip, del_ip, enable_dynamic_ip, set_ipv6_autoconf, has_tentative_address, wait_till_tentative_exit, and get_ipv6_autoconf
  • Added unit test to verify the decorator raises IPFeatureException when attempting operations on uninstalled interfaces

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
mfd_network_adapter/network_interface/feature/ip/freebsd.py Implements the require_installed decorator and applies it to IP management methods to enforce installation status checks
tests/unit/test_mfd_network_adapter/test_network_interface/test_feature/test_ip/test_ip_freebsd.py Adds test case to verify the decorator correctly prevents IP operations on uninstalled interfaces

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mfd_network_adapter/network_interface/feature/ip/freebsd.py Outdated
@mfd-intel-bot
Copy link
Copy Markdown
Contributor

We don't publish DEVs .whl.
To build .whl, run 'pip install git+https://intel/mfd-network-adapter@del_all_ips'

@adrianlasota adrianlasota force-pushed the del_all_ips branch 3 times, most recently from 49db71e to 24c5272 Compare January 23, 2026 12:57
abaczek
abaczek previously approved these changes Jan 30, 2026
mchromin
mchromin previously approved these changes Jan 30, 2026
@adrianlasota adrianlasota dismissed stale reviews from mchromin and abaczek via e247337 January 30, 2026 11:55
@adrianlasota adrianlasota force-pushed the del_all_ips branch 2 times, most recently from e247337 to 798b30b Compare January 30, 2026 11:57
…ce validation

Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
@abaczek abaczek merged commit b5cc78f into main Mar 5, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants