def step_impl(context, key, min_volt, port): sm.create_pdu(key, { "min_voltage": min_volt, "host": "127.0.0.1", "port": port }) context.hardware[key] = IStateManager.get_state_manager_by_key(key) for child_key in context.hardware[key].asset_info["children"]: context.hardware[child_key] = IStateManager.get_state_manager_by_key( child_key)
def step_impl(context, key, port): sm.create_ups( key, { "power_source": 120, "power_consumption": 24, "host": "localhost", "port": port, }, ) context.hardware[key] = IStateManager.get_state_manager_by_key(key) for child_key in context.hardware[key].asset_info["children"]: context.hardware[child_key] = IStateManager.get_state_manager_by_key( child_key)
def __init__(self, asset_info): super(Server, self).__init__(asset_info) self._psu_sm = {} self._storcli_emu = None self.removeHandler(super().on_power_button_press) for i in range(1, asset_info["num_components"] + 1): psu_key = self.key * 10 + i self._psu_sm[psu_key] = IStateManager.get_state_manager_by_key( psu_key) if "storcliEnabled" in asset_info and asset_info["storcliEnabled"]: server_dir = self._create_asset_workplace_dir() self._storcli_emu = StorCLIEmulator( asset_info["key"], server_dir, socket_port=asset_info["storcliPort"]) self.state.power_up()
def _add_server_to_context(context, key): context.hardware[key] = IStateManager.get_state_manager_by_key(key) for psu_key in context.hardware[key].asset_info["children"]: context.hardware[psu_key] = IStateManager.get_state_manager_by_key( psu_key)
def step_impl(context, key): sm.create_outlet(key, {}) context.hardware[key] = IStateManager.get_state_manager_by_key(key)
def step_impl(context, key, min_volt, wattage): sm.create_lamp(key, { "power_consumption": wattage, "min_voltage": min_volt }) context.hardware[key] = IStateManager.get_state_manager_by_key(key)