Skip to content

Commit 7890ccc

Browse files
allenrobelCopilot
andauthored
FabricSummary (v2): address tech debt (#564)
* Address FabricSummary (v2) tech debt 1. Unit tests for FabricSummary (v2) - This class did not have unit tests, added unit tests and fixtures - Updated dcnm_fabric/utils.py with FabricSummary (v2) support 2. FabricSummary (v2) - Added type hints throughout - Updated docstrings to use Markdown throughout - Made several public instances private (e.g. self.conversion -> self._conversion) - Updated rest_send and results properties with enhanced versions we use in other classes * Appease linters No functional changes in this commit * Use private attributes instead of property getters when calculating device count. Use private attributes instead of property getters when calculating device count. The current code calls property getters (self.leaf_count, self.spine_count, self.border_gateway_count) which invoke verify_refresh_has_been_called(), adding unnecessary overhead. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * FabricSummary (v2): Explain why lines are commented No functional changes in this commit. Addressing a Copilot comment regarding commented lines in fabric_summary_v2.py * Remove redundant empty data check in all_data property. Address below Copilot review comment. [nitpick] Remove redundant empty data check in all_data property. After a successful call to refresh(), self.data cannot be empty ({}) because _verify_controller_response() at line 212 would have raised a ControllerResponseError. The verify_refresh_has_been_called() call at line 318 already ensures refresh() completed successfully. This additional check is unnecessary and inconsistent with other properties like border_gateway_count, device_count, etc. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove rest_send getter validation Addressing the below Copilot review comment. [nitpick] The rest_send property getter validation prevents accessing the property before calling the setter, which is overly restrictive. Internal methods like _set_fabric_summary_endpoint() (line 176) use self.rest_send.path, which would fail this check. While refresh() validates params at line 245 before calling _set_fabric_summary_endpoint(), this getter-level validation adds unnecessary coupling and prevents legitimate use cases like inspecting the rest_send object. Consider removing lines 457-460 from the getter, as the setter and refresh() method already provide adequate validation. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e3f261e commit 7890ccc

File tree

4 files changed

+1469
-130
lines changed

4 files changed

+1469
-130
lines changed

0 commit comments

Comments
 (0)