Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added iBootbar agent with MIB and added set function to snmp.py #306

Merged
merged 29 commits into from
Jul 20, 2022

Conversation

davidvng
Copy link
Contributor

@davidvng davidvng commented Jun 10, 2022

Description

Added a set function to snmp.py to handle any set commands used in agent scripts.
Added new agent directory with Dockerfile, agent python script, and MIB (in sub-directory mibs).
The iBootbar agent contains 1 process and 4 tasks:

  • acq (process) - gets outlet status and sends to session.data and feed
  • get_names (task) - returns list of outlet names and updates them in session.data and feed
  • set_outlet (task) - sets a particular outlet to on/off
  • cycle_outlet (task) - cycles a particular outlet for a given amount of time
  • reboot (task) - reboots the entire system

Motivation and Context

Initial iBootbar agent PR.

Closes #63.

How Has This Been Tested?

Tested with iBootbar equipment in the lab. Ran each individual task and verified the changes done on the system. Tested the main process by verifying data is seen on OCS web and Grafana.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Unless I am preparing a release, I have opened this PR onto the develop branch.

@davidvng davidvng added the new agent New OCS agent needs to be created label Jun 10, 2022
@davidvng davidvng added this to the P10R1 milestone Jun 10, 2022
@davidvng davidvng self-assigned this Jun 10, 2022
@BrianJKoopman BrianJKoopman removed this from the P10R1 milestone Jun 13, 2022
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @davidvng! It's looking good, I have some suggestions for the structure, some questions, and documentation requests inline below.

One thing we're still missing is an Agent Reference Page. That'll go in socs/docs/agents/ and should be added to the index socs/docs/index.rst under the "Agent Reference" section. You can then try building the docs locally, which I usually do to check formatting.

agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
socs/snmp.py Outdated Show resolved Hide resolved
socs/snmp.py Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
@BrianJKoopman
Copy link
Member

I also just added the MIB file to our flake8 config file's ignore list, so it doesn't get auto-formatted, since it's just output from the mib converter script.

pre-commit runs flake8 and is catching a few unused imports. Please remove those as well. See output here: https://results.pre-commit.ci/run/github/186511668/1656001941.ccW0D6oWQ3uLcZUGv8WYrw (This is the "Details" on the pre-commit line under the checks at the end of this PR page.)

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

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

This is looking good! I have a couple questions still, and some clarification is needed on the session.data format.

EDIT: I pushed some small changes to the docstrings and docs page, as well as adding the docs page to the index file.

agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Outdated Show resolved Hide resolved
agents/ibootbar/ibootbar.py Show resolved Hide resolved
@BrianJKoopman BrianJKoopman self-requested a review July 20, 2022 20:04
@BrianJKoopman BrianJKoopman merged commit e64a182 into develop Jul 20, 2022
@BrianJKoopman BrianJKoopman deleted the ibootbar branch July 20, 2022 20:11
@BrianJKoopman BrianJKoopman mentioned this pull request Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new agent New OCS agent needs to be created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ibootbar Agent
2 participants