Skip to content

Conversation

@ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented Dec 13, 2025

Description

Switch out all usages of netconfig for an equivalent usage in sdfconfig if it is used in the switchtool gui.
Also add a --switch-type command-line argument so you can startup the tool without a description field, which is currently dropped in the transition from netconfig to sdfconfig.

Note that the subnet names changed between the two tools:

  • old: cds-xcs.pcdsn
  • new: PCDSN-CDS-XCS

It's possibly I didn't get all of these correct.

In cases where I made major edits to a file, or where I was trying to figure out if I needed to make edits, but couldn't grok it with the lack of type hints, etc., I also took the time to unravel all ruff and pylance warnings for those files.

In cases where I didn't really need to edit a file, but the fix was super obvious and quick, I did so.

Note that there are lingering code branches that I have left broken because they aren't used in the gui. These parts still rely on netconfig. I disabled some of these functions to check if the gui was using them. If someone wants they could fix those parts later.

Motivation and Context

Netconfig is going away and switchtool uses it a lot.

How Has This Been Tested?

Interactively only- seems OK, needs more testing probably.

Where Has This Been Documented?

Here and in jira only

Pre-merge checklist

  • Code works interactively
  • Code follows the style guide
  • Code contains descriptive docstrings, including context and API
  • New/changed functions and methods are covered in the test suite where possible
  • Test suite passes locally
  • Test suite passes on GitHub Actions
  • Ran docs/pre-release-notes.sh and created a pre-release documentation page
  • Pre-release docs include context, functional descriptions, and contributors as appropriate

@ZLLentz ZLLentz requested a review from a team as a code owner December 13, 2025 01:52
Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

I think the changes here look reasonable. Left some comments/food for thought.

There's certainly more to do to make this more maintainable, particularly removing vestigial code and more thoroughly type hinting. But that's for future us

Comment on lines +22 to +23
- Use sdfconfig instead of netconfig, which has been
deprecated and scheduled for removal.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's funny to see this line under "Maintenance", since it's such a pervasive change. I don't think there's a better place for it, to be fair.

Copy link
Member Author

Choose a reason for hiding this comment

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

At least there's related notes all over the api breaks section

@tangkong tangkong self-requested a review December 15, 2025 20:52
@tangkong
Copy link
Contributor

Did vscode eat all my comments >:V

Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

Testing a single comment

@tangkong tangkong self-requested a review December 15, 2025 21:10
Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

I think I covered the comments lost to the abyss of vscode 😢

I think the changes here are reasonable, and do what you set out to do. There's more to go in making this more maintainable, but that's for a separate effort.

ZLLentz and others added 3 commits December 15, 2025 15:10
@ZLLentz
Copy link
Member Author

ZLLentz commented Dec 15, 2025

I found one more tiny issue while retesting- one case where the user can be told to configure their sdfconfig but it is configured correctly. I'm seeing if I can resolve it and move back to other things.

@ZLLentz
Copy link
Member Author

ZLLentz commented Dec 15, 2025

I think this is stable now- probably still letting it sit until team members can use sdfconfig.

@ZLLentz
Copy link
Member Author

ZLLentz commented Jan 6, 2026

@pcdshub/python-reviewers this is ready for final review as users will start getting sdfconfig/foreman access this week

Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

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

This looks good to me on the whole, one small question but I think we could possibly ignore it

import json


@functools.lru_cache(maxsize=1000)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we modify an entry with switch tool, will this cache force us into displaying stale information? This is speaking to my lack of experience with the app, sorry if this is off-base

Copy link
Member Author

@ZLLentz ZLLentz Jan 6, 2026

Choose a reason for hiding this comment

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

This only returns information that could be modified by sdfconfig/foreman, not within switchtool itself.

The rationale here is that we don't change the hostname <-> mac addr mapping often, so we can save a lot of time by caching.

Copy link
Contributor

Choose a reason for hiding this comment

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

good by me then

@ZLLentz ZLLentz merged commit 3d0c5ca into pcdshub:master Jan 13, 2026
1 of 7 checks passed
@ZLLentz ZLLentz deleted the ref_sdfconfig branch January 13, 2026 18:25
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.

2 participants