Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

201807 cel - submodule and fwmgrutil update #31

Merged
merged 2 commits into from Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 36 additions & 29 deletions device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def get_bmc_version(self):
:returns: version string

"""
bmc_version = "None"
bmc_version = None

bmc_version_key = "OpenBMC Version"
bmc_info_req = requests.get(self.bmc_info_url)
bmc_info_json = bmc_info_req.json()
bmc_info = bmc_info_json.get('Information')
bmc_version = bmc_info.get(bmc_version_key)

return bmc_version
return str(bmc_version)

def get_cpld_version(self):
"""Get CPLD version from SONiC
Expand Down Expand Up @@ -83,9 +83,10 @@ def get_cpld_version(self):
int(CPLD_3[2], 16), int(CPLD_3[3], 16))
CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format(
int(CPLD_4[2], 16), int(CPLD_4[3], 16))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(
float(fan_cpld))

cpld_version_dict={}
cpld_version_dict = {}
cpld_version_dict.update({'CPLD_B': CPLD_B})
cpld_version_dict.update({'CPLD_C': CPLD_C})
cpld_version_dict.update({'CPLD_1': CPLD_1})
Expand All @@ -101,57 +102,63 @@ def get_bios_version(self):
:returns: version string

"""
bios_version='None'
bios_version = None

p=subprocess.Popen(
p = subprocess.Popen(
["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE)
raw_data=str(p.communicate()[0])
raw_data_list=raw_data.split("\n")
bios_version=raw_data_list[0] if len(
raw_data = str(p.communicate()[0])
raw_data_list = raw_data.split("\n")
bios_version = raw_data_list[0] if len(
raw_data_list) == 1 else raw_data_list[-2]

return bios_version
return str(bios_version)

def get_onie_version(self):
"""Get ONiE version from SONiC
:returns: version string

"""
onie_verison='None'
onie_verison = None

onie_version_keys="onie_version"
onie_config_file=open(self.onie_config_file, "r")
onie_version_keys = "onie_version"
onie_config_file = open(self.onie_config_file, "r")
for line in onie_config_file.readlines():
if onie_version_keys in line:
onie_version_raw=line.split('=')
onie_verison=onie_version_raw[1].strip()
onie_version_raw = line.split('=')
onie_verison = onie_version_raw[1].strip()
break
return onie_verison
return str(onie_verison)

def get_pcie_version(self):
"""Get PCiE version from SONiC
:returns: version string
"""Get PCiE version from SONiC
:returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" }

"""
cmd="sudo bcmcmd 'pciephy fw version'"
p=subprocess.Popen(
cmd = "sudo bcmcmd 'pciephy fw version'"
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err=p.communicate()
if err is not '':
return 'None'
else:
lines=raw_data.split('\n')
raw_data, err = p.communicate()

pcie_version = dict()
pcie_version["PCIE_FW_LOADER"] = 'None'
pcie_version["PCIE_FW"] = 'None'

if err == '':
lines = raw_data.split('\n')
for line in lines:
if 'PCIe FW loader' in line:
version=line.split(':')[1].strip()
return str(version)
pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip()
elif 'PCIe FW version' in line:
pcie_version["PCIE_FW"] = line.split(':')[1].strip()
return pcie_version

def get_fpga_version(self):
"""Get FPGA version from SONiC
:returns: version string

"""
version=self.__get_register_value(self.fpga_version_path, '0x00')
version = self.__get_register_value(self.fpga_version_path, '0x00')
if version is not 'None':
version="{}.{}".format(
version = "{}.{}".format(
int(version[2:][:4], 16), int(version[2:][4:], 16))
return str(version)
65 changes: 36 additions & 29 deletions device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def get_bmc_version(self):
:returns: version string

"""
bmc_version = "None"
bmc_version = None

bmc_version_key = "OpenBMC Version"
bmc_info_req = requests.get(self.bmc_info_url)
bmc_info_json = bmc_info_req.json()
bmc_info = bmc_info_json.get('Information')
bmc_version = bmc_info.get(bmc_version_key)

return bmc_version
return str(bmc_version)

def get_cpld_version(self):
"""Get CPLD version from SONiC
Expand Down Expand Up @@ -83,9 +83,10 @@ def get_cpld_version(self):
int(CPLD_3[2], 16), int(CPLD_3[3], 16))
CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format(
int(CPLD_4[2], 16), int(CPLD_4[3], 16))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(
float(fan_cpld))

cpld_version_dict={}
cpld_version_dict = {}
cpld_version_dict.update({'CPLD_B': CPLD_B})
cpld_version_dict.update({'CPLD_C': CPLD_C})
cpld_version_dict.update({'CPLD_1': CPLD_1})
Expand All @@ -101,57 +102,63 @@ def get_bios_version(self):
:returns: version string

"""
bios_version='None'
bios_version = None

p=subprocess.Popen(
p = subprocess.Popen(
["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE)
raw_data=str(p.communicate()[0])
raw_data_list=raw_data.split("\n")
bios_version=raw_data_list[0] if len(
raw_data = str(p.communicate()[0])
raw_data_list = raw_data.split("\n")
bios_version = raw_data_list[0] if len(
raw_data_list) == 1 else raw_data_list[-2]

return bios_version
return str(bios_version)

def get_onie_version(self):
"""Get ONiE version from SONiC
:returns: version string

"""
onie_verison='None'
onie_verison = None

onie_version_keys="onie_version"
onie_config_file=open(self.onie_config_file, "r")
onie_version_keys = "onie_version"
onie_config_file = open(self.onie_config_file, "r")
for line in onie_config_file.readlines():
if onie_version_keys in line:
onie_version_raw=line.split('=')
onie_verison=onie_version_raw[1].strip()
onie_version_raw = line.split('=')
onie_verison = onie_version_raw[1].strip()
break
return onie_verison
return str(onie_verison)

def get_pcie_version(self):
"""Get PCiE version from SONiC
:returns: version string
"""Get PCiE version from SONiC
:returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" }

"""
cmd="sudo bcmcmd 'pciephy fw version'"
p=subprocess.Popen(
cmd = "sudo bcmcmd 'pciephy fw version'"
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err=p.communicate()
if err is not '':
return 'None'
else:
lines=raw_data.split('\n')
raw_data, err = p.communicate()

pcie_version = dict()
pcie_version["PCIE_FW_LOADER"] = 'None'
pcie_version["PCIE_FW"] = 'None'

if err == '':
lines = raw_data.split('\n')
for line in lines:
if 'PCIe FW loader' in line:
version=line.split(':')[1].strip()
return str(version)
pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip()
elif 'PCIe FW version' in line:
pcie_version["PCIE_FW"] = line.split(':')[1].strip()
return pcie_version

def get_fpga_version(self):
"""Get FPGA version from SONiC
:returns: version string

"""
version=self.__get_register_value(self.fpga_version_path, '0x00')
version = self.__get_register_value(self.fpga_version_path, '0x00')
if version is not 'None':
version="{}.{}".format(
version = "{}.{}".format(
int(version[2:][:4], 16), int(version[2:][4:], 16))
return str(version)
65 changes: 36 additions & 29 deletions device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def get_bmc_version(self):
:returns: version string

"""
bmc_version = "None"
bmc_version = None

bmc_version_key = "OpenBMC Version"
bmc_info_req = requests.get(self.bmc_info_url)
bmc_info_json = bmc_info_req.json()
bmc_info = bmc_info_json.get('Information')
bmc_version = bmc_info.get(bmc_version_key)

return bmc_version
return str(bmc_version)

def get_cpld_version(self):
"""Get CPLD version from SONiC
Expand Down Expand Up @@ -83,9 +83,10 @@ def get_cpld_version(self):
int(CPLD_3[2], 16), int(CPLD_3[3], 16))
CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format(
int(CPLD_4[2], 16), int(CPLD_4[3], 16))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld))
FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(
float(fan_cpld))

cpld_version_dict={}
cpld_version_dict = {}
cpld_version_dict.update({'CPLD_B': CPLD_B})
cpld_version_dict.update({'CPLD_C': CPLD_C})
cpld_version_dict.update({'CPLD_1': CPLD_1})
Expand All @@ -101,57 +102,63 @@ def get_bios_version(self):
:returns: version string

"""
bios_version='None'
bios_version = None

p=subprocess.Popen(
p = subprocess.Popen(
["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE)
raw_data=str(p.communicate()[0])
raw_data_list=raw_data.split("\n")
bios_version=raw_data_list[0] if len(
raw_data = str(p.communicate()[0])
raw_data_list = raw_data.split("\n")
bios_version = raw_data_list[0] if len(
raw_data_list) == 1 else raw_data_list[-2]

return bios_version
return str(bios_version)

def get_onie_version(self):
"""Get ONiE version from SONiC
:returns: version string

"""
onie_verison='None'
onie_verison = None

onie_version_keys="onie_version"
onie_config_file=open(self.onie_config_file, "r")
onie_version_keys = "onie_version"
onie_config_file = open(self.onie_config_file, "r")
for line in onie_config_file.readlines():
if onie_version_keys in line:
onie_version_raw=line.split('=')
onie_verison=onie_version_raw[1].strip()
onie_version_raw = line.split('=')
onie_verison = onie_version_raw[1].strip()
break
return onie_verison
return str(onie_verison)

def get_pcie_version(self):
"""Get PCiE version from SONiC
:returns: version string
"""Get PCiE version from SONiC
:returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" }

"""
cmd="sudo bcmcmd 'pciephy fw version'"
p=subprocess.Popen(
cmd = "sudo bcmcmd 'pciephy fw version'"
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err=p.communicate()
if err is not '':
return 'None'
else:
lines=raw_data.split('\n')
raw_data, err = p.communicate()

pcie_version = dict()
pcie_version["PCIE_FW_LOADER"] = 'None'
pcie_version["PCIE_FW"] = 'None'

if err == '':
lines = raw_data.split('\n')
for line in lines:
if 'PCIe FW loader' in line:
version=line.split(':')[1].strip()
return str(version)
pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip()
elif 'PCIe FW version' in line:
pcie_version["PCIE_FW"] = line.split(':')[1].strip()
return pcie_version

def get_fpga_version(self):
"""Get FPGA version from SONiC
:returns: version string

"""
version=self.__get_register_value(self.fpga_version_path, '0x00')
version = self.__get_register_value(self.fpga_version_path, '0x00')
if version is not 'None':
version="{}.{}".format(
version = "{}.{}".format(
int(version[2:][:4], 16), int(version[2:][4:], 16))
return str(version)