Skip to content

srl-labs/srl-netbox-demo

Repository files navigation

SRLinux Netbox Demo with Ansible

This lab builds a demo fabric of Nokia SR Linux devices with NetBox 4.4.6 and Ansible. Containerlab spins up the topology, NetBox is populated with Nokia device types, and playbooks from the netbox_integration_example branch of intent-based-ansible-lab generate and deploy intents.


Run this lab in GitHub Codespaces for free.
Learn more about Containerlab for Codespaces.


Choose how to run

  • Codespaces: click the button above and wait for the devcontainer to finish. Everything below is run from the repo root inside Codespaces.
  • Local machine: follow the prerequisites and setup below, then run the same workflow.

Local prerequisites

  1. Containerlab installed. See the official docs.
  2. Git, Docker, and uv.

Tip

Why uv? uv is a single, ultra-fast tool that can replace pip, pipx, virtualenv, pip-tools, poetry, and more. It automatically manages Python versions, handles ephemeral or persistent virtual environments (uv venv), lockfiles, and often runs 10–100× faster than pip installs.

Local setup

git clone --recursive https://github.com/srl-labs/srl-netbox-demo
cd srl-netbox-demo

# Install uv (Linux/macOS)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install the Nokia SR Linux Ansible collection
uv run ansible-galaxy collection install nokia.srlinux

Important

Use --recursive because intent-based-ansible-lab is a submodule.

Run book (Codespaces or local)

All commands run from the repo root. Replace the NetBox URL step with the Codespaces forwarded port if you are in Codespaces.

  1. Deploy the topology

    Drawio Example

    clab deploy -t srl_netbox.clab.yaml
    • Spins up NetBox and the SR Linux fabric; expect ~4–5 minutes.
    • Watch progress: docker logs -f netbox
    • Wait until netbox_importer get healthy
  2. Open NetBox

    • Local: http://127.0.0.1:8000 (user/pass admin / admin).
    • Codespaces: open forwarded port 8000 in the Ports panel.
  3. Initialize NetBox data

    bash api_scripts/import_infra.sh      # imports device types, CFs, infrastructure intents
    bash api_scripts/import_service.sh    # imports L2/L3 VPN services
  4. Generate Ansible intents from NetBox

    INTENT_DIR=$(pwd)/intents/generated_intents
    uv run ansible-playbook -i inv/ -e intent_dir=$INTENT_DIR \
      intent-based-ansible-lab/playbooks/netbox_generate_intents.yml --diff
  5. Deploy the generated intents

    uv run ansible-playbook -i inv -e intent_dir=$INTENT_DIR \
      intent-based-ansible-lab/playbooks/cf_fabric.yml --diff
  6. (Optional) Verify with fcli

    CLAB_TOPO=srl_netbox.clab.yaml
    alias fcli="docker run -t --network $(grep '^name:' $CLAB_TOPO | awk '{print $2}') --rm \
      -v /etc/hosts:/etc/hosts:ro -v ${PWD}/${CLAB_TOPO}:/topo.yml \
      ghcr.io/srl-labs/nornir-srl:latest -t /topo.yml"
    
    fcli ni
  7. Tear down when done

    clab destroy -t srl_netbox.clab.yaml

Troubleshooting

  • Containerlab bring-up can take several minutes; rerun docker ps and docker logs -f netbox to verify health.
  • Make sure firewall/proxy rules allow the container connectivity defined in the topology.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published