netapi Integration

1. Overview

netapi is the unified network automation CLI for Domus Digitalis infrastructure. It provides consistent command-line access to all network services, replacing manual GUI operations with scriptable, repeatable commands.

Full CLI Reference: See domus-netapi-docs component (114 pages of command documentation)

2. Supported Platforms

Platform Commands Use Cases

ISE

netapi ise ers, netapi ise mnt, netapi ise dc, netapi ise pxgrid

Policy management, session monitoring, DataConnect queries

pfSense

netapi pfsense

DNS automation, firewall rules, DHCP management

WLC (C9800)

netapi wlc

WLAN management, client troubleshooting, policy profiles

IOS Switches

netapi ios exec, netapi ios run, netapi ios config

Show commands, configuration, IBNS 2.0

Vault

netapi vault

PKI certificate issuance, secrets management

Synology

netapi synology

Backup status, storage monitoring

Keycloak

netapi keycloak

Realm backup, user management

KVM

netapi kvm

VM management, snapshots

3. Quick Start

3.1. Load Credentials

dsource d000 dev/network

3.2. Common Commands

Check ISE sessions:

netapi ise mnt sessions

Check specific endpoint:

netapi ise mnt session <mac-address>

Query switch:

netapi ios exec "show access-session"

Issue certificate from Vault:

netapi vault pki-issue hostname.{domain} --role domus-server

Check pfSense DNS:

netapi pfsense dns list

4. ISE Commands

4.1. ERS API (Configuration)

# Policy sets
netapi ise get-policy-sets
netapi ise get-policy-set "Domus-Wired 802.1X"

# Authorization
netapi ise get-authz-profiles
netapi ise get-authz-profile "Linux_EAPTLS_Permit"
netapi ise get-dacls
netapi ise get-dacl "LINUX_RESEARCH_HARDENED"

# Create/update dACL
netapi ise create-dacl DACL_NAME --file /path/to/acl.txt --descr "Description"
netapi ise update-authz-profile "Profile" --dacl DACL_NAME --reauth-timer 3600

# Network devices
netapi ise get-nads
netapi ise get-nad "Switch-01"

4.2. MNT API (Monitoring)

# Active sessions
netapi ise mnt sessions
netapi ise mnt session <mac-address>

# Authentication logs
netapi ise mnt auth-logs <mac-address> --limit 10

# Change of Authorization
netapi ise mnt coa <mac-address>

4.3. DataConnect (Analytics)

DataConnect provides direct Oracle SQL access to ISE’s database - bypassing the limited ERS/MnT APIs for raw access to authentication logs, session data, profiler information, and endpoint inventory.

Why DataConnect over ERS/MnT?

  • Real-time: Live data, not cached API responses

  • Complete: Access to ALL fields, not just what APIs expose

  • Flexible: Custom SQL for any query you can imagine

  • Historical: Query days/weeks of data, not just active sessions

  • Correlatable: JOIN across tables for deep analysis

4.3.1. Basic Commands

# Test DataConnect connectivity
netapi ise dc test
# Authentication statistics
netapi ise dc stats --hours 24
# Recent failed authentications
netapi ise dc failed --hours 4 --limit 20
# Full session view (identity + profiler + auth history)
netapi ise dc session <mac-address> --hours 72
# Endpoint profiler breakdown
netapi ise dc profiler

4.3.2. Database Views Reference

DataConnect exposes these Oracle views for raw SQL queries:

View Description & Key Fields

RADIUS_AUTHENTICATIONS

All auth attempts: TIMESTAMP_TIMEZONE, CALLING_STATION_ID (MAC), USERNAME, PASSED ('Pass'/'Fail'), FAILURE_REASON, NAS_IP_ADDRESS, AUTHENTICATION_METHOD, AUTHENTICATION_PROTOCOL

RADIUS_ACCOUNTING

Session accounting: SESSION_ID, ACCT_STATUS_TYPE (Start/Stop), ACCT_SESSION_TIME, ACCT_INPUT_OCTETS, ACCT_OUTPUT_OCTETS

ENDPOINTS_DATA

Endpoint inventory: MAC_ADDRESS, HOSTNAME, ENDPOINT_IP, ENDPOINT_POLICY

PROFILED_ENDPOINTS_SUMMARY

Profiler data: ENDPOINT_ID (MAC), ENDPOINT_PROFILE, IDENTITY_GROUP

NETWORK_DEVICES

NAD inventory: switches, WLCs

4.3.3. Power Queries (Raw Oracle SQL)

Authentication Success Rate by Hour
netapi ise dc query "
SELECT
  TO_CHAR(TIMESTAMP_TIMEZONE, 'YYYY-MM-DD HH24') as hour,
  COUNT(*) as total,
  SUM(CASE WHEN PASSED = 'Pass' THEN 1 ELSE 0 END) as passed,
  ROUND(SUM(CASE WHEN PASSED = 'Pass' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 1) as success_pct
FROM RADIUS_AUTHENTICATIONS
WHERE TIMESTAMP_TIMEZONE > SYSDATE - 1
GROUP BY TO_CHAR(TIMESTAMP_TIMEZONE, 'YYYY-MM-DD HH24')
ORDER BY hour
"
Top Failure Reasons
netapi ise dc query "
SELECT
  FAILURE_REASON,
  COUNT(*) as count,
  ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER(), 1) as pct
FROM RADIUS_AUTHENTICATIONS
WHERE PASSED != 'Pass' AND TIMESTAMP_TIMEZONE > SYSDATE - 1
GROUP BY FAILURE_REASON
ORDER BY count DESC
FETCH FIRST 10 ROWS ONLY
"
Hub/Hypervisor Detection (Security)

Identify ports with multiple MACs - possible unauthorized hubs, hypervisors, or MAC spoofing:

netapi ise dc query "
SELECT
    DEVICE_NAME as Switch,
    NAS_PORT_ID as Port,
    NAS_PORT_TYPE as Port_Type,
    COUNT(DISTINCT CALLING_STATION_ID) as MAC_Count,
    COUNT(*) as Auth_Events,
    LISTAGG(DISTINCT CALLING_STATION_ID, '; ') WITHIN GROUP (ORDER BY CALLING_STATION_ID) as MACs,
    CASE
        WHEN NAS_PORT_TYPE LIKE '%Ethernet%' AND COUNT(DISTINCT CALLING_STATION_ID) > 2 THEN 'SUSPECTED HUB'
        WHEN NAS_PORT_TYPE LIKE '%Ethernet%' AND COUNT(DISTINCT CALLING_STATION_ID) > 5 THEN 'LIKELY HYPERVISOR'
        WHEN COUNT(DISTINCT CALLING_STATION_ID) > 10 THEN 'INVESTIGATE IMMEDIATELY'
        ELSE 'Normal'
    END as Risk_Level
FROM radius_authentications
WHERE TIMESTAMP >= (SYSDATE - 3)
  AND NAS_PORT_ID IS NOT NULL
GROUP BY DEVICE_NAME, NAS_PORT_ID, NAS_PORT_TYPE
HAVING COUNT(DISTINCT CALLING_STATION_ID) > 1
ORDER BY MAC_Count DESC
"
Roaming Devices (WiFi Troubleshooting)

Find devices that authenticated on multiple switches (roaming/mobile):

netapi ise dc query "
SELECT
    CALLING_STATION_ID as MAC,
    MAX(USERNAME) as Username,
    MAX(ENDPOINT_PROFILE) as Device_Type,
    COUNT(DISTINCT DEVICE_NAME) as Switch_Count,
    COUNT(*) as Auth_Count,
    LISTAGG(DISTINCT DEVICE_NAME, '; ') WITHIN GROUP (ORDER BY DEVICE_NAME) as Switches
FROM radius_authentications
WHERE TIMESTAMP >= (SYSDATE - 4/24)
GROUP BY CALLING_STATION_ID
HAVING COUNT(DISTINCT DEVICE_NAME) > 1
ORDER BY Switch_Count DESC
"
Licensing Impact Analysis (30 Days)

Critical for license compliance and capacity planning:

netapi ise dc query "
SELECT
    TRUNC(TIMESTAMP) as Date,
    COUNT(DISTINCT CALLING_STATION_ID) as Unique_MACs_Per_Day,
    COUNT(*) as Total_Auths,
    COUNT(DISTINCT DEVICE_NAME) as Active_Switches,
    COUNT(DISTINCT USERNAME) as Unique_Users
FROM radius_authentications
WHERE TIMESTAMP >= (SYSDATE - 30)
GROUP BY TRUNC(TIMESTAMP)
ORDER BY TRUNC(TIMESTAMP) DESC
"
MSCHAPv2 Migration Query

Find all devices still using MSCHAPv2 (for EAP-TLS migration):

netapi ise dc query "
SELECT
    CALLING_STATION_ID as MAC_Address,
    USERNAME,
    AUTHENTICATION_METHOD,
    AUTHENTICATION_PROTOCOL,
    DEVICE_NAME,
    ENDPOINT_PROFILE,
    MAX(TIMESTAMP) as Last_Auth
FROM radius_authentications
WHERE AUTHENTICATION_PROTOCOL LIKE '%MSCHAP%'
  AND TIMESTAMP >= (SYSDATE - 30)
GROUP BY CALLING_STATION_ID, USERNAME, AUTHENTICATION_METHOD,
         AUTHENTICATION_PROTOCOL, DEVICE_NAME, ENDPOINT_PROFILE
ORDER BY Last_Auth DESC
"
Network Device Activity

Authentication load per switch/WLC:

netapi ise dc query "
SELECT
    DEVICE_NAME as Switch,
    NAS_IP_ADDRESS as IP,
    COUNT(DISTINCT CALLING_STATION_ID) as Unique_Devices,
    COUNT(*) as Total_Auths,
    SUM(CASE WHEN PASSED = 'Pass' THEN 1 ELSE 0 END) as Success,
    SUM(CASE WHEN FAILED = 1 THEN 1 ELSE 0 END) as Failed,
    MAX(TIMESTAMP) as Last_Auth
FROM radius_authentications
WHERE TIMESTAMP >= (SYSDATE - 1)
  AND DEVICE_NAME IS NOT NULL
GROUP BY DEVICE_NAME, NAS_IP_ADDRESS
ORDER BY Total_Auths DESC
"
Session Duration by Endpoint

Data usage analysis:

netapi ise dc query "
SELECT
    CALLING_STATION_ID as MAC,
    COUNT(*) as sessions,
    ROUND(AVG(ACCT_SESSION_TIME)/60, 1) as avg_minutes,
    ROUND(SUM(ACCT_SESSION_TIME)/3600, 1) as total_hours,
    SUM(ACCT_INPUT_OCTETS + ACCT_OUTPUT_OCTETS) as total_bytes
FROM RADIUS_ACCOUNTING
WHERE TIMESTAMP_TIMEZONE > SYSDATE - 7
GROUP BY CALLING_STATION_ID
ORDER BY total_hours DESC
FETCH FIRST 20 ROWS ONLY
"

4.3.4. Oracle SQL Tips

Oracle Syntax Meaning

SYSDATE - 1

Last 24 hours

SYSDATE - 1/24

Last 1 hour

SYSDATE - 7

Last 7 days

FETCH FIRST N ROWS ONLY

Limit results (Oracle 12c+)

LISTAGG(col, '; ') WITHIN GROUP (ORDER BY col)

Concatenate values into comma-separated list

TRUNC(TIMESTAMP)

Group by day (remove time portion)

4.3.5. Environment Variables (DataConnect)

Variable Description Default

ISE_DATACONNECT_HOST

MnT node IP or hostname

(required)

ISE_DATACONNECT_PORT

Oracle TCPS port

2484

ISE_DATACONNECT_USER

DataConnect username

dataconnect

ISE_DATACONNECT_PASS

DataConnect password

(required)

ISE_DATACONNECT_SERVICE

Oracle service name

cpm10

5. Switch Commands

5.1. Show Commands

# Access sessions
netapi ios exec "show access-session"
netapi ios exec "show access-session interface Gi1/0/5 detail"

# Applied ACLs
netapi ios exec "show ip access-list"

# VLAN status
netapi ios exec "show vlan brief"

5.2. Configuration

# Enter config mode and apply
netapi ios config "interface Gi1/0/5" "shutdown"

# Privileged exec (clear commands)
netapi ios run "clear access-session interface Gi1/0/5"

6. Vault PKI Commands

# Check Vault status
netapi vault status

# Unseal Vault
netapi vault unseal --auto

# Issue server certificate
netapi vault pki-issue server.{domain} --role domus-server --ttl 8760h

# Issue workstation certificate
netapi vault pki-issue workstation.{domain} --role domus-workstation -o /tmp/certs

# List issued certificates
netapi vault pki-list

7. pfSense Commands

# DNS management
netapi pfsense dns list
netapi pfsense dns add-override inside.domusdigitalis.dev 10.50.1.50

# Interface status
netapi pfsense interfaces

# Firewall rules (read-only)
netapi pfsense firewall list

8. WLC Commands

# List WLANs
netapi wlc get-wlans

# Policy profiles
netapi wlc policy-profiles

# Show detailed policy
netapi wlc run "show wireless profile policy detailed POLICY-NAME"

# Connected clients
netapi wlc clients

9. Environment Variables

netapi uses environment variables loaded via dsource:

Variable Purpose

ISE_PAN_IP

ISE Primary Admin Node IP

ISE_API_USER / ISE_API_PASS

ERS API credentials

PFSENSE_HOST / PFSENSE_API_KEY

pfSense API access

IOS_HOST / IOS_USER / IOS_PASS

Switch SSH credentials

VAULT_ADDR / VAULT_TOKEN

Vault server and token

WLC_HOST / WLC_USER / WLC_PASS

WLC RESTCONF credentials

10. Integration with Documentation

The full netapi CLI reference is in the domus-netapi-docs component:

  • 114 pages of command documentation

  • Every ISE ERS, MNT, DataConnect, and pxGrid command

  • pfSense, WLC, IOS, Vault command references

  • Examples with real output

When built via domus-docs aggregator, cross-component links work:

  • ISE ERS: netapi::cli/ise/ers/index.adoc

  • ISE MNT: netapi::cli/ise/mnt/index.adoc

  • ISE DataConnect: netapi::cli/ise/dc/index.adoc

  • pfSense: netapi::cli/pfsense/index.adoc

  • Vault: netapi::cli/vault-commands.adoc