Restructcture of the directory layout
[fuel.git] / deploy / dha_adapters / hp_adapter.py
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 ###############################################################################
9
10
11 from ipmi_adapter import IpmiAdapter
12 from ssh_client import SSHClient
13
14 from common import (
15     log,
16 )
17
18 DEV = {'pxe': 'bootsource5',
19        'disk': 'bootsource3',
20        'iso': 'bootsource1'}
21
22 ROOT = '/system1/bootconfig1'
23
24
25 class HpAdapter(IpmiAdapter):
26
27     def __init__(self, yaml_path):
28         super(HpAdapter, self).__init__(yaml_path)
29
30     def node_set_boot_order(self, node_id, boot_order_list):
31         log('Set boot order %s on Node %s' % (boot_order_list, node_id))
32         ip, username, password = self.get_access_info(node_id)
33         ssh = SSHClient(ip, username, password)
34         with ssh as s:
35             for order, dev in enumerate(boot_order_list):
36                 s.exec_cmd('set %s/%s bootorder=%s'
37                            % (ROOT, DEV[dev], order + 1))