Trust, But Verify: An Empirical Evaluation of AI-Generated Code for SDN Controllers

Felipe Soares, Muriel Figueredo Franco, Eder J. Scheid, Lisandro Zambenedetti GranvillearXiv 2025 · DOI

Abstract

Generative Artificial Intelligence (AI) tools have revolutionized content creation, yet their reliability in specialized domains like Software-Defined Networking (SDN) remains a critical question. This paper presents an empirical evaluation of four prominent AI tools—ChatGPT, Copilot, DeepSeek, and BlackBox.ai—in generating Python code for POX controllers. Through a series of networking tasks ranging from basic forwarding to complex Layer-3 firewalls, we assess the functionality, correctness, and manual effort required to deploy AI-generated network logic. Our findings suggest that while all models can produce functional controllers, significant differences exist in code quality and the necessity for human-in-the-loop verification.

Introduction and Context

Software-Defined Networking (SDN) centralizes network control into a software-based controller, offering unprecedented flexibility. However, this centralization makes the controller code a single point of failure. As "vibe coding"—the practice of developing software through natural language interactions with Large Language Models (LLMs)—gains traction, understanding the risks and capabilities of AI in generating networking logic is essential.

Table 1: Comparison of this work with related literature in AI-driven networking.

As shown in Table 1, while previous studies have explored AI in computing and general networking contexts, this work specifically targets the intersection of programmable networks (SDN) and code generation across multiple state-of-the-art models.

Experimental Methodology

To evaluate the AI tools, we defined three tasks of increasing complexity:

  1. Simple Forwarding: Basic packet delivery between all hosts.
  2. Intermediate Blocking: Restricting communication between specific host groups (e.g., even vs. odd IDs).
  3. Complex L3 Firewall: Implementing an IP-based firewall with specific rule sets.

We employed both Zero-shot (direct instruction) and Few-shot (context-aware) prompting techniques. The resulting code was tested using the POX controller framework within the Mininet network emulator.

Figure 1: The four network topologies used for evaluating generated controller code: (a) Linear, (b) Star, (c) Fully Connected, and (d) Two Switches.

The generated code was validated across the four distinct topologies illustrated in Figure 1 to ensure robustness against varying network layouts.

Key Insights and Results

Our analysis revealed several critical patterns in how different LLMs approach networking logic:

  • Architectural Understanding: ChatGPT and DeepSeek demonstrated a superior grasp of networking fundamentals, such as implementing MAC learning by default. In contrast, Copilot initially relied on less efficient broadcast methods for simple forwarding.
  • Prompt Sensitivity: The models proved highly sensitive to technical phrasing. A minor translation error regarding host groupings led to logic failures, highlighting the need for precise technical specifications.
  • The Power of Few-Shot Prompting: While zero-shot prompts often yielded functional code for simple tasks, few-shot prompting was essential for complex engineering. It significantly improved code modularity and maintainability.

Performance Summary

The evaluation categorized results based on whether the code was functional out-of-the-box, required manual fixes, or failed entirely.

  • Task 1 (Simple Forwarding): All models achieved a 100% success rate in both zero-shot and few-shot scenarios.
  • Task 2 (Blocking Pings): All models eventually succeeded, though few-shot versions required unexpected manual fixes for IP mapping logic compared to zero-shot attempts.
  • Task 3 (L3 Firewall): This task served as the primary differentiator. In zero-shot scenarios, BlackBox.ai failed to produce a working solution, and others required manual intervention to resolve syntax or parameter issues. However, with few-shot guidance, all four models successfully generated functional firewalls.

Conclusion

The study confirms a "Trust, But Verify" paradigm for AI-assisted network engineering. While LLMs can handle the "heavy lifting" of boilerplate and basic logic, human oversight remains mandatory for security-critical components like firewalls. Future research will extend this evaluation to P4-based code generation and newer reasoning models to further explore the boundaries of AI in programmable networks.

Summary updated

BibTeX
@misc{soares2025trust,
  author = {Felipe Soares and Muriel Figueredo Franco and Eder J. Scheid and Lisandro Zambenedetti Granville},
  title = {{Trust, But Verify: An Empirical Evaluation of AI-Generated Code for SDN Controllers}},
  year = {2025},
  eprint = {2510.20703},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.20703},
  howpublished = {arXiv},
}
Figure