mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	Openbmc hardware control with OP940
This commit is contained in:
		| @@ -25,6 +25,8 @@ use xCAT::TableUtils; | ||||
| my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py"; | ||||
|  | ||||
| my $header = HTTP::Headers->new('Content-Type' => 'application/json'); | ||||
| # Currently not used, example of header to use for authorization | ||||
| #my $header = HTTP::Headers->new('X-Auth-Token' => 'xfMHrrxdMgbiITnX0TlN'); | ||||
|  | ||||
| sub new { | ||||
|     my $async = shift; | ||||
| @@ -44,8 +46,16 @@ sub send_request { | ||||
|     my $method = shift; | ||||
|     my $url = shift; | ||||
|     my $content = shift; | ||||
|     my $username = shift; | ||||
|     my $password = shift; | ||||
|  | ||||
|     my $request = HTTP::Request->new( $method, $url, $header, $content ); | ||||
|     if (defined $username and defined $password) { | ||||
|         # If username and password were passed in use authorization_basic() | ||||
|         # This is required to connect to BMC with OP940 level, ignored for  | ||||
|         # lower OP levels | ||||
|         $request->authorization_basic($username, $password); | ||||
|     } | ||||
|     my $id = $async->add_with_opts($request, {}); | ||||
|     return $id; | ||||
| } | ||||
|   | ||||
| @@ -2452,7 +2452,7 @@ sub gen_send_request { | ||||
|         } | ||||
|         process_debug_info($node, $debug_info); | ||||
|     } | ||||
|     my $handle_id = xCAT::OPENBMC->send_request($async, $method, $request_url, $content); | ||||
|     my $handle_id = xCAT::OPENBMC->send_request($async, $method, $request_url, $content, $node_info{$node}{username}, $node_info{$node}{password}); | ||||
|     $handle_id_node{$handle_id} = $node; | ||||
|     $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; | ||||
|  | ||||
| @@ -4212,7 +4212,7 @@ sub rspconfig_dump_response { | ||||
| sub dump_download_process { | ||||
|     my $node = shift; | ||||
|  | ||||
|     my $request_url = "$http_protocol://" . $node_info{$node}{bmc}; | ||||
|     my $request_url = "$http_protocol://" . $node_info{$node}{username} . ":" . $node_info{$node}{password} . "@" . $node_info{$node}{bmc}; | ||||
|     my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; | ||||
|     my $content_logout = '{ "data": [ ] }'; | ||||
|     my $cjar_id = "/tmp/_xcat_cjar.$node"; | ||||
| @@ -4876,7 +4876,7 @@ sub rflash_response { | ||||
|  | ||||
| sub rflash_upload { | ||||
|     my ($node, $callback) = @_; | ||||
|     my $request_url = "$http_protocol://" . $node_info{$node}{bmc}; | ||||
|     my $request_url = "$http_protocol://" . $node_info{$node}{username} . ":" . $node_info{$node}{password} . "@" . $node_info{$node}{bmc}; | ||||
|     my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; | ||||
|     my $content_logout = '{ "data": [ ] }'; | ||||
|     my $cjar_id = "/tmp/_xcat_cjar.$node"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user