1#!/usr/bin/env python3 2 3r""" 4IPMI raw commands table: 5 6 - Define IPMI interface index, commands and expected output. 7 8""" 9 10from robot.libraries.BuiltIn import BuiltIn 11 12# The currently supported cipher list. 13# Refer: 14# openbmc/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipe 15# s-phosphor/ipmi/phosphor-ipmi-host/cipher_list.json 16valid_ciphers = ["17"] 17unsupported_ciphers = ["1", "2", "15", "16"] 18 19IPMI_RAW_CMD = { 20 # Interface name 21 "power_supply_redundancy": { 22 # Command action type 23 "Get": [ 24 # raw command, expected output(s), comment 25 "0x04 0x2d 0x0b", 26 "00 00 01 00", 27 "Byte position 3rd LSB e.g. 01 indicates disabled", 28 "00 00 02 00", 29 "Byte position 3rd LSB e.g. 02 indicates enabled", 30 "00 40 02 00", 31 "40 is scanning enabled and 02 indicates redundancy enabled", 32 ], 33 "Enabled": [ 34 # raw command, expected output, comment 35 "0x04 0x30 0x0b 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00", 36 "none", 37 "Enabled nibble position 6th LSB e.g. 0x2", 38 ], 39 "Disabled": [ 40 # raw command, expected output, comment 41 "0x04 0x30 0x0b 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00", 42 "none", 43 "Enabled nibble position 6th LSB e.g. 0x1", 44 ], 45 }, 46 "power_reading": { 47 "Get": [ 48 # raw command, expected output(s), comment 49 "0x2c 0x02 0xdc 0x01 0x01 0x00", 50 "dc d5 00 d5 00 d5 00 d5 00 00 00 00 00 00 00 00 00 00", 51 "Byte position 2nd LSB e.g. d5 Instantaneous power readings", 52 ], 53 }, 54 "conf_param": { 55 "Enabled": [ 56 # raw command, expected output, comment 57 "0x2c 0x12 0xdc 0x02 0x00 0x01", 58 "dc", 59 "Enabled nibble position 6th LSB e.g. 0x01", 60 ], 61 "Disabled": [ 62 # raw command, expected output, comment 63 "0x2c 0x12 0xdc 0x02 0x00 0x00", 64 "dc", 65 "Disable nibble position 6th LSB e.g. 0x00", 66 ], 67 }, 68 "SEL_entry": { 69 "Reserve": [ 70 # raw command, expected output, comment 71 "0x0a 0x42", 72 "27 00", 73 "27 is Reservation ID, LSB, 00 Reservation ID, MSB ", 74 ], 75 "Get_SEL_Time": [ 76 # raw command 77 "0x0a 0x48", 78 ], 79 "Set_SEL_Time": [ 80 # raw command, expected output(s) 81 "0x0a 0x49", 82 "rsp=0xd5", 83 "not supported in present state", 84 "rsp=0xc7", 85 "Request data length invalid", 86 ], 87 "Clear_SEL": [ 88 # raw command, expected output(s) 89 "0x0a 0x47", 90 "0x43 0x4c 0x52 0xaa", 91 "sel clear", 92 "Clearing SEL", 93 "rsp=0xc5", 94 "Reservation cancelled or invalid", 95 "0x43 0x4c 0x52 0x00", 96 ], 97 "SEL_info": [ 98 # raw command 99 "0x0a 0x40" 100 ], 101 "Create_SEL": [ 102 # raw command, expected output, comment 103 "0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00", 104 "0x04", 105 "0x00 0xa0 0x04 0x07", 106 ], 107 "Get_SEL_Entry": [ 108 # raw command 109 "0x0a 0x43 0x00 0x00", 110 "0x00 0xff", 111 ], 112 }, 113 "Self_Test_Results": { 114 "Get": [ 115 # raw command, expected output(s), comment 116 "0x06 0x04", 117 "56 00", 118 "56h = Self Test function not implemented in this controller.", 119 ] 120 }, 121 "Device GUID": { 122 "Get": [ 123 # raw command, expected output(s), comment 124 "0x06 0x08", 125 "01 70 9b ae da 6f dd 9c b4 4c 36 be 66 c8 49 28", 126 "Get GUID bytes 1 through 16.", 127 ] 128 }, 129 "LAN_Config_Params": { 130 "Get": [ 131 # raw command, expected output, comment 132 "0x0c 0x02", 133 "11 02", 134 ( 135 "11 is Parameter revision, 02 is Configuration parameter data" 136 " e.g. Cipher Suite Entry count" 137 ), 138 ], 139 "Set": [ 140 # raw command, expected output, error response 141 "0x0c 0x01", 142 "11 00", 143 "Unknown (0x82)", 144 "Invalid data field in request", 145 ], 146 }, 147 "Payload": { 148 "Get_Payload_Activation_Status": [ 149 # raw command, expected output(s), comment 150 "0x06 0x4a 0x01", 151 "01 00 00", 152 ( 153 "1st byte is instance capacity, last two bytes is activation" 154 " status of instances" 155 ), 156 ], 157 "Activate_Payload": [ 158 # raw command, expected output(s), comment 159 "0x06 0x48 0x01 0x01 0xc6 0x00 0x00 0x00", 160 "00 00 00 00 ff 00 ff 00 6f 02 ff ff", 161 ( 162 "Last two bits are payload vlan number, - FFFFh if VLAN" 163 " addressing is not used" 164 ), 165 ], 166 "Deactivate_Payload": [ 167 # raw command, expected output(s), comment 168 "0x06 0x49 0x01 0x01 0x00 0x00 0x00 0x00", 169 "", 170 "Line feed only", 171 ], 172 "Get_Payload_Instance_Info": [ 173 # raw command, expected output(s), comment 174 "0x06 0x4b 0x01 0x01", 175 "00 00 00 00 00 00 00 00 00 00 00 00", 176 ( 177 "When the payload is activated, the first four bytes are the" 178 " session ID,otherwise it should be 00." 179 ), 180 ], 181 "Get_User_Access_Payload": [ 182 # raw command, 183 "0x06 0x4d" 184 ], 185 "Set_User_Access_Payload": [ 186 # raw command, 187 "0x06 0x4c" 188 ], 189 "Get_Channel_Payload_Version": [ 190 # raw command, 191 "0x06 0x4F" 192 ], 193 "Get_Channel_Payload_Support": [ 194 # raw command, 195 "0x06 0x4E" 196 ], 197 }, 198 "BIOS_POST_Code": { 199 "Get": [ 200 # raw command, expected output, comment 201 "0x30 0xe9", 202 "", 203 "Response bytes will vary in length depending on state of system", 204 "0x89", 205 "error response byte when host is powered off", 206 ] 207 }, 208 "Device ID": { 209 "Get": [ 210 # raw command, error response, error code 211 "0x06 0x01", 212 "Error: Unable to establish IPMI v2 / RMCP+ session", 213 "0xc7", 214 ] 215 }, 216 "Cold Reset": { 217 "reset": [ 218 # raw command 219 "0x06 0x02" 220 ] 221 }, 222 "lan_parameters": { 223 "get_ip": [ 224 # raw command 225 "0x0c 0x02 0x" 226 + BuiltIn().get_variable_value("${CHANNEL_NUMBER}") 227 + " 0x03 0 0", 228 ], 229 "get_ip_src": [ 230 # raw command 231 "0x0c 0x02 0x" 232 + BuiltIn().get_variable_value("${CHANNEL_NUMBER}") 233 + " 0x04 0 0", 234 ], 235 "get_dot1q": [ 236 # raw command 237 "0x0c 0x02 0x" 238 + BuiltIn().get_variable_value("${CHANNEL_NUMBER}") 239 + " 0x14 0 0", 240 ], 241 }, 242 "SDR_Info": { 243 "get": [ 244 # raw command 245 "0x04 0x20 1" 246 ] 247 }, 248 "Chassis_status": { 249 "get": [ 250 # raw command 251 "0x00 0x01" 252 ] 253 }, 254 "SEL_Info": { 255 "get": [ 256 # raw command 257 "0x0a 0x40" 258 ] 259 }, 260 "Watchdog": { 261 # Command action type 262 "Get": [ 263 # raw command, expected output(s), comment 264 "0x06 0x25", 265 "05 00 00 00 64 00", 266 "don't log bit enabled", 267 "85 00 00 00 64 00", 268 "don't log bit disabled", 269 "05 00 00 00 64 00", 270 "stop bit stop", 271 "45 00 00 00 64 00", 272 "stop bit resume", 273 "01 00 00 00 64 00", 274 "timer use FRB2", 275 "02 00 00 00 64 00", 276 "timer use POST", 277 "03 00 00 00 64 00", 278 "timer use OS", 279 "04 00 00 00 64 00", 280 "timer use SMS", 281 "05 00 00 00 64 00", 282 "timer use OEM", 283 "05 00 00 00 64 00", 284 "pre-timeout interrupt None", 285 "05 20 00 00 64 00", 286 "pre-timeout interrupt NMI", 287 "05 00 00 00 64 00", 288 "timeout action None", 289 "05 01 00 00 64 00", 290 "timeout action Reset", 291 "05 02 00 00 64 00", 292 "timeout action PowerDown", 293 "05 03 00 00 64 00", 294 "timeout action PowerCycle", 295 "01 00 00 02 00 00", 296 "timeout flag FRB2", 297 "02 00 00 04 00 00", 298 "timeout flag POST", 299 "03 00 00 08 00 00", 300 "timeout flag OS", 301 "04 00 00 10 00 00", 302 "timeout flag SMS", 303 "05 00 00 20 00 00", 304 "timeout flag OEM", 305 "05 00 00 00 30 35 30 35", 306 "Get should return 13.6 seconds", 307 "05 00 00 00 ff ff ff ff", 308 "Bit 6 not set when timer stopped", 309 "0x06 0x25 0x00", 310 "Get with one extra byte", 311 ], 312 "Set": [ 313 # raw command, expected output, comment 314 "0x06 0x24 0x05 0x00 0x00 0x00 0x64 0x00", 315 "none", 316 "don't log bit enabled", 317 "0x06 0x24 0x85 0x00 0x00 0x00 0x64 0x00", 318 "none", 319 "don't log bit disabled", 320 "0x06 0x24 0x05 0x00 0x00 0x00 0x64 0x00", 321 "none", 322 "stop bit stop", 323 "0x06 0x24 0x45 0x00 0x00 0x00 0x64 0x00", 324 "none", 325 "stop bit resume", 326 "0x06 0x24 0x01 0x00 0x00 0x00 0x64 0x00", 327 "none", 328 "timer use FRB2", 329 "0x06 0x24 0x02 0x00 0x00 0x00 0x64 0x00", 330 "none", 331 "timer use POST", 332 "0x06 0x24 0x03 0x00 0x00 0x00 0x64 0x00", 333 "none", 334 "timer use OS", 335 "0x06 0x24 0x04 0x00 0x00 0x00 0x64 0x00", 336 "none", 337 "timer use SMS", 338 "0x06 0x24 0x05 0x00 0x00 0x00 0x64 0x00", 339 "none", 340 "timer use OEM", 341 "0x06 0x24 0x05 0x00 0x00 0x00 0x64 0x00", 342 "none", 343 "pre-timeout interrupt None", 344 "0x06 0x24 0x05 0x20 0x00 0x00 0x64 0x00", 345 "none", 346 "pre-timeout interrupt NMI", 347 "0x06 0x24 0x05 0x00 0x00 0x00 0x64 0x00", 348 "none", 349 "timeout action None", 350 "0x06 0x24 0x05 0x01 0x00 0x00 0x64 0x00", 351 "none", 352 "timeout action Reset", 353 "0x06 0x24 0x05 0x02 0x00 0x00 0x64 0x00", 354 "none", 355 "timeout action PowerDown", 356 "0x06 0x24 0x05 0x03 0x00 0x00 0x64 0x00", 357 "none", 358 "timeout action PowerCycle", 359 "0x06 0x24 0x01 0x00 0x00 0x3e 0x00 0x00", 360 "none", 361 "timeout flag FRB2", 362 "0x06 0x24 0x02 0x00 0x00 0x3e 0x00 0x00", 363 "none", 364 "timeout flag POST", 365 "0x06 0x24 0x03 0x00 0x00 0x3e 0x00 0x00", 366 "none", 367 "timeout flag OS", 368 "0x06 0x24 0x04 0x00 0x00 0x3e 0x00 0x00", 369 "none", 370 "timeout flag SMS", 371 "0x06 0x24 0x05 0x00 0x00 0x3e 0x00 0x00", 372 "none", 373 "timeout flag OEM", 374 "0x06 0x24 0x01 0x02 0x00 0x00 0x20 0x00", 375 "none", 376 "Power down", 377 "0x06 0x24 0x01 0x01 0x00 0x00 0x20 0x00", 378 "none", 379 "Hard reset", 380 "0x06 0x24 0x01 0x03 0x00 0x00 0x20 0x00", 381 "none", 382 "Power cycle", 383 "0x06 0x24 0x01 0x00 0x00 0x00 0x20 0x00", 384 "none", 385 "No action", 386 "0x06 0x24 0x05 0x00 0x00 0x3e 0x30 0x35", 387 "none", 388 "Set for 13.6 seconds", 389 "0x06 0x24 0x05 0x00 0x07 0x00 0x50 0x00", 390 "none", 391 "Pre-timeout interval passes", 392 "0x06 0x24 0x05 0x00 0x04 0x00 0x0A 0x00", 393 "none", 394 "Pre-timeout interval fails", 395 "0x06 0x24 0x05 0x00 0x00 0x20 0xFF 0xFF", 396 "none", 397 "Bit 6 not set when timer stopped", 398 "0x06 0x24 0x05 0x00 0x08 0x00 0x64", 399 "none", 400 "Set with one less byte", 401 "0x06 0x24 0x05 0x00 0x08 0x00 0x64 0x00 0x00", 402 "none", 403 "Set with one extra byte", 404 ], 405 "Reset": [ 406 # raw command, expected output, comment 407 "0x06 0x22", 408 "none", 409 "Reset watchdog timer", 410 "0x06 0x22 0x00", 411 "none", 412 "Reset watchdog timer with extra byte", 413 "0x06 0x22", 414 "none", 415 "Reset watchdog timer without initialized watchdog", 416 ], 417 }, 418 "SOL": { 419 "Set_SOL": [ 420 # raw command, expected output(s), comment 421 "Invalid value", 422 "Valid values are serial, 9.6 19.2, 38.4, 57.6 and 115.2", 423 ] 424 }, 425 "Get SDR": { 426 "Get": [ 427 # Get SDR raw command without Reservation ID. 428 "0x0a 0x23 0x00 0x00 0x00 0x00 0x00 0xff", 429 # Netfunction and cmd. 430 "0x0a 0x23", 431 # Record ID offset and bytes to read. 432 "0x01 0x0f", 433 # Raw command To Get SDR Partial without Reservation ID. 434 "0x0a 0x23 0x00 0x00 0x00 0x00 0x01 0x0f", 435 ], 436 }, 437 "Get": { 438 "POH_Counter": [ 439 # raw command, error response 440 "0x00 0x0f", 441 "Error: Unable to establish IPMI v2 / RMCP+ session", 442 ] 443 }, 444 "Device_SDR": { 445 "Get_Info": [ 446 # raw command, expected output(s), comment 447 "0x04 0x20 0x00", 448 "0x04 0x20 0x01", 449 "rsp=0xc7", 450 "Request data length invalid", 451 "rsp=0xd4", 452 "Insufficient privilege level", 453 ], 454 "Get": [ 455 # raw command, expected output(s), comment 456 "0x04 0x21", 457 "0x00 0x00 0x00 0xff", 458 "rsp=0xc7", 459 "Request data length invalid", 460 ], 461 "Reserve_Repository": [ 462 # raw command, expected output(s), comment 463 "0x04 0x22", 464 "rsp=0xc7", 465 "Request data length invalid", 466 "rsp=0xd4", 467 "Insufficient privilege level", 468 "Reservation cancelled or invalid", 469 ], 470 }, 471 "System_Info": { 472 "param0_Set_In_Progress": { 473 "Get": [ 474 # raw command, expected output(s) 475 "0x06 0x59 0x00 0x00 0x00 0x00", 476 "Request data length invalid", 477 ], 478 "Set": [ 479 # raw command, expected output(s) 480 "0x06 0x58 0x00", 481 "Request data length invalid", 482 "Invalid data field in request", 483 ], 484 }, 485 "param1_System_Firmware_Version": { 486 "Get": [ 487 # raw command, expected output(s) 488 "0x06 0x59 0x00 0x01 0x00 0x00", 489 "Request data length invalid", 490 ], 491 "Set": [ 492 # raw command, expected output(s) 493 "0x06 0x58 0x01 0x00 0x00 0x0e", 494 "Invalid data field in request", 495 ], 496 }, 497 "param2_System_Name": { 498 "Get": [ 499 # raw command, expected output(s) 500 "0x06 0x59 0x00 0x02 0x00 0x00", 501 "Request data length invalid", 502 ], 503 "Set": [ 504 # raw command, expected output(s) 505 "0x06 0x58 0x02 0x00 0x00 0x0e", 506 "Invalid data field in request", 507 ], 508 }, 509 "param3_Primary_Operating_System_Name": { 510 "Get": [ 511 # raw command, expected output(s) 512 "0x06 0x59 0x00 0x03 0x00 0x00", 513 "Request data length invalid", 514 ], 515 "Set": [ 516 # raw command, expected output(s) 517 "0x06 0x58 0x03 0x00 0x00 0x0e", 518 "Invalid data field in request", 519 ], 520 }, 521 "param4_Operating_System_Name": { 522 "Get": [ 523 # raw command, expected output(s) 524 "0x06 0x59 0x00 0x04 0x00 0x00", 525 "Request data length invalid", 526 ], 527 "Set": [ 528 # raw command, expected output(s) 529 "0x06 0x58 0x04 0x00 0x00 0x0e", 530 "Invalid data field in request", 531 ], 532 }, 533 "param5_Present_OS_Version_number": { 534 "Get": [ 535 # raw command, expected output(s) 536 "0x06 0x59 0x00 0x05 0x00 0x00", 537 "Request data length invalid", 538 ], 539 "Set": [ 540 # raw command, expected output(s) 541 "0x06 0x58 0x05 0x00 0x00 0x0e", 542 "Invalid data field in request", 543 ], 544 }, 545 }, 546 "Get Channel Auth Cap": { 547 "get": [ 548 # raw command 549 "0x06 0x38", 550 ] 551 }, 552 "Cipher Suite": { 553 "get": [ 554 # raw command, supported algorithm 555 "0x06 0x54", 556 "03 44 81", 557 # 03 - HMAC-SHA256 558 # 44 - sha256_128 559 # 81 - aes_cbc_128 560 ] 561 }, 562 "SDR": { 563 "Get": [ 564 # Get SDR raw command without Reservation ID. 565 "0x0a 0x23 0x00 0x00 0x00 0x00 0x00 0xff", 566 # Netfunction and command. 567 "0x0a 0x23", 568 # Record ID offset and bytes to read. 569 "0x00 0x00 0x01 0x0f", 570 # Raw command To Get SDR Partial without reservation ID. 571 "0x0a 0x23 0x00 0x00 0x00 0x00 0x01 0x0f", 572 ], 573 "Reserve SDR Repository": [ 574 # raw command, expected output(s), comment 575 "0x0a 0x22", 576 ], 577 "SDR Repository Info": [ 578 # raw command. 579 "0x0a 0x20", 580 ], 581 "Get SDR allocation Info": [ 582 # raw command. 583 "0x0a 0x21" 584 ], 585 "Delete SDR": [ 586 # raw command. 587 "0x0a 0x26" 588 ], 589 "Partially Add SDR": [ 590 # raw command. 591 "0x0a 0x25" 592 ], 593 }, 594 "FRU": { 595 "Inventory_Area_Info": [ 596 # raw command, expected output(s), comment 597 "0x0a 0x10", 598 "Invalid data field in request", 599 "Request data length invalid", 600 ], 601 "Read": [ 602 # raw command 603 "0x0a 0x11", 604 ], 605 "Write": [ 606 # raw command 607 "0x0a 0x12", 608 ], 609 }, 610 "Chassis Capabilities": { 611 "Get": [ 612 # raw command, invalid data length 613 "0x00 0x00", 614 "0x00 0x00 0x01", 615 ] 616 }, 617} 618