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

refactor: Remove dependency on netaddr #261

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

gmuloc
Copy link
Collaborator

@gmuloc gmuloc commented Jul 10, 2023

Fixes #253

  • Remove netaddr dependency in favor of builtin ipaddress
  • Refactor tests for inventory model
  • Add error catching
  • Factorise the function using DEBUG for Exceptions
  • Fix typing for **kwargs to match with mypy recommendations

@@ -42,6 +41,81 @@ def __str__(self) -> str:
devs[dev_type] += 1
return f"ANTA Inventory contains {' '.join([f'{n} devices ({t})' for t, n in devs.items()])}"

@staticmethod
def __parse_hosts(inventory_input: AntaInventoryInput, inventory: AntaInventory, **kwargs: Any) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is mangling necessary ?
Maybe _parse_hosts() is enough.

inventory.add_device(device)

@staticmethod
def __parse_networks(inventory_input: AntaInventoryInput, inventory: AntaInventory, **kwargs: Any) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mangling ?

raise InventoryIncorrectSchema(message) from e

@staticmethod
def __parse_ranges(inventory_input: AntaInventoryInput, inventory: AntaInventory, **kwargs: Any) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mangling ?

@mtache
Copy link
Collaborator

mtache commented Jul 11, 2023

Works on my machine.

@mtache mtache merged commit d4c4053 into aristanetworks:master Jul 11, 2023
15 checks passed
titom73 pushed a commit that referenced this pull request Jul 24, 2023
* Refactor: Remove dependency on netaddr

* Refactor: Unmangling
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.

Remove netaddr requirement and use ipaddress standard library
2 participants