Skip to content

Feat: SEL-362X Module - #79

Open
fspardo wants to merge 2 commits into
sandialabs:mainfrom
fspardo:main
Open

Feat: SEL-362X Module#79
fspardo wants to merge 2 commits into
sandialabs:mainfrom
fspardo:main

Conversation

@fspardo

@fspardo fspardo commented Jul 22, 2026

Copy link
Copy Markdown

SEL-362X Module

Description

This PR aims to implement support for the SEL-362X family of products. While originally intended for the SEL-3622, this module ended up providing partial support for the SEL-3620. This module currently supports both products.

Please check the following items as they're completed.
Completion of all checklist items signals to maintainers that a PR is fully ready for review.

  • This PR conforms to the process detailed in the Contributing Guide
  • I have included no proprietary/sensitive information in my code
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have tested my code
  • I have added a description of my changes to the changelog in CHANGELOG.rst
  • Apply appropriate Tags to this PR, if any (e.g. bugfix, enhancement(feature), documentation, etc.)
  • Removing "Draft" status from the PR (if applicable).

@GhostofGoes

Copy link
Copy Markdown
Contributor

Thanks for opening a draft. Just a FYSA, my very first review comment will be asking you to squash those 285 glorious commits 😁

Comment thread examples/devices/sel/362X-config.yaml Outdated
@@ -0,0 +1,521 @@
# Configuration file for PEAT (the Process Extraction and Analysis Tool)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cut this config down to just the fields that have changed or are otherwise being used/are relevant.

@fspardo

fspardo commented Jul 23, 2026

Copy link
Copy Markdown
Author

Main branch has been cold-pressed.

Comment thread peat/modules/sel/sel_362X/method.py Outdated
return AdvancedRange(low, high)


class Method:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Encapsulating pull methods as objects is something I've wanted to do for a long time. Maybe you could be the chosen one and finally bring this to the PEAT API?!?!

Scan uses IdentifyMethod, but Pull is a basic override of Device._pull(). Instead of that nonsense, define PullMethod instances that the device can select and use based on configuration options, verification status, etc just like for IdentifyMethod and scan.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I may consider working on that eventually, if happenstance permits it.

@GhostofGoes

Copy link
Copy Markdown
Contributor

note: remove email from docstrings, policy for peat is all requests should go to peat@sandia.gov (and also emails change and become stale)

@fspardo
fspardo force-pushed the main branch 8 times, most recently from 4d84aef to a44d10c Compare July 30, 2026 23:02
@fspardo
fspardo marked this pull request as ready for review July 30, 2026 23:02
@fspardo

fspardo commented Jul 30, 2026

Copy link
Copy Markdown
Author

This should be ready for review, but I do not know why GitHub is preventing me from adding tags to the PR (which needs to be labeled as a feature addition).

@fspardo fspardo changed the title SEL-362X Module ADDITION: SEL-362X Module Jul 30, 2026
@GhostofGoes

Copy link
Copy Markdown
Contributor

This should be ready for review, but I do not know why GitHub is preventing me from adding tags to the PR (which needs to be labeled as a feature addition).

You likely can't tag because you're not a Maintainer for the project, just like I can't anymore 😅. No worries, @BugFriendlyGarden can tag/label as appropriate.

Can you please update the PR title to align with conventional commit style? e.g. "feat: 362x module"

I'll give this a proper review if I have some spare time tomorrow, otherwise it'll likely be next week. Fear not, there will definitely be comments 😈

@GhostofGoes

Copy link
Copy Markdown
Contributor

Biggest issue tho before I review everything else is there are way too many source files. one-function-per-file is excessive, it leads to a lot of import-related boilerplate, duplication, and hard to trace code, not to mention super cluttered folder. Follow the pattern other modules have of consolidating related functions into a single file or small set of files, e.g. data-model related functions in a "362x_processing" and data parsing in "362x_parsing.py".

I leave the approach up to you.

@fspardo fspardo changed the title ADDITION: SEL-362X Module Feat: SEL-362X Module Jul 31, 2026
@fspardo

fspardo commented Jul 31, 2026

Copy link
Copy Markdown
Author

Biggest issue tho before I review everything else is there are way too many source files. one-function-per-file is excessive, it leads to a lot of import-related boilerplate, duplication, and hard to trace code, not to mention super cluttered folder.

There were other requirements (namely collaboration) that I had to consider for this project, but it should be fairly straightforward to fix this.

@fspardo

fspardo commented Jul 31, 2026

Copy link
Copy Markdown
Author

I have reduced this to six files. Do let me know if that is still too much.

Author: Francisco Santana
"""

# TODO: This needs to be updated to better support the SEL-3620 or R212 of the firmware.

@GhostofGoes GhostofGoes Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Create a github issue to track this. if you can, include in the issues more details about what issues you ran into specifically (make sure not to include any sensitive info, if you're uncertain talk with your project lead). This is so someone picking up your work in the future has somewhere to start.

@GhostofGoes GhostofGoes mentioned this pull request Jul 31, 2026
9 tasks

@GhostofGoes GhostofGoes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, this is a big review. Don't take it the wrong way, you did great work here, and it made me want to give it a proper deep review. You really dug deep into the device and got a lot of information. Good work on error handling, type annotations, and comments.

Comment thread examples/devices/sel/362X-config.yaml Outdated
peat_module: "sel-362x"
options:
https:
port: 10443

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why 10443?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I interacted with the 3620 using SSH port forwarding, though I could change it to 443.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah change to 443, this is meant to be a general example

"""
SEL-362X Family of Security Gateways.

This module is designed to support both the SEL-3622 and the SEL-3620, though

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One major concern I have is the module name. There is already a module for the SEL-3620.

Does the 362X module also work with the 3620?

  • If so, then the modules need to be combined.
  • If not, probably should differentiate this module somehow, e.g. rename to SEL3622.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The plan is to replace the 3620 module eventually, but keep the old one for compatibility for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you document that somewhere? My concern is if there's a 3620 on the network, there could be two peat modules activated simultaneously, with odd results. Have you tested against the peat rack with all modules enabled? e.g. peat pull -i <rack-subnet> (all defaults)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This module seemingly takes precedence over the 3620 module due to the higher reliability rating. For now, I removed the aliases to the 3620 on my module.

was originally developed for the former.

Authors:
- Francisco Santana

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If Nehal contributed code, both of you should be added to the AUTHORS file

Comment thread peat/modules/sel/sel_362X/__init__.py Outdated

class SEL362X(DeviceModule):
"""
SEL-3620 Security Gateway

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see earlier comment about duplication with SEL3620

Comment thread peat/modules/sel/sel_362X/__init__.py Outdated
vendor_id = "SEL"
vendor_name = "Schweitzer Engineering Laboratories"
brand = "SEL"
module_aliases = ["sel-3622", "sel-3620", "sel-362x", "3622", "3620", "362x"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this overlaps with the existing SEL3620 module

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I removed aliases for the 3620.

return result


def parse_free_mem(lines: list[str]) -> dict[str, Any]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dev.hardware (see SELRTAC for example)

return result


def parse_process_list(lines: list[str]) -> list[dict[str, Any]]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dev.related.process


def pull_syslog_settings(dev: DeviceData, session: HTTP362X) -> dict[str, Any]:
"""
Pull the configuration under /Syslog.sel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can probably re-use a lot of the parsing and processing code from SEL3620 and SELRTAC modules.

Comment thread CHANGELOG.rst
Releases
========

- Added support for pulling and parsing configuration data for the SEL-3622/3620 Security Gateway (Tested for Firmware R200 and R212, respectively)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be a towncrier snippet. Was a relatively recent change to peat, talk to @BugFriendlyGarden

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I should probably ask him about that. Thanks for telling me!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, the change is documented in CONTRIBUTING.rst under Update the CHANGELOG.

I'm working on making the new requirement clear. You just need to put your new text above into a file called newsfragments/79.feature

When we create the next release, we'll run a tool called towncrier that digests all of the newsfragments files to automatically update the CHANGELOG.rst file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good to know. I just added a file to my repo -- feel free to correct it.

Comment thread pdm.lock
{file = "tomlkit-0.14.0.tar.gz", hash = "sha256:cf00efca415dbd57575befb1f6634c4f42d2d87dbba376128adb42c121b87064"},
]

[[package]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

revert changes to pdm.lock

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Restored from upstream 👍

@fspardo
fspardo force-pushed the main branch 7 times, most recently from e317810 to d79bbef Compare July 31, 2026 22:12
@BugFriendlyGarden

Copy link
Copy Markdown
Collaborator

This should be ready for review, but I do not know why GitHub is preventing me from adding tags to the PR (which needs to be labeled as a feature addition).

You likely can't tag because you're not a Maintainer for the project, just like I can't anymore 😅. No worries, @BugFriendlyGarden can tag/label as appropriate.

@GhostofGoes Does tag in this case only refer to release tags? It's the only one I see in CONTRIBUTING.md.

@fspardo
fspardo force-pushed the main branch 2 times, most recently from a4293e2 to f1700e1 Compare August 3, 2026 19:17
@GhostofGoes

Copy link
Copy Markdown
Contributor

This should be ready for review, but I do not know why GitHub is preventing me from adding tags to the PR (which needs to be labeled as a feature addition).

You likely can't tag because you're not a Maintainer for the project, just like I can't anymore 😅. No worries, @BugFriendlyGarden can tag/label as appropriate.

@GhostofGoes Does tag in this case only refer to release tags? It's the only one I see in CONTRIBUTING.md.

Labels is the proper term.

image

@BugFriendlyGarden BugFriendlyGarden added the enhancement New feature or request label Aug 4, 2026
@fspardo
fspardo force-pushed the main branch 3 times, most recently from 34397cf to 6cd692c Compare August 7, 2026 19:40
def do_hash(hcons: Callable[..., _Hash], data: str) -> str:
"""Get a HASH object from `hcons`, then make a digest of `data`"""
hobj = hcons(usedforescurity=False)
hobj.update(data.encode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants