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 ###############################################################################
14 from dha_adapters.libvirt_adapter import LibvirtAdapter
15 from dha_adapters.ipmi_adapter import IpmiAdapter
16 from dha_adapters.hp_adapter import HpAdapter
17 from dha_adapters.amt_adapter import AmtAdapter
18 from dha_adapters.zte_adapter import ZteAdapter
20 class DeploymentHardwareAdapter(object):
22 def __new__(cls, yaml_path):
23 with io.open(yaml_path) as yaml_file:
24 dha_struct = yaml.load(yaml_file)
25 type = dha_struct['adapter']
27 if cls is DeploymentHardwareAdapter:
29 return LibvirtAdapter(yaml_path)
31 return IpmiAdapter(yaml_path)
33 return HpAdapter(yaml_path)
35 return AmtAdapter(yaml_path)
37 return ZteAdapter(yaml_path)
38 return super(DeploymentHardwareAdapter, cls).__new__(cls)