Method and apparatus for allocating gateway IP address in virtualization control system
By assigning gateway IP addresses to communication gateways in the virtualized control system, communication chaos caused by arbitrary allocation of gateway station numbers or IP addresses in the virtualized control system is solved, and the ease of use of the system is improved.
Patent Information
- Application Number
- CN202410247267.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2044-03-05
AI Technical Summary
In a virtualized control system, if the gateway station number or IP address is arbitrarily allocated, communication chaos will be caused. The mandatory requirement that the gateway station number of different controllers will not be repeated will increase the complexity of network configuration and management and reduce the ease of system use.
By determining the communication gateway in the virtualized control system where the gateway IP address is not assigned, the controller IP address of the target controller and the dial value of the communication gateway are read, and the gateway IP address is assigned to the communication gateway based on this information, ensuring that the fourth segment of the communication gateway connected to the same target controller is different, and the third segment of the IP address of the communication gateway connected to the communication gateway connected to the different target controllers is different.
It effectively prevents communication chaos between the controller and the communication gateway, and allows the gateway station numbers of the communication gateways under different controllers to be arbitrarily allocated, avoiding the complexity of network configuration and management, and improving the ease of use of the system.
Smart Images

Figure CN118214738B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a method and device for allocating gateway IP addresses in a virtualized control system. Background Art
[0002] In a traditional hardware control system, each controller is connected to its own communication gateway through a physical link and only connects to its own gateway. Therefore, the gateway station number can be arbitrarily allocated or repeated.
[0003] However, in a virtualized control system, different controllers and the communication gateways subordinate to each controller are in the same network. If the gateway station number or IP address is arbitrarily allocated, communication chaos will inevitably occur. If it is mandatory to require that the gateway station numbers of different controllers are not repeated, it will increase the complexity of network configuration and management and also reduce the usability of the control system. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method and device for allocating gateway IP addresses in a virtualized control system to solve the problem that communication chaos will occur if the gateway station number or IP address is arbitrarily allocated in a virtualized control system, while setting the gateway station numbers of different controllers to be non-repeated will increase the complexity of network configuration and management and reduce the usability of the system.
[0005] In the first aspect of the embodiments of this application, a method for allocating gateway IP addresses in a virtualized control system is provided. The virtualized control system includes a server in which a plurality of controllers are deployed, and each controller is connected to at least one communication gateway. The method includes the following steps:
[0006] Determine a first type of communication gateway in the virtualized control system for which the gateway IP address has not been allocated. The first type of communication gateway includes at least two first communication gateways;
[0007] If at least two first communication gateways are respectively connected to at least two different target controllers, read the controller IP addresses of each target controller and read the first dial code values of each first communication gateway;
[0008] For each first communication gateway, based on the controller IP address of the target controller connected to the first communication gateway and the first dial code value of the first communication gateway, allocate a first gateway IP address to the first communication gateway. The first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment. For the first communication gateways connected to the same target controller, the fourth IP address segments in their first gateway IP addresses are different. For the first communication gateways connected to different target controllers, the third IP address segments in their first gateway IP addresses are different.
[0009] In a second aspect of the embodiments of the present application, there is provided an apparatus for allocating gateway IP addresses in a virtualization control system, including:
[0010] A determination module, configured to determine a first type of communication gateway in the virtualization control system for which a gateway IP address has not been allocated, the first type of communication gateway including at least two first communication gateways;
[0011] A reading module, configured to, if at least two first communication gateways are respectively connected to at least two different target controllers, read the controller IP addresses of the respective target controllers, and read the first dial values of the respective first communication gateways;
[0012] An allocation module, configured to, for each first communication gateway, based on the controller IP address of the target controller connected to the first communication gateway and the first dial value of the first communication gateway, allocate a first gateway IP address to the first communication gateway; wherein, the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment; for the first communication gateways connected to the same target controller, the fourth IP address segments in their first gateway IP addresses are different; for the first communication gateways connected to different target controllers, the third IP address segments in their first gateway IP addresses are different.
[0013] In a third aspect of the embodiments of the present application, there is provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the above method are implemented.
[0014] In a fourth aspect of the embodiments of the present application, there is provided a readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0015] Compared with the prior art, the beneficial effects of the embodiments of the present application at least include: The method provided by the embodiments of the present application is applied to a virtualization control system, which includes a server. Multiple controllers are deployed in the server, and each controller is connected to at least one communication gateway. First, determine the first type of communication gateway in the virtualization control system that has not been assigned a gateway IP address. If at least two single communication gateways are respectively connected to at least two different target controllers, read the controller IP addresses of each target controller and read the first dial value of each first communication gateway. Then, for each first communication gateway, based on the controller IP address of the target controller connected to the first communication gateway and the first dial value of the first communication gateway, assign a first gateway IP address to the first communication gateway. The first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment. For the first communication gateways connected to the same target controller, the fourth IP address segments in their first gateway IP addresses are different. For the first communication gateways connected to different target controllers, the third IP address segments in their first gateway IP addresses are different. In this way, it can be ensured that the first gateway IP addresses of the first communication gateways connected to different controllers do not repeat, effectively preventing the phenomenon of communication chaos between the controllers and the communication gateways in the system. At the same time, it allows the gateway station numbers of the communication gateways connected to different controllers to be arbitrarily assigned, without increasing the complexity of network configuration and management, and the system has good usability. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the prior art descriptions. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0017] Figure 1 is a schematic diagram of the system structure of a virtualization control system provided by an embodiment of the present application;
[0018] Figure 2 is a schematic flowchart of a method for allocating gateway IP addresses in a virtualization control system provided by an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of the system structure of a virtualization control system provided by another embodiment of the present application;
[0020] Figure 4 is a schematic diagram of the structure of an apparatus for allocating gateway IP addresses in a virtualization control system provided by an embodiment of the present application;
[0021] Figure 5It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0022] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0023] Next, a method and device for allocating gateway IP addresses in a virtualization control system according to an embodiment of the present application will be described in detail with reference to the accompanying drawings.
[0024] Figure 1 It is a schematic system architecture diagram of a virtualization control system according to an embodiment of the present application. As Figure 1 shown, the virtualization control system may include servers (hosts), controller 1, controller 2... controller n, switches, communication gateways 1-1, communication gateways 1-2... communication gateways 1-m, communication gateways 2-1, communication gateways 2-2... communication gateways 2-w, communication gateways n-1, communication gateways n-2... communication gateways n-k; where n, m, w, and k are all positive integers less than 256. Among them, controller 1, controller 2... controller n are all deployed on the server; controller 1 is communicatively connected to its subordinate communication gateways 1-1, communication gateways 1-2... communication gateways 1-m through a switch; controller 2 is communicatively connected to its subordinate communication gateways 2-1, communication gateways 2-2... communication gateways 2-w through a switch; controller n is communicatively connected to its subordinate communication gateways n-1, communication gateways n-2... communication gateways n-k through a switch.
[0025] In some implementation manners, a gateway IP management module may be set in the switch, and the gateway IP management module is used to implement each step in the method provided by the embodiment of the present application to achieve unified management and allocation of the IP addresses of the communication gateways connected to each controller in the system.
[0026] In other implementation manners, a dedicated gateway IP management module may be set to implement each step in the method provided by the embodiment of the present application to achieve unified management and allocation of the IP addresses of the communication gateways connected to each controller in the system.
[0027] It should be noted that the specific number of controllers deployed on the server can be deployed according to actual needs; the number of communication gateways connected under each controller can also be set according to actual needs, and the embodiments of the present application do not limit this.
[0028] Figure 2 It is a schematic flowchart of a method for allocating gateway IP addresses in a virtualization control system provided by an embodiment of the present application. Figure 2 The method for allocating gateway IP addresses in the virtualization control system can be executed by a gateway IP management module.
[0029] As Figure 2 shown, the method for allocating gateway IP addresses in the virtualization control system can be applied to the virtualization control system, and specifically may include the following steps:
[0030] Step S201, determine the first type of communication gateways in the virtualization control system that have not been allocated gateway IP addresses, and the first type of communication gateways includes at least two first communication gateways.
[0031] As an example, as Figure 1 shown, if the communication gateway 1-1 under the controller 1 in the virtualization control system, and the communication gateways 2-1 and 2-2 under the controller 2 are all gateways that have not been allocated gateway IP addresses, then the communication gateway 1-1, the communication gateway 2-1, and the communication gateway 2-2 all belong to the first type of communication gateways.
[0032] Step S202, if at least two first communication gateways are respectively connected to at least two different target controllers, read the controller IP addresses of each target controller, and read the first dial code value of each first communication gateway.
[0033] The controller IP address refers to the IP address of the target controller. For example, XXX.YYY.ZZZ.A, where XXX, YYY, ZZZ, and A can be decimal integers between 0 and 255, as long as the combined IP address is valid.
[0034] The first dial code value refers to the configuration value of the dial switch of the first communication gateway, and this configuration value can be used to indicate the selected hardware function, the selected communication protocol, the switching of function modes, the adjustment of device performance, etc.
[0035] As an example, in combination with Figure 1, if the first type of communication gateways include communication gateway 1-1, communication gateway 2-1, and communication gateway 2-2, then the target controllers are controller 1 and controller 2. Read the controller IP address of controller 1, denoted as controller IP address A, and read the controller IP address of controller 2, denoted as controller IP address B; respectively read the first DIP values of communication gateway 1-1, communication gateway 2-1, and communication gateway 2-2, denoted as first DIP value A1, first DIP value B1, and first DIP value B2.
[0036] Step S203, for each first communication gateway, based on the controller IP address of the target controller connected to the first communication gateway and the first DIP value of the first communication gateway, allocate a first gateway IP address for the first communication gateway; wherein, the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment; for the first communication gateways connected to the same target controller, the fourth IP address segments in their first gateway IP addresses are different; for the first communication gateways connected to different target controllers, the third IP address segments in their first gateway IP addresses are different.
[0037] Both the controller IP address and the first gateway IP address are 32-bit binary numbers, usually divided into 4 "8-bit binary numbers" (i.e., 4 bytes). For example, the controller IP address of a certain controller is XXX.YYY.ZZZ.A, and XXX, YYY, ZZZ, and A can all be any value between 0 and 255, as long as the combined IP address is valid. If the first gateway IP address of a certain first communication gateway is XXX.YYY.A.K, then the first IP address segment, the second IP address segment, the third IP address segment, and the fourth IP address segment correspond to XXX, YYY, A, and K respectively, where XXX, YYY, A, and K can all be any value between 0 and 255, as long as the combined IP address is valid.
[0038] The third IP address segment in the first gateway IP address is related to the fourth IP segment in the controller IP address connected to the first communication gateway; the fourth IP address segment can be used to indicate the gateway station number of the first communication gateway. The station numbers of the communication gateways under different controllers are allowed to be assigned arbitrarily. For example, the gateway station numbers of communication gateway 1-1 and communication gateway 2 under controller 1 can be No. 1 and No. 2 respectively; the gateway station numbers of communication gateway 2-1 and communication gateway 2-2 under controller 2 can be No. 1 and No. 2 respectively.
[0039] Combined with the above example, communication gateways 1-1, 2-1, and 2-2 are all of the first type of communication gateways. Taking communication gateway 1-1 as an example, the following details the specific process of the gateway IP management module allocating the first gateway IP address to communication gateway 1-1. The gateway IP management module reads the controller IP address A of the target controller (i.e., controller 1) connected to communication gateway 1-1, and the first DIP value A1 of communication gateway 1-1, then determines the first gateway IP address A1 based on the controller IP address A and the first DIP value A1, and then allocates the first gateway IP address A1 to communication gateway 1-1.
[0040] Similarly, the first gateway IP addresses B1 and B2 of communication gateways 2-1 and 2-2 can be determined by referring to the method of determining and allocating the first gateway IP address A1 of communication gateway 1-1 as described above, and will not be elaborated here.
[0041] It should be noted that in the above example, the fourth IP address segments in the first gateway IP addresses B1 and B2 of communication gateways 2-1 and 2-2 connected to the same controller 2 are different; the third IP address segment in the first gateway IP address A1 of communication gateway 1-1 connected to controller 1 is different from the third IP address segments in the first gateway IP addresses B1 and B2 of the above communication gateways 2-1 and 2-2. For example, the first gateway IP address A1 is XXX.YYY.A.1, the first gateway IP address B1 is XXX.YYY.B.1, and the first gateway IP address B2 is XXX.YYY.B.2, where "A" is different from "B" (A is 1 and B is 2); the fourth IP address segments in the first gateway IP addresses B1 and B2 are different, the former is 1 and the latter is 2.
[0042] Through the above technical solution, it can be ensured that the first gateway IP addresses of the first communication gateways connected to different controllers do not repeat, effectively preventing the phenomenon of communication chaos between the controllers and communication gateways in the system; at the same time, it allows the gateway station numbers of the communication gateways connected to different controllers to be arbitrarily allocated, without increasing the complexity of network configuration and management, and the system has good usability.
[0043] In some embodiments, the gateway IP management module can count and organize the IP addresses of each controller and its subordinate communication gateways in the virtualized control system into an IP address mapping table as shown in Table 1 and store it, so as to facilitate the maintenance and management of the IP addresses of each controller and its subordinate communication gateways in the virtualized control system.
[0044] Table 1
[0045]
[0046]
[0047] In some embodiments, determining a first type of communication gateway without an assigned gateway IP address in a virtualized control system includes:
[0048] Obtaining the jumper values of each communication gateway in the virtualized control system;
[0049] Based on the jumper values, determining the powered-on communication gateway;
[0050] If the gateway IP address of the powered-on communication gateway is not read, or the gateway IP address of the powered-on communication gateway is a null value, then determine the powered-on communication gateway as the first type of communication gateway.
[0051] The jumper value refers to the on / off indication value of different electrical signals on a hardware device.
[0052] It is possible to determine the powered-on state of each communication gateway (i.e., the gateway is in the powered-on state) by detecting the jumper values of each communication gateway in the virtualized control system, and determine the communication gateway in the powered-on state as the powered-on communication gateway.
[0053] When the jumper value of a certain communication gateway is detected and it is determined that it is in the powered-on state, but the gateway IP address corresponding to this communication gateway is not read due to reasons such as a reading function failure; or, when there is no failure in the reading function but the gateway IP address of the powered-on communication gateway is a null value, then determine this communication gateway as the first type of communication gateway.
[0054] As an example, if the gateway IP management module detects the jumper value of communication gateway 1-1 and determines that communication gateway 1-1 is currently in the powered-on state, then determine communication gateway 1-1 as the powered-on communication gateway. Further, if the gateway IP address of communication gateway 1-1 is not read or the gateway IP address of communication gateway 1-1 is a null value, then determine communication gateway 1-1 as the first type of communication gateway.
[0055] Through the above method, all the first communication gateways without an assigned gateway IP address in the virtualized control system can be found, and then a first gateway IP address can be uniformly and batch-assigned to each first communication gateway in the subsequent process, which is beneficial to improving the allocation and management efficiency of the gateway IP address, and at the same time, it is not easy to have incorrect or missed allocations, facilitating subsequent gateway IP maintenance work.
[0056] In some embodiments, based on the controller IP address of the target controller connected to the first communication gateway and the first DIP value of the first communication gateway, allocating a first gateway IP address to the first communication gateway includes:
[0057] Extract the identification IP address segment from the controller IP address, and the identification IP address segment is used to identify and distinguish different target controllers;
[0058] Based on the first dial value of the first communication gateway and the identification IP address segment, assign the first gateway IP address to the first communication gateway; wherein, the third IP address segment in the first gateway IP address is the identification IP address segment; the fourth IP address segment in the first gateway IP address is determined by the first dial value.
[0059] The identification IP address segment in the embodiments of this application generally refers to the fourth IP segment of the controller IP address of the target controller. For example, if controller 1 is the target controller and its controller IP address is XXX.YYY.ZZZ.1, then the identification IP address segment is "1", and "XXX", "YYY", and "ZZZ" can all be any decimal integer between 0 and 255, as long as the overall combined IP address XXX.YYY.ZZZ.1 is valid.
[0060] For different controllers, their corresponding identification IP address segments are different. In this way, each controller in the virtualized control system can be identified and distinguished.
[0061] As an example, combined with Figure 1 , assume that communication gateways 2-1 and 2-2 both belong to the first type of communication gateway, then the controller they are commonly connected to is controller 2; the controller IP address of controller 2 is read as XXX.YYY.ZZZ.2, the first dial value of communication gateway 2-1 is Q1, and the first dial value of communication gateway 2-2 is Q2. Extract the fourth IP segment from the controller IP address of controller 2, that is, "2", and use "2" as the third IP address segment in the first gateway IP address B1 assigned to communication gateway 2-1; further, determine the fourth IP address segment in the first gateway IP address B1 according to the first dial value Q1 of communication gateway 2-1. For example, it is 1. Next, combine the first IP segment "XXX", the second IP segment "YYY", the third IP address segment "2", and the fourth IP address segment "1" in the controller IP address of controller 2 to obtain the first gateway IP address B1 assigned to communication gateway 2-1 as XXX.YYY.2.1.
[0062] Similarly, the first gateway IP address B2 assigned to communication gateway 2-2 can be determined by referring to the determination method of the first gateway IP address B1 of communication gateway 2-1 above. Among them, the third IP address segments in the first gateway IP address B1 and the first gateway IP address B2 are the same, while the fourth IP address segments are different.
[0063] In this way, different communication gateways under different controllers in the virtualized control system can be well distinguished, and each controller can accurately identify the communication gateways under its jurisdiction and communicate only with the communication gateways under its jurisdiction, thereby effectively preventing communication chaos between the controllers and communication gateways in the virtualized control system, which is beneficial to improving communication efficiency and communication quality. At the same time, the gateway station numbers of the communication gateways of different controllers are allowed to be arbitrarily assigned without increasing the complexity of network configuration and management.
[0064] In some embodiments, if the target controller connected to the first communication gateway is not connected to a second type of communication gateway, where the second type of communication gateway is a gateway with an assigned gateway IP address, then based on the controller IP address of the target controller and the first dial value of the first communication gateway, a first gateway IP address is assigned to the first communication gateway.
[0065] As an example, in combination with Figure 1 , assume that the target controllers are Controller 1 and Controller 2. There are 2 communication gateways connected to Controller 1, namely Communication Gateway 1-1 and Communication Gateway 1-2, and both Communication Gateway 1-1 and Communication Gateway 1-2 are first communication gateways. There are 2 communication gateways connected to Controller 2, namely Communication Gateway 2-1 and Communication Gateway 2-2, and both Communication Gateway 2-1 and Communication Gateway 2-2 are first communication gateways. That is, currently, neither Controller 1 nor Controller 2 has a gateway with an assigned gateway IP address, that is, there is no second type of communication gateway. At this time, for each communication gateway under each controller, based on the controller IP address of each target controller and the first dial value of the communication gateway under its jurisdiction, a first gateway IP address can be assigned to each communication gateway according to the technical solution provided in the above embodiment.
[0066] In other embodiments, if the target controller connected to the first communication gateway is connected to a second type of communication gateway, and the second type of communication gateway includes at least one second communication gateway, then the second gateway IP addresses of each second communication gateway are read, and based on the second gateway IP address, the controller IP address, and the first dial value of the first communication gateway, a first gateway IP address is assigned to the first communication gateway.
[0067] The first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment; among them, the first IP address segment and the second IP address segment are the same as the first IP segment and the second IP segment in the controller IP address of the target controller connected to the first communication gateway; the third IP address segment is the same as the fourth IP segment in the controller IP address of the target controller connected to the first communication gateway; the fourth IP address segment in the first gateway IP address assigned to the first communication gateway can be determined according to the first dial value of the first communication gateway and the fourth gateway IP address segment in the second gateway IP address of the second communication gateway that has a common communication connection with the first communication gateway. Among them, the fourth IP address segment of the first communication gateway is different from the fourth IP address segment of the second communication gateway. In this way, each controller can better identify and distinguish different communication gateways under it for performing different functions, which is beneficial to improving the communication efficiency and communication quality of each controller and its subordinate communication gateways.
[0068] In some embodiments, the second gateway IP address includes a fifth IP address segment, a sixth IP address segment, a seventh IP address segment, and an eighth IP address segment;
[0069] Based on the second gateway IP address, the controller IP address, and the first dial value of the first communication gateway, allocating the first gateway IP address to the first communication gateway includes:
[0070] Determine the fifth IP address segment as the first address segment in the first gateway IP address assigned to the first communication gateway, and determine the sixth IP address segment as the second IP address segment in the first gateway IP address assigned to the first communication gateway;
[0071] Determine the identification IP address segment as the third IP address segment in the first gateway IP address assigned to the first communication gateway;
[0072] Determine the fourth IP address segment in the first gateway IP address assigned to the first communication gateway based on the eighth IP address segment, where the eighth IP address segment is different from the fourth IP address segment;
[0073] Concatenate the first IP address segment, the second IP address segment, the third IP address segment, and the fourth IP address segment to obtain the first gateway IP address and assign it to the first communication gateway.
[0074] As an example, in combination with Figure 1, assume that the target controller includes controller 1 and controller 2, and there are 2 communication gateways connected to controller 1, namely communication gateway 1-1 and communication gateway 1-2, and communication gateway 1-2 is the first communication gateway, while communication gateway 1-1 is the second communication gateway; there are 2 communication gateways connected to controller 2, namely communication gateway 2-1 and communication gateway 2-2, and communication gateway 2-1 is the first communication gateway, and communication gateway 2-2 is the second communication gateway.
[0075] The following takes the determination of the first gateway IP address A2 of communication gateway 1-2 as an example for detailed description. First, read the controller IP address A of controller 1, the first DIP value of communication gateway 1-2, and the second gateway IP address A1 of communication gateway 1-1; then, intercept the first IP segment, the second IP segment, and the fourth IP segment from the controller IP address A, and intercept the eighth IP address segment from the second gateway IP address A1; next, determine the fourth IP address segment A2-4 of the second gateway IP address A2 assigned to communication gateway 1-2 according to the first DIP value of communication gateway 1-2 and the eighth IP address segment A1-8 in the second gateway IP address A1; finally, assemble the first IP segment, the second IP segment, the fourth IP segment, and the fourth IP address segment A2-4 to obtain the second gateway IP address A2 assigned to communication gateway 1-2.
[0076] For example, the controller IP address A of controller 1 is XXX.YYY.ZZZ.1, and the second gateway IP address A1 is XXX.YYY.2.1. According to the first DIP value of communication gateway 1-2 and the eighth IP address segment A1-8 in the second gateway IP address A1, it is determined that the fourth IP address segment A2-4 is 2. Then, the second gateway IP address A2 can be assembled as XXX.YYY.2.2, where "XXX" corresponds to the first IP segment of the controller IP address A, "YYY" corresponds to the second IP segment of the controller IP address A, the "2" following "YYY" corresponds to the fourth IP segment of the controller IP address A, and the last "2" corresponds to the fourth IP address segment A2-4, and this second gateway IP address A2 is assigned to communication gateway 1-2.
[0077] In some embodiments, determining the fourth IP address segment in the first gateway IP address assigned to the first communication gateway based on the eighth IP address segment includes:
[0078] Determine whether there is a recycled gateway IP address corresponding to the target controller in the gateway IP recycling pool. The recycled gateway IP address includes a first recycled IP segment, a second recycled IP segment, a third recycled IP segment, and a fourth recycled IP segment;
[0079] If there is a recycling gateway IP address corresponding to the target controller, the fourth recycling IP address segment is determined as the fourth IP address segment in the first gateway IP address assigned to the first communication gateway.
[0080] A gateway IP recycling pool is used to store the second gateway IP addresses of some second communication gateways that are no longer in use or have faults.
[0081] As an example, assume that the target controllers are Controller 1 and Controller 2. After traversing the gateway IP recycling pool, the gateway IP management module finds that there is a recycling gateway IP address corresponding to Controller 1 (such as the second gateway IP address of Communication Gateway 1-2). The first communication gateway connected to Controller 1 is Communication Gateway 1-1. Then, the second gateway IP address of Communication Gateway 1-2 recycled and stored in the gateway IP recycling pool can be determined as the first gateway IP address assigned to the first communication gateway, and at the same time, the second gateway IP address of Communication Gateway 1-2 recycled in the gateway IP recycling pool is cleared. In this way, it is possible to prevent the recycling gateway IP addresses in the gateway IP recycling pool from being repeatedly assigned to other first communication gateways, and at the same time, it is possible to quickly determine the first gateway IP address assigned to the first communication gateway, which is beneficial to improving the allocation efficiency of gateway IP.
[0082] As another example, it is also possible to assemble the first IP segment, the second IP segment, and the fourth IP segment in the controller IP address of Controller 1 and the fourth recycling IP address segment in the second gateway IP address of Communication Gateway 1-2 recycled and stored in the gateway IP recycling pool to obtain the first gateway IP address assigned to Communication Gateway 1-1.
[0083] In some embodiments, based on the controller IP address of the target controller connected to the first communication gateway and the first dialing value of the first communication gateway, assigning the first gateway IP address to the first communication gateway includes:
[0084] Determine the communication gateway set to which the first communication gateway belongs, and obtain the subnet mask corresponding to the communication gateway set. The subnet masks of different communication gateway sets belonging to the same target controller are different;
[0085] Based on the subnet mask of the communication gateway set to which the first communication gateway belongs, the controller IP address of the target controller connected to the first communication gateway, and the first dial value of the first communication gateway, assign a first gateway IP address to the first communication gateway; wherein, the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, a fourth IP address segment, and a subnet mask; for the first communication gateways belonging to the same communication gateway set, the fourth IP address segments in their first gateway IP addresses are different, and the subnet masks are the same; for the first communication gateways belonging to different communication gateway sets, the fourth IP address segments in their first gateway IP addresses are different, and the subnet masks are different.
[0086] Figure 3 FIG. is a schematic diagram of the system structure of the virtualization control system provided in another embodiment of the present application.
[0087] As Figure 3 shown, the virtualization control system may include a server (host), controller 1, controller 2... controller n, a switch. Each controller has a communication gateway sets, which are communication gateway set n-1, communication gateway set n-2... communication gateway set n-a respectively; each communication gateway set contains b communication gateways, which are communication gateway n-m-1, communication gateway n-m-2... communication gateway n-m-b respectively. For example, controller 1 may include communication gateway set 1-1, communication gateway set 1-2... communication gateway set 1-a, and communication gateway set 1-1 may include communication gateway 1-1-1, communication gateway 1-1-2... communication gateway 1-1-b. Among them, n, a, and b are all positive integers between 1 and 256. Among them, controller 1, controller 2... controller n are all deployed on the server; controller 1 communicates with the communication gateways in each of its subordinate communication gateway sets through the switch; controller 2 communicates with the communication gateways in each of its subordinate communication gateway sets through the switch; controller n communicates with the communication gateways in each of its subordinate communication gateway sets through the switch.
[0088] It should be noted that the number of communication gateway sets under each controller may be the same or different, and the number of communication gateways under each communication gateway set may also be the same or different. Specifically, it can be deployed and configured according to actual needs, and the embodiments of the present application do not make limitations.
[0089] As an example, in combination with Figure 3 , assume that the target controllers are controller 1 and controller 2, and the first type of communication gateways include communication gateway 1-1-1 and communication gateway 1-1-2 connected to controller 1; and communication gateway 2-1-1 and communication gateway 2-2-1 connected to controller 2.
[0090] Taking the communication gateway 1-1-1 connected to the controller 1 as an example, the method for determining its first gateway IP address will be described below. First, the communication gateway set to which the communication gateway 1-1-1 belongs can be determined by querying, which is the communication gateway set 1-1, and the subnet mask of the communication gateway set 1-1 is read; then the controller IP address of the controller 1 connected to the communication gateway 1-1-1 is read, and the first DIP value of the communication gateway 1-1-1 is read; according to the first IP segment, second IP segment, fourth IP segment in the controller IP address of the controller 1, the first DIP value of the communication gateway 1-1-1, and the subnet mask of the communication gateway set 1-1, the first gateway IP address is determined and assigned to the communication gateway 1-1-1. Among them, the first IP address segment and the second IP address segment of the first gateway IP address respectively correspond to the first IP segment and the second IP segment in the controller IP address of the controller 1, the third IP address segment corresponds to the fourth IP segment in the controller IP address of the controller 1, the fourth IP address segment corresponds to the value determined by the first DIP value of the communication gateway 1-1-1, and the subnet mask corresponds to the subnet mask of the communication gateway set 1-1 to which the communication gateway 1-1-1 belongs.
[0091] In some embodiments, for each controller, at least one communication gateway set can be determined according to the communication functions performed by the gateways, and then at least one communication gateway can be configured according to the detailed function items in each communication gateway set. In this way, the number of communication gateways under each controller can be greatly increased to meet more diverse communication requirements.
[0092] By configuring different subnet masks for different communication gateway sets connected to the same controller, and the gateway IP addresses of all communication gateways under the same communication gateway set all contain the subnet mask of the communication gateway set, different communication gateway sets can be better distinguished, while the communication gateways in the same communication gateway set use the same subnet, and the gateway IP addresses of each communication gateway in the same communication gateway set do not repeat. The gateway station numbers of the communication gateways in different communication gateway sets under the same controller can be arbitrarily assigned, so as to increase the number of communication gateways under the same controller without increasing the complexity of network configuration and management, and improve the usability and scalability of the virtualized control system.
[0093] All the above optional technical solutions can be combined arbitrarily to form optional embodiments of the present application, which will not be elaborated one by one here.
[0094] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For the details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0095] Figure 4 It is a schematic diagram of a device for allocating gateway IP addresses in a virtualization control system provided by an embodiment of the present application. As Figure 4 shown, the device for allocating gateway IP addresses in the virtualization control system includes:
[0096] A determination module 401, configured to determine a first type of communication gateway in the virtualization control system for which the gateway IP address has not been allocated, and the first type of communication gateway includes at least two first communication gateways;
[0097] A reading module 402, configured to read the controller IP addresses of each target controller and the first dial value of each first communication gateway if at least two first communication gateways are respectively connected to at least two different target controllers;
[0098] An allocation module 403, configured to allocate a first gateway IP address to each first communication gateway based on the controller IP address of the target controller connected to the first communication gateway and the first dial value of the first communication gateway; wherein, the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, and a fourth IP address segment; for the first communication gateways connected to the same target controller, the fourth IP address segments in their first gateway IP addresses are different; for the first communication gateways connected to different target controllers, the third IP address segments in their first gateway IP addresses are different.
[0099] In some embodiments, Figure 4 the determination module 401 in
[0100] may include:
[0101] An acquisition unit, configured to acquire the jumper values of each communication gateway in the virtualization control system;
[0102] A first determination unit, configured to determine the powered-on communication gateway based on the jumper value;
[0103] In some embodiments, Figure 4 the allocation module 403 in
[0104] may include:
[0105] The first allocation unit is configured to allocate a first gateway IP address to the first communication gateway based on the first dial value of the first communication gateway and the identified IP address segment; wherein, the third IP address segment in the first gateway IP address is the identified IP address segment; the fourth IP address segment in the first gateway IP address is determined by the first dial value.
[0106] In some other embodiments, Figure 4 the allocation module 403 in
[0107] The second allocation unit is configured to, if the target controller connected to the first communication gateway is not connected to a second type of communication gateway, and the second type of communication gateway is a gateway that has been allocated a gateway IP address, allocate a first gateway IP address to the first communication gateway based on the controller IP address of the target controller and the first dial value of the first communication gateway;
[0108] The third allocation unit is configured to, if the target controller connected to the first communication gateway is connected to a second type of communication gateway, and the second type of communication gateway includes at least one second communication gateway, read the second gateway IP addresses of each second communication gateway, and allocate a first gateway IP address to the first communication gateway based on the second gateway IP addresses, the controller IP address, and the first dial value of the first communication gateway.
[0109] In some embodiments, the second gateway IP address includes a fifth IP address segment, a sixth IP address segment, a seventh IP address segment, and an eighth IP address segment.
[0110] The above-mentioned third allocation unit includes an allocation component, and this allocation component is configured to allocate a first gateway IP address to the first communication gateway based on the second gateway IP address, the controller IP address, and the first dial value of the first communication gateway.
[0111] This allocation component includes:
[0112] The first determination device is configured to determine the fifth IP address segment as the first address segment in the first gateway IP address allocated to the first communication gateway, and determine the sixth IP address segment as the second IP address segment in the first gateway IP address allocated to the first communication gateway;
[0113] The second determination device is configured to determine the identified IP address segment as the third IP address segment in the first gateway IP address allocated to the first communication gateway;
[0114] The third determination device is configured to determine the fourth IP address segment in the first gateway IP address allocated to the first communication gateway based on the eighth IP address segment, wherein the eighth IP address segment is different from the fourth IP address segment;
[0115] The splicing device is configured to splice the first IP address segment, the second IP address segment, the third IP address segment, and the fourth IP address segment to obtain a first gateway IP address and assign it to the first communication gateway.
[0116] In some embodiments, the third determination device may be specifically configured to: determine whether there is a recycled gateway IP address corresponding to the target controller in the gateway IP recycling pool, where the recycled gateway IP address includes a first recycled IP address segment, a second recycled IP address segment, a third recycled IP address segment, and a fourth recycled IP address segment; if there is a recycled gateway IP address corresponding to the target controller, then determine the fourth recycled IP address segment as the fourth IP address segment in the first gateway IP address assigned to the first communication gateway.
[0117] In still other embodiments, Figure 4 The allocation module 403 in may include:
[0118] The set determination unit is configured to determine the communication gateway set to which the first communication gateway belongs and obtain the subnet mask corresponding to the communication gateway set, and the subnet masks of different communication gateway sets belonging to the same target controller are different;
[0119] The IP allocation unit is configured to allocate a first gateway IP address to the first communication gateway based on the subnet mask of the communication gateway set to which the first communication gateway belongs, the controller IP address of the target controller connected to the first communication gateway, and the first dial code value of the first communication gateway; wherein, the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, a fourth IP address segment, and a subnet mask; for the first communication gateways belonging to the same communication gateway set, the fourth IP address segments in their first gateway IP addresses are different, and the subnet masks are the same; for the first communication gateways belonging to different communication gateway sets, the fourth IP address segments in their first gateway IP addresses are different, and the subnet masks are different.
[0120] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution, and the order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0121] Figure 5 is a schematic diagram of the electronic device 5 provided by the embodiments of the present application. As Figure 5As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 501 executes the computer program 503, the functions of the various modules / units in the above-mentioned device embodiments are implemented.
[0122] The electronic device 5 may be a desktop computer, a notebook, a palm computer, a cloud server, or other electronic devices. The electronic device 5 may include, but is not limited to, the processor 501 and the memory 502. Those skilled in the art can understand that Figure 5 merely examples of the electronic device 5, which do not constitute a limitation on the electronic device 5, may include more or fewer components than shown in the figure, or different components.
[0123] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0124] The memory 502 may be an internal storage unit of the electronic device 5, for example, the hard disk or memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk equipped on the electronic device 5, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. The memory 502 may also include both an internal storage unit and an external storage device of the electronic device 5. The memory 502 is used to store computer programs and other programs and data required by the electronic device.
[0125] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0126] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium (such as a computer-readable storage medium). Based on this understanding, to implement all or part of the processes in the above embodiment methods of this application, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above method embodiments. The computer program can include computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium can include: any entity or device that can carry computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0127] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of this application, and should all be included in the protection scope of this application.
Claims
1. A method for allocating gateway IP addresses in a virtualized control system, characterized in that: The virtualization control system includes a server, at least two controllers are deployed in the server, and each of the controllers is connected to at least one communication gateway; The method comprises the following steps: Determine a first type of communication gateway to which a gateway IP address is not assigned in the virtualized control system, wherein the first type of communication gateway includes at least two first communication gateways; If the at least two first communication gateways are respectively connected to at least two different target controllers, then reading the controller IP address of each of the target controllers, and reading the first dial value of each of the first communication gateways; For each of the first communication gateways, a first gateway IP address is allocated to the first communication gateway based on the controller IP address of the target controller connected to the first communication gateway and the first dial value of the first communication gateway; wherein the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment and a fourth IP address segment; the first communication gateways connected to the same target controller have different fourth IP address segments in their first gateway IP addresses; the first communication gateways connected to different target controllers have different third IP address segments in their first gateway IP addresses; Allocating a first gateway IP address to the first communication gateway based on a controller IP address of a target controller connected to the first communication gateway and a first dial value of the first communication gateway includes: Extracting an identification IP address segment from the controller IP address, wherein the identification IP address segment is used to identify and distinguish different target controllers; Based on the first dial code value and identification IP address segment of the first communication gateway, a first gateway IP address is allocated to the first communication gateway; wherein the third IP address segment in the first gateway IP address is the identification IP address segment; and the fourth IP address segment in the first gateway IP address is determined by the first dial code value.
2. The method according to claim 1, characterized in that Allocating a first gateway IP address to the first communication gateway based on a controller IP address of a target controller connected to the first communication gateway and a first dial value of the first communication gateway includes: If the target controller connected to the first communication gateway is not connected to a second-type communication gateway, and the second-type communication gateway is a gateway to which a gateway IP address has been assigned, then based on the controller IP address of the target controller and the first dial value of the first communication gateway, a first gateway IP address is assigned to the first communication gateway; If the target controller connected to the first communication gateway is connected to a second type of communication gateway, and the second type of communication gateway includes at least one second communication gateway, the second gateway IP address of each second communication gateway is read, and the first gateway IP address is assigned to the first communication gateway based on the second gateway IP address, the controller IP address and the first dial value of the first communication gateway.
3. The method according to claim 2, characterized in that The second gateway IP address includes a fifth IP address segment, a sixth IP address segment, a seventh IP address segment, and an eighth IP address segment; Allocating a first gateway IP address to the first communication gateway based on the second gateway IP address, the controller IP address, and the first dial value of the first communication gateway includes: Determine the fifth IP address segment as the first address segment in the first gateway IP address assigned to the first communication gateway, and determine the sixth IP address segment as the second IP address segment in the first gateway IP address assigned to the first communication gateway; Determine the identified IP address segment as a third IP address segment in the first gateway IP address assigned to the first communication gateway; Determine, based on the eighth IP address segment, a fourth IP address segment in the first gateway IP address allocated to the first communication gateway, wherein the eighth IP address segment is different from the fourth IP address segment; The first IP address segment, the second IP address segment, the third IP address segment and the fourth IP address segment are concatenated to obtain a first gateway IP address, and the first gateway IP address is allocated to the first communication gateway.
4. The method according to claim 3, characterized in that Determining a fourth IP address segment in the first gateway IP address allocated to the first communication gateway based on the eighth IP address segment includes: Determine whether there is a recycled gateway IP address corresponding to the target controller in the gateway IP recycling pool, wherein the recycled gateway IP address includes a first recycled IP address segment, a second recycled IP address segment, a third recycled IP address segment, and a fourth recycled IP address segment; If there is a recycled gateway IP address corresponding to the target controller, the fourth recycled IP address segment is determined as the fourth IP address segment in the first gateway IP address allocated to the first communication gateway.
5. The method according to claim 1, characterized in that Allocating a first gateway IP address to the first communication gateway based on a controller IP address of a target controller connected to the first communication gateway and a first dial value of the first communication gateway includes: Determine the communication gateway set to which the first communication gateway belongs, and obtain a subnet mask corresponding to the communication gateway set, where different communication gateway sets belonging to the same target controller have different subnet masks; A first gateway IP address is allocated to the first communication gateway based on the subnet mask of the communication gateway set to which the first communication gateway belongs, the controller IP address of the target controller connected to the first communication gateway, and the first dial value of the first communication gateway; wherein the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment, a fourth IP address segment and a subnet mask; first communication gateways belonging to the same communication gateway set have different fourth IP address segments in their first gateway IP addresses and the same subnet masks; first communication gateways belonging to different communication gateway sets have different fourth IP address segments in their first gateway IP addresses and different subnet masks.
6. The method according to claim 1, characterized in that Determine the first type of communication gateways that are not assigned gateway IP addresses in the virtualized control system, including: Obtaining jumper values of each communication gateway in the virtualized control system; Based on the jumper value, determining a powered-on communication gateway; If the gateway IP address of the powered-on communication gateway is not read, or the gateway IP address of the powered-on communication gateway is a null value, the powered-on communication gateway is determined as a first-category communication gateway.
7. A device for allocating gateway IP addresses in a virtualized control system, characterized in that: include: A determination module is configured to determine a first type of communication gateway to which a gateway IP address is not assigned in the virtualized control system, wherein the first type of communication gateway includes at least two first communication gateways; A reading module configured to read the controller IP address of each of the target controllers and read the first dial value of each of the first communication gateways if the at least two first communication gateways are respectively connected to at least two different target controllers; The allocation module is configured to allocate a first gateway IP address to each of the first communication gateways based on the controller IP address of the target controller connected to the first communication gateway and the first dial value of the first communication gateway; wherein the first gateway IP address includes a first IP address segment, a second IP address segment, a third IP address segment and a fourth IP address segment; the first communication gateways connected to the same target controller have different fourth IP address segments in their first gateway IP addresses; the first communication gateways connected to different target controllers have different third IP address segments in their first gateway IP addresses; Allocating a first gateway IP address to the first communication gateway based on a controller IP address of a target controller connected to the first communication gateway and a first dial value of the first communication gateway includes: Extracting an identification IP address segment from the controller IP address, wherein the identification IP address segment is used to identify and distinguish different target controllers; Based on the first dial code value and identification IP address segment of the first communication gateway, a first gateway IP address is allocated to the first communication gateway; wherein the third IP address segment in the first gateway IP address is the identification IP address segment; and the fourth IP address segment in the first gateway IP address is determined by the first dial code value.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
BMS communication address allocation method and system and battery management system
CN113840019A
Equipment control method, system and device, computer equipment and storage medium
CN117193098A