Adding support for svi enabled at network attachment level (supported on >= 4.1#700
Adding support for svi enabled at network attachment level (supported on >= 4.1#700juarocha wants to merge 8 commits into
Conversation
|
Hi @juarocha — you're right that there's no existing version knob for ND 4.1 specifically. The repo has two patterns for version gating; the one that fits
nd_version = get_nd_version(self._action_module, self._task_vars, self._tmp)
if nd_version >= 12.4:
svi_enabled = bool(attach.pop("svi_enabled", True))
inst_values = {"sviEnabled": "true" if svi_enabled else "false"}
attach.update({"instanceValues": json.dumps(inst_values)})
else:
attach.update({"instanceValues": ""})The alternative is to add an |
|
The get_nd_version function is for action plugins, but i found a version var (self.dcnm_version) on the module and I used for the same knob logic |
High: Preserve disabled SVI state when
|
High: Complete the omission fix by sanitizing pre-12.4 attachment payloadsIssue The first posted finding covers omission on a controller that supports
Instead, the code removes and translates the key only inside the 12.4+ branch. The pre-12.4 branch sets
For example, this playbook never requests the new option: state: merged
config:
- net_name: Network-1
attach:
- ip_address: 10.1.1.10
ports:
- Ethernet1/1Validation currently injects {
"serialNumber": "ABC123",
"switchPorts": "Ethernet1/1",
"svi_enabled": true,
"instanceValues": ""
}Resolving the first finding only for merged-state preservation does not remove this payload leak. Removing the automatic default would protect omitted values, but an explicitly supplied value would still leak on pre-12.4. This finding is fully resolved only if the implementation also removes the raw key from every outgoing payload and version-gates explicit use. Evidence
Existing PR overlap
Impact Because validation adds the default even when the user omits the option, existing playbooks can acquire an unknown REST member without opting into this feature. Any new or changed attachment sent under An explicitly supplied Suggested fix Handle explicitness and sanitization together:
|
Medium: Include
|
|
Juan, I just realized that there are significant conflicts between your 3 PRs. It’s going to be easier if you can combine these 3 PRs into a single PR to sort out the conflicts. Following is a detailed plan to move the diffs into a single PR and coordinate the changes so we don’t lose functionality. High: Coordinate the attachment-property integrations across PRs #687, #689, and #700Issue PRs #687, #689, and #700 each merge cleanly into These conflicts are substantive. Resolving them with a simple ours/theirs choice—or by only removing conflict markers—can silently discard one feature, leak an Ansible-only key into the NDFC REST request, reset another property during readback, or prevent property-only changes from triggering an update. The coordinated implementation needs to support all three mappings simultaneously:
Required integration work
Required combined test Add at least one attachment that manages all three properties together: attach:
- ip_address: 10.1.1.10
ports:
- Ethernet1/13
- Ethernet1/14
vlan_id: 301
freeform_config: |
interface Vlan301
description Updated
svi_enabled: falseThe resulting REST attachment should contain the equivalent of: {
"vlan": 301,
"freeformConfig": "interface Vlan301\n description Updated",
"instanceValues": "{\"sviEnabled\":\"false\"}"
}The combined tests should verify:
This coordinated coverage is needed before the three branches can be considered safe to integrate into the same |
Fixes #690
Note:
This feature is only supported on ND v4.1 newer.
I didn't see any version knob on the repo for this type of features