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 ip_power control for BareMetal platform #3550

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

paulli2017
Copy link
Contributor

No description provided.

@squirrelsc
Copy link
Member

Please rebase on latest main to avoid conflict.

from .schema import IPPowerSchema


class IPPower(subclasses.BaseClassWithRunbookMixin, ContextMixin, InitializableMixin):
Copy link
Member

Choose a reason for hiding this comment

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

  1. Inherit from features.StartStop.
  2. Move it under cluster/generic.

@dataclass
class IPPowerSchema(schema.TypedSchema, schema.ExtendableSchemaMixin):
type: str = field(default="Ip9285", metadata=field_metadata(required=True))
hostname: str = ""
Copy link
Member

Choose a reason for hiding this comment

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

host

class Ip9285(IPPower):
def __init__(self, runbook: IPPowerSchema) -> None:
super().__init__(runbook)
self._request_cmd = (
Copy link
Member

Choose a reason for hiding this comment

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

What does the P6 mean? If it's part of the port, move it to on/off, so it's clearer.

def type_schema(cls) -> Type[schema.TypedSchema]:
return IPPowerSchema

def on(self, port: int) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Change the type of port to str, because maybe other type uses a name instead of an int.


def on(self, port: int) -> None:
request_on = f"{self._request_cmd}{port}=1"
requests.get(request_on)
Copy link
Member

Choose a reason for hiding this comment

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

Follow the internal example to check the status, make sure it's reliable.

paull and others added 8 commits December 9, 2024 16:08
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