Skip to content

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Aug 27, 2025

Scope and purpose

Fixes #2160.

Adds new column showing VLAN description to the Ports table in ipdevinfo.

Adds VLAN description to the results of the interface API. This was necessary as the Port table gets its data from that endpoint.

Not too many VLANs seem to have a description, but I found some examples when using a dump from gloshaugen vk. I was unable to find any examples on sikt-vk (there were VLANs in the database with descriptions, but none of them seemed to be related to any of the interfaces)
I would post before/after, but not sure if NTNU would be happy about me posting images of their port stuff?

Draft PR because I'm not entirely sure if the way I get the VLAN description is correct, or what should be done if there are multiple VLANs that match the query. I've experienced getting 8 swportvlan results that map the interface ae10 at sikt-trd-dsw2.c.uninett.no to the Vlan 1:

<QuerySet [<SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (nettel_ztp)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>, <SwPortVlan: ae10 at sikt-trd-dsw2.c.uninett.no, on vlan 1 (default)>]>

7 of these are identical, while one has a different ident than the others (nettel_ztp as opposed to default). When there are 8 different Vlan objects to choose from, which one should I get the description from?

This pull request

  • changes the API

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • This pull request is based on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

Copy link

github-actions bot commented Aug 27, 2025

Test results

   12 files     12 suites   12m 26s ⏱️
2 366 tests 2 366 ✅ 0 💤 0 ❌
6 633 runs  6 633 ✅ 0 💤 0 ❌

Results for commit ab9ce74.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.05%. Comparing base (0279150) to head (ab9ce74).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3473   +/-   ##
=======================================
  Coverage   61.04%   61.05%           
=======================================
  Files         610      610           
  Lines       44708    44715    +7     
  Branches       43       43           
=======================================
+ Hits        27294    27301    +7     
  Misses      17404    17404           
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stveit stveit force-pushed the show-vlan-descr-in-ipdevinfo branch from fe9a66b to 9f6644a Compare August 27, 2025 14:25
@stveit stveit self-assigned this Aug 27, 2025
@stveit stveit force-pushed the show-vlan-descr-in-ipdevinfo branch from 9f6644a to ab9ce74 Compare August 28, 2025 11:13
Copy link

@stveit stveit marked this pull request as ready for review August 28, 2025 11:22
@stveit stveit marked this pull request as draft August 28, 2025 11:22
@stveit stveit changed the title Add vlan description to ipdevinfo ports table Add VLAN description to ipdevinfo ports table Aug 29, 2025
@lunkwill42
Copy link
Member

I would post before/after, but not sure if NTNU would be happy about me posting images of their port stuff?

Good call. Never post customer data online unless you have explicit consent.

@lunkwill42 lunkwill42 self-requested a review August 29, 2025 13:59
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

The issue mentions #1935, which was solved by #1955 - it basically uses str(vlan_object) as "description" - which, in fact, is the netident, not the "description". Netidents are more prevalent.

But it sounds like you need input on what SwportVlan is and how to interpret the data, so let's have a f2f chat about this feature next week...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show VLAN description in the portlist in ipdevinfo
2 participants