CN113791826A - Method and device for generating initialization configuration of network equipment in batch - Google Patents

Method and device for generating initialization configuration of network equipment in batch Download PDF

Info

Publication number
CN113791826A
CN113791826A CN202111110843.3A CN202111110843A CN113791826A CN 113791826 A CN113791826 A CN 113791826A CN 202111110843 A CN202111110843 A CN 202111110843A CN 113791826 A CN113791826 A CN 113791826A
Authority
CN
China
Prior art keywords
command
module
template
configuring
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111110843.3A
Other languages
Chinese (zh)
Inventor
汤荣波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202111110843.3A priority Critical patent/CN113791826A/en
Publication of CN113791826A publication Critical patent/CN113791826A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to a method and a device for generating initialization configuration of network equipment in batches, wherein the method comprises the steps of configuring a variable table and configuring a template through a Jinja2 module; associating the variable report form with the template through a Python script to generate a command; and uploading the command to a network device through a Netmiko module and executing the command. The technical scheme provided by the invention can solve the problems that the switch batch delivery scene is time-consuming and labor-consuming in manual configuration and easy to make mistakes, and the method provided by the invention can improve the working efficiency of the operation and maintenance of the data center network.

Description

Method and device for generating initialization configuration of network equipment in batch
Technical Field
The invention belongs to the technical field of networks, and particularly relates to a method and a device for generating initialization configuration of network equipment in batches.
Background
Network devices and components are physical entities connected into a network. The variety of network devices is great and increasing. The basic network devices are: computers (whether personal computers or servers), hubs, switches, bridges, routers, gateways, Network Interface Cards (NICs), Wireless Access Points (WAPs), printers and modems, fiber optic transceivers, fiber optic cables, and the like.
The current computer network is rapidly developed, the number of used bottom network devices is increasingly huge, and with the appearance of various remote connection technologies and the continuous expansion of network scale, the network is more and more dispersed geographically, and even if the network is a small network, the network devices can be far away from each other.
When a network project is opened, whether ZTP or manual command knocking is adopted, the equipment configuration files of all Role in the whole network are required to be prepared. The existing technical scheme is that scripts are manually created manually based on baseline configuration, but characters in a configuration template are manually replaced one by one, so that the workload is too large, and errors are easy to occur.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for generating initialization configuration of network devices in batch, so as to solve the problem in the prior art that characters in a configuration template are replaced one by one manually, which results in too large workload and is prone to error.
In order to achieve the purpose, the invention adopts the following technical scheme: a method of generating network device initialization configurations in batches, comprising:
configuring a variable table and a template through a Jinja2 module;
associating the variable report form with the template through a Python script to generate a command;
and uploading the command to a network device through a Netmiko module and executing the command.
Further, the configuration variable table includes:
acquiring IP information of equipment needing to be operated;
and configuring the IP information into a variable table.
Further, the associating the variable table and the template through the Python script generates a command, including:
and performing ID judgment on the IP information in the variable table and generating a command according to the application of the Jinja2 module in the Python script.
Further, the network device includes:
computers, hubs, switches, bridges, routers, gateways, and printers.
The embodiment of the present application provides an apparatus for generating initialization configuration of network devices in batch, including:
the configuration module is used for configuring the variable table and the template through the Jinja2 module;
the generating module is used for associating the variable report form with the template through a Python script to generate a command;
and the execution module is used for uploading the command to the network equipment through the Netmiko module and executing the command.
By adopting the technical scheme, the invention can achieve the following beneficial effects:
the invention provides a method and a device for generating initialization configuration of network equipment in batches, wherein the method comprises the steps of configuring a variable table and configuring a template through a Jinja2 module; associating the variable report form with the template through a Python script to generate a command; and uploading the command to a network device through a Netmiko module and executing the command. The technical scheme provided by the invention can solve the problems that the switch batch delivery scene is time-consuming and labor-consuming in manual configuration and easy to make mistakes, and the method provided by the invention can improve the working efficiency of the operation and maintenance of the data center network.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating steps of a method for batch generation of network device initialization configuration according to the present invention;
fig. 2 is a schematic structural diagram of an apparatus for batch-generating network device initialization configuration according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
A specific method for generating initialization configuration of network devices in batch according to the embodiment of the present application is described below with reference to the accompanying drawings.
As shown in fig. 1, the method for batch-generating network device initialization configuration provided in this embodiment of the present application includes:
s101, configuring a variable table and a template through a Jinja2 module;
s102, associating the variable report form and the template through a Python script to generate a command;
and S103, uploading the command to the network equipment through the Netmiko module and executing the command.
The working principle of the method for generating the initialization configuration of the network equipment in batches is as follows: configuring a variable table and a template through a Jinja2 module; associating the variable report form with the template through a Python script to generate a command; and uploading the command to a network device through a Netmiko module and executing the command.
In some embodiments, the configuration variable table comprises:
acquiring IP information of equipment needing to be operated;
and configuring the IP information into a variable table.
Preferably, the associating the variable table and the template by the Python script to generate the command includes:
and performing ID judgment on the IP information in the variable table and generating a command according to the application of the Jinja2 module in the Python script.
Preferably, the network device includes:
computers, hubs, switches, bridges, routers, gateways, and printers.
As shown in fig. 2, the present application provides an apparatus for generating initialization configurations of network devices in batch, including:
the configuration module 201 is used for configuring the variable table and configuring the template through the Jinja2 module;
the generating module 202 is configured to associate the variable report with the template through a Python script, and generate a command;
and the execution module 203 is used for uploading the command to the network equipment through the Netmiko module and executing the command.
The working principle of the device for generating the initialization configuration of the network equipment in batches provided by the application is that the configuration module 201 configures a variable table and a template through a Jinja2 module; the generating module 202 associates the variable report form and the template through a Python script to generate a command; the execution module 203 uploads the command to the network device through the Netmiko module and executes it.
Preferably, the configuration variable table includes:
acquiring IP information of equipment needing to be operated;
and configuring the IP information into a variable table.
Preferably, the associating the variable table and the template by the Python script to generate the command includes:
and performing ID judgment on the IP information in the variable table and generating a command according to the application of the Jinja2 module in the Python script.
Preferably, the network device includes:
computers, hubs, switches, bridges, routers, gateways, and printers.
The embodiment of the application provides computer equipment, which comprises a processor and a memory connected with the processor;
the memory is used for storing computer program, and the computer program is used for executing
Configuring a variable table and a template through a Jinja2 module;
associating the variable report form with the template through a Python script to generate a command;
uploading the command to a network device through a Netmiko module and executing the command;
the processor is used to call and execute the computer program in the memory.
In summary, the present invention provides a method and an apparatus for generating initialization configuration of network devices in batch, where the method includes configuring a variable table and configuring a template through Jinja2 module; associating the variable report form with the template through a Python script to generate a command; and uploading the command to a network device through a Netmiko module and executing the command. The technical scheme provided by the invention can solve the problems that the switch batch delivery scene is time-consuming and labor-consuming in manual configuration and easy to make mistakes, and the method provided by the invention can improve the working efficiency of the operation and maintenance of the data center network.
It is to be understood that the embodiments of the method provided above correspond to the embodiments of the apparatus described above, and the corresponding specific contents may be referred to each other, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (5)

1. A method for generating initialization configurations of network devices in batches, comprising:
configuring a variable table and a template through a Jinja2 module;
associating the variable report form with the template through a Python script to generate a command;
and uploading the command to a network device through a Netmiko module and executing the command.
2. The method of claim 1, wherein configuring the variable table comprises:
acquiring IP information of equipment needing to be operated;
and configuring the IP information into a variable table.
3. The method according to claim 2, wherein the associating the variable table and the template through a Python script generates a command comprising:
and performing ID judgment on the IP information in the variable table and generating a command according to the application of the Jinja2 module in the Python script.
4. The method of claim 1, wherein the network device comprises:
computers, hubs, switches, bridges, routers, gateways, and printers.
5. An apparatus for generating network device initialization configurations in batches, comprising:
the configuration module is used for configuring the variable table and the template through the Jinja2 module;
the generating module is used for associating the variable report form with the template through a Python script to generate a command;
and the execution module is used for uploading the command to the network equipment through the Netmiko module and executing the command.
CN202111110843.3A 2021-09-18 2021-09-18 Method and device for generating initialization configuration of network equipment in batch Pending CN113791826A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111110843.3A CN113791826A (en) 2021-09-18 2021-09-18 Method and device for generating initialization configuration of network equipment in batch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111110843.3A CN113791826A (en) 2021-09-18 2021-09-18 Method and device for generating initialization configuration of network equipment in batch

Publications (1)

Publication Number Publication Date
CN113791826A true CN113791826A (en) 2021-12-14

Family

ID=78879097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111110843.3A Pending CN113791826A (en) 2021-09-18 2021-09-18 Method and device for generating initialization configuration of network equipment in batch

Country Status (1)

Country Link
CN (1) CN113791826A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050201342A1 (en) * 2002-03-27 2005-09-15 Randy Wilkinson Wireless access point network and management protocol
CN107885547A (en) * 2017-11-08 2018-04-06 江苏国泰新点软件有限公司 A kind of collocation method of application program, device, configuration equipment and storage medium
CN110650037A (en) * 2019-09-06 2020-01-03 中盈优创资讯科技有限公司 Heterogeneous network device configuration method and device
CN113010232A (en) * 2021-03-31 2021-06-22 建信金融科技有限责任公司 Configuration-driven lightweight batch data processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050201342A1 (en) * 2002-03-27 2005-09-15 Randy Wilkinson Wireless access point network and management protocol
CN107885547A (en) * 2017-11-08 2018-04-06 江苏国泰新点软件有限公司 A kind of collocation method of application program, device, configuration equipment and storage medium
CN110650037A (en) * 2019-09-06 2020-01-03 中盈优创资讯科技有限公司 Heterogeneous network device configuration method and device
CN113010232A (en) * 2021-03-31 2021-06-22 建信金融科技有限责任公司 Configuration-driven lightweight batch data processing method and device

Similar Documents

Publication Publication Date Title
CN105843182B (en) A kind of power scheduling accident prediction system and method based on OMS
CN105429806B (en) A kind of device and method of the network function virtualization based on data-driven
CN103412768A (en) Zookeeper cluster automatic-deployment method based on script program
CN101894059B (en) A kind of detection method of running status and system
CN103841179A (en) Cloud desktop system
WO2015188617A1 (en) Method and device for installing mysql databases
CN106878363A (en) A kind of information processing method, apparatus and system
CN105847088A (en) Virtual machine performance testing system based on cloud service
CN104809015A (en) Method for automatically deploying Oracle rac environment based on Linux system
CN106168993B (en) Real-time simulation analysis system for power grid
CN107992403B (en) IO performance test method, device, equipment and computer readable storage medium
US20150040125A1 (en) Allowing management of a virtual machine by multiple cloud providers
CN105162756A (en) Method for implementing government virtual office platform
US20170033979A1 (en) Restoration of consistent regions within a streaming environment
CN111143128A (en) Openstack cloud host data protection method and system
CN106850304A (en) A kind of gateway group method and system based on SDN frameworks
CN103501295B (en) A kind of remote access method based on virtual machine (vm) migration and equipment
CN109446255A (en) A kind of storage method and system that can be adaptive
CN109684033B (en) Cloud platform bare metal management method, storage medium, electronic device and system
CN114048108A (en) Automatic treatment method and device for multi-source heterogeneous data
CN116400987B (en) Continuous integration method, device, electronic equipment and storage medium
CN106886477B (en) Method and device for setting monitoring threshold in cloud system
CN113791826A (en) Method and device for generating initialization configuration of network equipment in batch
CN108427560A (en) API file management methods, server and storage medium
CN103281202A (en) System of browser/server architecture and front-end presentation method of system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination