Set up DevOps for network automation

Build a proper CI/CD pipeline for your network changes — from Git repository to automated deployment with guardrails.

8 steps · For teams ready to go from scripts to full NetDevOps

Already installed Python and run a first script? This guide picks up where /docs/setup leaves off — it covers the full CI/CD stack: Git, pipelines, environment promotion, AI assistance, and DORA metrics.
1

Understand the architecture

Here is what you are building — a complete loop from an engineer's editor to live network devices, with Git and NAPT in between.

YOUR NETDEVOPS STACKEngineer IDECursor / VS CodeGitHub / GitLabrepositoryPipeline StudioValidateTestApproveDeployVerifyClaude DesktopAI assistantNetwork DevicesCisco / JuniperArista / NokiapushwebhookMCPMCPSSH/NETCONF
The complete NetDevOps loop: engineers push intent to Git, NAPT runs pipelines, and changes flow to devices with full audit.

Decision guide: which parts do you need?

Scripts run automatically on push

Follow Steps 1–5

AI-assisted automation from your IDE

Follow Steps 1, 6

Full DevOps with approvals & audit

Follow Steps 1–8

2

Set up your Git repository

If you already have a Git repo, skip to Step 2c.

2a — Create the repository

bash
# Create a new repo for network automation
gh repo create network-automation --private --description "Network-as-Code configs"
cd network-automation

# Or via web: github.com/new
Naming convention: <org>-network-automation or netops-configs. Visibility: Private (contains network topology info).

2b — Initialize the repo structure

bash
# Create the standard NAPT repo layout
mkdir -p intent/{production,staging,lab}/{bgp,dc,sdwan,security,compliance}
mkdir -p tests/{routing,fabric,security}
mkdir -p pipelines
mkdir -p inventory
mkdir -p scripts

# Create initial files
cat > .gitignore << 'EOF'
# Never commit credentials
.env
*.key
*.pem
devices.csv     # may contain credentials
secrets.yaml

# Python
__pycache__/
*.pyc
.venv/

# NAPT local cache
.napt/
EOF

cat > README.md << 'EOF'
# Network Automation Repository

Network-as-Code configurations and automation scripts for NAPT.

## Structure
- intent/    YAML intent files by environment and domain
- tests/     Network validation test suites
- pipelines/ NAPT pipeline definitions (exported JSON)
- inventory/ Device inventory (credentials via NAPT Vault, not here)
- scripts/   Custom Python scripts
EOF

git init && git add . && git commit -m "init: NAPT network automation repo"

2c — Connect to NAPT

  1. Go to napt.networkgig.in/devops/git → Connect repository
  2. Paste your repo URL and generate a webhook secret
  3. Add the webhook to GitHub: Settings → Webhooks → Add webhook
3

Write your first intent file

Intent files declare desired network state in YAML. NAPT validates them and pipelines enforce them.

Example: intent/staging/bgp/edge-peers.yaml

yaml
# Network Intent: Edge BGP Peers — Staging
# Owner: network-team
# Last updated: 2026-06-16

apiVersion: napt.networkgig.in/v1
kind: BGPPeer
metadata:
  name: edge-rtr01-transit-a
  namespace: staging
  labels:
    site: mumbai-dc1
    role: edge
    vendor: cisco_xr
    team: network-ops
spec:
  localAs: 65000
  neighbor: 10.255.0.1        # staging test peer IP
  remoteAs: 65001
  description: "Staging transit simulation peer"
  addressFamily:
    ipv4Unicast: true
  policy:
    inbound: STAGING-TRANSIT-IN
    outbound: STAGING-TRANSIT-OUT
  security:
    ttlSecurity: 1
  maxPrefix:
    limit: 10000
    restartInterval: 5

Commit the file

bash
git add intent/staging/bgp/edge-peers.yaml
git commit -m "feat(bgp/staging): add transit simulation peer on edge-rtr01"
git push origin main
What happens next (if the webhook is configured):
  • ✓ Git push detected by the NAPT webhook
  • ✓ YAML schema validation runs automatically
  • ✓ Pipeline triggers if configured for this path
  • ✓ Results appear in Pipeline Studio and the audit log
4

Create your first pipeline

Navigate to napt.networkgig.in/devops/pipelines → New Pipeline.

Pipeline name: "Staging BGP Change Pipeline"

Trigger: Git push to main (path: intent/staging/bgp/*)

Add these stages in order

  1. 1

    YAML Lint

    Validation → YAML Lint

    Target: intent/staging/bgp/*.yaml

  2. 2

    Schema Validate

    Validation → Schema Validate

    Target: same path

  3. 3

    Dry Run

    Execution → Script Runner

    Script: bgp_community_deploy · Environment: Staging · Mode: Dry run (checked)

  4. 4

    pyATS BGP Test

    Test → pyATS Test Suite

    Suite: BGP Neighbor State Test · Environment: Staging

  5. 5

    Notify

    Post-Deploy → Notify

    Channel: Slack #netops · Message: "Staging BGP pipeline complete"

Save → "Save pipeline". Test it: push a small change to intent/staging/bgp/edge-peers.yaml and watch the pipeline run in real time in Pipeline Studio.
5

Set up environment promotion

Navigate to napt.networkgig.in/devops/environments and create three environments.

Lab

Devices:
[tag=lab] from your inventory
Approval:
None (auto-proceed)
Compliance threshold:
60%
For initial testing, no guardrails needed

Staging

Devices:
[tag=staging] from your inventory
Approval:
None (auto-proceed if tests pass)
Compliance threshold:
75%

Production

Devices:
[tag=production] from your inventory
Approval:
Manual — 1 approver required
Compliance threshold:
80%
Maintenance windows:
Mon–Thu 22:00–06:00 IST · Sat 00:00–08:00 IST
Promotion rule: Lab → Staging → Production. Enforce it by having each pipeline stage target a specific environment, and require a separate pipeline with the Manual Approval stage to promote to Production.
6

Connect your AI assistant

Install the NAPT MCP package

bash
npm install -g @networkgig/napt-mcp
Get your MCP key at napt.networkgig.in/mcp/keys (see the MCP docs). It looks like napt_mcp_••••••••••••.

For Claude Desktop

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

json
{
  "mcpServers": {
    "napt": {
      "command": "npx",
      "args": ["-y", "@networkgig/napt-mcp"],
      "env": {
        "NAPT_API_KEY": "napt_mcp_your_key_here",
        "NAPT_WORKSPACE": "your_workspace_id_here"
      }
    }
  }
}

Restart Claude Desktop → verify by typing "List NAPT tools" in chat. Claude should respond with the available tools.

For Cursor IDE

Create .cursor/mcp.json in your project root:

json
{
  "mcpServers": {
    "napt": {
      "command": "npx",
      "args": ["-y", "@networkgig/napt-mcp"],
      "env": { "NAPT_API_KEY": "napt_mcp_your_key_here" }
    }
  }
}

Cursor picks this up automatically on next restart.

7

Set up GitHub Actions (optional)

For teams using GitHub Actions alongside NAPT pipelines. Create .github/workflows/napt-validate.yml:

yaml
name: NAPT Network Validation

on:
  push:
    paths:
      - 'intent/**'
  pull_request:
    paths:
      - 'intent/**'

jobs:
  validate:
    runs-on: ubuntu-latest
    name: Validate network intent files

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install NAPT CLI
        run: pip install napt-cli    # NAPT's Python CLI (coming soon)

      - name: Validate intent files
        env:
          NAPT_API_KEY: ${{ secrets.NAPT_API_KEY }}
        run: |
          napt validate intent/      # Schema validation via NAPT API

      - name: Run NAPT dry-run
        if: github.ref == 'refs/heads/main'
        env:
          NAPT_API_KEY: ${{ secrets.NAPT_API_KEY }}
          SSH_PASS: ${{ secrets.SSH_PASS }}
        run: |
          napt run --pipeline "Staging BGP Change Pipeline" --dry-run

      - name: Post results to PR
        if: github.event_name == 'pull_request'
        uses: actions/github-script@v7
        with:
          script: |
            // Post NAPT pipeline results as PR comment
            // (handled by NAPT's PR comment bot if Git integration is connected)
8

Monitor with DORA metrics

Once pipelines are running, check DORA metrics weekly at napt.networkgig.in/devops/metrics.

Deployment Frequency

Aim for daily (even small changes count)

  • Week 1: 1–2 deployments (learning)
  • Month 1: 5–10/week (building confidence)
  • Month 3: Daily or multiple/day (elite)

Lead Time

From intent commit to production deploy

  • Initial: Days (manual approval, cautious)
  • Target: Hours (automated validation + approval)
  • Elite: Under 1 hour for pre-approved change types

Change Failure Rate

% of changes needing rollback

  • Target: Under 5% (DORA elite)
  • Above 15%: invest in more test coverage before deploying

MTTR

Time from failure to recovery

  • Target: Under 1 hour
  • NAPT auto-rollback handles most failures automatically
Review tip: Look at metrics weekly, not daily. Single-day spikes are noise — meaningful improvement shows up in the 4-week trend line.

Connect all three (full integration)

The complete DevOps loop, end to end:

  1. 1. Engineer edits an intent file in VS Code/Cursor (AI assistant via MCP helps write correct YAML).
  2. 2. Git commit + push → webhook fires to NAPT.
  3. 3. NAPT Pipeline Studio runs automatically: Validate → Test → Dry-run → [Approval] → Deploy → Verify.
  4. 4. Results posted back to the PR as a comment.
  5. 5. Audit trail written automatically.
  6. 6. DORA metrics updated.
  7. 7. Morning: engineer asks Claude "NAPT status?" (MCP call returns the overnight summary).
Total human effort: writing the intent file + reviewing the approval. Everything else is automated.

Your CI/CD readiness checklist

Track which parts of your network DevOps stack you've configured. Your selections are saved on this device.