Skip to content

Setting up a test environment

Instructions should work on Mac and Linux.
Instructions require python >= 3.6, git, and docker-compose to be installed.

Clone nbcli repo

git clone https://codeberg.org/nbcli/nbcli.git && \
    cd nbcli

Set up a virtual environment

Optional

python3 -m venv venv && \
    source venv/bin/activate

Install nbcli

  • From Pypi

    pip3 install nbcli
    
  • From source

    pip3 install -e .
    

Set an alternate nbcli directory

Optional

export NBCLI_DIR=$(pwd)/.nbcli_testing

Initialize nbcli

The default values in user_config.yml should work

nbcli init

Create test server

Clone netbox-docker repo

and copy needed files into netbox-docker directory

git clone https://github.com/netbox-community/netbox-docker.git && \
    cp -r tests/docker-compose.override.yml netbox-docker/ && \
    cd netbox-docker

Start test Netbox service

service usually take ~1 min to come up

docker-compose pull && \
    docker-compose up -d

The test Netbox instance should now be ready for testing!

After testing

Bring down test Netbox service and deactivate virtual environment.

docker-compose down -v && \
    deactivate