Central data models of NAV’s management subsystems

Netbox

From NAV Wiki: The netbox table is the heart of the heart so to speak, the most central table of them all. The netbox tables contains information on all IP devices that NAV manages with adhering information and relations.

Parameters
  • id (AutoField) – Id

  • ip (GenericIPAddressField) – Ip

  • room (ForeignKey to Room) – Room

  • type (ForeignKey to NetboxType) – Type

  • sysname (VarcharField) – Sysname

  • category (ForeignKey to Category) – Category

  • organization (ForeignKey to Organization) – Organization

  • up (CharField) – Up

  • up_since (DateTimeField) – Up since

  • up_to_date (BooleanField) – Up to date

  • discovered (DateTimeField) – Discovered

  • deleted_at (DateTimeField) – Deleted at

  • master (ForeignKey to Netbox) – Master

  • data (HStoreField) – Data

  • groups (ManyToManyField) – Groups

  • profiles (ManyToManyField) – Profiles

Model field: netbox, accesses the M2M AdjacencyCandidate model.

Model field: netbox, accesses the M2M AlertHistory model.

Model field: netbox, accesses the M2M AlertQueue model.

Model field: netbox, accesses the M2M Arp model.

Model field: netbox, accesses the M2M Cam model.

Model field: category, accesses the Category model.

Model field: category

Custom validation

Model field: to netbox, accesses the M2M Interface model.

Model field: data

Model field: deleted at

Property to access the former device-field

Returns the first chassis device if any

Model field: discovered

Model field: netbox, accesses the M2M NetboxEntity model.

Model field: netbox, accesses the M2M EventQueue model.

Model field: netbox, accesses the M2M GatewayPeerSession model.

Calculates and returns an availability data structure.

Returns a QuerySet of chassis devices seen on this netbox

Returns the sensors to be displayed on the Environment Sensor tab

Returns the netbox’ prefix address only when the prefix is not a scope, private or reserved prefix.

Returns the function description of this netbox.

Returns the number of all interfaces that have IP addresses.

Returns all interfaces that have IP addresses.

Returns gwports naturally sorted by interface name

Returns the last log entry for all jobs

Autogenerated: Finds next instance based on discovered.

Autogenerated: Finds next instance based on up_since.

Return all ports that are present.

Return all ports that are present sorted by interface name.

Returns the prefix address for this netbox’ IP address.

Autogenerated: Finds previous instance based on discovered.

Autogenerated: Finds previous instance based on up_since.

Returns sensors associated with this netbox

Returns sysname without the domain suffix if specified in the DOMAIN_SUFFIX setting in nav.conf

Returns the number of all interfaces that are switch ports.

Returns all interfaces that are switch ports.

Returns swports naturally sorted by interface name

Gets a list of available Graphite metrics related to this Netbox, except for ports and sensors, which are seen as separate.

Returns

A list of dicts describing the metrics, e.g.: {id:”nav.devices.some-gw.cpu.cpu1.loadavg1min”,

group=”cpu”, suffix=”cpu1.loadavg1min”}

Returns a queryset of unresolved alert states

Autogenerated: Shows the label of the up

Returns a list of uplinks on this netbox. Requires valid vlan.

Gets the availability for this netbox for the last week

Model field: groups, accesses the M2M Netbox model.

Returns true if this netbox has unignored unrecognized neighbors

Model field: id

Model field: netbox, accesses the M2M NetboxInfo model.

Model field: master, accesses the M2M Netbox model.

Model field: netbox, accesses the M2M Interface model.

Model field: ip

Returns True if this netbox is currently on maintenance

Returns True if this netbox has any unresolved snmp agent state alerts

Returns True if the Netbox isn’t known to be down or in shadow

Model field: netbox, accesses the M2M IpdevpollJobLog model.

Returns the end_time of the last known boxState alert.

Returns

A datetime object if a serviceState alert was found, otherwise None

Returns the last updated timestamp of a particular job as a datetime object.

Model field: master, accesses the Netbox model.

Model field: master

Model field: netbox, accesses the M2M Memory model.

Model field: netbox, accesses the M2M Module model.

Model field: netbox, accesses the M2M NetboxCategory model.

Model field: netbox, accesses the NetboxPrefix model.

Model field: netbox, accesses the M2M NetboxProfile model.

Model field: netbox, accesses the M2M NetboxVtpVlan model.

Model field: netbox, accesses the M2M NetmapViewNodePosition model.

Model field: organization, accesses the Organization model.

Model field: organization

Model field: netbox, accesses the M2M POEGroup model.

Model field: netbox, accesses the M2M POEPort model.

Model field: netbox, accesses the M2M PowerSupplyOrFan model.

Model field: profiles, accesses the M2M Netbox model.

Returns the read-only SNMP community

Returns the read-write SNMP community

Model field: room, accesses the Room model.

Model field: room

Model field: netbox, accesses the M2M Sensor model.

Model field: netbox, accesses the M2M Service model.

Returns the configured SNMP version as an integer

Model field: sysname

Model field: to netbox, accesses the M2M AdjacencyCandidate model.

Model field: type, accesses the NetboxType model.

Model field: type

Model field: netbox, accesses the M2M UnrecognizedNeighbor model.

Model field: up

Model field: up since

Model field: up to date

Model field: netbox, accesses the M2M Vlan model.

NetboxType

From NAV Wiki: The type table defines the type of a netbox, the sysobjectid being the unique identifier.

Parameters
  • id (AutoField) – Id

  • vendor (ForeignKey to Vendor) – Vendor

  • name (VarcharField) – Type name

  • sysobjectid (VarcharField) – Sysobjectid

  • description (VarcharField) – Description

Model field: description

Returns the type’s enterprise ID as an integer.

The type’s sysobjectid should always start with SNMPv2-SMI::enterprises (1.3.6.1.4.1). The next OID element will be an enterprise ID, while the remaining elements will describe the type specific to the vendor.

Model field: id

Model field: type name

Model field: type, accesses the M2M Netbox model.

Model field: sysobjectid

Model field: vendor, accesses the Vendor model.

Model field: vendor

Category

From NAV Wiki: The cat table defines the categories of a netbox (GW,GSW,SW,EDGE,WLAN,SRV,OTHER).

Parameters
  • id (CharField) – Id

  • description (VarcharField) – Description

  • req_mgmt (BooleanField) – Req mgmt

Model field: description

Model field: id

Is this an edge switch?

Is this a routing switch?

Is this a router?

Is this an uncategorized device?

Is this a server?

Is this a core switch?

Model field: category, accesses the M2M Netbox model.

Model field: categories, accesses the M2M NetmapView model.

Model field: category, accesses the M2M NetmapViewCategories model.

Model field: req mgmt

Interface

The network interfaces, both physical and virtual, of a Netbox.

Parameters
  • id (AutoField) – Id

  • netbox (ForeignKey to Netbox) – Netbox

  • module (ForeignKey to Module) – Module

  • ifindex (IntegerField) – Ifindex

  • ifname (VarcharField) – Ifname

  • ifdescr (VarcharField) – Ifdescr

  • iftype (IntegerField) – Iftype

  • speed (FloatField) – Speed

  • ifphysaddress (CharField) – Ifphysaddress

  • ifadminstatus (IntegerField) – Ifadminstatus

  • ifoperstatus (IntegerField) – Ifoperstatus

  • iflastchange (IntegerField) – Iflastchange

  • ifconnectorpresent (BooleanField) – Ifconnectorpresent

  • ifpromiscuousmode (BooleanField) – Ifpromiscuousmode

  • ifalias (VarcharField) – Ifalias

  • baseport (IntegerField) – Baseport

  • media (VarcharField) – Media

  • vlan (IntegerField) – Vlan

  • trunk (BooleanField) – Trunk

  • duplex (CharField) – Duplex

  • to_netbox (ForeignKey to Netbox) – To netbox

  • to_interface (ForeignKey to Interface) – To interface

  • gone_since (DateTimeField) – Gone since

Returns interfaces stacked with this one on a layer above

Model field: interface, accesses the M2M AdjacencyCandidate model.

Model field: aggregator, accesses the M2M InterfaceAggregate model.

Model field: baseport

Returns interfaces stacked with this one on a layer below

Model field: interface, accesses the M2M InterfaceAggregate model.

Model field: to interface, accesses the M2M Interface model.

Model field: duplex

Time since last CAM activity on port, looking at CAM entries for the last ``interval’’ days.

Returns None if no activity is found, else number of days since last activity as a datetime.timedelta object.

Returns the interface that is selected as an aggregator for me.

Naively selects the aggregator with the lowest ifIndex in cases where there are multiple aggregators (may happen on e.g. Juniper devices, due to stacking of logical units)

Returns the set of allowed vlans as a list of ranges

Return type

nav.util.NumberRange

Returns the interfaces that are bundled on this interface

Autogenerated: Shows the label of the duplex

Autogenerated: Shows the label of the ifadminstatus

Autogenerated: Shows the label of the ifoperstatus

Returns the newest cam record gotten from this switch port.

Returns a display value for this interface’s link status.

Autogenerated: Finds next instance based on gone_since.

Gets a list of available Graphite metrics related to this Interface.

Returns

A list of dicts describing the metrics, e.g.: {id:”nav.devices.some-gw.ports.gi1_1.ifInOctets”,

suffix:”ifInOctets”}

Autogenerated: Finds previous instance based on gone_since.

Returns a queryset of sorted swportvlans

Converts the list of allowed vlans on trunk to a string of ranges. Ex: [1, 2, 3, 4, 7, 8, 10] -> “1-4,7-8,10”

List of VLAN numbers related to the port

Model field: gone since

Model field: interface, accesses the M2M GwPortPrefix model.

Returns True if this interface has unrecognized neighbors that are not ignored

Model field: higher, accesses the M2M InterfaceStack model.

Model field: id

Model field: interface, accesses the M2M Identity model.

Model field: ifadminstatus

Model field: ifalias

Model field: ifconnectorpresent

Model field: ifdescr

Model field: ifindex

Model field: iflastchange

Model field: ifname

Model field: ifoperstatus

Model field: ifphysaddress

Model field: ifpromiscuousmode

Model field: iftype

Returns True if interface is administratively up

Returns True if this aggregator has been degraded, False if it has not, None if this interface is not a known aggregator.

Returns True if the interface has an IP address.

NOTE: This doesn’t necessarily mean the port forwards packets for other hosts.

Returns True if the owning Netbox is on maintenance

Returns True if interface is operationally up

Returns true if this interface has a physical connector present

Returns True if the interface is configured as a switch-port

Model field: lower, accesses the M2M InterfaceStack model.

Model field: media

Model field: module, accesses the Module model.

Model field: module

Model field: netbox, accesses the Netbox model.

Model field: netbox

Model field: interface, accesses the M2M Patch model.

Model field: interface, accesses the M2M POEPort model.

Model field: interface, accesses the M2M RoutingProtocolAttribute model.

Model field: interface, accesses the M2M Sensor model.

Model field: speed

Model field: interface, accesses the SwPortAllowedVlan model.

Model field: interface, accesses the M2M SwPortBlocked model.

Model field: interface, accesses the M2M SwPortVlan model.

Model field: to interface, accesses the M2M AdjacencyCandidate model.

Model field: to interface, accesses the Interface model.

Model field: to interface

Model field: to netbox, accesses the Netbox model.

Model field: to netbox

Model field: trunk

Model field: interface, accesses the M2M UnrecognizedNeighbor model.

Model field: vlan

Room

From NAV Wiki: The room table defines a wiring closes / network room / server room.

Parameters
  • id (CharField) – Id

  • location (ForeignKey to Location) – Location

  • description (VarcharField) – Description

  • position (PointField) – Position

  • data (HStoreField) – Data

Model field: room, accesses the M2M Cabling model.

Model field: data

Model field: description

Model field: id

Model field: room, accesses the M2M Image model.

Model field: location, accesses the Location model.

Model field: location

Model field: room, accesses the M2M Netbox model.

Model field: position

Location

The location table defines a group of rooms; i.e. a campus.

Parameters
  • id (CharField) – Id

  • parent (ForeignKey to Location) – Parent

  • description (VarcharField) – Description

  • data (HStoreField) – Data

Model field: data

Model field: description

Return a queryset returning all rooms in this location and sublocations

Model field: id

Model field: location, accesses the M2M Image model.

Model field: parent, accesses the M2M Location model.

Model field: parent, accesses the Location model.

Model field: parent

Model field: location, accesses the M2M Room model.

Organization

From NAV Wiki: The org table defines an organization which is in charge of a given netbox and is the user of a given prefix.

Parameters
  • id (CharField) – Id

  • parent (ForeignKey to Organization) – Parent

  • description (VarcharField) – Description

  • contact (VarcharField) – Contact

  • data (HStoreField) – Data

Model field: organizations, accesses the M2M Account model.

Model field: contact

Model field: data

Model field: description

Naively extract email addresses from the contact string

Model field: id

Model field: organization, accesses the M2M Identity model.

Model field: organization, accesses the M2M Netbox model.

Model field: parent, accesses the M2M Organization model.

Model field: parent, accesses the Organization model.

Model field: parent

Model field: organization, accesses the M2M Vlan model.