Skip to content

Commit

Permalink
Merge pull request #1575 from digitalocean/develop
Browse files Browse the repository at this point in the history
Release v2.2.0
  • Loading branch information
jeremystretch authored Oct 12, 2017
2 parents 7cb287d + 9d8daca commit 74731bc
Show file tree
Hide file tree
Showing 154 changed files with 6,319 additions and 1,315 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*.pyc
/netbox/netbox/configuration.py
/netbox/netbox/ldap_config.py
/netbox/reports/*
!/netbox/reports/__init__.py
/netbox/static
.idea
/*.sh
Expand Down
16 changes: 6 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
sudo: required

services:
- docker

env:
- DOCKER_TAG=$TRAVIS_TAG

- postgresql
addons:
postgresql: "9.4"
language: python
python:
- "2.7"
- "3.5"
install:
- pip install -r requirements.txt
- pip install pep8
before_script:
- psql --version
- psql -U postgres -c 'SELECT version();'
script:
- ./scripts/cibuild.sh
after_success:
- if [ ! -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
./scripts/docker-build.sh;
fi
39 changes: 35 additions & 4 deletions docs/api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ The base serializer is used to represent the default view of a model. This inclu
"vid": 101,
"name": "Users-Floor1",
"tenant": null,
"status": [
1,
"Active"
],
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 9,
"url": "http://localhost:8000/api/ipam/roles/9/",
Expand Down Expand Up @@ -122,6 +122,37 @@ When a base serializer includes one or more nested serializers, the hierarchical
}
```

## Static Choice Fields

Some model fields, such as the `status` field in the above example, utilize static integers corresponding to static choices. The available choices can be retrieved from the read-only `_choices` endpoint within each app. A specific `model:field` tuple may optionally be specified in the URL.

Each choice includes a human-friendly label and its corresponding numeric value. For example, `GET /api/ipam/_choices/prefix:status/` will return:

```
[
{
"value": 0,
"label": "Container"
},
{
"value": 1,
"label": "Active"
},
{
"value": 2,
"label": "Reserved"
},
{
"value": 3,
"label": "Deprecated"
}
]
```

Thus, to set a prefix's status to "Reserved," it would be assigned the integer `2`.

A request for `GET /api/ipam/_choices/` will return choices for _all_ fields belonging to models within the IPAM app.

# Pagination

API responses which contain a list of objects (for example, a request to `/api/dcim/devices/`) will be paginated to avoid unnecessary overhead. The root JSON object will contain the following attributes:
Expand Down
18 changes: 9 additions & 9 deletions docs/configuration/optional-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ An API consumer can request an arbitrary number of objects by appending the "lim

Default: $BASE_DIR/netbox/media/

The file path to the location where media files (such as image attachments) are stored. By default, this is the `netbox/media` directory within the base NetBox installation path.
The file path to the location where media files (such as image attachments) are stored. By default, this is the `netbox/media/` directory within the base NetBox installation path.

---

Expand Down Expand Up @@ -191,14 +191,6 @@ The amount of time (in seconds) to wait for NAPALM to connect to a device.

---

## NETBOX_USERNAME (Deprecated)

## NETBOX_PASSWORD (Deprecated)

These settings have been deprecated and will be removed in NetBox v2.2. Please use `NAPALM_USERNAME` and `NAPALM_PASSWORD` instead.

---

## PAGINATE_COUNT

Default: 50
Expand All @@ -215,6 +207,14 @@ When determining the primary IP address for a device, IPv6 is preferred over IPv

---

## REPORTS_ROOT

Default: $BASE_DIR/netbox/reports/

The file path to the location where custom reports will be kept. By default, this is the `netbox/reports/` directory within the base NetBox installation path.

---

## TIME_ZONE

Default: UTC
Expand Down
2 changes: 1 addition & 1 deletion docs/data-model/ipam.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ VLAN groups can be employed for administrative organization within NetBox. Each

# Services

A service represents a TCP or UDP service available on a device. Each service must be defined with a name, protocol, and port number; for example, "SSH (TCP/22)." A service may optionally be bound to one or more specific IP addresses belonging to a device. (If no IP addresses are bound, the service is assumed to be reachable via any assigned IP address.)
A service represents a TCP or UDP service available on a device or virtual machine. Each service must be defined with a name, protocol, and port number; for example, "SSH (TCP/22)." A service may optionally be bound to one or more specific IP addresses belonging to its parent. (If no IP addresses are bound, the service is assumed to be reachable via any assigned IP address.)
29 changes: 29 additions & 0 deletions docs/data-model/virtualization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
NetBox supports the definition of virtual machines arranged in clusters. A cluster can optionally have physical host devices associated with it.

# Clusters

A cluster is a logical grouping of physical resources within which virtual machines run. A cluster must be assigned a type, and may optionally be assigned an organizational group.

Physical devices (from NetBox's DCIM component) may be associated with clusters as hosts. This allows users to track on which host(s) a particular VM may reside. However, NetBox does not support pinning a specific VM within a cluster to a particular host device.

### Cluster Types

A cluster type represents a technology or mechanism by which a cluster is formed. For example, you might create a cluster type named "VMware vSphere" for a locally hosted cluster or "DigitalOcean NYC3" for one hosted by a cloud provider.

### Cluster Groups

Cluster groups may be created for the purpose of organizing clusters.

---

# Virtual Machines

A virtual machine represents a virtual compute instance hosted within a cluster. Each VM must be associated with exactly one cluster.

Like devices, each VM can have interfaces created on it. These behave similarly to device interfaces, and can be assigned IP addresses, however given their virtual nature they cannot be connected to other interfaces. VMs can also be assigned layer four services. Unlike physical devices, VMs cannot be assigned console or power ports, or device bays.

The following resources can be defined for each VM:

* vCPU count
* Memory (MB)
* Disk space (GB)
53 changes: 53 additions & 0 deletions docs/development/utility-views.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Utility Views

Utility views are reusable views that handle common CRUD tasks, such as listing and updating objects. Some views operate on individual objects, whereas others (referred to as "bulk" views) operate on multiple objects at once.

## Individual Views

### ObjectListView

Generates a paginated table of objects from a given queryset, which may optionally be filtered.

### ObjectEditView

Updates an object identified by a primary key (PK) or slug. If no existing object is specified, a new object will be created.

### ObjectDeleteView

Deletes an object. The user is redirected to a confirmation page before the deletion is executed.

## Bulk Views

### BulkCreateView

Creates multiple objects at once based on a given pattern. Currently used only for IP addresses.

### BulkImportView

Accepts CSV-formatted data and creates a new object for each line. Creation is all-or-none.

### BulkEditView

Applies changes to multiple objects at once in a two-step operation. First, the list of PKs for selected objects is POSTed and an edit form is presented to the user. On submission of that form, the specified changes are made to all selected objects.

### BulkDeleteView

Deletes multiple objects. The user selects the objects to be deleted and confirms the deletion.

## Component Views

### ComponentCreateView

Create one or more component objects beloning to a parent object (e.g. interfaces attached to a device).

### ComponentEditView

A subclass of `ObjectEditView`: Updates an individual component object.

### ComponentDeleteView

A subclass of `ObjectDeleteView`: Deletes an individual component object.

### BulkComponentCreateView

Create a set of components objects for each of a selected set of parent objects. This view can be used e.g. to create multiple interfaces on multiple devices at once.
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NetBox is an open source web application designed to help manage and document co
* **Equipment racks** - Organized by group and site
* **Devices** - Types of devices and where they are installed
* **Connections** - Network, console, and power connections among devices
* **Virtualization** - Virtual machines and clusters
* **Data circuits** - Long-haul communications circuits and providers
* **Secrets** - Encrypted storage of sensitive credentials

Expand Down Expand Up @@ -46,7 +47,7 @@ NetBox is built on the [Django](https://djangoproject.com/) Python framework and
| HTTP Service | nginx or Apache |
| WSGI Service | gunicorn or uWSGI |
| Application | Django/Python |
| Database | PostgreSQL |
| Database | PostgreSQL 9.4+ |

# Getting Started

Expand Down
32 changes: 21 additions & 11 deletions docs/installation/netbox.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Installation

This section of the documentation discusses installing and configuring the NetBox application.

!!! note
Python 3 is strongly encouraged for new installations. Support for Python 2 will be discontinued in the near future. This documentation includes a guide on [migrating from Python 2 to Python 3](migrating-to-python3).

**Ubuntu**

Python 3:

```no-highlight
# apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# apt-get install -y python3 python3-dev python3-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# easy_install3 pip
```

Python 2:

```no-highlight
# apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# apt-get install -y python2.7 python-dev python-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# easy_install pip
```

**CentOS**
Expand All @@ -22,14 +29,14 @@ Python 3:
# yum install -y epel-release
# yum install -y gcc python34 python34-devel python34-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config
# easy_install-3.4 pip
# ln -s -f python3.4 /usr/bin/python
```

Python 2:

```no-highlight
# yum install -y epel-release
# yum install -y gcc python2 python-devel python-pip libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config
# yum install -y gcc python2 python-devel python-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config
# easy_install pip
```

You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub.
Expand Down Expand Up @@ -97,6 +104,9 @@ Python 2:
# pip install -r requirements.txt
```

!!! note
If you encounter errors while installing the required packages, check that you're running a recent version of pip (v9.0.1 or higher) with the command `pip -V` or `pip3 -V`.

### NAPALM Automation

As of v2.1.0, NetBox supports integration with the [NAPALM automation](https://napalm-automation.net/) library. NAPALM allows NetBox to fetch live data from devices and return it to a requester via its REST API. Installation of NAPALM is optional. To enable it, install the `napalm` package using pip or pip3:
Expand Down Expand Up @@ -158,13 +168,13 @@ You may use the script located at `netbox/generate_secret_key.py` to generate a
# Run Database Migrations

!!! warning
The examples on the rest of this page call the `python` executable, which will be Python2 on most systems. Replace this with `python3` if you're running NetBox on Python3.
The examples on the rest of this page call the `python3` executable. Replace this with `python2` or `python` if you're using Python 2.

Before NetBox can run, we need to install the database schema. This is done by running `python manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example):
Before NetBox can run, we need to install the database schema. This is done by running `python3 manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example):

```no-highlight
# cd /opt/netbox/netbox/
# python manage.py migrate
# python3 manage.py migrate
Operations to perform:
Apply all migrations: dcim, sessions, admin, ipam, utilities, auth, circuits, contenttypes, extras, secrets, users
Running migrations:
Expand All @@ -182,7 +192,7 @@ If this step results in a PostgreSQL authentication error, ensure that the usern
NetBox does not come with any predefined user accounts. You'll need to create a super user to be able to log into NetBox:

```no-highlight
# python manage.py createsuperuser
# python3 manage.py createsuperuser
Username: admin
Email address: admin@example.com
Password:
Expand All @@ -193,7 +203,7 @@ Superuser created successfully.
# Collect Static Files

```no-highlight
# python manage.py collectstatic --no-input
# python3 manage.py collectstatic --no-input
You have requested to collect static files at the destination
location as specified in your settings:
Expand All @@ -214,7 +224,7 @@ NetBox ships with some initial data to help you get started: RIR definitions, co
This step is optional. It's perfectly fine to start using NetBox without using this initial data if you'd rather create everything from scratch.

```no-highlight
# python manage.py loaddata initial_data
# python3 manage.py loaddata initial_data
Installed 43 object(s) from 4 fixture(s)
```

Expand All @@ -223,7 +233,7 @@ Installed 43 object(s) from 4 fixture(s)
At this point, NetBox should be able to run. We can verify this by starting a development instance:

```no-highlight
# python manage.py runserver 0.0.0.0:8000 --insecure
# python3 manage.py runserver 0.0.0.0:8000 --insecure
Performing system checks...
System check identified no issues (0 silenced).
Expand Down
Loading

0 comments on commit 74731bc

Please sign in to comment.