Skip to content

Commit

Permalink
Release v1.2.0 (#293)
Browse files Browse the repository at this point in the history
* Implement natural keys as primary keys for related fields (#292)

Closes #262

API
- Natural keys can now be used any place a primary key could be used for
  related fields on Interfaces and Circuits.
- For Circuits, the default is now to display the A/Z endpoint interfaces by
  their natural key (e.g. `device_hostname:name` format).
- For Interfaces, the Device hostname may now be used to create or retrieve
  interfaces (no more need to lookup the Device ID first)
- Bugfix in `NsotSerializer` when `view` isn't part of the context that caused a
  crash.
- Interface now has a `name_slug` field that can be used for natural
  key lookups. This is now also officially the natural key field.
- Network now has a `cidr` field that can be used for displaying
  the `network_address/prefix_length` without additional effort
- Network now has a `parent` field that can be used for displaying
  the parent CIDR without an additional lookup
- All underlying serializer code has been streamlined to reduce code
  duplication where possible.
- All "update" serializers have been moved to subclasses of "partial
  update" serializers with extra required fields specified as "extra
  kwargs" vs. re-defining the fields.
- The fields for `site_id` and `attributes` have been moved to the base
  `ResourceSerializer` since ALL resources inherit these anyways.

Util
- Util stats functions can now be directly imported from `nsot.util`
  • Loading branch information
jathanism committed Jul 28, 2017
1 parent 1e2e1e4 commit 7106dab
Show file tree
Hide file tree
Showing 14 changed files with 475 additions and 173 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@ Changelog
Version History
===============

.. _v1.2.0:

1.2.0 (2017-07-28)
------------------

* Fix #262: Natural keys can now be used any place a primary key could be used for
related fields on Interfaces and Circuits.

+ For Circuits, the default is now to display the A/Z endpoint interfaces by
their natural key (e.g. ``device_hostname:name`` format).
+ For Interfaces, the Device hostname may now be used to create or retrieve
interfaces (no more need to lookup the Device ID first)
+ Interface now has a ``name_slug`` field that can be used for natural key
lookups. This is now also officially the natural key field.
+ Network now has a ``cidr`` field that can be used for displaying the
``network_address/prefix_length`` without additional effort
+ Network now has a ``parent`` field that can be used for displaying the parent
CIDR without an additional lookup

* All underlying serializer code has been streamlined to reduce code
duplication where possible.
* All "update" serializers have been moved to subclasses of "partial update"
serializers with extra required fields specified as "extra kwargs" vs.
re-defining the fields.
* The fields for ``site_id`` and ``attributes`` have been moved to the base
``ResourceSerializer`` since ALL resources inherit these anyways.
* Bugfix in ``NsotSerializer`` when ``view`` isn't part of the context that caused
a crash.
* Util stats functions can now be directly imported from ``nsot.util``

.. _v1.1.8:

1.1.8 (2017-07-26)
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN pip install -U setuptools

# Try to run this as late as possible for layer caching - this version will be
# updated every update so let the build not take longer than necessary
RUN pip install nsot==1.1.8
RUN pip install nsot==1.2.0
COPY conf /etc/nsot

ENTRYPOINT ["nsot-server", "--config=/etc/nsot/nsot.conf.py"]
Expand Down
60 changes: 56 additions & 4 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,13 @@ A typical Network object might look like:
{
"parent_id": null,
"parent": null,
"state": "allocated",
"prefix_length": 8,
"is_ip": false,
"ip_version": "4",
"network_address": "10.0.0.0",
"cidr": "10.0.0.0/8",
"attributes": {
"type": "internal"
},
Expand Down Expand Up @@ -312,14 +314,17 @@ A typical Interface object might look like:
"10.10.10.1/32"
],
"device": 1,
"device_hostname": "lax-r1",
"speed": 10000,
"networks": [
"10.10.10.0/24"
],
"description": "this is eth0",
"name": "eth0",
"id": 1,
"parent_id": null,
"description": "this is ae0.0",
"name": "ae0.0",
"name_slug": "lax-r1:ae0.0",
"id": 2,
"parent_id": 1,
"parent": "lax-r1:ae0",
"mac_address": null,
"attributes": {
"vlan": "100"
Expand Down Expand Up @@ -358,6 +363,53 @@ Networks
The networks for an Interface are the are read-only representation of the
derived parent Network objects of any addresses assigned to an Interface.

Circuits
--------

A Circuit represents a physical or logical circuit between two network
interfaces, such as a backbone interconnect or external peering.

Circuits are created by binding local (A-side) and remote (Z-side) Interface
objects. Interfaces may only be bound to a single Circuit at a time. The Z-side
Interface is optional, such as if you want to model a circuit for which you do
not own the remote side.

The Circuit name defaults to the natural key (slug) representations of the A
and Z interfaces, but may also be customized.

A Circuit's "name slug" may sometimes differ from its name due to certain
special characters that complicate API lookups. The name slug is used to
uniquely identify the Circuit internally.

A typical Circuit object might look like:

.. code-block:: javascript
{
"name": "lax-r1:ae0_jfk-r1:ae0",
"endpoint_a": "lax-r1:ae0",
"endpoint_z": "jfk-r1:ae0",
"name_slug": "lax-r1:ae0_jfk-r1:ae0",
"attributes": {},
"id": 1
}
Addresses
~~~~~~~~~

Returns the addresses assigned to the member Interfaces of the Circuit, if any.

Devices
~~~~~~~

Returns the Devices to which the member Interfaces are attached.

Interfaces
~~~~~~~~~~

Returns the Interface objects bound to the circuit ordered from A to Z (local
to remote).

Changes
=======

Expand Down

0 comments on commit 7106dab

Please sign in to comment.