-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestLAN.h
72 lines (57 loc) · 2.28 KB
/
testLAN.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef __TEST_LAN_H
#define __TEST_LAN_H
#include "cxxtest/TestSuite.h"
#include <iostream>
#include <fstream>
class TestLANSuite : public CxxTest::TestSuite
{
private:
unsigned char* blank_request;
public:
static TestLANSuite* createSuite() {
return new TestLANSuite();
}
static void destroySuite(TestLANSuite* suite) {
delete suite;
}
void setUp(){
MsgHandler::initCMD();
blank_request = new unsigned char[IpmiCommandDefines::MAX_DATA_SIZE];
blank_request[IpmiCommandDefines::NET_FN_INDEX] = 0x30;
}
void tearDown() {
MsgHandler::clearCMD();
delete blank_request;
}
//---------------------------------------------------
//---------- TEST Get LAN Configuration ----------
void testGetLANConfig(void) {
TS_TRACE("Testing Get LAN Configuration CMD -- default return expected");
blank_request[IpmiCommandDefines::COMMAND_INDEX] = 0x02;
blank_request[IpmiCommandDefines::COMMAND_INDEX+1] = 0x01; //Channel 1 default
blank_request[IpmiCommandDefines::COMMAND_INDEX+2] = 0x03; //
IpmiMessage request(blank_request, 25);
IpmiMessage testResponse;
MsgHandler::processRequest(request, testResponse);
TS_ASSERT_EQUALS(testResponse.data()[0], IpmiCommandDefines::COMP_CODE_OK);
TS_ASSERT_EQUALS(testResponse.data()[1], 0x00);
TS_ASSERT_EQUALS(testResponse.data()[2], 0x7F);
TS_ASSERT_EQUALS(testResponse.data()[3], 0x00);
TS_ASSERT_EQUALS(testResponse.data()[4], 0x00);
TS_ASSERT_EQUALS(testResponse.data()[5], 0x01);
}
//---------------------------------------------------
//---------- TEST Set LAN Configuration ----------
void testSetLANConfig(void){
TS_TRACE("Testing Set LAN Configuration CMD");
blank_request[IpmiCommandDefines::COMMAND_INDEX] = 0x01;
blank_request[IpmiCommandDefines::COMMAND_INDEX+1] = 0x01; //Channel 1 default
blank_request[IpmiCommandDefines::COMMAND_INDEX+2] = 0x00; //Change Set-in-progress
blank_request[IpmiCommandDefines::COMMAND_INDEX+3] = 0x01; //change to set in progress
IpmiMessage request(blank_request, 25);
IpmiMessage testResponse;
MsgHandler::processRequest(request, testResponse);
TS_ASSERT_EQUALS(testResponse.data()[0], IpmiCommandDefines::COMP_CODE_OK);
}
};
#endif