Method and system for computing node network relation change in network target range

By incrementally modifying the node network relationship of topological instances in the network shooting range, the problem of poor performance in the existing technology is solved, and efficient resource management and topological adjustment are achieved.

CN119583365AActive Publication Date: 2025-03-07SAINING WANGAN

Patent Information

Application Number
CN202510112108.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-03-07
Estimated Expiration
2045-01-24

AI Technical Summary

Technical Problem

The method of calculating changes in network relationships in existing network shooting ranges has poor performance, requiring the recycling and recreation of all virtual machines and network resources, resulting in high resource consumption and time-consuming.

Method used

By sorting and traversing the nodes in the topological instance, node network relationships are generated, including derivative networks and access networks, node changes are compared before and after modification, invalid relationships are cleaned, network information required for incremental modifications, new node relationships are regenerated, and incremental modifications are made by comparing and determining the networks that need to be deleted and added.

Benefits of technology

Incremental modification of the built topology is realized, performance is improved, unnecessary resource recycling and reconstruction is avoided, and system efficiency and resource utilization are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583365A_ABST
    Figure CN119583365A_ABST
Patent Text Reader

Abstract

The invention discloses a method and system for calculating node network relation change in a network target range, and the method comprises the steps: generating a node network relation for a topology instance before modification, and enabling the node network relation to comprise derivative network information and access network information of a node; comparing changes of the nodes and the ports before and after modification, and clearing invalid node network relations; based on the network identification data of the node ports in the modified topology instance and all derivative network sets generated by the topology instance before modification, generating derivative network information and access network information of the nodes in the modified topology instance; re-executing a node network relationship generation process for the modified topology instance, and supplementing a newly added node network relationship; determining networks needing to be deleted and newly added by comparing all node derivative network sets before and after topology instance modification; and performing incremental modification on network resources and virtual machine resources according to the new node network relationship. According to the method, the performance of operating topology instance modification is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and system for changing the network relationship of computing nodes in a network target range, belonging to the technical field of computer software and network security. Background Art

[0002] The cyber range is a simulation of the real network environment based on virtualization technology. It serves as a platform to support cyberspace security technology verification, network weapons and equipment testing, attack and defense drills, and network risk assessment.

[0003] After a topology instance in the range is built, it is sometimes necessary to adjust the nodes and connection relationships of this topology. Usually, this topology instance needs to be closed, which will cause all the virtual machines, networks, routers and other resources created by this topology instance to be recycled, and then the topology template is edited to adjust the nodes and connection relationships. Then the topology instance is rebuilt based on the topology template.

[0004] The existing network relationship change processing solution has the following problems: 1. Poor performance. If you adjust a topology instance that has been built, all the created virtual machines, networks, routers and other resources will be recycled, and then the global construction will be completed again. This process will consume a lot of CPU, memory, and disk, and involve a large number of disk IO operations. While consuming a lot of system resources, it is also very time-consuming. 2. If the topology instance modification involves rebuilding (recycling and then recreating) the virtual machine, because the reconstruction will recycle disk resources, the virtual machine data generated before the reconstruction will disappear. Summary of the invention

[0005] Purpose of the invention: In view of the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide a method and system for calculating changes in node network relationships in a network target range, which can calculate the changes in node network relationships after the constructed topology is modified. According to the calculated results of the node network relationship changes, the constructed topology can be incrementally modified to improve the reconstruction performance.

[0006] Technical solution: To achieve the above-mentioned invention object, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for changing a network relationship of computing nodes in a network range, comprising the following steps: The nodes in the topology instance before modification are sorted, and the node set is traversed to generate the node network relationship, including the derived network information and access network information of the node; wherein the derived network is the network generated when the node port and the opposite end port are not added to the network when traversing the node and its port; the access network is the network added to the opposite end port when traversing the node and its port; Compare the changes in nodes and node connection ports before and after the topology instance is modified, and clean up invalid node network relationships; Generate derived network information and access network information of nodes in the modified topology instance based on network identification data of node ports in the modified topology instance and a set of all derived networks generated by the topology instance before modification; For the modified topology instance, re-execute the node network relationship generation process and add the newly added node network relationship; By comparing all node derived network sets before and after the topology instance is modified, determine the networks that need to be deleted and added; Based on the new node network relationship, incremental modifications are made to network resources and virtual machine resources.

[0007] Furthermore, the step of sorting the nodes in the topology instance before modification and traversing the node set to generate a node network relationship includes: Sort the nodes according to their types, and sort the nodes of the same type according to their node identifiers to obtain a node set; the node types are sorted in the order of switches, routers, and terminals; Maintain a global port and network mapping relationship to record the network information corresponding to each port, traverse the node set, and execute for each node: Initialize a default network to serve as a derived network of the current non-router type node; traverse all the connection ports of the current node, and for each port, perform the following: Determine whether the port exists in the mapping relationship: If it does, obtain the target network corresponding to the current port. If neither the access network nor the derived network of the current node contains the obtained target network, add the obtained target network to the access network of the current node, otherwise end the processing of the current port; If it does not exist, perform different processing according to the node type: For terminal or switch nodes, set the node identifier of the default network to the identifier of the current node, update the port and network mapping relationship, and add the current port and the opposite port of the line where the current port is connected Mapping to the default network, and add the two ports to the connection port pair of the default network; if neither the access network nor the derived network of the current node contains the default network, add the default network to the derived network of the current node; for the router node, initialize a new network to serve as the derived network of each port of the current router node; set the node identifier of the new network to the identifier of the current node, update the port and network mapping relationship, add the mapping of the current port and the opposite port of the line where the current port is located to the new network, and add the two ports to the connection port pair of the new network; if neither the access network nor the derived network of the current node contains the new network, add the new network to the derived network of the current node.

[0008] Furthermore, the comparison of the changes of nodes and node connection ports before and after the topology instance is modified, and clearing invalid node network relationships, includes: Traverse all nodes in the modified topology instance, and for each node, check whether there is a node with the same node ID in the topology instance before modification; If it does not exist, clear the network identification information of all its ports; If it exists, then traverse all its ports; for each port, check whether there is a port with the same port ID in the topology instance before the modification. If not, clear the network ID information of the current port; if it exists, respectively obtain the opposite end ports before and after the modification, and perform the following processing according to different connection states: If both connection ports are empty or have the same identifier, the network identification information of the current port remains unchanged; If one of the connection ports is empty, clear the network identification information of the current port; If the two connection port identifiers are different, the network identification information of the current port is cleared. If the current node type is a switch, all ports under the node are traversed, and the network identification information of each port and its opposite port is cleared.

[0009] Further, the generating of the derived network information and the access network information of the nodes in the modified topology instance includes: Obtain all derived network sets corresponding to the topology instance before modification, maintain a global port and network mapping relationship, and record the network information corresponding to each port; For each derived network in the derived network set, execute: traverse each port of each node in the modified topology instance, process the network identification information of the port, and when the network identification information is not empty and is the same as the identification of the current derived network, obtain the opposite port, update the connection port pair of the derived network and the port and network mapping relationship according to the opposite port situation, and when the opposite port exists, add the current derived network to the access network of the node to which the opposite port belongs; For each derived network in the derived network set, execute: according to the node identifier recorded in the current derived network, obtain the corresponding node information; if the connection port pair of the derived network is not empty, add the current derived network to the derived network sequence of the obtained node.

[0010] Furthermore, the step of comparing all node derived network sets before and after the topology instance is modified to determine the networks that need to be deleted and added includes: Load all derived network sets corresponding to the topology instance before modification into the first set; Traversing each node in the modified topology instance, and adding all derived networks of each node to the second set; Traverse the first set and determine whether each derived network exists in the second set. If not, mark the current derived network as a network to be deleted. The second set is traversed to determine whether each derived network exists in the first set. If not, the current derived network is marked as a network that needs to be added.

[0011] Furthermore, the incremental modification of network resources and virtual machine resources includes: For the deleted network, delete it directly; For newly added nodes, they are created directly based on the new node network relationship; For the deleted nodes, delete them directly; For a node whose network has been changed, the network card access information of the node virtual machine is changed based on the derived network information and access network information before the modification and the derived network information and access network information after the modification.

[0012] Furthermore, the data structure for storing node information includes a node identifier, a node type, a node's access network information, derived network information, and a port list; wherein each port in the port list includes a port identifier and a network identifier; the data structures of the node's access network and derived network are the same, including a network identifier, a node identifier, and a list of connection port pairs.

[0013] In a second aspect, the present invention provides a system for changing the network relationship of computing nodes in a network range, comprising: The old topology node network relationship generation module is used to sort the nodes in the topology instance before modification, and traverse the node set to generate the node network relationship, including the derived network information and access network information of the node; the derived network information is the network generated when the node port and the opposite end port are not added to the network when traversing the node and its port; the access network information is the network added by the opposite end port when traversing the node and its port; The node network relationship change calculation module is used to compare the changes of nodes and node connection ports before and after the topology instance is modified, and to clean up invalid node network relationships; based on the network identification data of the node ports in the modified topology instance and all derived network sets generated by the topology instance before the modification, the derived network information and access network information of the nodes in the modified topology instance are generated; for the modified topology instance, the node network relationship generation process is re-executed to supplement the newly added node network relationship; and by comparing all node derived network sets before and after the topology instance is modified, the network that needs to be deleted and added is determined; And an incremental modification module is used to incrementally modify network resources and virtual machine resources according to new node network relationships.

[0014] In a third aspect, the present invention provides a computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of a method for changing the network relationship of computing nodes in a network target range.

[0015] In a fourth aspect, the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of a method for changing the network relationship of computing nodes in a network target range.

[0016] Beneficial effects: Compared with the prior art, the method proposed in the present invention can calculate the changes in the node network relationships of the constructed topology after the modification. According to the calculated node network relationship change results, the constructed topology can be incrementally modified without the need to recycle all resources first and then re-execute the entire construction process. The advantages of incremental modification over global recycling first and then rebuilding are as follows: 1. Performance is greatly improved. The construction of the topology involves a large number of network, CPU, memory, and disk operations. It supports incremental modification of the constructed topology, which can greatly optimize unnecessary network, CPU, memory, and disk resource usage and operations during the modification process. 2. Incremental modification will not recycle the disk resources of nodes that still exist before and after the topology modification. The disk data generated before the topology modification can be retained after the modification. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Schematic diagram of a flow chart of an embodiment of the present invention.

[0018] Figure 2 The figure is a schematic diagram of topological changes of an example in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.

[0020] like Figure 1As shown, in response to the problems existing in modifying the topology running instance, an embodiment of the present invention discloses a method for calculating the change of the network relationship of nodes in a network target range, which mainly includes: firstly, sorting the nodes in the topology instance before modification, and traversing the node set to generate the node network relationship, including the derived network information and access network information of the node; wherein the derived network and the access network are two types of networks defined by the present invention for recording and comparing the node network relationship, wherein the derived network is a network generated when the node port and the opposite end port are not added to the network when traversing the node and its port, and the access network is a network added by the opposite end port when traversing the node and its port; then, comparing the changes of the nodes and the node connection ports before and after the topology instance is modified, clearing the invalid node network relationship, and based on the network identification data of the node port in the modified topology instance and all the derived network sets generated by the topology instance before modification, generating the derived network information and access network information of the nodes in the modified topology instance; then, for the modified topology instance, re-executing the node network relationship generation process, supplementing the newly added node network relationship; finally, by comparing all the node derived network sets before and after the topology instance is modified, determining the networks that need to be deleted and added, and incrementally modifying the network resources and virtual machine resources according to the new node network relationship.

[0021] Through the method for calculating the change of the network relationship of nodes described in the embodiment of the present invention, it is possible to know the change of the network relationship between nodes before and after the dynamic change of the topology instance. Therefore, for 1. nodes whose network relationship has not changed, no processing is required; 2. nodes whose network relationship has changed, only the network information they are connected to needs to be modified, and their CPU, memory, and disk resources do not need additional processing; 3. deleted nodes need to release their network, CPU, memory, and disk resources; 4. newly added nodes need to apply for network, CPU, memory, and disk resources.

[0022] In order to better describe the implementation process, Figure 2 The method of this embodiment is exemplarily described by taking the topological structure described in as an example. Figure 2 The left side is the original topology template. Virtual core router r1 is connected to switch s1 port s1-p2 through port r1-p1, and is connected to switch s2 port s2-p2 through port r1-p2. Switch s1 is connected to virtual machine terminal t1 port t1-p1 through port s1-p1. Switch s2 is connected to virtual machine terminal t2 port t2-p1 through port s2-p1, and is connected to virtual machine terminal t3 port t3-p1 through port s2-p3.

[0023] After the user modification, port s2-p2 of switch s2 is connected to port r2-p2 of new router r2, terminal t3 is deleted, and port s2-p3 of switch s2 is not connected to any node. Port r2-p1 of new router r2 is connected to port r1-p3 of router r1. Port r1-p2 of router r1 is not connected to any node.

[0024] Before describing in detail how to incrementally calculate changes in network relationships, the data structure involved in this embodiment is first described.

[0025] Network information storage structure: { "network_id": "2343252345", / / network id "node_id": "s1", / / node id of the derived network "connect_ports": [ / / Network connection relationship { "from": "s1-p1", / / departure port "to": "t1-p1" / / destination port }, { "from": "s1-p2", / / departure port "to": "r1-p1" / / destination port } ] } Wherein, network_id is the unique identification ID of the network, which is generated using a standard uuid generator. node_id is the node ID from which the network is derived. In this embodiment, the relationship between the network and the node is divided into a node-derived network and a node-accessed network. connect_ports is the port accessed in the current network. There are multiple groups, one of which is a line, one end of which is the from departure port and the other end is the to destination port. The from departure ports are all ports of the node corresponding to the node_id.

[0026] The data structure of Node node information: { "node_id": "s1", "node_type": "1", / / Node types are 0-terminal 1-switch 2-router "access_networks": [ ], "derive_networks": [ { "network_id": "2343252345", "node_id": "s1", "connect_ports": [ { "from": "s1-p1", "to": "t1-p1" },{ "from": "s1-p2", "to": "r1-p1" } ] } ], "ports": [ { "port_id": "s1_p1", "network_id": "2343252345", "src_element": "A reference to the current node" }, { "port_id": "s1-p2", "network_id": "2343252345", "src_element": "A reference to the current node" } ] } Each node holds the derived network information of the derive_networks node and the access network information of the access_networks node. Both fields are of type List <network>At the same time, the node also holds the information of the ports it owns, and the relevant information is stored in the List it holds. <port>The port data of each node is determined based on the topology. The calculation process of the derived network and access network data is shown in step 1 below.

[0027] Step 1: When the topology is first constructed, the node network relationship is generated. The process of generating the node network relationship is actually the calculation process of the derived network information of the derive_networks node and the access network information of the access_networks node of each node. The specific steps include: Step 1.1 Sort the nodes and get the sorted node list <node>Before calculating the node network relationship, you need to sort the nodes according to their types. Node types are divided into terminals, routers, and switches. If they are of the same type, they are sorted according to the node ID. Among the node types, switches are ranked first, followed by router types, and finally terminal types.

[0028] Step 1.2 Traverse the node collection List <node>, generate node network relationships. The specific process includes: Step 1.2.1 Maintain a global port and network mapping map<Port, Network> portToNetworkMap.

[0029] Step 1.2.2 Traverse the node collection List <node>, for each of the nodes, perform the following steps.

[0030] Step 1.2.3 Initialize a default network (initializing a network specifically uses the standard uuid generator to set the network id, and sets the others to empty, the same below) Network defaultNetwork, process the current node, and traverse all the connection ports List of the node <port>For each port, perform the following steps.

[0031] Step 1.2.4 For the current port Port port, execute: Step 1.2.4.1 Determine whether portToNetworkMap contains the current port. If so, execute the steps below step 1.2.4.1.

[0032] Step 1.2.4.1.1 Use portToNetworkMap.get(port) to obtain the Network target_network corresponding to the current port. If neither the access_networks nor the derive_networks of the current node node contain the current target_network, add the target_network to the access_networks of the current node node. Otherwise, the processing of the current port port ends.

[0033] Step 1.2.4.2 Determine whether portToNetworkMap contains the current port. If not, execute the steps below step 1.2.4.2.

[0034] Step 1.2.4.2.1 If the current node type node_type is 0 or 1, that is, the terminal type or switch, the node_id of defaultNetwork is the node_id of the current traversal node.

[0035] Step 1.2.4.2.1.1 The other side of the line where the current port port is connected is Port connect_port, set portToNetworkMap.put(port, defaultNetwork), portToNetworkMap.put(connect_port, defaultNetwork). At the same time, defaultNetwork.getConnectPorts.add(port,connect_port). That is, add a mapping with key port and value defaultNetwork in portToNetworkMap; add a mapping with key connect_port and value defaultNetwork. And add a port pair with from as port and to as connect_port in connect_ports of defaultNetwork. At the same time, the network_id values ​​of port and connect_port are set to the network_id of defaultNetwork.

[0036] Step 1.2.4.2.1.2 If neither the access_networks nor the derive_networks of the current node node contains defaultNetwork, add defaultNetwork to the derive_networks of the current node.

[0037] Step 1.2.4.2.2 If the current node type node_type is 2, router.

[0038] Step 1.2.4.2.2.1 Initialize a network Network currentNetwork. The node_id of currentNetwork is the node_id of the currently traversed node node.

[0039] Step 1.2.4.2.2.2 The other side of the line where the current port port is connected is Port connect_port, set portToNetworkMap.put(port, currentNetwork), portToNetworkMap.put(connect_port, currentNetwork). At the same time, currentNetwork.getConnectPorts.add(port,connect_port). That is, add a mapping with key port and value currentNetwork to portToNetworkMap; add a mapping with key connect_port and value currentNetwork. And add a port pair with from as port and to as connect_port to connect_port in currentNetwork's connect_ports. At the same time, the network_id values ​​of port and connect_port are both set to the network_id of currentNetwork.

[0040] Step 1.2.4.2.2.3 If neither access_networks nor derive_networks of the current node node contains currentNetwork, add currentNetwork to derive_networks of the current node.

[0041] In the example topology diagram, following the descriptions in steps 1.1 to 1.2, we can obtain a node network relationship like this: The switch s1 derived network derive_networks has only one element network1, and the access network access_networks is empty. The node_id of network1 is the node_id of s1. The port connection pairs connect_ports included are (s1-p2,r1-p1) and (s1-p1,t1-p1). The first element of the connection pair is from, and the second element is to.

[0042] The switch s2's derived network derive_networks also has only one element network2, and the access network access_networks is empty. The node_id of network2 is the node_id of s2. The port connection pairs connect_ports included are (s2-p2,r1-p2), (s2-p1,t2-p1), (s2-p3,t3-p1).

[0043] The derived network derive_networks of terminal t1 is empty, and access_networks has one element network1.

[0044] The derived network derive_networks of terminal t2 is empty, and access_networks has one element network2.

[0045] The derived network derive_networks of terminal t3 is empty, and access_networks has one element, network2.

[0046] The derived network derive_networks of router r1 is empty, and access_networks has two elements: network1 and network2.

[0047] Step 1.3 After obtaining the above relationship, we traverse the derive_networks of all nodes and obtain the List of all derived network sets <network>all_networks and persist them. At the same time, the node information and port information are persisted.

[0048] Step 2: After modifying the topology instance, clean up invalid node network relationships.

[0049] This step compares the changes in nodes and node connection ports before and after the topology modification, and clears the invalid network information recorded in the network_id field in the node port due to the change in the node network relationship. This facilitates step 4 to correctly calculate the valid node network relationship before and after the topology change. The following is a detailed introduction on how to clear invalid node network relationships.

[0050] Step 2.1 compares the topology of the topology instance before and after the modification. The topology before the modification is recorded as old_topo, and the topology after the modification is recorded as new_topo.

[0051] Step 2.2 traverses all nodes in new_topo and performs the following operations on each node new_topo_node.

[0052] Step 2.2.1 The current node id is new_topo_node.node_id. Check whether there is a node with the same node id in old_topo.

[0053] Step 2.2.2 If there is no node with the same node id in old_topo, this new_topo_node is a newly added node, and the network_id information of all ports of this node is set to blank.

[0054] Step 2.2.3 If there is a node with the same node id in old_topo, record it as old_topo_node. Traverse all ports of new_topo_node and perform the following operations for each port new_topo_node_port Step 2.2.3.1 The current port id is new_topo_node_port.port_id. Check whether there is a port id in old_topo_node that is the same as new_topo_node_port.port_id.

[0055] Step 2.2.3.2 If there is no port with the same id, it means that new_topo_node_port is a new port and the network_id information of the port should be empty.

[0056] Step 2.2.3.3 If there is a port old_topo_node_port with the same id, get the port new_topo_node_connect_port at the other end of the line where new_topo_node_port is located in new_topo. Get the port old_topo_node_connect_port at the other end of the line where old_topo_node_port is located in old_topo.

[0057] Step 2.2.3.4 If new_topo_node_connect_port is empty and old_topo_node_connect_port is empty, it means that the port corresponding to new_topo_node_port is not connected to any connection before and after the topology modification, and the new_topo_node_port.network_id information remains unchanged.

[0058] Step 2.2.3.5 If new_topo_node_connect_port is not empty and old_topo_node_connect_port is empty, it means that the new_topo_node_port port was not connected before the topology modification, and a connection to this port was added after the modification. new_topo_node_port.network_id is set to empty.

[0059] Step 2.2.3.6 If new_topo_node_connect_port is empty and old_topo_node_connect_port is not empty, it means that the new_topo_node_port port was connected before the topology modification, and the connection was deleted after the modification. Set new_topo_node_port.network_id to empty.

[0060] Step 2.2.3.7 If new_topo_node_connect_port is not empty and old_topo_node_connect_port is not empty.

[0061] Step 2.2.3.7.1 If new_topo_node_connect_port.port_id is the same as old_topo_node_connect_port.port_id, it means that the connection has not changed before and after the topology modification and no processing is required.

[0062] Step 2.2.3.7.2 If new_topo_node_connect_port.port_id is different from old_topo_node_connect_port.port_id, it means that the port connected by new_topo_node_port has changed before and after the topology modification. Set new_topo_node_port.network_id to empty.

[0063] Step 2.2.3.7.2.1 If the current node type new_topo_node.node_type is a switch, traverse all ports under new_topo_node.

[0064] Step 2.2.3.7.2.1: Record the current port as sw-p, and the opposite port of the line to which the current port is connected as sw-connect-p. Set sw-p.network_id to null, and if sw-connect-p is not null, set sw-connect-p.network_id to null.

[0065] Thus, the invalid node network relationship is cleared. According to the rule expressed in step 2, the situation of clearing the invalid node network relationship in the example topology diagram is as follows: All port connections of terminal t1 remain unchanged and no processing is performed.

[0066] All port connections of switch s1 remain unchanged and no processing is performed.

[0067] The port r1-p1 connection of router r1 has not changed and does not need to be processed; the port r1-p2 connection is deleted, and r1-p2.network_id is set to empty; the port r1-p3 connection is added, and r1-p3.network_id should be empty.

[0068] The network_id of all ports of router r2, which is a newly added node, should be empty.

[0069] The connection of switch s2 port s2-p2 changes, and the network_id of its ports s2-p2, s2-p1 and the opposite ports t2-p1 and r2-p2 of the line to which the port belongs need to be cleared.

[0070] The network_id of terminal t2 port t2-p1 is set to null.

[0071] Terminal t3 is deleted before and after the topology modification and is not involved in the processing in step 2.

[0072] Step 4: Calculate the invariant node network relationships.

[0073] Step 1 completes the initialization of the network relationship of the topology before modification. After the user modifies the topology, we need to incrementally calculate the node network relationship based on the node network relationship recorded in the old topology and the changes in the connection relationship between nodes and nodes in the new topology. Step 2 cleans up the node network relationship that is invalid due to topology changes. Step 4 starts to calculate valid node network relationships. That is, based on the network_id data of the node port in the new topology and all_networks generated in step 1, load the node's derived network derive_networks and access network access_networks. Because it has been processed in step 3, the node network relationship obtained in step 4 is the node network relationship that has not changed before and after the topology modification. This relationship needs to be processed in the following steps to process the node network relationship newly added to the new topology in order to finally obtain the complete node network relationship of the new topology.

[0074] The following describes in detail how to calculate the unchanged effective node network relationship.

[0075] Step 3.1 Get all derived network sets all_networks. Step 2 finally persists all derived network sets. Here we reload it into memory and get all derived network sets all_networks of the last topology construction.

[0076] Step 3.2 Load the node derived network derive_networks and use Map<Port, Network> portToNetworkMap records the mapping relationship between node ports and networks. Perform the following steps: Step 3.2.1 Traverse all nodes in the edited topology, obtain the mapping management of node node_id to node information node, and store it in Map<String, Node> nodeIdToNodeMap.

[0077] Step 3.2.2 traverses all_networks and performs the following operations for each network.

[0078] Step 3.2.2.1 Traverse all nodes in the topology and perform the following operations on each node.

[0079] Step 3.2.2.1.1 traverses the ports of the current node, and performs the following processing for each port.

[0080] Step 3.2.2.1.1.1 If port.network_id is empty, skip the current port processing.

[0081] Step 3.2.2.1.1.2 If port.network_id is not empty, and port.network_id and network.network_id are different, skip the current port processing.

[0082] Step 3.2.2.1.1.3 If port.network_id is not empty, and port.network_id is the same as network.network_id, obtain the opposite port connect_port of the line to which the current port is connected.

[0083] Step 3.2.2.1.1.3.1 If connect_port is empty, add (port,null) to network.connect_ports, and add a mapping relationship with key as port and value as network to portToNetworkMap.

[0084] Step 3.2.2.1.1.3.2 if connect_port is not empty.

[0085] Step 3.2.2.1.1.3.2.1 If connect_port.network_id and network.network_id are the same.

[0086] Step 3.2.2.1.1.3.2.1.1Add (port,connect_port) to network.connect_ports.

[0087] Step 3.2.2.1.1.3.2.1.2 At the same time, portToNetworkMap adds a mapping relationship with the key being port and the value being network; add a mapping with the key being connect_port and the value being network.

[0088] Step 3.2.2.1.1.3.2.1.3connect_port.node_id is the node to which the opposite port belongs. Get the opposite node Node connect_node through nodeIdToNodeMap.get(connect_port.node_id), add the current network network to the access network of the opposite node, connect_node.add(network).

[0089] Step 3.2.2.1.1.3.2.2 If connect_port.network_id and network.network_id are not the same, a topology data exception occurs and all current processes are terminated.

[0090] Step 3.2.2.2 derives the node node_id of the current network network as network.node_id. nodeIdToNodeMap.get(node_id) obtains the corresponding node information node.

[0091] Step 3.2.2.2.1 If the current network network.connect_ports is not empty, add the current network to the derived network sequence of node node, node.derive_networks.add(network).

[0092] Step 3.2.2.2.2 If the current network network.connect_ports is empty, no processing is done.

[0093] At this point, the calculation of the unchanged node network relationship is completed. According to the rules described in step 3, the calculation results of the unchanged node network relationship in the example topology graph are as follows: The switch s1 derived network derive_networks has only one element network1, and the access network access_networks is empty. The node_id of network1 is the node_id of s1. The port connection pairs connect_ports included are (s1-p2,r1-p1) and (s1-p1,t1-p1). The first element of the connection pair is from, and the second element is to.

[0094] The derived network derive_networks of switch s2 is empty, and the access network access_networks is also empty.

[0095] The derived network derive_networks of terminal t1 is empty, and access_networks has one element network1.

[0096] The derived network derive_networks of terminal t2 is empty, and access_networks is also empty.

[0097] Terminal t3 is a node that is deleted after the topology is modified and does not need to be processed in step 3.

[0098] The derived network derive_networks of router r1 is empty, and access_networks has one element, network1.

[0099] Router r2 is a new node, and its derived networks derive_networks and access_networks are both empty.

[0100] Step 4: Calculate the newly added node network relationship.

[0101] Calculating the newly added node network relationship means re-executing step 1 for each node. Steps 2 and 3 have already calculated the node network relationship that has not changed after the topology modification. Each calculated port corresponds to a specific network, and this relationship is recorded in the portToNetworkMap of step 3.2. If a port of the current node does not obtain the mapped network in this Map, it means that the network relationship of this port needs to be recalculated. Therefore, if the port of the mapped network is not obtained in portToNetworkMap, step 1.2 needs to be re-executed to supplement the newly added node network relationship.

[0102] Step 4.1: Execute step 1.1 to sort the nodes of the edited topology new_topo. Traverse the sorted nodes and record the current node as new_topo_node.

[0103] Step 4.2: Execute all the steps below step 1.2 above for each current node new_topo_node, where the portToNetworkMap value declared in step 1.2.1 is the value of portToNetworkMap in step 3.2.

[0104] According to the rules described in steps 4.1 and 4.2, the final node network relationship of the new topology in the example topology diagram is as follows: The switch s1 derived network derive_networks has only one element network1, and the access network access_networks is empty. The node_id of network1 is the node_id of s1. The port connection pairs connect_ports included are (s1-p2,r1-p1) and (s1-p1,t1-p1). The first element of the connection pair is from, and the second element is to.

[0105] The switch s2 has an element network3 in the derived network derive_networks, and the access network access_networks is empty. The node_id of network3 is the node_id of s2. The port connection pairs connect_ports included are (s2-p1, t2-p1) and (s2-p2, r2-p2).

[0106] The derived network derive_networks of terminal t1 is empty, and access_networks has one element network1.

[0107] The derived network derive_networks of terminal t2 is empty, and access_networks has one element, network3.

[0108] Terminal t3 is a node that is deleted after the topology is modified. It is not in the edited topology new_topo and does not need to be processed in step 4.

[0109] The derived network derive_networks of router r1 has one element network4. The access_networks has one element network1. The node_id of network4 is the node_id of r1. The port connection pair connect_ports contains one (r1-p3,r2-p1).

[0110] Router r2 is a new node, the derived network derive_networks is empty, and access_networks has two elements, network3 and network4.

[0111] Step 5: Calculate the networks that need to be deleted and added.

[0112] The set of derived networks of all nodes before the topology is modified is A. After the topology is modified, after steps 2 to 4, the set of derived networks of all nodes in the new topology is B. The network to be deleted is AB, and the newly added network is BA. The specific execution steps are as follows: Step 5.1 Get the list of derived networks of all nodes when the topology persisted in step 1.4 was built before being modified <network>allNetworks.

[0113] Step 5.2 Get the edited topology new_topo after executing step 4. Use List <network>allNetworksForNewTopo records all derived networks for the new topology.

[0114] Step 5.3 traverse all nodes in new_topo, for each node current_node.

[0115] Step 5.3.1 Add the derived network of current_node to allNetworksForNewTopo. allNetwoksForNewTopo.addAll(current_node.derive_networks).

[0116] Step 5.4 traverses allNetworks and performs the following operations on the element network under allNetworks.

[0117] Step 5.4.1 If network does not exist in allNetworksForNewTopo, then network is the network that needs to be deleted.

[0118] Step 5.5 traverse allNetworkForNewTopo and perform the following operations on the element new_topo_network under allNetworkForNewTopo Step 5.5.1 If new_topo_network does not exist in allNetworks, then new_topo_network is the network that needs to be added.

[0119] According to the rules described in step 5, in the example topology diagram, the network to be deleted is network2, and the newly added networks are network3 and network4.

[0120] Step 6: Based on the calculated new node network relationship, add, delete, and change network and virtual machine resources.

[0121] After the above steps 1 to 5, we can get the node network relationship of the edited topology. For the newly added network, just create it directly. For the deleted network, just delete it directly. For the newly added node, its new node network relationship has been generated, just create it directly. For the deleted node, just delete it directly. For the node whose network has changed, it has its derived network and access network relationship before the modification and its derived network and access network relationship after the modification. Just change the network connected by the network card of the virtual machine of this node according to the changes of the two.

[0122] According to the topology modification shown in the example topology diagram, you need to perform the following operations: Step 6.1 Delete network network2.

[0123] Step 6.2 Add networks network3 and network4.

[0124] Step 6.3 After the terminal t3 topology is modified, the node is deleted and the virtual machine resources are recycled.

[0125] Step 6.4 After the topology of terminal t1 is modified, the node exists. Before the modification, the derived network derive_networks is empty, and access_networks has an element of network1. After the modification, the derived network derive_networks is empty, and access_networks has an element of network1. There is no change in its derived network and access network before and after the topology modification, so no processing is required.

[0126] Step 6.5 After the topology of switch s1 is modified, the node exists. Before the modification, there is only one element network1 in the derived network derive_networks, and the access network access_networks is empty. After the modification, there is only one element network1 in the derived network derive_networks, and the access network access_networks is empty. There is no change in its derived network and access network before and after the topology modification, and the corresponding network resource network1 does not require any operation.

[0127] Step 6.6 Before the topology of router r1 is modified, the derived network derive_networks is empty, and access_networks has two elements, network1 and network2. According to network1.connect_ports, port r1-p1 of r1 corresponds to the network card connected to network1, and according to network2.connect_ports, port r1-p2 of r1 corresponds to the network card connected to network2. After the topology is modified, the derived network derive_networks of router r1 has one element, network4. Access_networks has one element, network1. The network card corresponding to port r1-p2 is no longer connected to network2; port r1-p3 corresponds to the network card connected to network4; port r1-p1 corresponds to the network card connected to the network card and does not need to be changed.

[0128] Step 6.7 Router r2 is a newly added node, its derived network derive_networks is empty, and access_networks has two elements, network3 and network4. Port r2-p1 corresponds to the network card access network4; port r2-p2 corresponds to the network card access network3.

[0129] Step 6.8 Before the topology modification of switch s2, there is only one element network2 in the derived network derive_networks, and the access network access_networks is empty. After the topology modification, there is only one element network3 in the derived network derive_networks, and the access network access_networks is empty. Before and after the topology modification, the derived network changes from network2 to network3.

[0130] Step 6.9 Before the topology modification of terminal t2, the derived network derive_networks is empty, and access_networks has an element of network2. After the topology modification, the derived network derive_networks is empty, and access_networks has an element of network3. The network access network of the corresponding network card of port t2-p1 is changed from network2 to network3.

[0131] Based on the method of the embodiment of the present invention, it is possible to incrementally calculate the changes in network relationships before and after the topology changes. For virtual nodes whose network access relationships have not changed, no resources need to be consumed during the dynamic adjustment of the topology instance; even for virtual nodes whose network access relationships have changed, during the dynamic adjustment of the topology instance, only the network access relationships are adjusted, and the CPU, memory, disk and other resources allocated to the virtual nodes do not need to be recycled, and only the accessed network needs to be adjusted. This can greatly optimize the performance of modifying the topology instance. By incrementally calculating the changes in network relationships, only the deleted virtual machines before and after the topology instance changes will involve disk resource recycling, and other virtual machine disk data will not be affected.

[0132] Based on the same inventive concept, a system for calculating node network relationship changes in a network range disclosed in an embodiment of the present invention includes: an old topology node network relationship generation module, which is used to sort the nodes in the topology instance before modification, and traverse the node set to generate node network relationships, including the derived network information and access network information of the nodes; a node network relationship change calculation module, which is used to compare the changes of nodes and node connection ports before and after the topology instance is modified, and clean up invalid node network relationships; based on the network identification data of the node ports in the modified topology instance, and all derived network sets generated by the topology instance before modification, the derived network information and access network information of the nodes in the modified topology instance are generated; for the modified topology instance, the node network relationship generation process is re-executed to supplement the newly added node network relationship; and by comparing all node derived network sets before and after the topology instance is modified, the network that needs to be deleted and added is determined; and an incremental modification module, which is used to incrementally modify network resources and virtual machine resources according to the new node network relationship. The specific implementation details of each module refer to the aforementioned method embodiment, which will not be repeated.

[0133] An embodiment of the present invention also discloses a computer system, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method for changing the network relationship of computing nodes in a network target range are implemented.

[0134] An embodiment of the present invention also discloses a computer program product, including a computer program, which, when executed by a processor, implements the steps of a method for changing the network relationship of computing nodes in a network target range.< / network> < / network> < / network> < / port> < / node> < / node> < / node> < / port> < / network>

Claims

1. A method for changing the network relationship of computing nodes in a network range, characterized in that: The steps include: Sorting the nodes in the topology instance before modification, and traversing the node set to generate the node network relationship, including the derived network information and access network information of the node; The derived network is the network generated when the node and its ports are traversed and the ports of the node and the peer port are not added to the network; the access network is the network added by the peer port when traversing the nodes and their ports; Compare the changes in nodes and node connection ports before and after the topology instance is modified, and clean up invalid node network relationships; Generate derived network information and access network information of nodes in the modified topology instance based on network identification data of node ports in the modified topology instance and a set of all derived networks generated by the topology instance before modification; For the modified topology instance, re-execute the node network relationship generation process and add the newly added node network relationship; By comparing all node derived network sets before and after the topology instance is modified, determine the networks that need to be deleted and added; Based on the new node network relationship, incremental modifications are made to network resources and virtual machine resources.

2. According to claim 1, a method for changing the network relationship of computing nodes in a network range is characterized in that: The step of sorting the nodes in the topology instance before modification and traversing the node set to generate a node network relationship includes: Sort the nodes according to their types, and sort the nodes of the same type according to their node identifiers to obtain a node set; the node types are sorted in the order of switches, routers, and terminals; Maintain a global port and network mapping relationship to record the network information corresponding to each port, traverse the node set, and execute for each node: Initialize a default network to serve as a derived network of the current non-router type node; traverse all the connection ports of the current node, and for each port, perform the following: Determine whether the port exists in the mapping relationship: If it does, obtain the target network corresponding to the current port. If neither the access network nor the derived network of the current node contains the obtained target network, add the obtained target network to the access network of the current node, otherwise end the processing of the current port; If it does not exist, perform different processing according to the node type: For terminal or switch nodes, set the node identifier of the default network to the identifier of the current node, update the port and network mapping relationship, and add the current port and the opposite port of the line where the current port is connected Mapping to the default network, and add the two ports to the connection port pair of the default network; if neither the access network nor the derived network of the current node contains the default network, add the default network to the derived network of the current node; for the router node, initialize a new network to serve as the derived network of each port of the current router node; set the node identifier of the new network to the identifier of the current node, update the port and network mapping relationship, add the mapping of the current port and the opposite port of the line where the current port is located to the new network, and add the two ports to the connection port pair of the new network; if neither the access network nor the derived network of the current node contains the new network, add the new network to the derived network of the current node.

3. According to claim 1, a method for changing the network relationship of computing nodes in a network range is characterized in that: The comparing the changes of nodes and node connection ports before and after the topology instance is modified, and clearing invalid node network relationships, includes: Traverse all nodes in the modified topology instance, and for each node, check whether there is a node with the same node ID in the topology instance before modification; If it does not exist, clear the network identification information of all its ports; If it exists, then traverse all its ports; for each port, check whether there is a port with the same port ID in the topology instance before the modification. If not, clear the network ID information of the current port; if it exists, respectively obtain the opposite end ports before and after the modification, and perform the following processing according to different connection states: If both connection ports are empty or have the same identifier, the network identification information of the current port remains unchanged; If one of the connection ports is empty, clear the network identification information of the current port; If the two connection port identifiers are different, the network identification information of the current port is cleared. If the current node type is a switch, all ports under the node are traversed, and the network identification information of each port and its opposite port is cleared.

4. According to claim 1, a method for changing the network relationship of computing nodes in a network range is characterized in that: The generating of the derived network information and the access network information of the nodes in the modified topology instance includes: Obtain all derived network sets corresponding to the topology instance before modification, maintain a global port and network mapping relationship, and record the network information corresponding to each port; For each derived network in the derived network set, execute: traverse each port of each node in the modified topology instance, process the network identification information of the port, and when the network identification information is not empty and is the same as the identification of the current derived network, obtain the opposite port, update the connection port pair of the derived network and the port and network mapping relationship according to the opposite port situation, and when the opposite port exists, add the current derived network to the access network of the node to which the opposite port belongs; For each derived network in the derived network set, execute: according to the node identifier recorded in the current derived network, obtain the corresponding node information; if the connection port pair of the derived network is not empty, add the current derived network to the derived network sequence of the obtained node.

5. The method for changing the network relationship of computing nodes in a network range according to claim 1, characterized in that: The determining of the networks to be deleted and added by comparing all node derived network sets before and after the topology instance is modified includes: Load all derived network sets corresponding to the topology instance before modification into the first set; Traversing each node in the modified topology instance, and adding all derived networks of each node to the second set; Traverse the first set and determine whether each derived network exists in the second set. If not, mark the current derived network as a network to be deleted. The second set is traversed to determine whether each derived network exists in the first set. If not, the current derived network is marked as a network that needs to be added.

6. A method for changing the network relationship of computing nodes in a network range according to claim 1, characterized in that: The incremental modification of network resources and virtual machine resources includes: For the deleted network, delete it directly; For newly added nodes, they are created directly based on the new node network relationship; For the deleted nodes, delete them directly; For a node whose network has been changed, the network card access information of the node virtual machine is changed based on the derived network information and access network information before the modification and the derived network information and access network information after the modification.

7. A method for changing the network relationship of computing nodes in a network range according to claim 1, characterized in that: The data structure for storing node information includes node identification, node type, node access network information, derived network information and port list; each port in the port list includes a port identification and a network identification; the data structure of the node's access network and derived network is the same, including a network identification, a node identification and a list of connection port pairs.

8. A system for computing node network relationship changes in a network range, characterized in that: include: The old topology node network relationship generation module is used to sort the nodes in the topology instance before modification, and traverse the node set to generate the node network relationship, including the derived network information and access network information of the node; the derived network information is the network generated when the node port and the opposite end port are not added to the network when traversing the node and its port; the access network information is the network added by the opposite end port when traversing the node and its port; The node network relationship change calculation module is used to compare the changes of nodes and node connection ports before and after the topology instance is modified, and to clean up invalid node network relationships; based on the network identification data of the node ports in the modified topology instance and all the derived network sets generated by the topology instance before the modification, the derived network information and access network information of the nodes in the modified topology instance are generated; for the modified topology instance, the node network relationship generation process is re-executed to supplement the newly added node network relationship; And by comparing all node derived network sets before and after the topology instance is modified, determine the networks that need to be deleted and added; And an incremental modification module is used to incrementally modify network resources and virtual machine resources according to new node network relationships.

9. A computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by a processor, the steps of a method for changing the network relationship of computing nodes in a network range according to any one of claims 1 to 7 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of a method for changing the network relationship of computing nodes in a network range according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Virtual network topology construction and dynamic change method

    CN112804081A

  • Target range scene topology analysis, initialization and recovery method and system

    CN114422374A

  • Method and system for network resource allocation and topological distribution of distributed network target range

    CN119011362A

  • Real-time event correlation in information networks

    US10693711B1

Cited By

  • Method and system for cross-service unified topological data structure and operation in network target range

    CN120301931A