Methods, devices, equipment, and media for collecting switch configuration information
By using Ansible technology in the cloud network to automatically collect switch configuration information on the seed machine, the high cost and low accuracy problems caused by manual collection in the cloud network delivery process are solved, and efficient and accurate automated configuration information collection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2024-12-06
- Publication Date
- 2026-07-31
AI Technical Summary
In the cloud network delivery process, existing technologies require manual collection of switch configuration information, resulting in high costs and low accuracy.
Ansible technology is used to establish a communication connection between the seed machine and the target switch, automatically obtain a list of configuration commands, and collect the switch's configuration information through the communication connection.
It enables automated configuration information collection without human intervention in the cloud network delivery process, improving collection efficiency and accuracy while reducing costs.
Smart Images

Figure CN119854126B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, specifically to a method, apparatus, device, and medium for collecting switch configuration information. Background Technology
[0002] In the delivery phase of large-scale cloud network architectures, there are numerous network devices and complex network topologies and configuration information. Because the cloud network is in the delivery phase and the access network has not yet been cut off, the network monitoring system cannot monitor or manage the network devices at this stage. When it is necessary to collect switch configuration information, it must be done manually, wasting human resources and time, and the accuracy of the collected configuration information is low. Summary of the Invention
[0003] This application proposes a method, apparatus, device, and medium for collecting switch configuration information to address the problem of high cost and low accuracy in manually collecting switch configuration information when the cloud network is in the delivery stage.
[0004] In a first aspect, embodiments of this application provide a method for collecting switch configuration information, applied to a seed machine deployed in a cloud network, the seed machine being configured according to a network configuration toolkit of the cloud network; the method includes:
[0005] Ansible technology is used to establish a communication connection with the target switch whose configuration information is to be collected;
[0006] Obtain the configuration command list corresponding to the target switch, and automatically obtain the configuration information of the target switch through the communication connection based on the configuration command list.
[0007] Secondly, embodiments of this application provide a device for collecting switch configuration information, applied to a seed machine deployed in a cloud network, the seed machine being configured according to a network configuration toolkit of the cloud network; the device includes:
[0008] The communication module is used to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology.
[0009] An automatic acquisition module is used to obtain a list of configuration commands corresponding to the target switch, and automatically obtain the configuration information of the target switch through the communication connection based on the list of configuration commands.
[0010] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any embodiment of the first aspect.
[0011] Fourthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon that, when executed by a processor, implements the method as described in any embodiment of the first aspect.
[0012] The switch configuration information collection method, apparatus, device, and medium provided in this application embodiment allow the seed machine to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology. This enables the seed machine to automatically establish a communication connection with the target switch without human intervention. Furthermore, due to the use of Ansible technology, the technical solution provided in this embodiment does not require the installation of any software or agent on the remotely configured target switch, making the process of establishing a communication connection simple and easy to implement. The process of collecting the target switch's configuration information is automatically completed by the seed machine. The seed machine itself is not part of the network monitoring system but is deployed in the cloud network. This allows the seed machine to establish a normal communication connection with the target switch and automatically collect its configuration information even when the cloud network is in the delivery phase. The automatic collection of configuration information has high efficiency and accuracy, solving the problem of high cost and low accuracy in the prior art when the cloud network is in the delivery phase, which requires manual collection of switch configuration information. Moreover, since the seed machine is configured according to the cloud network's network configuration toolkit, it has the same configuration as the cloud network environment and has the function of deploying and managing other network devices or services, facilitating the management and monitoring of cloud network resources. Attached Figure Description
[0013] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0014] Figure 1 This is a flowchart of one embodiment of the switch configuration information collection method of this application;
[0015] Figure 2 yes Figure 1 The flowchart shown is a step 101 flowchart of the switch configuration information collection method of this application;
[0016] Figure 3 yes Figure 1 The flowchart shown is a method for generating the configuration command list in step 102 of the switch configuration information collection method of this application.
[0017] Figure 4 yes Figure 1 The flowchart shown is a process for automatically obtaining the configuration information of the target switch according to the configuration command list in step 102 of the switch configuration information acquisition method of this application.
[0018] Figure 5 This is a schematic diagram of the structure of one embodiment of the switch configuration information acquisition device of this application;
[0019] Figure 6 This is a schematic diagram of the structure of an electronic device used to implement the embodiments of this application. Detailed Implementation
[0020] All actions involving the acquisition of signals, information, or data in this application are carried out in accordance with the relevant data protection laws and policies of the country where the application is located, and with the authorization of the owner of the relevant device.
[0021] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0023] Please refer to Figure 1 This document illustrates a flowchart 100 of an embodiment of a method for collecting switch configuration information according to this application. This method for collecting switch configuration information can be applied to various electronic devices with data processing capabilities. For example, such electronic devices may include, but are not limited to, cloud servers and physical servers. The execution entity of this method for collecting switch configuration information may be a processor in the aforementioned electronic device.
[0024] In this embodiment, the method for collecting switch configuration information can be applied to a seed machine, which can be deployed in a cloud network. Specifically, it can be deployed on the management node of the cloud network. In this embodiment and the following embodiments, the management node is a cloud computing management node as an example. When the seed machine is deployed on the cloud computing management node, the network convenience of the cloud computing management node can be utilized to enable the seed machine to connect to all switches in the cloud network without hindrance.
[0025] For example, a seed machine can be created by a kernel-based virtual machine (KVM) module.
[0026] In this embodiment, the KVM module allows users to create and run multiple isolated virtual machine environments on the same physical machine (such as a cloud computing management node). Each virtual machine can run its own operating system and applications without interfering with each other.
[0027] Based on the functions of the KVM module described above, in this embodiment, the seed machine is specifically a virtual machine created and deployed on the cloud computing management node. This virtual machine has the ability to communicate with any switch in the cloud network and automatically collect its configuration information.
[0028] In this embodiment, the network configuration toolkit can be obtained by the system from the delivery platform. The system can be the operating system of the cloud computing management node, and the delivery platform can be a centrally deployed project delivery management platform.
[0029] For example, the system can obtain cloud network configuration information and device information from the delivery platform, then process the cloud network configuration information and device information to generate data files such as device hardware information, server network planning and switch network planning, and finally package the data files into the seed machine customized image to form a network configuration toolkit.
[0030] In this embodiment, the network toolkit contains relevant information for each switch, such as: the device name for identifying the switch, the login IP for remotely logging into the switch, the login account and password for authentication, the switch manufacturer, and the software version running on the switch.
[0031] like Figure 1 As shown, the method for collecting the switch configuration information includes the following steps:
[0032] Step 101: Use Ansible technology to establish a communication connection with the target switch whose configuration information is to be collected.
[0033] In this embodiment, the triggering method for step 101 can include two types:
[0034] One approach is to use Ansible technology to establish a communication connection with the target switch whose configuration information is to be collected when the preset collection period arrives.
[0035] Another approach is to use Ansible technology to establish a communication connection with the target switch whose configuration information is to be collected when a preset event is triggered.
[0036] The above two triggering methods can enable the seed machine to periodically or automatically start the process of collecting switch configuration information, thereby improving the degree of automation and meeting the needs of collecting switch configuration information in different scenarios.
[0037] Of course, the above two triggering methods are only specific examples. In actual use, step 101 can also be triggered in other ways. Each case will not be described in detail here.
[0038] In this embodiment, as Figure 2 As shown, step 101 may include:
[0039] Step 201: Unzip the network configuration toolkit to obtain configuration and device information.
[0040] In this embodiment, step 201 can export the network configuration toolkit from the seed machine customized image and decompress it to obtain configuration information and device information.
[0041] Step 202: Using the Secure Shell (SSH) and / or Telecommunication Network Protocol (Telnet) in Ansible technology, remotely log in to the target switch whose configuration information is to be collected, based on the configuration information and device information.
[0042] In this embodiment, Ansible is a configuration management, application deployment, task execution, and multi-node orchestration tool that can communicate with remote hosts via the SSH protocol without requiring any software or agent to be installed on the remote host. For example, the remote host is a switch.
[0043] In this embodiment, SSH is an encrypted protocol that provides secure data transmission. It uses technologies such as public-key cryptography and key exchange to ensure that data is encrypted during transmission, thereby protecting user privacy and data security.
[0044] In this embodiment, Telnet is a plaintext protocol, and all data is transmitted in plaintext. It only supports authentication based on username and password, and transmits plaintext data.
[0045] In summary, when remotely logging into the target switch in step 202, either SSH or Telnet can be used.
[0046] For example, step 202 can use the login IP address for remote login to the switch and the login account and password for authentication as described above to perform remote login.
[0047] Step 203: If the remote login is successful, activate the interactive environment of the target switch and establish a communication connection with the target switch.
[0048] Optionally, in this embodiment, step 203 may also include recording the relevant information of the target switch and the reason for the login failure in the event of a remote login failure, so as to facilitate subsequent analysis and processing.
[0049] Step 102: Obtain the configuration command list corresponding to the target switch. Based on the configuration command list, automatically obtain the configuration information of the target switch through the communication connection established in Step 101.
[0050] In this embodiment, as Figure 3 As shown, methods for generating a list of configuration commands may include:
[0051] Step 301: Use the jinja2 template to encapsulate the Command Line Interface (CLI) commands and Network Configuration Protocol (Netconf) commands of the target switch into atomic scripts.
[0052] In this embodiment, the seed machine can have built-in CLI commands and Netconf commands for various brands and models of switches. Step 302 can obtain the corresponding CLI commands and Netconf commands based on the device information of the target switch.
[0053] In this embodiment, CLI commands are a text-based user interface that allows users to operate the system by entering commands via the keyboard.
[0054] In this embodiment, the Netconf command is a network configuration tool that helps users manage and configure network connections and interfaces in a Linux system. Using the netconf command, users can easily view and modify network configurations to meet the needs of different network environments.
[0055] Step 302: Based on the configuration information collection requirements of the target switch, use the atomic command orchestration engine to orchestrate the atomic scripts into a configuration acquisition template and generate a list of configuration commands.
[0056] In this embodiment, an atomic command orchestration engine can be written in advance for the atomic script mentioned above. In step 302, different atomic commands can be orchestrated on the seed machine for different quantities, types, and orders of configurations to be acquired, generating a configuration command list to achieve automation and flexibility of on-site configuration acquisition.
[0057] For example, if only four configuration items need to be collected: interface description configuration, Virtual Local Area Network (VLAN) name configuration, Intermediate System to Intermediate System (ISIS) neighbor status, and ISIS routing status, step 302 can use an atomic command orchestration engine to arrange these four atomic commands in a specific order to generate a configuration command list. When the seed machine subsequently performs configuration information collection operations, it will follow the orchestration principles to obtain the corresponding configuration or status information.
[0058] For example, such as Figure 4 As shown, step 102, which involves automatically obtaining the configuration information of the target switch based on the configuration command list, may include:
[0059] Step 401: Send the configuration commands in the configuration command list to the target switch one by one.
[0060] Step 402: Receive the echo information returned by the target switch.
[0061] Step 403: Parse the echo information to obtain the echo content.
[0062] In this embodiment, step 403 can parse the echo content according to the character encoding predefined by the target switch manufacturer.
[0063] Step 404: Use regular expressions to match the echoed content and collect information for each configuration item.
[0064] In this embodiment, the configuration item information includes, but is not limited to:
[0065] 1. Interface configuration information
[0066] Interface configuration information may include, but is not limited to: aggregated interface information, physical interface information, route aggregated interface information, and tunnel interface information.
[0067] 2. Configuration information for Open Shortest Path First (OSPF)
[0068] OSPF configuration information may include, but is not limited to, router IDs and silent interfaces. OSPF configuration information can enable routing and forwarding within an autonomous system (such as a cloud network).
[0069] 3. Configuration information for Virtual Routing and Forwarding (VRF)
[0070] The configuration information of a VRF may include, but is not limited to, the name and description of the VRF. The configuration information of a VRF can enable network isolation.
[0071] 4. Border Gateway Protocol (BGP) configuration information
[0072] BGP configuration information may include, but is not limited to: BGP Autonomous System (AS) number, instance number, and some basic attribute configurations. BGP configuration information can ensure that BGP routers correctly exchange routing information.
[0073] 5. VLAN configuration information
[0074] VLAN configuration information may include, but is not limited to, VLAN ID, etc. VLAN configuration information has the function of making communication transmission between different VLANs independent of each other.
[0075] Step 405: Organize and categorize the configuration items according to their respective configuration blocks.
[0076] Step 406: Use regular expressions to match the content of the configuration block and collect the parameters of the configuration block.
[0077] Step 407: Record the configuration block and parameters corresponding to each configuration item to obtain the configuration information of the target switch.
[0078] In this embodiment, after the seed machine finishes collecting the configuration information of a target switch, it records the JSON file containing the configuration block and configuration parameters corresponding to each configuration item of the target switch, which facilitates subsequent data processing and storage.
[0079] In this embodiment, the seed machine can traverse all switches in the cloud network and use the above methods on each switch. Figure 1-4 The steps shown illustrate the collection of configuration information. After completing the work on all switches in the cloud network that require configuration information collection, the switch configuration information collection method provided in this application embodiment may further include a step of resetting the configuration of the seed machine to zero.
[0080] By resetting the seed machine's configuration to zero, the seed machine can be reconfigured according to the latest network configuration toolkit each time configuration information is collected, thereby increasing the applicability and reliability of the switch configuration information collection method provided in this application embodiment.
[0081] The switch configuration information collection method provided in this application embodiment allows the seed machine to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology. This enables the seed machine to automatically establish a communication connection with the target switch without human intervention. Furthermore, due to the use of Ansible technology, the technical solution provided in this embodiment does not require the installation of any software or agent on the remotely configured target switch. The process of establishing a communication connection is simple and easy to implement. The process of collecting the target switch's configuration information is automatically completed by the seed machine. The seed machine itself is not part of the network monitoring system but is deployed in the cloud network. This allows the seed machine to establish a normal communication connection with the target switch and automatically collect its configuration information even when the cloud network is in the delivery phase. The automatic collection of configuration information has high efficiency and accuracy, solving the problem of high cost and low accuracy in the prior art when the cloud network is in the delivery phase, which requires manual collection of switch configuration information. Moreover, since the seed machine is configured according to the cloud network's network configuration toolkit, it has the same configuration as the cloud network environment and has the function of deploying and managing other network devices or services, facilitating the management and monitoring of cloud network resources.
[0082] Please refer to Figure 5 As an implementation of the methods shown in the figures, this application provides an embodiment of a switch configuration information acquisition device, which corresponds to the methods shown in the above embodiments and can be applied to various electronic devices.
[0083] In this embodiment, the method for collecting switch configuration information can be applied to a seed machine, which can be deployed in a cloud network. Specifically, it can be deployed on the management node of the cloud network. In this embodiment and the following embodiments, the management node is a cloud computing management node as an example. When the seed machine is deployed on the cloud computing management node, the network convenience of the cloud computing management node can be utilized to enable the seed machine to connect to all switches in the cloud network without hindrance.
[0084] For example, a seed machine can be created by a kernel-based virtual machine (KVM) module.
[0085] In this embodiment, the KVM module allows users to create and run multiple isolated virtual machine environments on the same physical machine (such as a cloud computing management node). Each virtual machine can run its own operating system and applications without interfering with each other.
[0086] Based on the functions of the KVM module described above, in this embodiment, the seed machine is specifically a virtual machine created and deployed on the cloud computing management node. This virtual machine has the ability to communicate with any switch in the cloud network and automatically collect its configuration information.
[0087] In this embodiment, the network configuration toolkit can be obtained by the system from the delivery platform. The system can be the operating system of the cloud computing management node, and the delivery platform can be a centrally deployed project delivery management platform.
[0088] For example, the system can obtain cloud network configuration information and device information from the delivery platform, then process the cloud network configuration information and device information to generate data files such as device hardware information, server network planning and switch network planning, and finally package the data files into the seed machine customized image to form a network configuration toolkit.
[0089] In this embodiment, the network toolkit contains relevant information for each switch, such as: the device name for identifying the switch, the login IP for remotely logging into the switch, the login account and password for authentication, the switch manufacturer, and the software version running on the switch.
[0090] like Figure 5 As shown, the switch configuration information acquisition device 500 in this embodiment includes:
[0091] The communication module 501 is used to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology.
[0092] The automatic acquisition module 502 is used to acquire the configuration command list corresponding to the target switch, and automatically acquire the configuration information of the target switch through the communication connection based on the configuration command list.
[0093] Optionally, the communication module 501 is further configured to establish a communication connection with the target switch for collecting configuration information using Ansible technology when a preset collection period arrives; and / or, to establish a communication connection with the target switch for collecting configuration information using Ansible technology when a preset event is triggered.
[0094] Optionally, the communication module 501 is further configured to decompress the network configuration toolkit to obtain configuration information and device information; use the Secure Shell Protocol (SSH) and / or the Telnet remote terminal protocol in Ansible technology to remotely log in to the target switch whose configuration information is to be collected based on the configuration information and device information; and, if the remote login is successful, activate the interactive environment of the target switch and establish a communication connection with the target switch.
[0095] Optionally, the automatic acquisition module 502 is further configured to send the configuration commands in the configuration command list to the target switch one by one; receive the echo information returned by the target switch; parse the echo information to obtain the echo content; use regular expressions to match the echo content and collect the information of each configuration item respectively; organize and classify the configuration items according to the configuration block they belong to; use the regular expressions to match the content of the configuration block and collect the parameters of the configuration block; record the configuration block and the parameters of the configuration block corresponding to each configuration item to obtain the configuration information of the target switch.
[0096] Optionally, the automatic acquisition module 502 is further configured to encapsulate the command-line interface CLI commands and network configuration protocol Netconf commands of the target switch into atomic scripts using a jinja2 template; and, according to the configuration information acquisition requirements of the target switch, use an atomic command orchestration engine to orchestrate the atomic scripts into a configuration acquisition template to generate a list of configuration commands.
[0097] Optionally, the automatic acquisition module 502 is also used to reset the configuration of the seed machine to zero.
[0098] Optionally, the seed machine is created by a KVM module and deployed on the cloud computing management node of the cloud network.
[0099] The specific implementation method of the switch configuration information acquisition device provided in this application embodiment can be found in the switch configuration information acquisition method provided in the above embodiments, and will not be repeated here.
[0100] The switch configuration information collection device provided in this application embodiment allows the seed machine to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology. This enables the seed machine to automatically establish a communication connection with the target switch without human intervention. Furthermore, due to the use of Ansible technology, the technical solution provided in this embodiment does not require the installation of any software or agent on the remotely configured target switch. The process of establishing a communication connection is simple and easy to implement. The process of collecting the target switch's configuration information is automatically completed by the seed machine. The seed machine itself is not part of the network monitoring system but is deployed in the cloud network. This allows the seed machine to establish a normal communication connection with the target switch and automatically collect its configuration information even when the cloud network is in the delivery phase. The automatic collection of configuration information has high efficiency and accuracy, solving the problem of high cost and low accuracy in the prior art when the cloud network is in the delivery phase, which requires manual collection of switch configuration information. Moreover, since the seed machine is configured according to the cloud network's network configuration toolkit, it has the same configuration as the cloud network environment and has the function of deploying and managing other network devices or services, facilitating the management and monitoring of cloud network resources.
[0101] The following is for reference. Figure 6 It shows a schematic diagram of the structure of an electronic device used to implement some embodiments of this application. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application.
[0102] like Figure 6 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0103] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, disks, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 4 Each box shown can represent a device or multiple devices as needed.
[0104] In particular, according to some embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, it performs the functions defined above in the methods of some embodiments of this application.
[0105] It should be noted that the computer-readable medium described in some embodiments of this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0106] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0107] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology; obtain a list of configuration commands corresponding to the target switch; and automatically obtain the configuration information of the target switch through the communication connection based on the list of configuration commands.
[0108] Computer program code for performing operations of some embodiments of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++; and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, or it can be connected to an external computer (e.g., via the Internet using an Internet service provider), including local area networks (LANs) or wide area networks (WANs).
[0109] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0110] The units described in some embodiments of this application can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a first determining unit, a second determining unit, a selecting unit, and a third determining unit. The names of these units do not necessarily limit the specific unit itself.
[0111] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0112] The above description is merely a selection of preferred embodiments of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this application.
Claims
1. A method for collecting configuration information of a switch, characterized in that, The method is applied to a seed machine deployed in a cloud network, which is configured according to the network configuration toolkit of the cloud network; the seed machine has the ability to communicate with any switch in the cloud network and automatically collect the configuration information of the switch; the method includes: Ansible technology is used to establish a communication connection with the target switch whose configuration information is to be collected; Obtain the configuration command list corresponding to the target switch, and automatically obtain the configuration information of the target switch through the communication connection based on the configuration command list; The step of automatically obtaining the configuration information of the target switch according to the configuration command list includes: Send each configuration command in the configuration command list to the target switch; Receive the echo information returned by the target switch; The echoed information is parsed to obtain the echoed content; Regular expressions are used to match the echoed content, and information for each configuration item is collected respectively; The configuration items are organized and categorized according to the configuration blocks they belong to; The regular expression is used to match the content of the configuration block, and the parameters of the configuration block are collected. Record the configuration block and parameters corresponding to each configuration item to obtain the configuration information of the target switch; The method further includes: After collecting configuration information from all switches in the cloud network that require it, the configuration of the seed machine is reset to zero.
2. The method of claim 1, wherein, The process of establishing a communication connection with the target switch whose configuration information is to be collected using Ansible technology includes: When the preset data collection period arrives, Ansible technology is used to establish a communication connection with the target switch whose configuration information is to be collected; and / or, When a preset event is triggered, Ansible technology is used to establish a communication connection with the target switch whose configuration information is to be collected.
3. The method of claim 1, wherein, The process of establishing a communication connection with the target switch whose configuration information is to be collected using Ansible technology includes: Decompress the network configuration toolkit to obtain configuration information and device information; Using the Secure Shell protocol SSH and / or the remote terminal protocol Telnet in Ansible technology, remote login is performed on the target switch whose configuration information is to be collected, based on the configuration information and device information. Upon successful remote login, the interactive environment of the target switch is activated, and a communication connection with the target switch is established.
4. The method of claim 1, wherein, The method for generating the configuration command list includes: The command-line interface CLI commands and network configuration protocol Netconf commands of the target switch are encapsulated into atomic scripts using the jinja2 template; Based on the configuration information collection requirements of the target switch, the atomic command orchestration engine is used to orchestrate the atomic scripts into a configuration acquisition template and generate a list of configuration commands.
5. The method according to any one of claims 1-4, characterized in that, The seed machine is created by the kernel-based virtual machine (KVM) module and deployed on the cloud management node of the cloud network.
6. A device for collecting switch configuration information, characterized in that, The device is applied to a seed machine deployed in a cloud network and configured according to the network configuration toolkit of the cloud network. The seed machine has the ability to communicate with any switch in the cloud network and automatically collect the configuration information of the switch. The device includes: The communication module is used to establish a communication connection with the target switch whose configuration information is to be collected using Ansible technology. An automatic acquisition module is used to obtain a list of configuration commands corresponding to the target switch, and automatically obtain the configuration information of the target switch through the communication connection based on the list of configuration commands. The automatic data acquisition module is further configured to send the configuration commands in the configuration command list to the target switch one by one; receive the echo information returned by the target switch; parse the echo information to obtain the echo content; use regular expressions to match the echo content and collect the information of each configuration item; organize and classify the configuration items according to the configuration blocks they belong to; use the regular expressions to match the content of the configuration blocks and collect the parameters of the configuration blocks; record the configuration block and the parameters of the configuration block corresponding to each configuration item to obtain the configuration information of the target switch. The automatic data acquisition module is also used to reset the configuration of the seed machine to zero after collecting configuration information from all the switches in the cloud network that require it.
7. An electronic device, characterized in that, include: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.