netbox-bgp icon indicating copy to clipboard operation
netbox-bgp copied to clipboard

NetBox 4.3 Support

Open cruse1977 opened this issue 6 months ago • 7 comments

Primary Issue for adding NetBox 4.3 support.

cruse1977 avatar May 02 '25 21:05 cruse1977

Finally found the time to test the develop branch. I'm currently getting the following stack trace:

🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Traceback (most recent call last):
  File "/opt/netbox/netbox/./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 457, in execute
    self.check(**check_kwargs)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 492, in check
    all_issues = checks.run_checks(
                 ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 89, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 44, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 63, in _load_all_namespaces
    url_patterns = getattr(resolver, "url_patterns", [])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 718, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 711, in urlconf_module
    return import_module(self.urlconf_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/netbox/netbox/netbox/urls.py", line 9, in <module>
    from netbox.graphql.schema import schema
  File "/opt/netbox/netbox/netbox/graphql/schema.py", line 37, in <module>
    schema = strawberry.Schema(
             ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/sentry_sdk/integrations/strawberry.py", line 125, in _sentry_patched_schema_init
    return old_schema_init(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema.py", line 343, in __init__
    raise error.__cause__ from None
  File "/opt/netbox/venv/lib/python3.12/site-packages/graphql/type/definition.py", line 1472, in fields
    fields = resolve_thunk(self._fields)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/graphql/type/definition.py", line 300, in resolve_thunk
    return thunk() if callable(thunk) else thunk
           ^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 530, in <lambda>
    fields=lambda: self.get_graphql_input_fields(type_definition),
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 487, in get_graphql_input_fields
    return _get_thunk_mapping(
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 145, in _get_thunk_mapping
    thunk_mapping[name_converter(field)] = field_converter(
                                           ^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 452, in from_input_field
    self.from_maybe_optional(
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 858, in from_maybe_optional
    return self.from_type(type_.of_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 886, in from_type
    return self.from_type(type_.resolve_type())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 880, in from_type
    return self.from_enum(enum_definition)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 312, in from_enum
    self.validate_same_type_definition(enum_name, enum, cached_type)
  File "/opt/netbox/venv/lib/python3.12/site-packages/strawberry/schema/schema_converter.py", line 1055, in validate_same_type_definition
    raise DuplicatedTypeName(first_origin, second_origin, name)
strawberry.exceptions.duplicated_type_name.DuplicatedTypeName: Type IPAddressFamilyEnum is defined multiple times in the schema

When disabling the plugin the exception is gone.

kuhball avatar Jun 12 '25 07:06 kuhball

Agreed, interesting this doesn't happen in 4.3.1, only 4.3.2 - looking

cruse1977 avatar Jun 13 '25 21:06 cruse1977

@kuhball - Should be fixed, could you pull the develop branch and re-test ?

cruse1977 avatar Jun 13 '25 21:06 cruse1977

Re-tested and can confirm the fix works. Thanks for the fast reaction 🥇

kuhball avatar Jun 16 '25 06:06 kuhball

Thank you! Can't wait for the release! ;-)

mathieumd avatar Jun 17 '25 08:06 mathieumd

On the README Version 0.16.0 is announced, but it's not released yet. When can we expect a release?

adrianhiller avatar Jun 26 '25 07:06 adrianhiller

Would 4.3.3 be supported soon?

lukasscms avatar Jun 27 '25 10:06 lukasscms

Just tested against 4.3.3 and everything is working fine. Can we please get a release for this? I'm currently installing the plugin from the develop branch, this is far from ideal.

dc exec netbox python /opt/netbox/netbox/manage.py test netbox_bgp.tests --parallel
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Found 205 test(s).
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
System check identified no issues (0 silenced).
.............................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 205 tests in 3.971s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...

SanderDelden avatar Jul 08 '25 05:07 SanderDelden