Skip to content

Database Schema

All NetOps data lives in the netops DuckDB schema. Tables are auto-created when olav-netops is installed.

Feature Claims

ID Claim Status
C-NE-08 netops.devices contains hostname, ip_address, platform columns ⬜ Pending
C-NE-09 v_bgp_neighbors_auto view is auto-generated from parsed_outputs ⬜ Pending
C-NE-10 netops.topology_links includes discovery_protocol to distinguish L2/L3 ⬜ Pending
C-NE-11 netops.raw_output_store preserves latest raw CLI output per device ⬜ Pending

Tables

netops.devices

Network device inventory, populated during /netops_init Stage 1.

Column Type Description
hostname VARCHAR Device hostname (primary key)
ip_address VARCHAR Management IP address
platform VARCHAR NTC platform identifier (e.g., cisco_ios, arista_eos)
vendor VARCHAR Device vendor
model VARCHAR Hardware model
os_version VARCHAR Operating system version
site VARCHAR Site/location tag
role VARCHAR Device role (core, edge, access)

netops.parsed_outputs

Structured CLI output parsed by TextFSM. One row per device-command-snapshot combination.

Column Type Description
device_name VARCHAR Source device hostname
command VARCHAR CLI command executed (e.g., show ip bgp summary)
parsed_data JSON Array of parsed records from TextFSM
template_name VARCHAR TextFSM template that produced this parse
snapshot_id VARCHAR Snapshot identifier linking to collection run

netops.raw_output_store

Latest raw CLI output per device-command pair. Useful for config extraction and debugging parse failures.

Column Type Description
device_name VARCHAR Source device hostname
command VARCHAR CLI command
raw_output VARCHAR Full unprocessed CLI output text
snapshot_id VARCHAR Snapshot identifier

Network links derived from LLDP, CDP, and OSPF neighbor data.

Column Type Description
link_id VARCHAR Unique link identifier
source_device VARCHAR Source device hostname
source_interface VARCHAR Source interface name
destination_device VARCHAR Destination device hostname
destination_interface VARCHAR Destination interface name
discovery_protocol VARCHAR How link was discovered: LLDP, CDP, OSPF
link_status VARCHAR Link state: up, down
snapshot_id VARCHAR Snapshot identifier

netops.oc_outputs

OpenConfig JSON data per device (sparse — populated when OC mappings are available).

Column Type Description
device_name VARCHAR Source device hostname
oc_module VARCHAR OpenConfig YANG module name
oc_data JSON Structured OpenConfig data
snapshot_id VARCHAR Snapshot identifier

Auto-Generated Views

These views are automatically created from netops.parsed_outputs based on schema_catalog and view_recipes metadata. Query them without the netops. prefix.

View Key Columns Source Command
v_bgp_neighbors_auto device_name, neighbor_ip, neighbor_as, state show ip bgp summary
v_ospf_neighbors_auto device_name, neighbor_id, neighbor_ip, interface, state show ip ospf neighbor
v_interfaces_auto device_name, interface, ip_address, prefix_length, status show ip interface brief
v_topology_l2_auto device_name, local_interface, destination_device, protocol show cdp neighbors / show lldp neighbors
v_arp_auto device_name, ip_address, mac_address, interface show arp
v_topo_links_clean src, dst, source_interface, destination_interface Derived from topology_links
v_device_neighbors_summary device_name, connected_device, protocol, status Aggregated neighbor view
v_bgp_neighbors_enriched + resolved peer device name BGP + devices join
v_routes_enriched + resolved next-hop device name Routes + devices join

Querying

All agents use execute_sql to query these tables:

-- Always qualify netops schema tables
SELECT * FROM netops.devices WHERE platform = 'cisco_ios';

-- Views don't need schema prefix
SELECT * FROM v_bgp_neighbors_auto WHERE state != 'Established';

-- Cross-snapshot comparison
SELECT * FROM netops.parsed_outputs
WHERE snapshot_id IN ('snap-001', 'snap-002')
  AND command = 'show ip bgp summary';

Schema prefix required

Always use netops.devices, netops.topology_links, netops.parsed_outputs — never devices or topology_links without the schema prefix. Views (v_*_auto) do not need a prefix.