ChatGPT-enabled_Network_Automation_using_API-based_Prompts
ChatGPT-enabled_Network_Automation_using_API-based_Prompts
Abstract—In the rapidly evolving world of network automation scripts to meet network requirements, leading to
provisioning and management, the traditional approach to potential for syntax errors [3].
device configuration has proven to be error-prone and time-
consuming, especially in large-scale deployments. The TABLE I. RELATED WORKS ON NETWORK AUTOMATION
emergence of network automation has sought to address these
challenges by leveraging software to perform tasks which were Reference Python Ansible ChatGPT
traditionally executed manually by network engineers. [1]
However, utilizing these tools requires technical expertise. This [2]
study explores the potential of using Large Language Models [3]
[4]
(LLMs), specifically ChatGPT, to generate Ansible Playbooks
[5]
for automating network deployment tasks. The goal is to
[6]
eliminate the need for network engineers to prepare automation [7]
scripts. An application named "Bubbln" was developed to [8]
prompt ChatGPT through APIs and execute the ChatGPT- [9]
generated playbooks on a network of four Cisco routers. A [10]
systematic evaluation of this approach reveals impressive results [11]
including 99% accuracy, 100% reliability, a 62% improvement [12]
in efficiency compared to traditional approach and a 13.52% [13]
efficiency gain over manually prepared playbook approach. [14]
These results highlight ChatGPT as a promising tool to enhance [15]
existing network automation approaches. [16]
[17]
Keywords—ChatGPT, chatbot, network automation, [18]
provisioning, configuration. [19]
[20]
I. INTRODUCTION
The evolution of network provisioning processes has More recently, significant advancements have emerged
transitioned from a traditional, error-prone approach to the in the field of Artificial Intelligence, with a particular focus
use of automation tools. Initially, engineers configured each on Large Language Models (LLMs) such as ChatGPT and
networking device manually through Command Line Bard. These models exhibit the remarkable ability to process
Interfaces, which became impractical for large-scale instructions expressed in natural language to generate desired
networks. The growing complexity of networks necessitated textual outputs [21]. The release of ChatGPT has ushered in
faster setup procedures, leading to the concept of network a new era of LLM applications across various domains,
automation. Network automation involves the utilization of including software coding [22], debugging [23], vulnerability
software tools such as Ansible, Chef, Puppet, and others to detection [24] and more. Considering these advancements,
streamline tasks that were traditionally performed manually research on the use of LLMs to automate the scripting process
by network engineers [1]. did not return any result. This prompted our research to
explore the potential of leveraging ChatGPT to generate
Recent research on network automation approaches has Ansible playbooks for network deployment, eliminating the
primarily focused on the preparation of Ansible [1]-[7] and necessity for manual preparation of automation scripts. This
Python scripts [8]-[20] by the researchers as summarized in approach is expected to improve network automation
Table I, to execute various network tasks. For instance, [2] efficiency and ultimately increase the productivity of
compared the performance of Ansible, Salt and Puppet, by engineers.
preparing scripts for different tools, [3] utilized Ansible
scripts to configure both the interfaces and routing protocols II. METHODOLOGY
on a network of five Cisco and five MikroTik routers, while To assess the potential of ChatGPT to generate Ansible
[4] utilized Ansible scripts to provision and verify routing playbooks, a systematic methodology was devised. The key
protocols on a network of three routers. In a similar manner, steps of the methodology included the following:
Python scripts were prepared by [8] to prove its ability to
verify network states automatically and [9] utilized python in A. Obtain API Keys
a proposed architecture to automate VPN configurations. The first step was to register on the OpenAI portal to
Although this approach of manually preparing automation obtain an API key, which was then utilized in the application
scripts offer numerous advantages over traditional methods, developed for prompting ChatGPT.
including increased efficiency and a reduction in errors, there
is a requirement for technical expertise, for effective use of
the automation tools [2]. Engineers need to prepare or tailor
Authorized licensed use limited to: UNIVERSIDADE FEDERAL DO CEARA. Downloaded on January 28,2025 at 20:52:38 UTC from IEEE Xplore. Restrictions apply.
2024 IEEE/IFIP Network Operations and Management Symposium (NOMS 2024) - Poster
B. Application Development
An application named Bubbln, was developed using
Python programming language to get network parameters
from users, compose prompts, prompt ChatGPT, process the
response from ChatGPT, and finally execute the ChatGPT-
generated playbooks on a network of four Cisco routers.
Bubbln was developed with three main components as
follows:
• Logic and Control – This component manages taking
and validating router parameters from users. It then
combines these inputs with a pre-defined set of
instructions written in natural language to form the
prompts illustrated in Fig. 2, which were then sent to
the OpenAPI Gateway. It also receives ChatGPT’s
raw response from the OpenAPI gateway component
and extracts the playbooks, which are subsequently
sent along with the host file to the Playbook Executor
component for onward execution on the network. This
entire process is illustrated in Bubbln’s architecture in
Fig. 1.
• OpenAPI Gateway – This component is responsible
for prompting and receiving responses from ChatGPT
through APIs. It utilizes GPT-4 model, with a
temperature parameter setting of zero and maximum
token of 1500 and OpenAI’s chatCompletion API for
sending prompts to ChatGPT. The choice of
parameter values was to limit the tendency of
ChatGPT generating unwanted features. It works by
passing prompts received from the Logic and Control
component to ChatGPT and sends the raw response
from ChatGPT, which contains a combination of the
playbooks and explanation notes, back to the Logic
and Control component for processing as illustrated in
Fig. 1.
• Playbook Executor – This component handles the Fig. 2. Prompt for generation of playbook for router four.
execution of the ChatGPT-generated playbooks on the
C. Network Design
network. It makes use of the Python library called
Ansible-runner which takes a hosts file and the A network of four Cisco routers with parameter details
ChatGPT-generated playbooks as input from the displayed in Fig. 3, was set up to test the ChatGPT-generated
Logic and Control component. playbooks. It was also used to conduct traditional and user-
prepared playbook experiments. The physical interfaces,
shown in the topology, static routes, SSH2.0 and Ansible host
file, were manually configured for the ChatGPT-generated
and user-prepared playbook experiments to enable
reachability from the controller machine, which hosts Bubbln
and Ansible installations.
D. Conduct of the Experiment
Three categories of experiments were conducted. The
main experiment, which is ChatGPT-enabled, and two other
benchmark experiments as follows:
• ChatGPT-generated Playbooks: Twenty-five
experiments were conducted to test the defined
performance metrics. It involved taking parameter
input from users, prompting ChatGPT for playbook
generation, automatically executing the generated
playbooks on the network and keeping a record of the
deployment timings. Inputting of parameters was
done only in the first experiment and the loaded
parameters were re-used for the remaining twenty-
four experiments.
Fig. 1. Bubbln's architecture and process flow.
Authorized licensed use limited to: UNIVERSIDADE FEDERAL DO CEARA. Downloaded on January 28,2025 at 20:52:38 UTC from IEEE Xplore. Restrictions apply.
2024 IEEE/IFIP Network Operations and Management Symposium (NOMS 2024) - Poster
Authorized licensed use limited to: UNIVERSIDADE FEDERAL DO CEARA. Downloaded on January 28,2025 at 20:52:38 UTC from IEEE Xplore. Restrictions apply.
2024 IEEE/IFIP Network Operations and Management Symposium (NOMS 2024) - Poster
Time (Seconds)
generation, and execution across twenty-five experiments. In 800
Percentage
99.40
The ChatGPT-enabled approach is 61.63% more efficient 99.20
than the traditional approach and 13.52% more efficient than 99.00
user-prepared playbook approach. 98.80
98.60
IV. EVALUATION 98.40
Reliability Accuracy
Traditional network deployment approach is error-prone Performance Metric
and inefficient, prompting the adoption of automation tools,
which also require technical expertise to operate and prone to Fig. 6. Experimental outcome of reliability and accuracy of
syntax errors. This led to our investigation into ChatGPT's ChatGPT-generated playbooks.
potential to generate Ansible playbooks. This section
discusses the discovered pros and cons of using a ChatGPT- • Cost: The utilization of ChatGPT APIs involves
enabled tool for automating network configuration tasks. incurring costs based on usage volume. In essence, a
higher frequency of prompts sent to ChatGPT results
A. Pros of A Chat-GPT Network Automation Tool in proportionally increased costs. This financial aspect
The outcome of this research highlights a ChatGPT- must be carefully factored into the decision to employ
enabled approach as a potential tool for enhancing the this approach.
existing network automation tools for the following reasons:
• Rate Limit: The process of transmitting prompts to
• Simplified Automation Process: The ChatGPT- ChatGPT through APIs is subject to predefined rate
enabled approach seamlessly generated Ansible limits, necessitating thoughtful consideration during
playbooks with 99% accuracy and 100% reliability as the design of an automation tool. This is vital to
seen in Fig. 6. This result positions the approach as prevent the unforeseen interruption of automation
promising for eliminating manual scripting, thereby processes.
reducing time spent on preparing Ansible playbooks.
It addresses the limitations identified by [2] and [3] V. CONCLUSION AND FUTURE WORK
and obviates the need for extensive technical In conclusion, the experiments undertaken to assess the
expertise, eliminating limitations encountered by [2]. potential of employing ChatGPT for generating playbooks
for network deployment tasks have yielded promising and
• Efficiency: The ChatGPT-enabled approach exhibited noteworthy results. ChatGPT has exhibited a commendable
notable efficiency gains. On average, it took 468.23 accuracy rate of 99% and an exceptional reliability rate of
seconds, outperforming the user-prepared playbook 100%. Moreover, these findings indicate an appreciable
approach (541.54 seconds) by 13.52% and the improvement in efficiency, with ChatGPT streamlining
traditional approach (1219 seconds) by 61.63%. It is processes by approximately 62% when compared to
noteworthy that enhancing the efficiency of a traditional methods and 14% when compared to user-
ChatGPT-enabled approach could be achieved prepared playbook approaches. The combination of these
through the adoption of a less time-intensive results demonstrates ChatGPT as a potential tool to enhance
parameter input method, such as the direct loading of existing network automation approaches.
parameters from design documents.
In future research, we aim to investigate ChatGPT’s
B. Cons of A Chat-GPT Driven Network Automation Tool potential for network fault monitoring and auto-recovery to
During this experiment, certain issues were encountered simplify network management, enhance resilience, and
which need to be considered before adopting this approach to minimize downtime. This marks a significant advancement
automate a network. These considerations include the in applying AI and natural language processing to network
following: automation, opening avenues for further exploration of
ChatGPT's potential in network management.
Authorized licensed use limited to: UNIVERSIDADE FEDERAL DO CEARA. Downloaded on January 28,2025 at 20:52:38 UTC from IEEE Xplore. Restrictions apply.
2024 IEEE/IFIP Network Operations and Management Symposium (NOMS 2024) - Poster
Authorized licensed use limited to: UNIVERSIDADE FEDERAL DO CEARA. Downloaded on January 28,2025 at 20:52:38 UTC from IEEE Xplore. Restrictions apply.