No WWN field when creating new interface, only available after creation in edit form. #5734

Closed
opened 2025-12-29 19:32:02 +01:00 by adam · 9 comments
Owner

Originally created by @ziggekatten on GitHub (Dec 7, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.0

Python version

3.9

Steps to Reproduce

  1. Create a new Device as you normally would do
  2. After saving the device, click "Add Components" and select "Interface"

Expected Behavior

A field for WWN should be present under MAC Adress field

Observed Behavior

WWN Field missing
image

Creating and saving the interface and then editing, the WWN field shows up
image

Originally created by @ziggekatten on GitHub (Dec 7, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.0 ### Python version 3.9 ### Steps to Reproduce 1. Create a new Device as you normally would do 2. After saving the device, click "Add Components" and select "Interface" ### Expected Behavior A field for WWN should be present under MAC Adress field ### Observed Behavior WWN Field missing ![image](https://user-images.githubusercontent.com/55629049/145029506-772ac7b8-5020-43fd-8767-145eaf80fa3e.png) Creating and saving the interface and then editing, the WWN field shows up ![image](https://user-images.githubusercontent.com/55629049/145029101-7d9294d8-50d1-4983-8372-3fa153eba10b.png)
adam added the type: bugstatus: accepted labels 2025-12-29 19:32:02 +01:00
adam closed this issue 2025-12-29 19:32:02 +01:00
Author
Owner

@danwalkeruk commented on GitHub (Dec 7, 2021):

Not sure if this is the reason, but I'm hitting this bug during the upgrade from 3.0.11 to 3.1.0, related?

Excerpt from upgrade.sh:

  Applying ipam.0053_asn_model... OK
  Applying dcim.0134_interface_wwn_bridge...Traceback (most recent call last):
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)
psycopg2.errors.UndefinedObject: type "macaddr8" does not exist
LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL
                                                      ^


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 246, in handle
    fake_initial=fake_initial,
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 106, in database_forwards
    field,
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 522, in add_field
    self.execute(sql, params)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 145, in execute
    cursor.execute(sql, params)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)
django.db.utils.ProgrammingError: type "macaddr8" does not exist
LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL

Edit: I've realised we're still on PostgreSQL 9.x, so I think updating to 10 should fix this, however I'm not sure if this would cause the issue seen above so I'll leave this comment here.

@danwalkeruk commented on GitHub (Dec 7, 2021): Not sure if this is the reason, but I'm hitting this bug during the upgrade from 3.0.11 to 3.1.0, related? Excerpt from upgrade.sh: ``` Applying ipam.0053_asn_model... OK Applying dcim.0134_interface_wwn_bridge...Traceback (most recent call last): File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django_prometheus/db/common.py", line 71, in execute return super().execute(*args, **kwargs) psycopg2.errors.UndefinedObject: type "macaddr8" does not exist LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 246, in handle fake_initial=fake_initial, File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/migration.py", line 126, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 106, in database_forwards field, File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 522, in add_field self.execute(sql, params) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 145, in execute cursor.execute(sql, params) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/opt/netbox-3.1.0/venv/lib/python3.7/site-packages/django_prometheus/db/common.py", line 71, in execute return super().execute(*args, **kwargs) django.db.utils.ProgrammingError: type "macaddr8" does not exist LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL ``` Edit: I've realised we're still on PostgreSQL 9.x, so I think updating to 10 should fix this, however I'm not sure if this would cause the issue seen above so I'll leave this comment here.
Author
Owner

@jeremystretch commented on GitHub (Dec 7, 2021):

@danwalkeruk no, that's not related to this issue.

@jeremystretch commented on GitHub (Dec 7, 2021): @danwalkeruk no, that's not related to this issue.
Author
Owner

@danwalkeruk commented on GitHub (Dec 7, 2021):

@danwalkeruk no, that's not related to this issue.

Wasn't sure it would be! Have just upgraded PostgreSQL and all is well, wasn't sure whether a failed upgrade.sh could have produced that issue.

Side note: Thanks for all your work on NetBox, just upgraded a long overdue install, it's my favourite of our internal tooling by far!

@danwalkeruk commented on GitHub (Dec 7, 2021): > @danwalkeruk no, that's not related to this issue. Wasn't sure it would be! Have just upgraded PostgreSQL and all is well, wasn't sure whether a failed upgrade.sh could have produced that issue. Side note: Thanks for all your work on NetBox, just upgraded a long overdue install, it's my favourite of our internal tooling by far!
Author
Owner

@ruben-herold commented on GitHub (Dec 8, 2021):

hi,

I can confirm the problem with 9.6 after upgrade to 10 the migration runs fine

@ruben-herold commented on GitHub (Dec 8, 2021): hi, I can confirm the problem with 9.6 after upgrade to 10 the migration runs fine
Author
Owner

@diegonuevo commented on GitHub (Dec 29, 2021):

I'm upgrading from v3.0.12 to v3.1.0 and I'm getting the same error as stated above:

Running migrations:
  Applying dcim.0134_interface_wwn_bridge...Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedObject: type "macaddr8" does not exist
LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL
                                                      ^

In my case, I have PostgreSQL 12 installed (specifically 12+214ubuntu0.1, which is the latest version available in the oficial repos of my Ubuntu 20.04 distro), so it should support the macaddr8 type.

I'm not sure if the error is yielded by the PostgreSQL engine or by the psycopg2 python package. Any ideas?

@diegonuevo commented on GitHub (Dec 29, 2021): I'm upgrading from v3.0.12 to v3.1.0 and I'm getting the same error as stated above: ``` Running migrations: Applying dcim.0134_interface_wwn_bridge...Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedObject: type "macaddr8" does not exist LINE 1: ALTER TABLE "dcim_interface" ADD COLUMN "wwn" macaddr8 NULL ^ ``` In my case, I have PostgreSQL 12 installed (specifically 12+214ubuntu0.1, which is the latest version available in the oficial repos of my Ubuntu 20.04 distro), so it should support the macaddr8 type. I'm not sure if the error is yielded by the PostgreSQL engine or by the psycopg2 python package. Any ideas?
Author
Owner

@jeremystretch commented on GitHub (Dec 29, 2021):

@diegonuevo you may have PostgreSQL 12 installed, but it looks like your database is still using an older version. You can execute the command SELECT version(); from a SQL shell to determine the running version.

@jeremystretch commented on GitHub (Dec 29, 2021): @diegonuevo you may have PostgreSQL 12 installed, but it looks like your database is still using an older version. You can execute the command `SELECT version();` from a SQL shell to determine the running version.
Author
Owner

@diegonuevo commented on GitHub (Dec 30, 2021):

You are totally right. Turns out I had three different PostgreSQL instances running as a result of multiple previous upgrades:

postgres:~$ pg_lsclusters 
Ver Cluster Port Status Owner    Data directory               Log file
9.5 main    5432 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log
10  main    5433 online postgres /var/lib/postgresql/10/main  /var/log/postgresql/postgresql-10-main.log
12  main    5434 online postgres /var/lib/postgresql/12/main  /var/log/postgresql/postgresql-12-main.log

I upgraded the database, and the migration completed as expected.

I include here the DB migration procedure I used, just in case it's useful for others facing the same issue:

  1. As root, stop netbox and PostgreSQL services (both source and target versions):
root:/opt/netbox# systemctl stop netbox netbox-rq                
root:/opt/netbox# systemctl stop postgresql
root:/opt/netbox# systemctl stop postgresql@9.5-main.service 
root:/opt/netbox# systemctl stop postgresql@12-main.service 
  1. As postgres user, run the pg_upgrade command:
postgres:~$ /usr/lib/postgresql/12/bin/pg_upgrade \
        --old-bindir=/usr/lib/postgresql/9.5/bin \
        --new-bindir=/usr/lib/postgresql/12/bin \
        --old-datadir=/etc/postgresql/9.5/main \
        --new-datadir=/etc/postgresql/12/main
  1. I then deleted the old cluster versions with pg_dropcluster:
postgres:~$ pg_dropcluster 9.5 main
postgres:~$ pg_dropcluster 10 main
  1. And updated the port in /etc/postgresql/12/main/postgresql.conf to use the default (5432), so I don't have to update the netbox/netbox/configuration.py config, and keep pointing to the default port

Thanks a lot for your help.

Regards

@diegonuevo commented on GitHub (Dec 30, 2021): You are totally right. Turns out I had three different PostgreSQL instances running as a result of multiple previous upgrades: ``` postgres:~$ pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 9.5 main 5432 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log 10 main 5433 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log 12 main 5434 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log ``` I upgraded the database, and the migration completed as expected. I include here the DB migration procedure I used, just in case it's useful for others facing the same issue: 1. As root, stop netbox and PostgreSQL services (both source and target versions): ``` root:/opt/netbox# systemctl stop netbox netbox-rq root:/opt/netbox# systemctl stop postgresql root:/opt/netbox# systemctl stop postgresql@9.5-main.service root:/opt/netbox# systemctl stop postgresql@12-main.service ``` 2. As postgres user, run the `pg_upgrade` command: ``` postgres:~$ /usr/lib/postgresql/12/bin/pg_upgrade \ --old-bindir=/usr/lib/postgresql/9.5/bin \ --new-bindir=/usr/lib/postgresql/12/bin \ --old-datadir=/etc/postgresql/9.5/main \ --new-datadir=/etc/postgresql/12/main ``` 3. I then deleted the old cluster versions with `pg_dropcluster`: ``` postgres:~$ pg_dropcluster 9.5 main postgres:~$ pg_dropcluster 10 main ``` 4. And updated the port in `/etc/postgresql/12/main/postgresql.conf` to use the default (5432), so I don't have to update the `netbox/netbox/configuration.py` config, and keep pointing to the default port Thanks a lot for your help. Regards
Author
Owner

@jeremystretch commented on GitHub (Dec 30, 2021):

Thanks for following up with your fix!

@jeremystretch commented on GitHub (Dec 30, 2021): Thanks for following up with your fix!
Author
Owner

@mrosu-sp commented on GitHub (Jan 11, 2022):

diegonuevo you are awsome. I am not as savvy with this stuff so I had been having this issue for a long time and was hoping it would have been solved in some future release, but that would have never been the case!

Thank you so much for your very thorough resolution steps!

@mrosu-sp commented on GitHub (Jan 11, 2022): diegonuevo you are awsome. I am not as savvy with this stuff so I had been having this issue for a long time and was hoping it would have been solved in some future release, but that would have never been the case! Thank you so much for your very thorough resolution steps!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5734