|
@@ -14,11 +14,9 @@
|
|
废弃机箱管理是能按钮。由BMC程序里的g_BMCInfo.isChMC代替。ChMC默认就支持机箱管理,IPMC默认不支持。
|
|
废弃机箱管理是能按钮。由BMC程序里的g_BMCInfo.isChMC代替。ChMC默认就支持机箱管理,IPMC默认不支持。
|
|
gChassisManageEn、setBladeManage、getBladeManage保留但是用不到。
|
|
gChassisManageEn、setBladeManage、getBladeManage保留但是用不到。
|
|
*/
|
|
*/
|
|
-uint8_t gIPMBAddr[BLADE_NUMBERS] = {0x20, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
|
|
|
|
-uint8_t gChassisManageEn = 0;
|
|
|
|
|
|
+uint8_t gIPMBAddr[BLADE_NUMBERS] = {0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
|
|
/*获取设备信息*/
|
|
/*获取设备信息*/
|
|
void getDeviceInfo(Webs *wp){
|
|
void getDeviceInfo(Webs *wp){
|
|
- printf("--->getDeviceInfo wp.index = %d\n", wp->index);
|
|
|
|
uint16_t wRet = LIBIPMI_E_SUCCESS;
|
|
uint16_t wRet = LIBIPMI_E_SUCCESS;
|
|
GetDevIDRes_T DeviceID;
|
|
GetDevIDRes_T DeviceID;
|
|
struct ifreq ifreq;
|
|
struct ifreq ifreq;
|
|
@@ -45,7 +43,7 @@ void getDeviceInfo(Webs *wp){
|
|
wRet = IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
|
|
wRet = IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
|
|
if (wRet == LIBIPMI_E_SUCCESS)
|
|
if (wRet == LIBIPMI_E_SUCCESS)
|
|
{
|
|
{
|
|
- sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
|
|
|
|
|
|
+ sprintf(FwVersion, "%d.%02x", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
|
|
}
|
|
}
|
|
//get mac adn ip address
|
|
//get mac adn ip address
|
|
if((sock=socket(AF_INET,SOCK_STREAM,0))<0)
|
|
if((sock=socket(AF_INET,SOCK_STREAM,0))<0)
|
|
@@ -93,7 +91,7 @@ void getDeviceInfo(Webs *wp){
|
|
wRet = IPMC_GetDeviceID( &UDSSession, target_addr, &DeviceID, DEFAULT_TIMEOUT);
|
|
wRet = IPMC_GetDeviceID( &UDSSession, target_addr, &DeviceID, DEFAULT_TIMEOUT);
|
|
if (wRet == LIBIPMI_E_SUCCESS)
|
|
if (wRet == LIBIPMI_E_SUCCESS)
|
|
{
|
|
{
|
|
- sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
|
|
|
|
|
|
+ sprintf(FwVersion, "%d.%02x", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -204,12 +202,6 @@ sys_info_end:
|
|
cJSON_Delete(root);
|
|
cJSON_Delete(root);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-/*获取刀片信息*/
|
|
|
|
-void getCardInfo(Webs *wp){
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void getSensorInfo(Webs *wp){
|
|
void getSensorInfo(Webs *wp){
|
|
int wRet;
|
|
int wRet;
|
|
int nSensors = 0;
|
|
int nSensors = 0;
|
|
@@ -242,7 +234,7 @@ void getSensorInfo(Webs *wp){
|
|
//Create session
|
|
//Create session
|
|
LIBIPMI_CreateSession(&UDSSession, 10000);
|
|
LIBIPMI_CreateSession(&UDSSession, 10000);
|
|
|
|
|
|
-// wp->index = TEST_INDEX;
|
|
|
|
|
|
+
|
|
target_addr = gIPMBAddr[wp->index];
|
|
target_addr = gIPMBAddr[wp->index];
|
|
if(target_addr == 0x20)
|
|
if(target_addr == 0x20)
|
|
{
|
|
{
|
|
@@ -446,24 +438,21 @@ void buy(Webs *wp)
|
|
|
|
|
|
void actionTest(Webs *wp)
|
|
void actionTest(Webs *wp)
|
|
{
|
|
{
|
|
- char *name, *age;
|
|
|
|
- name = websGetVar(wp, "name", NULL);
|
|
|
|
- age = websGetVar(wp, "age", NULL);
|
|
|
|
- logmsg(2, "name value is : %s", name );
|
|
|
|
- logmsg(2, "age value is : %s", age );
|
|
|
|
|
|
+ IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
+ GetDevIDRes_T DeviceID;
|
|
|
|
+ LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
+
|
|
|
|
+ IPMC_GetDeviceID( &UDSSession, 0x86, &DeviceID, DEFAULT_TIMEOUT);
|
|
|
|
+ LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
+
|
|
websSetStatus(wp, 200);
|
|
websSetStatus(wp, 200);
|
|
websWriteHeaders(wp, -1, 0);
|
|
websWriteHeaders(wp, -1, 0);
|
|
websWriteEndHeaders(wp);
|
|
websWriteEndHeaders(wp);
|
|
-
|
|
|
|
- websWrite(wp, "Name %s", name);
|
|
|
|
- websWrite(wp, "age %s", age);
|
|
|
|
|
|
+ websWrite(wp, "Every thing is ok");
|
|
websFlush(wp, 0);
|
|
websFlush(wp, 0);
|
|
websDone(wp);
|
|
websDone(wp);
|
|
|
|
|
|
- if(name)
|
|
|
|
- wfree(name);
|
|
|
|
- if(age)
|
|
|
|
- wfree(age);
|
|
|
|
|
|
+ printf("FirmwareRevision: %d.%d\n", DeviceID.FirmwareRevision1,DeviceID.FirmwareRevision2);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -476,7 +465,7 @@ void getAllBladeInfo(Webs *wp){
|
|
//Create session
|
|
//Create session
|
|
LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
|
|
- wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, gChassisManageEn, pBladeStatus, DEFAULT_TIMEOUT);
|
|
|
|
|
|
+ wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, pBladeStatus, DEFAULT_TIMEOUT);
|
|
if(wRet != 0)
|
|
if(wRet != 0)
|
|
{
|
|
{
|
|
printf("Get Blade status error!\n");
|
|
printf("Get Blade status error!\n");
|
|
@@ -526,189 +515,3 @@ void getAllBladeInfo(Webs *wp){
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-// void getAllBladeInfo(Webs *wp){
|
|
|
|
-// uint16_t wRet = LIBIPMI_E_SUCCESS;
|
|
|
|
-
|
|
|
|
-// IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
-// BladeStatus_T *pBladeStatus = walloc(BLADE_NUMBERS*sizeof(BladeStatus_T));
|
|
|
|
-// //Create session
|
|
|
|
-// LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
-
|
|
|
|
-// wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, gChassisManageEn, pBladeStatus, DEFAULT_TIMEOUT);
|
|
|
|
-// if(wRet != 0)
|
|
|
|
-// {
|
|
|
|
-// printf("Get Blade status error!\n");
|
|
|
|
-// websError(wp, 404, "Get Blade status error!");
|
|
|
|
-// wfree(pBladeStatus);
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// //Close session
|
|
|
|
-// LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
-
|
|
|
|
-// char *pStr;
|
|
|
|
-// cJSON * root = cJSON_CreateObject();
|
|
|
|
-// cJSON *pJsonArry,*pJsonsub;
|
|
|
|
-// pJsonArry=cJSON_CreateArray(); /*创建数组*/
|
|
|
|
-// cJSON_AddItemToObject(root, "data", pJsonArry);//根节点下添加
|
|
|
|
-// cJSON_AddStringToObject(root, "msg", "");
|
|
|
|
-// cJSON_AddNumberToObject(root, "code", 200);
|
|
|
|
-
|
|
|
|
-// int i;
|
|
|
|
-// for(i=0;i<BLADE_NUMBERS;i++)
|
|
|
|
-// {
|
|
|
|
-// cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
|
|
|
|
-// cJSON_AddNumberToObject(pJsonsub, "present", pBladeStatus[i].present); //0:不在位,1:在位
|
|
|
|
-// cJSON_AddNumberToObject(pJsonsub, "status", pBladeStatus[i].healthStatus); //0:灰色, 1: 绿色 2:红色
|
|
|
|
-// cJSON_AddNumberToObject(pJsonsub, "slot", pBladeStatus[i].slotID);
|
|
|
|
-// cJSON_AddNumberToObject(pJsonsub, "power", pBladeStatus[i].pwrStatus);
|
|
|
|
-// cJSON_AddStringToObject(pJsonsub, "name", pBladeStatus[i].bladeName);
|
|
|
|
-// cJSON_AddNumberToObject(pJsonsub, "isChMC", pBladeStatus[i].isChMC);
|
|
|
|
-
|
|
|
|
-// //将主模块的IPMB地址改成0x20
|
|
|
|
-// if(pBladeStatus[i].isChMC)
|
|
|
|
-// {
|
|
|
|
-// gIPMBAddr[i] = 0x20;
|
|
|
|
-// printf("Modify %d blade ipmb address to 0x20\n", i);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// pStr = cJSON_PrintUnformatted(root);
|
|
|
|
-
|
|
|
|
-// websSetStatus(wp, 200);
|
|
|
|
-// websWriteHeaders(wp, -1, 0);
|
|
|
|
-// websWriteEndHeaders(wp);
|
|
|
|
-// websWrite(wp, "%s", pStr);
|
|
|
|
-// websFlush(wp, 0);
|
|
|
|
-// websDone(wp);
|
|
|
|
-// printf("cJSON:%s\n", pStr);
|
|
|
|
-
|
|
|
|
-// if(pStr)
|
|
|
|
-// wfree(pStr);
|
|
|
|
-// if(root)
|
|
|
|
-// cJSON_Delete(root);
|
|
|
|
-// if(pBladeStatus)
|
|
|
|
-// wfree(pBladeStatus);
|
|
|
|
-
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-//废弃
|
|
|
|
-void setBladeManage(Webs *wp){
|
|
|
|
- char *strEnable = websGetVar(wp, "enable", NULL);
|
|
|
|
-
|
|
|
|
- gChassisManageEn = atoi(strEnable);
|
|
|
|
-
|
|
|
|
- char *pStr;
|
|
|
|
- cJSON * root = cJSON_CreateObject();
|
|
|
|
- cJSON * data = cJSON_CreateObject();
|
|
|
|
- cJSON_AddItemToObject(root, "data", data);//根节点下添加
|
|
|
|
- cJSON_AddStringToObject(root, "msg", "");
|
|
|
|
- cJSON_AddNumberToObject(root, "code", 200);
|
|
|
|
-
|
|
|
|
- pStr = cJSON_PrintUnformatted(root);
|
|
|
|
-
|
|
|
|
- websSetStatus(wp, 200);
|
|
|
|
- websWriteHeaders(wp, -1, 0);
|
|
|
|
- websWriteEndHeaders(wp);
|
|
|
|
- websWrite(wp, "%s", pStr);
|
|
|
|
- websFlush(wp, 0);
|
|
|
|
- websDone(wp);
|
|
|
|
- printf("cJSON:%s\n", pStr);
|
|
|
|
-
|
|
|
|
- if(pStr)
|
|
|
|
- wfree(pStr);
|
|
|
|
- if(root)
|
|
|
|
- cJSON_Delete(root);
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//废弃
|
|
|
|
-void getBladeManage(Webs *wp){
|
|
|
|
- char *pStr;
|
|
|
|
- cJSON * root = cJSON_CreateObject();
|
|
|
|
- cJSON * data = cJSON_CreateObject();
|
|
|
|
- cJSON_AddItemToObject(root, "data", data);//根节点下添加
|
|
|
|
- cJSON_AddStringToObject(root, "msg", "");
|
|
|
|
- cJSON_AddNumberToObject(root, "code", 200);
|
|
|
|
- cJSON_AddNumberToObject(data, "isEnable", gChassisManageEn); //机箱管理功能是否已经打开
|
|
|
|
-
|
|
|
|
- pStr = cJSON_PrintUnformatted(root);
|
|
|
|
-
|
|
|
|
- websSetStatus(wp, 200);
|
|
|
|
- websWriteHeaders(wp, -1, 0);
|
|
|
|
- websWriteEndHeaders(wp);
|
|
|
|
- websWrite(wp, "%s", pStr);
|
|
|
|
- websFlush(wp, 0);
|
|
|
|
- websDone(wp);
|
|
|
|
- printf("cJSON:%s\n", pStr);
|
|
|
|
-
|
|
|
|
- if(pStr)
|
|
|
|
- wfree(pStr);
|
|
|
|
- if(root)
|
|
|
|
- cJSON_Delete(root);
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-void getChassisInfo(Webs *wp){
|
|
|
|
- uint16_t wRet = LIBIPMI_E_SUCCESS;
|
|
|
|
- IPMI20_UDS_SESSION_T UDSSession;
|
|
|
|
- OemChassisInfo_T ChassisInfo;
|
|
|
|
-
|
|
|
|
- //Create session
|
|
|
|
- LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
|
|
|
|
-
|
|
|
|
- wRet = LIBIPMI_HL_GetChassisInfo(&UDSSession, &ChassisInfo, DEFAULT_TIMEOUT);
|
|
|
|
- if(wRet != 0)
|
|
|
|
- {
|
|
|
|
- websError(wp, 404, "Get Chassis Info Error!");
|
|
|
|
- LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //Close session
|
|
|
|
- LIBIPMI_CloseSession(&UDSSession );
|
|
|
|
-
|
|
|
|
- if(ChassisInfo.isChMC)
|
|
|
|
- {
|
|
|
|
- if(ChassisInfo.curIndex < BLADE_NUMBERS)
|
|
|
|
- {
|
|
|
|
- gIPMBAddr[ChassisInfo.curIndex] = 0x20;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- printf("\n\n\nWarning: Invalid curIndex %d\n\n\n", ChassisInfo.curIndex);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- gChassisManageEn = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- char *pStr;
|
|
|
|
- cJSON * root = cJSON_CreateObject();
|
|
|
|
- cJSON * data = cJSON_CreateObject();
|
|
|
|
- cJSON_AddItemToObject(root, "data", data);//根节点下添加
|
|
|
|
- cJSON_AddStringToObject(root, "msg", "");
|
|
|
|
- cJSON_AddNumberToObject(root, "code", 200);
|
|
|
|
-
|
|
|
|
- cJSON_AddNumberToObject(data, "slotNum", ChassisInfo.slotNum); //机箱内一共有多少个槽位
|
|
|
|
- cJSON_AddNumberToObject(data, "supportManage", ChassisInfo.isChMC); //是否支持机箱管理功能。 0:不支持, 1:支持
|
|
|
|
- cJSON_AddNumberToObject(data, "ManageEn", gChassisManageEn); //是否打开机箱管理功能。0:关闭, 1:打开
|
|
|
|
- cJSON_AddNumberToObject(data, "curIndex", ChassisInfo.curIndex); //当前刀片插在第几个槽位。
|
|
|
|
-
|
|
|
|
- pStr = cJSON_PrintUnformatted(root);
|
|
|
|
- websSetStatus(wp, 200);
|
|
|
|
- websWriteHeaders(wp, -1, 0);
|
|
|
|
- websWriteEndHeaders(wp);
|
|
|
|
- websWrite(wp, "%s", pStr);
|
|
|
|
- websFlush(wp, 0);
|
|
|
|
- websDone(wp);
|
|
|
|
- printf("cJSON:%s\n", pStr);
|
|
|
|
-
|
|
|
|
- if(pStr)
|
|
|
|
- wfree(pStr);
|
|
|
|
- if(root)
|
|
|
|
- cJSON_Delete(root);
|
|
|
|
-
|
|
|
|
-}
|
|
|