Skip to content

cwccie/intentlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intentlang

Network intent DSL — declare desired network state, generate vendor-specific configs.

CI Python 3.9+ License: MIT

Problem

Network engineers express intent ("all guest traffic should be rate-limited to 100 Mbps") but implement it as vendor-specific CLI commands scattered across device types. When you manage Cisco, Juniper, and Arista devices, the same intent becomes three different configurations.

Solution

intentlang provides a simple DSL for declaring network intents, then compiles them to vendor-specific configurations. Write once, deploy to any supported vendor.

Architecture

+----------------+     +----------+     +------------+     +--------------+
| Intent File    | --> |  Parser  | --> |  Validator  | --> |  Compiler    |
|                |     |          |     |             |     | (per vendor) |
| deny telnet;   |     |   AST    |     | Semantic    |     |              |
| limit vlan..   |     |          |     | checks      |     | Cisco IOS    |
|                |     |          |     |             |     | JunOS        |
+----------------+     +----------+     +------------+     | Arista EOS   |
                                                           +------+-------+
                                                                  |
                                                           +------v-------+
                                                           | Config Lines |
                                                           +--------------+

Features

  • 5 actions: ensure, deny, limit, allow, require
  • 7 target types: traffic, interface, vlan, protocol, subnet, service, route
  • 3 vendor compilers: Cisco IOS, JunOS, Arista EOS
  • 8 built-in templates: common security and QoS patterns
  • Validation: semantic checks before compilation
  • Extensible: add custom compilers via registry

Install

pip install intentlang

Quick Start

Write Intents

# network-policy.intent
deny protocol telnet on all interfaces;
require service ssh on management interfaces;
limit traffic on vlan 100 to 100 mbps;
allow traffic from subnet 192.168.1.0/24 to subnet 10.0.0.0/8;

Compile to Vendor Config

# Cisco IOS
intentlang compile network-policy.intent --vendor cisco_ios

# JunOS
intentlang compile network-policy.intent --vendor junos

# Arista EOS
intentlang compile network-policy.intent --vendor arista_eos

Use Built-in Templates

intentlang list-intents
intentlang list-intents --category security
intentlang list-intents --search ssh

DSL Reference

<action> <target> [<conditions>] [<method>] [<value>];

Actions:   ensure | deny | limit | allow | require
Targets:   traffic | interface | vlan | protocol | subnet | service
Conditions: from <target> | to <target> | on <target>
Methods:   using <method>
Values:    to <number> <unit>  (mbps, gbps, kbps)

API

from intentlang.parser import parse_intent
from intentlang.compiler import get_compiler
import intentlang.compilers  # Register compilers

program = parse_intent("deny protocol telnet on all interfaces;")
compiler = get_compiler("cisco_ios")
result = compiler.compile_program(program)
print(result.to_config())

License

MIT

About

Network intent DSL — declare desired network state, generate vendor-specific configs via LLM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors