A method and device for verifying batch configuration of server management ports

CN118972247BActive Publication Date: 2025-01-03POWERLEADER COMPUTER SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411376522.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-03
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

In the prior art, the batch configuration of server management ports is inefficient and prone to errors, and requires manual configuration, resulting in inefficiency and difficulty in verification.

Method used

The server management port batch configuration verification method is used to connect to the switch through the host computer, and the server management port information is automatically configured and verified using the SSH protocol and Redfish interface, including IP address, subnet mask and gateway address, and the configuration relationship table and The dormant mechanism realizes an automated process.

Benefits of technology

It realizes automated batch configuration and verification of the server management port, improves efficiency, reduces manual operations, avoids errors, and meets the management needs of cloud server computer rooms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972247B_ABST
    Figure CN118972247B_ABST
Patent Text Reader

Abstract

This invention relates to a method and apparatus for batch configuration verification of server management ports. The method includes: a host computer randomly connecting to a server to be configured via a switch; the host computer obtaining the serial number of the connected server; configuring the management port information of the connected server based on a configuration relationship table; the host computer's main thread executing a sleep operation for a preset sleep time; and the host computer repeating the above operations until the management port information of all servers is configured. This method and apparatus can automatically batch configure server management port information and simultaneously verify whether the configuration is complete. It efficiently, simply, and quickly solves the problem of manual configuration in existing technologies, greatly improving efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of servers, and in particular to a method and device for batch configuration verification of server management ports. Background Art

[0002] When the server leaves the factory, it is generally configured uniformly, and the server management port also has a unified IP address, subnet mask, and gateway address. However, when the server arrives at the cloud server room, it will be installed in batches and put on the shelves. Then, it is necessary to configure different IP addresses, subnet masks, and gateway addresses for the management port for the actual later deployment and operation of the cloud server. Therefore, the operation and maintenance personnel need to configure the management port information of each server. When the server is put on the shelf in the computer room, the server is generally divided into column numbers and cabinet numbers for deployment, and then the network cables are uniformly connected. Finally, the server management port information needs to be configured. At present, the operator needs to check one by one according to the serial number SN, and then connect to the web page of the baseboard management controller BMC WEB, or enter the basic input and output system BIOS interface to configure the address information of the management port. This manual configuration method is inefficient and prone to errors. It is not convenient to verify whether the configuration is successful later.

[0003] In actual operation, for example, if all new servers connected under the same switch need to be put on the shelf, in the prior art, it is necessary to first connect the first server to the switch, then connect the host computer to the switch, configure the information of the first server through the host computer, and then connect the second server to the switch, and configure the information of the second server through the host computer, and repeat this process until all servers under the switch are configured one by one. Summary of the invention

[0004] The present invention provides a method and device for batch configuration verification of server management ports, aiming to solve at least one of the technical problems existing in the prior art.

[0005] The technical solution of the present invention is a server management port batch configuration verification method, which is applied to a server management port batch configuration verification device, which includes a host computer, a switch and multiple servers, the host computer and the multiple servers are respectively connected to the switch, and the servers are in a waiting state. The server management port batch configuration verification method includes the following steps:

[0006] S100, the host computer is randomly connected to a server to be configured through a switch;

[0007] S200, the host computer obtains the serial number of the connected server;

[0008] S300, configuring the management port information of the connected server based on the configuration relationship table;

[0009] S400, the host computer main thread performs a sleep operation for a preset sleep time, waiting for the switch to switch to the next server address to be configured that can be connected;

[0010] S500: The host computer repeats steps S100 to S400 until the management port information of all servers is configured.

[0011] Furthermore, the server management port batch configuration verification method also includes the following steps:

[0012] S600, configuring the management port information of the host computer to be in the same network segment as the configured server;

[0013] S700, the host computer batch checks the management port information of the server.

[0014] Further, the step S100 includes:

[0015] S110, configuring the management port information of the host computer so that the host computer and the server to be configured are in the same network segment. When not configured, the multiple servers are in the factory default configuration state, and the management information of the multiple servers is consistent. The management port information includes IP address information, subnet mask information and gateway address information;

[0016] S120. Based on the SSH protocol, the host computer is randomly connected to the management port of a server through a switch.

[0017] Further, the step S200 includes:

[0018] S210, the host computer logs in to the super account of the baseboard management controller BMC of the connected server through SSH;

[0019] S220, the host computer sends an ipmitool command to the connected server to query fru information;

[0020] S230: The connected server returns a first reply message to the host computer, and the host computer extracts the serial number of the connected server from the first reply message.

[0021] Further, the step S300 includes:

[0022] S310, searching the serial number of the connected server in the configuration relationship table, and obtaining the management port information that needs to be configured for the connected server, wherein the configuration relationship table at least includes the serial numbers of all servers to be connected, the IP address information to be configured, the subnet mask information to be configured, and the gateway address information to be configured;

[0023] S320: The host computer requests the Redfish interface in a patch manner to configure the management port information that needs to be configured for the connected server to the baseboard management controller BMC of the connected server.

[0024] Furthermore, in the step S400, the preset sleep time is used to prevent the host computer from connecting to a server that has been configured with management port information when the host computer performs the next connection, and the preset sleep time is between 15 seconds and 30 seconds.

[0025] Further, in the step S600, if the configured servers are in multiple different network segments, the management information of the host computer will be sequentially configured as the network segments of the configured servers;

[0026] In the step S600, the IP address information, subnet mask information and gateway address information of the host computer are configured by using the netifaces library of python.

[0027] Further, the step S700 includes:

[0028] S710, based on SSH mode, the host computer batch-concurrently connects to all servers in the same network segment;

[0029] S720, the host computer sends an ipmitool command to all connected servers in the same network segment to query fru information;

[0030] S730, the connected server in the same network segment returns a second reply message to the host computer, and the host computer extracts the serial number of the connected server from the second reply message, matches it with the information in the configuration relationship table, and verifies whether the management port information of all servers in the same network segment is configured correctly;

[0031] S740, when the batch verification is completed, the host computer is modified to have the management port information of the same network segment as the original state of the factory server.

[0032] Furthermore, in step S600 and step S700, if the configured servers are in multiple different network segments, the management information of the host computer will be configured as the network segments of the configured servers in sequence.

[0033] Furthermore, the present invention also proposes a server management port batch configuration verification device, the server management port batch configuration verification device is used to execute the server management port batch configuration verification method, the server management port batch configuration verification device comprises:

[0034] Host computer;

[0035] A switch, wherein the host computer is electrically connected to the switch;

[0036] The number of the servers is at least one, and the servers are respectively connected to the switches.

[0037] The beneficial effects of the present invention are:

[0038] The server management port batch configuration verification method and device can automatically configure server management port information in batches, and at the same time batch verify whether the management port information has been configured, which efficiently, concisely and quickly solves the problem of manual configuration one by one in the prior art, greatly improving efficiency.

[0039] The method for batch configuration and verification of server management ports is an automated process, which greatly reduces manual operations; it does not rely on the operating system OS, and is only set by connecting to the background system of the baseboard management controller BMC; the configuration process is efficient and fast, and meets actual business needs; by parsing the data table Excel to configure and verify the information of the management port of the baseboard management controller BMC, the process from data to data is realized to prevent mistakes; not only the IP addresses are configured in batches, but also a double insurance process of batch verification of the management port information is added; the equipment requirements are low, only common equipment such as laptops and switches are required, and there are no special equipment requirements, which is efficient and practical.

[0040] Specifically, the server management port batch configuration verification method connects the new server to the switch at one time, randomly connects to the switch through the upper computer, and then configures the connected server. After an appropriate period of sleep, the switch automatically switches to the next connectable address, and then randomly connects to another server to be configured for configuration until all servers to be configured are configured. The server management port batch configuration verification method avoids the trouble of rewiring each time the configuration is completed by a single wiring and multiple configurations. At the same time, remote operation can be realized without the need for operation and maintenance personnel to stay in the computer room for a long time, thereby improving work efficiency and meeting the management requirements of the server computer room. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is the overall flow chart of the batch configuration verification method for the server management port.

[0042] Figure 2The present invention is a flowchart of an embodiment of a method for batch configuration verification of server management ports.

[0043] Figure 3 Schematic diagram of batch configuration verification device for server management ports.

[0044] Figure 4 A schematic diagram of the structure of an embodiment of a device for batch configuration verification of server management ports.

[0045] Figure 5 This is a schematic diagram of the configuration relationship table in the batch configuration verification method of the server management port.

[0046] Figure 6 This is a schematic diagram of obtaining the server serial number in the batch configuration verification method of the server management port.

[0047] Reference numerals: 100, host computer; 200, switch; 300, server. DETAILED DESCRIPTION

[0048] The following will be combined with the embodiments and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention, so as to fully understand the purpose, scheme and effect of the present invention. It should be noted that the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0049] It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to the other feature, or it may be indirectly fixed or connected to the other feature. In addition, the descriptions of up, down, left, right, top, bottom, etc. used in the present invention are only relative to the relative positional relationship of the components of the present invention in the drawings.

[0050] In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art. The terms used in this specification are only for describing specific embodiments, not for limiting the present invention. The term "and / or" used herein includes any combination of one or more related listed items.

[0051] It should be understood that, although the terms first, second, third, etc. may be used to describe various elements in the present disclosure, these elements should not be limited to these terms. These terms are only used to distinguish elements of the same type from each other. For example, without departing from the scope of the present disclosure, the first element may also be referred to as the second element, and similarly, the second element may also be referred to as the first element.

[0052] Reference Figures 1 to 6In some embodiments, the technical solution of the present invention is a server management port batch configuration verification method, the server management port batch configuration verification method is applied to a server management port batch configuration verification device, the server management port batch configuration verification device includes a host computer 100, a switch 200 and multiple servers 300, the host computer 100 and the multiple servers 300 are respectively connected to the switch 200, the server 300 is in a state to be configured, refer to Figure 1 and Figure 2 The server management port batch configuration verification method comprises the following steps:

[0053] S100, the host computer 100 is randomly connected to a server 300 to be configured through a switch 200;

[0054] S200, the host computer 100 obtains the serial number of the connected server 300;

[0055] S300, configuring the management port information of the connected server 300 based on the configuration relationship table;

[0056] S400, the main thread of the host computer 100 performs a sleep operation for a preset sleep time, waiting for the switch 200 to switch to the address of the next server 300 to be configured that can be connected;

[0057] S500 , the host computer 100 repeats step S100 to step S400 until the management port information of all servers 300 is configured.

[0058] The beneficial effects of the present invention are:

[0059] The server management port batch configuration verification method and device can automatically batch configure the server 300 management port information, and at the same time batch verify whether the management port information is configured, which efficiently, concisely and quickly solves the problem of manual configuration one by one in the prior art, greatly improving efficiency.

[0060] Specifically, the server management port batch configuration verification method connects the new server to the switch at one time, randomly connects to the switch through the upper computer, and then configures the connected server. After an appropriate period of sleep, the switch automatically switches to the next connectable address, and then randomly connects to another server to be configured for configuration until all servers to be configured are configured. The server management port batch configuration verification method avoids the trouble of rewiring each time the configuration is completed by configuring multiple times after a single connection. At the same time, remote operation can be realized without the need for operation and maintenance personnel to stay in the computer room for a long time, thereby improving work efficiency and meeting the management requirements of the server computer room.

[0061] In step S100, the host computer 100 is randomly connected to a server 300 to be configured through a switch 200 and configured, which is a main technical point of the present invention. It achieves the effect of one connection and multiple configurations in a "random" manner, which greatly improves the efficiency of the configuration work of the new server.

[0062] The method for batch configuration and verification of server management ports is an automated process, which greatly reduces manual operations; it does not rely on the operating system OS, and is only set by connecting to the background system of the baseboard management controller BMC; the configuration process is efficient and fast, meeting actual business needs; by parsing the data table file Excel to configure and verify the information of the management port of the baseboard management controller BMC, the process from data to data is realized to prevent mistakes; not only the IP addresses are configured in batches, but also a double insurance process of batch verification of the management port information is added; the equipment requirements are low, only common equipment such as laptops and switches 200 are needed, no special equipment requirements are required, and it is efficient and practical.

[0063] After the server 300 is put on the rack in the computer room, according to the relationship data between the serial number SN of the server 300 and the management port IP address, the server 300 configuration is the management port address of all servers 300 connected to a switch 200, which has nothing to do with the specific number of servers 300. Every time the host computer 100 controls the computer to plug in the switch 200, it can only randomly connect to one server 300, because the IP addresses of other servers 300 are the same (the actual situation of the switch 200 is that the IP addresses are all the same), then you can log in to the baseboard management controller BMC backend by simulating SSH, and obtain the serial number SN through the ipmitool fru information, and Product Serial is the serial number SN.

[0064] Further, refer to Figure 1 and Figure 2 The server management port batch configuration verification method also includes the following steps:

[0065] S600, configuring the management port information of the host computer 100 to be in the same network segment as the configured server 300;

[0066] S700 , the host computer 100 batch checks the management port information of the server 300 .

[0067] Further, refer to Figure 1 and Figure 2 , the step S100 comprises:

[0068] S110, configuring the management port information of the host computer 100 so that the host computer 100 and the server 300 to be configured are in the same network segment. When not configured, the multiple servers 300 are in the factory default configuration state, and the management information of the multiple servers 300 is consistent. The management port information includes IP address information, subnet mask information and gateway address information;

[0069] S120 , based on the SSH protocol, the host computer 100 is randomly connected to the management port of a server 300 through the switch 200 .

[0070] Specifically, in step S100, the factory-produced management port information of the server 300 is a fixed unified IP address, subnet mask and gateway address, so the host computer 100 controls the computer to first configure an IP address in the same network segment as this IP address, and then it can randomly connect to the management port address of the previous server 300.

[0071] The step S120 includes:

[0072] S121, the host computer 100 creates an SSH object through the SSHClient class in the Paramiko module of Python;

[0073] S122. The SSH object connects to the corresponding server through the server's IP address, user name, password, and port.

[0074] Further, refer to Figure 1 and Figure 2 , the step S200 comprises:

[0075] S210, the host computer 100 logs in to the super account of the baseboard management controller BMC of the connected server 300 through SSH;

[0076] S220, the host computer 100 sends an ipmitool command to the connected server 300 to query fru information;

[0077] S230 , the connected server 300 returns a first reply message to the host computer 100 , and the host computer 100 extracts the serial number of the connected server 300 from the first reply message.

[0078] Specifically, in steps S210 and S220, referring to Figure 6 , the host computer 100 controls the computer to log in to the server 300 through SSH, and then logs in through the baseboard management controller BMC super user. The serial number SN information of the connected server 300 can be obtained through the ipmitool fru command output, refer to Figure 6, Product Serial is the serial number SN of the currently connected server 300.

[0079] In a specific embodiment, the implementation codes of S210 to S230 are as follows:

[0080] try:

[0081] ssh = paramiko.SSHClient()

[0082] ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

[0083] ssh.connect(hostname=ip, port=port, username=username, password=password)

[0084] except Exception as e:

[0085] message = "Failed to connect to device {}: {}".format(device_number, e)

[0086] log.error(message)

[0087] run_log[device_number] = {"message":message, "status":False}

[0088] result_list.append({"SN":None,"Result":"Fail","BMC IP":None,"gateway":None,"netmask":None,"Description":"Device connection failed!"})

[0089] send_data_ip_config(self, message, status, is_end)

[0090] ssh.close()

[0091] continue

[0092] # Get the sn number in the device

[0093] log.info("Start getting the sn number of the device")

[0094] # if serial_type == "product":

[0095] , result_sn_stdout, result_sn_stderr = ssh.exec_command("ipmitool fruprint 0 | awk -F ': ' ' / Product Serial / {print $2}'")

[0096] result_sn_error = result_sn_stderr.read().decode("utf-8")

[0097] if result_sn_error != '':

[0098] message = "Modify the ip configuration of device {}, and fail to obtain the sn number of the device {}".format(device_number, result_sn_error)

[0099] log.error(message)

[0100] run_log[device_number] = {"message":message, "status":False}

[0101] result_list.append({"SN":None,"Result":"Fail","BMC

[0102] IP":None,"gateway":None,"netmask":None,"Description":"Failed to get the device's sn number!"})

[0103] send_data_ip_config(self, message, status, is_end)

[0104] ssh.close()

[0105] continue

[0106] product_serial = result_sn_stdout.read().decode("utf-8").strip()

[0107] log.info("The sn number of the {}th device is {}".format(device_number,product_serial))

[0108] Further, refer to Figure 1 and Figure 2 , the step S300 comprises:

[0109] S310, searching the serial number of the connected server 300 in the configuration relationship table, and obtaining the management port information that needs to be configured for the connected server 300, wherein the configuration relationship table at least includes the serial numbers of all servers 300 to be connected, the IP address information to be configured, the subnet mask information to be configured, and the gateway address information to be configured;

[0110] S320 , the host computer 100 requests the Redfish interface in a patch manner, and configures the management port information required to be configured of the connected server 300 to the baseboard management controller BMC of the connected server 300 .

[0111] In step S300, refer to Figure 1 and Figure 5 Before installing server 300, the computer room manager will provide a configuration relationship table between the server 300 serial number SN and the management port information. The configuration relationship table is generally an Excel table. The host computer 100 control computer can read the content of the data table file Excel through Python's pandas library, and then parse out the one-to-one correspondence between the serial number SN and the actual setting information of the management port.

[0112] Through step S310, the management port IP address, subnet mask and gateway address information that need to be configured of the connected server 300 are queried. By using the redfish interface, which is the interface information of the self-developed PR2715E of the server 300, a command is sent to the server 300 to complete the configuration of the baseboard management controller BMC management port, which is specifically configured as the actual IP address, subnet mask and gateway address information of bond0.

[0113] The redfish interface address is:

[0114] / / {{ip}} / redfish / v1 / Managers / 1 / EthernetInterfaces / bond0

[0115] Among them: redfish indicates the interface protocol, v1 indicates version 1, Managers / 1 / EthernetInterfaces / bond0 indicates the setting of management port Ethernet bond0, and bond0 is the name of the management port. In addition, before the request, you need to log in to the baseboard management controller BMC information and obtain the token through the post request as verification.

[0116] Specifically, the actual request method of the Redfish protocol request parameters is: Patch,

[0117] The request address is:

[0118] / / {{ip}} / redfish / v1 / Managers / 1 / EthernetInterfaces / bond0

[0119] The parameters are:

[0120] "IPv4StaticAddresses":[

[0121] "Address": "192.168.44.230",

[0122] "AddressOrigin":"static",

[0123] "Gateway": "192.168.44.254"

[0124] "SubnetMask":"255.255.255.0].

[0125] In a specific embodiment, the implementation code of S320 is as follows:

[0126] try:

[0127] match = response.headers['ETag']

[0128] # l = response.headers

[0129] headers1 = {

[0130] "Content-Type": "application / json",

[0131] "X-Auth-Token": token,

[0132] "If-Match'": match}

[0133] new_network = result_dict.get(product_serial)

[0134] log.info("The IP configuration that needs to be configured for the {}th device is {}".format(device_number, new_network))

[0135] new_ip = new_network.get("BMC IP")

[0136] gateway = new_network.get("gateway")

[0137] netmask = new_network.get("netmask")

[0138] body1={"IPv4StaticAddresses":[{"Address":new_ip,"SubnetMask":netmask,"Gateway":gateway, "AddressOrigin":"Static"}]}

[0139] response1 = requests.patch(

[0140] " / / "+ip+" / redfish / v1 / Managers / 1 / EthernetInterfaces / bond0",

[0141] headers=headers1, # add request header

[0142] json=body1,

[0143] stream=False,

[0144] verify=False )

[0145] if response1.status_code == 200 or response1.status_code == 201:

[0146] message = "Change the ip of device {}, sn number to {}, change the ip to {}, gateway to {}, subnet mask to {} successfully".format(device_number, product_serial, new_ip, gateway, netmask)

[0147] log.info(message)

[0148] run_log[device_number] = {"message":message, "status":True}

[0149] result_list.append({"SN":product_serial,"Result":"Success","BMC IP":new_ip,"gateway":gateway,"netmask":netmask,"Description":"Network configuration successful!"})

[0150] status = "success"

[0151] send_data_ip_config(self, message, status, is_end)

[0152] sleep(26)

[0153] except Exception as e:

[0154] message = "Failed to connect to device {}: {}".format(device_number, e)

[0155] log.error(message)

[0156] run_log[device_number] = {"message":message, "status":False}

[0157] result_list.append({"SN":None,"Result":"Fail","BMC IP":None,"gateway":None,"netmask":None,"Description":"Device connection failed!"})

[0158] send_data_ip_config(self, message, status, is_end)

[0159] Further, refer to Figure 1 and Figure 2 In step S400, the preset sleep time is used to prevent the host computer 100 from connecting to a server 300 that has been configured with management port information when the host computer 100 performs the next connection. The preset sleep time is between 15 seconds and 30 seconds.

[0160] Specifically, in step S400, the main thread of the host computer 100 performs a sleep operation for a preset sleep time, which is the time for the main thread to wait for the switch to switch to the next connectable IP address. During this period, the host computer is kept powered on to ensure the survival of the main thread. The main thread has a preset sleep time that is greater than the time for the switch to automatically switch to the next connectable IP address, ensuring that it can reliably connect to the next connectable IP address.

[0161] After configuring a server, the host computer 100 cannot connect to the next server 300 to be configured, which is equivalent to the port state. The main thread must wait for the switch 200 to automatically switch to the next connectable server IP address. If there is no connection for more than 30 seconds (actual test data of multiple switches), it means that the configuration has been completed.

[0162] In addition, the switching time of the switch connection should also be considered. After a server is successfully modified, the host computer is temporarily unable to ping any device. The sleep time is adjusted according to the actual situation.

[0163] Specifically, when actually configuring the server 300, since it is illegal to connect multiple identical IP addresses to the switch 200 at the same time, after configuring the management port information of a server 300, it is necessary to put the operating program into sleep for 15 to 30 seconds before connecting to the same IP address to prevent the connected server 300 from being the management port of the previously configured server 300.

[0164] In a specific embodiment, each time a configuration is completed, the device will sleep for more than ten seconds before proceeding to the next configuration. In the actual multiple switches 200, it will take more than 10 seconds to switch to another management port. Of course, in order to avoid the situation where the switch cannot be made, the final batch verification step will verify whether the configuration is successful.

[0165] Further, in the step S600, if the configured server 300 is in a plurality of different network segments, the management information of the host computer 100 will be sequentially configured as the network segments of the configured server 300;

[0166] In the step S600, the IP address information, subnet mask information and gateway address information of the host computer 100 are configured by using the Python netifaces library.

[0167] Specifically, in step S600, in a specific embodiment, the configured IP addresses in a sub-table form selected from the general table according to the cabinet number or the switch 200 rule are generally in the same network segment, the IP address of the sub-table is parsed, and then 1 is subtracted from the end of the initial IP address to configure the IP address of the host computer 100 to control the computer. For example, the IP address of the baseboard management controller BMC in the configuration relationship table is 192.168.44.23, 192.168.44.24, 192.168.44.25..., after parsing the data, the IP address of the host computer 100 to control the computer is set to 192.168.44.22 (synchronously verify whether it is the same as the actually configured management port IP).

[0168] Use Python's netifaces library to configure the Ethernet port IP address, subnet mask, gateway address and other information of the host computer 100 control computer. After the configuration is completed, you can start the verification.

[0169] The following is a specific embodiment:

[0170] import subprocess

[0171] def configure_network(interface_name, ip_address, subnet_mask,gateway):

[0172] # Set static IP address and subnet mask

[0173] # Set up the gateway

[0174] subprocess.run(f"netsh interface ip set address name={interface_name} static {ip_address} {subnet_mask} {gateway}", shell=True, check=True)

[0175] print(f"The gateway has been set to {gateway}")

[0176] # Example usage

[0177] if __name__ == "__main__":

[0178] interface_name = "Ethernet" # Replace with your network interface name

[0179] ip_address = "192.168.44.22"

[0180] subnet_mask = "255.255.255.0"

[0181] gateway = "192.168.44.254"

[0182] configure_network(interface_name, ip_address, subnet_mask,gateway)

[0183] Further, refer to Figure 1 and Figure 2 , the step S700 includes:

[0184] S710, based on SSH mode, the host computer 100 batches and concurrently connects to all servers 300 in the same network segment;

[0185] S720, the host computer 100 sends an ipmitool command to all connected servers 300 in the same network segment to query fru information;

[0186] S730, the connected server 300 in the same network segment returns a second reply message to the host computer 100, and the host computer 100 extracts the serial number of the connected server 300 from the second reply message, matches it with the information in the configuration relationship table, and verifies whether the management port information of all servers 300 in the same network segment is configured correctly;

[0187] S740, when the batch verification is completed, the upper computer 100 is modified to have the management port information of the same network segment as the original state of the factory server 300.

[0188] In a specific embodiment, after step S720, it is also necessary to send an ipmitool lan print command to verify the configured IP, subnet mask, and gateway information.

[0189] In step S730, the IP address, subnet mask and gateway information of the server are obtained through ipmitool lan print, and the IP address, subnet mask and gateway of the server are verified with the data in the form.

[0190] Specifically, after completing the configuration of the management ports of all servers 300 on a switch 200 (generally managing servers 300 in 2 to 3 cabinets), since the configuration information is still cached inside the program and the host computer 100 control computer and the switch 200 are also in a connected state, the next step of verification can be performed based on the configuration relationship table information.

[0191] In step S710 to step S730, since the management ports of the servers 300 on the switch 200 have been configured and the IP port of the host computer 100 controlling the computer has also completed the modification of the IP address, the IP addresses that need to be tested and verified can be connected in batches through SSH. After connecting through SSH, the serial number SN of each server 300 is obtained through the ipmitool fru print 0 command, and verified with the configuration relationship table. When all the verifications are completed, it means that the configuration is successful.

[0192] When the batch verification is completed, the Ethernet port of the host computer 100 is modified again to an IP address in the same network segment as the original state of the factory server 300. At this point, the batch configuration and verification of the server 300 management port information is completed, and you can switch to the next switch 200 to continue configuration.

[0193] In step S740, if there are different network segments, the configuration process remains unchanged. The difference is that the verification process needs to repeat the process of steps S710 to S740. If there are two network segments (generally there are at most two network segments), it can be analyzed when parsing the Excel form. After completing the verification of the first network segment, repeat steps S710 to S740 to configure the IP address of one more network segment of the local machine to complete the verification of all IP addresses configured in the second network segment.

[0194] Furthermore, in step S600 and step S700 , if the configured servers 300 are in multiple different network segments, the management information of the host computer 100 will be configured as the network segments of the configured servers 300 in sequence.

[0195] Network segment collapse: If the configuration relationship table shows a network segment collapse, that is, the management port address that needs to be configured appears in more than one network segment, with a maximum of two network segments (this actual situation rarely occurs, and the number of network ports of the general switch 200 will not exceed 128). At this time, the IP address needs to be automatically configured once more during verification. In an example, if 192.168.44.121, 192.168.44.122, 192.168.45.98, and 192.168.45.99 appear in the configuration relationship table, the Ethernet IP address of the host computer 100 control computer needs to be configured to a network segment such as 192.168.44.10, and an automatic verification is performed once, and then it is automatically configured to a network segment such as 192.168.45.10, and the IP address information of the remaining 45.x network segments is verified.

[0196] In addition, in some instances, virtual LAN (Vlan) restrictions occur. In fact, the switch 200 in the cloud server room is configured with a virtual LAN (Vlan). If the switch 200 does not have a virtual LAN (Vlan), you only need to import the information in the configuration relationship table into the switch and the corresponding server to be configured to complete all configurations at one time. If the switch 200 is configured with a virtual LAN (Vlan), you need to first configure the management port information of N-1 servers 300, and then configure the management port configuration of the switch 200 that has the network cable unplugged (the same applies to batch verification).

[0197] The virtual LAN Vlan configuration indicates that only ports with virtual LAN Vlan can be connected. When there is no virtual LAN Vlan port, although it is connected to the switch 200, it cannot be connected. The initial situation is that the switch 200 is not configured with virtual LAN Vlan. You only need to insert a network cable into the empty port position of the switch 200 to connect the control end and the server 300. When there is a virtual LAN Vlan, you need to unplug a network port originally connected to the server 300 and then insert the network cable of the control end. There will be one less machine to configure and verify. Finally, the last machine is configured separately. Compared with the setting without virtual LAN Vlan, it is equivalent to doing one more configuration and verification.

[0198] Each port of the switch itself has a default virtual LAN Vlan. In the example, the virtual LAN Vlan settings will be reconfigured on the switch, which is equivalent to creating a separate new switch on the original switch with the interface to be used. The newly configured switch can be connected internally, but other external ports cannot be connected to the newly configured switch. Therefore, you need to unplug a network cable during setup in order to allow the host computer to connect to the port of the internal virtual LAN Vlan configured by the customer.

[0199] Further, referring to FIG3, the present invention also proposes a server management port batch configuration verification device, the server management port batch configuration verification device is used to execute the server management port batch configuration verification method, the server management port batch configuration verification device comprises:

[0200] Host computer 100;

[0201] A switch 200, wherein the host computer 100 is electrically connected to the switch 200;

[0202] The server 300 includes at least one server 300 , and each of the servers 300 is connected to the switch 200 .

[0203] Reference Figure 4 The present invention proposes a structural schematic diagram of a server management port batch configuration verification device, wherein a host computer 100 is a control computer, the host computer 100 reads a data table Excel, reads a serial number SN and a management port configuration method list, the control computer is connected to a switch 200 via SSH, N servers 300 to be configured are placed in cabinets 1 and 2, and 2N servers 300 are connected to the same switch 200.

[0204] Specifically, the host computer 100 control computer and the management ports of multiple servers 300 are connected to the switch 200. In the actual cloud server 300 computer room, there are generally 2 to 3 cabinets configured with servers 300, which are uniformly connected to a 128-port switch 200.

[0205] In the configuration situation, one table is usually used to configure all the management ports of servers 300 on a switch 200. Each batch configuration and verification is only for the management ports of servers 300 in the cabinets (usually 2 to 3 cabinets) connected to a switch 200. When a switch 200 is configured, the connection relationship needs to be adjusted, and the network cable needs to be connected to the next switch 200 for configuration.

[0206] The above is only a preferred embodiment of the present invention. The present invention is not limited to the above implementation. As long as the technical effect of the present invention is achieved by the same means, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of protection of the present disclosure. All should belong to the protection scope of the present invention. Within the protection scope of the present invention, its technical scheme and / or implementation method can have various modifications and changes.

Claims

1. A server management port batch configuration verification method, the server management port batch configuration verification method is applied to a server management port batch configuration verification device, the server management port batch configuration verification device comprises a host computer (100), a switch (200) and a plurality of servers (300), the host computer (100) and the plurality of servers (300) are respectively connected to the switch (200), and the servers (300) are in a waiting state, characterized in that: The server management port batch configuration verification method comprises the following steps: S100, the host computer (100) is randomly connected to a server (300) to be configured via a switch (200); S200, the host computer (100) obtains the serial number of the connected server (300); The step S200 includes: S210, the host computer (100) logs in to the super account of the baseboard management controller BMC of the connected server (300) via SSH; S220, the host computer (100) sends an ipmitool command to the connected server (300) to query fru information; S230, the connected server (300) returns a first reply message to the host computer (100), and the host computer (100) extracts the serial number of the connected server (300) from the first reply message; S300, configuring the management port information of the connected server (300) based on the configuration relationship table; The step S300 includes: S310, searching the serial number of the connected server (300) in the configuration relationship table, and obtaining the management port information that needs to be configured for the connected server (300), wherein the configuration relationship table at least includes the serial numbers of all servers (300) to be connected, the IP address information to be configured, the subnet mask information to be configured, and the gateway address information to be configured; S320, the host computer (100) requests the Redfish interface in a patch manner, and configures the management port information that needs to be configured of the connected server (300) to the baseboard management controller BMC of the connected server (300); S400, the main thread of the host computer (100) performs a sleep operation for a preset sleep time, waiting for the switch (200) to switch to the address of the next server (300) to be configured that can be connected; S500, the host computer (100) repeats the polling configuration operation from step S100 to step S400 until the management port information of all servers (300) is configured; S600, configuring the management port information of the host computer (100) to be in the same network segment as the configured server (300); S700, the host computer (100) batch checks the management port information of the server (300); The step S700 includes: S710, based on SSH, the host computer (100) batch-concurrently connects to all servers (300) in the same network segment; S720, the host computer (100) sends an ipmitool command to all connected servers (300) in the same network segment to query fru information; S730, the connected server (300) in the same network segment returns a second reply message to the host computer (100), and the host computer (100) extracts the serial number of the connected server (300) from the second reply message, matches it with the information in the configuration relationship table, and verifies whether the management port information of all servers (300) in the same network segment is correctly configured; S740, when the batch verification is completed, the upper computer (100) is modified to have management port information in the same network segment as the original state of the factory server (300).

2. The method for batch configuration verification of server management ports according to claim 1, characterized in that: The step S100 includes: S110, configuring the management port information of the host computer (100) so that the host computer (100) and the server (300) to be configured are in the same network segment, and when not configured, the multiple servers (300) are in a factory default configuration state, and the management information of the multiple servers (300) is consistent, and the management port information includes IP address information, subnet mask information and gateway address information; S120: Based on the SSH protocol, the host computer (100) is randomly connected to the management port of a server (300) through the switch (200).

3. The method for batch configuration verification of server management ports according to claim 1, characterized in that: In the step S400, the preset sleep time is used to prevent the host computer (100) from connecting to a server (300) that has been configured with management port information when the host computer (100) performs the next connection. The preset sleep time is between 15 seconds and 30 seconds.

4. The server management port batch configuration verification method according to claim 1, characterized in that: In the step S600, if the configured server (300) is located in a plurality of different network segments, the management information of the host computer (100) will be sequentially configured as the network segments of the configured servers (300); In the step S600, the IP address information, subnet mask information and gateway address information of the host computer (100) are configured by using the netifaces library of Python.

5. The method for batch configuration verification of server management ports according to claim 1, characterized in that: In step S600 and step S700, if the configured server (300) is located in a plurality of different network segments, the management information of the host computer (100) will be sequentially configured as the network segments of the configured server (300).

6. A server management port batch configuration verification device, the server management port batch configuration verification device is used to execute the server management port batch configuration verification method according to any one of claims 1 to 5, characterized in that: The server management port batch configuration verification device comprises: Host computer (100); A switch (200), the host computer (100) being electrically connected to the switch (200); A server (300), wherein there is at least one server (300), and each of the servers (300) is connected to the switch (200).