/// <summary> /// Switches Serial control from System serial port to Bmc to close console redirection /// </summary> public virtual SerialMuxSwitch ResetSerialMux() { //Sent an Ipmi Command ChannelAuthenticationCapabilities auth = GetAuthenticationCapabilities(PrivilegeLevel.Administrator, false); // try 1 more time, as serial console snooping my not have detected the 1st request if (auth.CompletionCode != 0) { auth = GetAuthenticationCapabilities(PrivilegeLevel.Administrator, false); } // create response package SerialMuxSwitch response = new SerialMuxSwitch(auth.CompletionCode); if (auth.CompletionCode == 0) { response.SetParamaters(true, true, true, true, true, true); } else { response.SetParamaters(true, false, true, true, false, true); } return(response); }
/// <summary> /// Switches Serial control from BMC to serial port for console redirection /// </summary> public virtual SerialMuxSwitch SetSerialMuxSwitch(byte channel) { // Switch mux to system SerialMuxSwitch response = SetSerialMux(channel, MuxSwtich.ForceSystem, true); if (response.CompletionCode == 0x00) { Thread.Sleep(TimeSpan.FromSeconds((setSerialMuxPollingTimeSeconds / 5))); } else if (response.CompletionCode == 0xD5) { // Loop until the mux has been set to BMC DateTime startTime = DateTime.Now; while (DateTime.Now.Subtract(startTime).TotalSeconds < setSerialMuxPollingTimeSeconds) { if ((response.CompletionCode == 0) && (response.MuxSetToSystem == true)) { break; } Thread.Sleep(6000); response = SetSerialMux(channel, MuxSwtich.ForceSystem, false); } } return(response); }
/// <summary> /// Switches Serial control from System serial port to Bmc to close console redirection /// </summary> public virtual SerialMuxSwitch ResetSerialMux(byte channel) { // Switch mux back to BMC SerialMuxSwitch response = SetSerialMux(channel, MuxSwtich.SwitchBmc, true); // Loop until the mux has been set to BMC DateTime startTime = DateTime.Now; while (DateTime.Now.Subtract(startTime).TotalSeconds < setSerialMuxPollingTimeSeconds) { if ((response.CompletionCode == 0) && (response.MuxSetToSystem == false)) { break; } Thread.Sleep(3000); response = SetSerialMux(channel, MuxSwtich.GetMuxSetting, true); } // Check for timeout if ((response.CompletionCode == 0) && (response.MuxSetToSystem == true)) { // Set to failure response.CompletionCode = 0xff; } return(response); }
/// <summary> /// Sends the IPMI command to BMC for SetSerialMux /// </summary> public virtual SerialMuxSwitch SetSerialMux(byte channel, MuxSwtich mux, bool retry) { SetSerialMuxResponse setMux = (SetSerialMuxResponse)this.IpmiSendReceive( new SetSerialMuxRequest(channel, mux), typeof(SetSerialMuxResponse), retry); SerialMuxSwitch response = new SerialMuxSwitch(setMux.CompletionCode); if (setMux.CompletionCode == 0) { setMux.GetMux(); response.SetParamaters( setMux.AlertInProgress, setMux.MessagingActive, setMux.MuxSetToSystem, setMux.MuxSwitchAllowed, setMux.RequestAccepted, setMux.RequestToBmcAllowed ); } else if (mux == MuxSwtich.ForceSystem && setMux.CompletionCode == 0xD5) { setMux.GetMux(); if (response.MuxSetToSystem) { response.CompletionCode = 0x00; response.SetParamaters( setMux.AlertInProgress, setMux.MessagingActive, setMux.MuxSetToSystem, setMux.MuxSwitchAllowed, setMux.RequestAccepted, setMux.RequestToBmcAllowed ); } } return(response); }