Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • 00afb76e6a325828eaef54a8ccf1dabd6eb5b2f8
  • main default protected
  • main_36 protected
  • v1.5.0
  • v2.3.0
  • v2.2.0
  • v1.4.0
  • v1.3.0
  • v2.1.0
  • v2.0.0
  • v1.2.1
  • v1.2.0
  • v1.1.1
  • v1.1.0
  • v1.0.2
  • v0.1.0
16 results

netbox-sys-plugin

  • Clone with SSH
  • Clone with HTTPS
  • SYS Plugin for Netbox

    A Netbox plugin for Create Virtual Machine Process.

    Installation

    1. Install our development environment

    Requirements:

    2. Prepare the plugin

    2.1 - Reference the plugin to netbox

    Add the plugin to the configuration file in netbox:

    projects/netbox/netbox/netbox/configuration.py
    PLUGINS = ['netbox_sys_plugin']

    And check that the configurations for the database and redis match the ones in

    projects/netbox-sys-plugin/netbox_configuration/configuration_testing.py

    2.2 - Install the plugin

    #Clone plugin repo
    git clone https://code.europa.eu/digit-c4/netbox/netbox-sys-plugin.git
    
    #Source virtual env from netbox
    source netbox/venv/bin/activate
    
    #Go to the plugin folder
    cd ../netbox_sys_plugin
    
    #Install poetry
    pip install poetry
    
    #Install the plugin
    poetry install
    
    

    3. Start Docker

    #Start database and redis
    docker compose up -d

    4. Run Migrations

    #Changes to the database
    ../netbox/netbox/manage.py migrate netbox_sys_plugin
    

    5. Create User

    #Changes to the database
    ../netbox/netbox/manage.py createsuperuser
    

    6. Start Netbox

    #Start Netbox
    ../netbox/netbox/manage.py runserver 0.0.0.0:8000 --insecure

    Visit http://localhost:8000/ Use the credentials for the user you created

    Run tests

    After installing you development environment, you can run the tests plugin (you don't need to start the Netbox instance):

    Run tests:

    ../netbox/netbox/manage.py test netbox_sys_plugin

    Modification to the command:

    To keep the testing database add the --keepdb To keep the add console logs add the -v and 1,2 or 3 to increase the detail


    With code coverage Install coverage.py then run the tests and print the report:

    coverage run --include='*/netbox-sys-plugin/*' ./../netbox/netbox/manage.py test netbox_sys_plugin.tests
    coverage report -m