Added sessionId context in host-ipmid, used by GetSessionInfo

SessionId is now passed to host-ipmid context along with userid
and privilege information. This will enable certain commands to know
the current sessionid

Added option to get current session info in get session info command.

With this change, we can get the current session info by passing
sessionIndex as zero in get session info command via lan interface and
the same via host interface will return an error, beacuse no session
will be created for host interface.

Tested:

ipmitool -I lanplus -U <user> -P <password> -H <lan1_ip> raw 6 0x3d <Zero>
Response : gives currents session info

ipmitool -I lanplus -U <user> -P <password> -H <lan2_ip> raw 6 0x3d <Zero>
Response : gives currents session info

//host interface
ipmitool raw 6 0x3d 0
Response: 0xCC // invalid field in the request

//This command shows info of all sessions, which includes current
session info as well.
ipmitool -I lanplus -U <user> -P <password> -H <lan1_ip> session info all
session handle                : 129
slot count                    : 45
active sessions               : 1
user id                       : 1
privilege level               : ADMINISTRATOR
session type                  : IPMIv1.5
channel number                : 0x03
console ip                    : 0.0.0.0
console mac                   : 00:00:00:00:00:00
console port                  : 52670

session handle                : 0
slot count                    : 45
active sessions               : 1

//This command shows info of all sessions, which includes current
session info as well.
ipmitool -I lanplus -U <user> -P <password> -H <lan2_ip> session info all
session handle                : 0
slot count                    : 45
active sessions               : 1

session handle                : 1
slot count                    : 45
active sessions               : 1
user id                       : 1
privilege level               : ADMINISTRATOR
session type                  : IPMIv1.5
channel number                : 0x01
console ip                    : 0.0.0.0
console mac                   : 00:00:00:00:00:00
console port                  : 57622

//host interface
ipmitool session info all
session handle                : 0
slot count                    : 45
active sessions               : 0

session handle                : 0
slot count                    : 45
active sessions               : 0

Tested other postive and negative test cases for get session info
command in Lan1, Lan2 and host interfaces. All are working fine.

Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com>
Change-Id: I9fb1ef12693e4c0da3661ffdf21eec248b48b5b4
4 files changed