1 ###############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # szilard.cserey@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ###############################################################################
12 from ipmi_adapter import IpmiAdapter
21 class ZteAdapter(IpmiAdapter):
23 def __init__(self, yaml_path):
24 super(ZteAdapter, self).__init__(yaml_path)
26 def node_reset(self, node_id):
28 log('RESET Node %s' % node_id)
29 cmd_prefix = self.ipmi_cmd(node_id)
30 state = exec_cmd('%s chassis power status' % cmd_prefix, mask_args=[8,10])
31 if state == 'Chassis Power is on':
34 exec_cmd('%s chassis power cycle' % cmd_prefix, mask_args=[8,10])
35 for i in range(WAIT_LOOP):
36 state, _ = exec_cmd('%s chassis power status' % cmd_prefix,
39 if state == 'Chassis Power is off':
41 elif state == 'Chassis Power is on' and was_shut_off:
46 err('Could Not RESET Node %s' % node_id)
48 err('Cannot RESET Node %s because it\'s not Active, state: %s'