Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dhcp validation to prevent switch from DHCPServer/DHCPRelay to DHCPDeactivated #996

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

yanjunz97
Copy link
Contributor

According to NSX change that we would not support static IP Allocation modification.
We add rules to only allow the DHCP mode switch between DHCPServer and DHCPRelay.

Testing done:

  • subnetDHCPConfig.mode can switch between DHCPServer and DHCPRelay, but not between DHCPDeactivated and DHCPServer/DHCPRelay
  • those 3 conditions can switch between each other: subnetDHCPConfig.mode=DHCPDeactivated, subnetDHCPConfig.mode=null, subnetDHCPConfig=null
  • In case of subnetDHCPConfig.mode=null or subnetDHCPConfig=null, we cannot set subnetDHCPConfig.mode to DHCPServer or DHCPRelay

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.08%. Comparing base (ccc66e7) to head (729ce25).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #996   +/-   ##
=======================================
  Coverage   74.08%   74.08%           
=======================================
  Files         118      118           
  Lines       16362    16362           
=======================================
  Hits        12122    12122           
  Misses       3466     3466           
  Partials      774      774           
Flag Coverage Δ
unit-tests 74.08% <ø> (ø)
Files with missing lines Coverage Δ
pkg/apis/vpc/v1alpha1/subnet_types.go 100.00% <ø> (ø)
pkg/apis/vpc/v1alpha1/subnetset_types.go 100.00% <ø> (ø)

@yanjunz97 yanjunz97 requested review from dantingl, TaoZou1 and lxiaopei and removed request for TaoZou1 January 9, 2025 07:20
lxiaopei
lxiaopei previously approved these changes Jan 10, 2025
Copy link
Contributor

@lxiaopei lxiaopei left a comment

Choose a reason for hiding this comment

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

LGTM

… DHCPDeactivated

Signed-off-by: Yanjun Zhou <yanjun.zhou@broadcom.com>
@yanjunz97
Copy link
Contributor Author

Removed the e2e test for dhcp switch for now as the current e2e testbed does not apply crd for each run and the current e2e test for switch is not well-designed for the new case.
Will add back the e2e test with better cases after the crd files are applied the e2e testbed.

Copy link
Contributor

@lxiaopei lxiaopei left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@timdengyun timdengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@yanjunz97 yanjunz97 merged commit 245ba08 into vmware-tanzu:main Jan 10, 2025
2 checks passed
yanjunz97 added a commit to yanjunz97/nsx-operator that referenced this pull request Jan 10, 2025
… DHCPDeactivated (vmware-tanzu#996)

Signed-off-by: Yanjun Zhou <yanjun.zhou@broadcom.com>
yanjunz97 added a commit that referenced this pull request Jan 10, 2025
… DHCPDeactivated (#996) (#998)

Signed-off-by: Yanjun Zhou <yanjun.zhou@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants