28 lines
886 B
Python
28 lines
886 B
Python
|
|
import os
|
||
|
|
import json
|
||
|
|
from main import append_log as add_log
|
||
|
|
|
||
|
|
class configuration:
|
||
|
|
|
||
|
|
def __init__(self, _conf_file) :
|
||
|
|
self.conf_file = _conf_file
|
||
|
|
|
||
|
|
def get_config(self):
|
||
|
|
add_log("Start Parse Configuration, file : {}\n".format(self.conf_file))
|
||
|
|
|
||
|
|
with open(self.conf_file, 'r') as jsonfile:
|
||
|
|
self.conf_data = json.load(jsonfile)
|
||
|
|
|
||
|
|
def parse_general_config(self):
|
||
|
|
self.Proj_name = self.conf_data['Proj_name']
|
||
|
|
self.BMCIP = self.conf_data['BMCIP']
|
||
|
|
self.BMC_USER = self.conf_data['BMC_USER']
|
||
|
|
self.BMC_PW = self.conf_data['BMC_PW']
|
||
|
|
self.OS_USER = self.conf_data['OS_USER']
|
||
|
|
self.OS_PW = self.conf_data['OS_PW']
|
||
|
|
|
||
|
|
def parse_ipmi_config(self):
|
||
|
|
self.is_enable_ipmi_test = self.conf_data['IPMI']
|
||
|
|
|
||
|
|
def parse_redfish_config(self):
|
||
|
|
self.is_enable_redfish_test = self.conf_data['REDFISH']
|