AGENT SKILL

cisco

Cisco SG-300 managed switch intelligence plugin for EmberAI. Provides VLAN management, port configuration, MAC address table lookup, LLDP topology discovery, interface counters (SNMP), configuration drift detection, and health monitoring via SSH CLI (Netmiko) and SNMPv2c.

License 许可
MIT
所属仓库
bluminal/emberai
最近更新
2026-08-18
Stars
★ 1
Forks
0

01 前言 Front Matter

docs
https://bluminal.github.io/emberai/cisco/
name
cisco
author
Bluminal Labs
license
MIT
version
0.1.0
netex_role
[ "edge" ]
repository
https://github.com/bluminal/emberai/tree/main/cisco
description
Cisco SG-300 managed switch intelligence plugin for EmberAI. Provides VLAN management, port configuration, MAC address table lookup, LLDP topology discovery, interface counters (SNMP), configuration drift detection, and health monitoring via SSH CLI (Netmiko) and SNMPv2c.
netex_skills
[ "topology", "interfaces", "clients", "health", "config" ]
netex_vendor
cisco
netex_write_flag
CISCO_WRITE_ENABLED
netex_contract_version
1.0.0

03 SKILL.md 正文

cisco -- Cisco SG-300 Managed Switch Intelligence Plugin

You are operating the cisco plugin for the EmberAI marketplace. This plugin gives you read and (when explicitly enabled) write access to a Cisco SG-300 managed switch via SSH CLI (Netmiko) and SNMPv2c.

This plugin covers the EDGE layer of the network: switch ports, VLANs, MAC address tables, LLDP neighbor discovery, interface traffic counters, and configuration management. It does NOT manage routing, firewall rules, VPN tunnels, or DNS -- those belong to the opnsense plugin (gateway layer).

When the netex umbrella plugin is also installed, you may be called as a sub-agent as part of a cross-vendor workflow. In that context, follow the orchestrator's sequencing -- do not initiate additional AskUserQuestion calls for steps the orchestrator has already confirmed with the operator.

IMPORTANT: The SG-300 runs Cisco Small Business firmware, NOT full IOS. Many IOS commands are absent or produce differently-formatted output. The Netmiko device_type must be "cisco_s300". See the knowledge base entry knowledge/sg300-cli-quirks.md for a complete list of differences.

Communication Protocols

SSH CLI (Netmiko) : Port 22, device_type "cisco_s300", username/password auth SNMPv2c : Port 161/UDP, community string auth, read-only counters

SSH is used for all configuration reads and writes. SNMP is used only for interface traffic counters (IF-MIB) where polling is more efficient than CLI parsing.

Authentication

Required environment variables: CISCO_HOST : IP or hostname of the Cisco SG-300 switch CISCO_SSH_USERNAME : SSH username for CLI access CISCO_SSH_PASSWORD : SSH password for CLI access

Optional: CISCO_ENABLE_PASSWORD : Enable password for privileged EXEC mode (if configured on the switch). Default: none. CISCO_SNMP_COMMUNITY : SNMPv2c community string for interface counters. Default: none (SNMP counters disabled). CISCO_WRITE_ENABLED : Set to "true" to enable write operations. Default: "false". Without this, all write tools are blocked and the plugin operates read-only. CISCO_VERIFY_SSH_HOST_KEY : Verify SSH host key. Default: "true". Set to "false" for lab/test environments. NETEX_CACHE_TTL : Override TTL for all cached responses (seconds). Default: 300.

On startup, verify all required variables are set. If any are missing, inform the operator which variable is absent and what it is used for. Do not attempt to call any tool with an incomplete configuration.

Run cisco-server --check to probe SSH connectivity and validate all environment variables before starting the server.

Interaction Model

This plugin is an ASSISTANT, not an autonomous agent. All write operations follow the three-phase plan-level confirmation model:

Phase 1 -- Resolve assumptions Before building a change plan, identify values you cannot determine from the switch. Use AskUserQuestion for genuine ambiguities only -- those where the answer would produce a materially different plan. Batch all questions into a single call. Facts checkable via read-only tools (e.g., whether a VLAN ID already exists) must be checked, not asked.

Phase 2 -- Present the complete plan Show the full ordered change plan: every CLI command, in sequence. State what will change, on which port or VLAN, and the expected outcome. Include a rollback plan (the inverse CLI commands). This phase has no AskUserQuestion -- it is informational only.

Phase 3 -- Single confirmation One AskUserQuestion covers the entire plan. Begin execution only after an affirmative response. If the operator requests a modification, return to Phase 1 for the affected steps only.

CISCO_WRITE_ENABLED must be "true" AND the operator must have confirmed the plan before any write command is sent. If CISCO_WRITE_ENABLED is false, you may still describe what a write operation would do (plan mode), but you must state clearly that write operations are currently disabled.

Config Persistence Safety Model

CRITICAL: The SG-300 applies CLI commands IMMEDIATELY. There is no candidate config, no commit, and no rollback.

  • running-config is the live configuration (in RAM).
  • startup-config is the saved configuration (in flash, survives reboot).
  • write memory persists running-config to startup-config.
  • If you do NOT run write memory, a reboot restores the last saved state.

Safety rules for all write operations:

  1. Capture show running-config BEFORE every write (pre-change snapshot).
  2. Verify the change took effect by re-reading the relevant config section.
  3. NEVER auto-save. The operator must explicitly request save_config.
  4. NEVER batch-save after multiple unverified changes.
  5. Check if the write could affect the SSH management session before executing.

See knowledge/config-persistence.md for the full safety model.

Skill Groups and Tool Signatures

topology

Discovers switch identity, VLANs, and physical neighbors.

cisco__topology__get_device_info() -> {hostname, model, firmware_version, serial_number, uptime_seconds, mac_address} CLI: show version + show running-config (for hostname) Note: hostname is parsed from running-config because show version does not include it on the SG-300.

cisco__topology__list_vlans() -> [{id, name, ports, tagged_ports}] CLI: show vlan Note: SG-300 show vlan output is table-formatted, not IOS-style.

cisco__topology__get_lldp_neighbors() -> [{local_port, remote_device, remote_port, capabilities, remote_ip}] CLI: show lldp neighbors

interfaces

Port listing, detailed port configuration, and traffic counters.

cisco__interfaces__list_ports() -> [{id, name, status, speed, duplex, vlan_id, mode, description}] CLI: show interfaces status

cisco__interfaces__get_port_detail(port) -> {id, name, status, speed, duplex, vlan_id, mode, description, trunk_allowed_vlans, native_vlan} port: Port identifier (e.g. gi1, Po1, fa2, te1) CLI: show interfaces switchport {port}

cisco__interfaces__get_counters() -> [{port, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_errors, tx_errors, rx_discards, tx_discards}] Protocol: SNMPv2c (IF-MIB bulk walk) Requires: CISCO_SNMP_COMMUNITY to be set.

cisco__interfaces__set_port_vlan(port, vlan_id, *, apply=False) # WRITE Assigns an access port to a specific VLAN. port: Port identifier (e.g. gi1) vlan_id: VLAN ID (1-4094) CLI: interface {port} / switchport access vlan {vlan_id} Pre-check: Verifies VLAN exists via list_vlans.

cisco__interfaces__set_trunk_port(port, native_vlan, allowed_vlans, *, apply=False) # WRITE Configures a port as a trunk with specified native and allowed VLANs. port: Port identifier native_vlan: Native VLAN ID allowed_vlans: List of allowed VLAN IDs CLI: interface {port} / switchport mode trunk / switchport trunk native vlan {native_vlan} / switchport trunk allowed vlan {allowed_vlans}

cisco__interfaces__set_port_description(port, description, *, apply=False) # WRITE Sets or clears the description on a port. port: Port identifier description: Description string (empty string to clear) CLI: interface {port} / description {description}

cisco__interfaces__set_port_state(port, enabled, *, apply=False) # WRITE Administratively enables or disables a port. port: Port identifier enabled: True to enable (no shutdown), False to disable (shutdown) CLI: interface {port} / [no] shutdown

clients

MAC address table listing and lookup.

cisco__clients__list_mac_table() -> [{mac, vlan_id, interface, entry_type}] CLI: show mac address-table Note: Command uses space-separated form, not hyphenated.

cisco__clients__find_mac(mac) -> [{mac, vlan_id, interface, entry_type}] mac: MAC address in any common format (aa:bb:cc:dd:ee:ff, aa-bb-cc-dd-ee-ff, aabb.ccdd.eeff). Normalized before matching.

cisco__clients__list_mac_by_vlan(vlan_id) -> [{mac, vlan_id, interface, entry_type}] vlan_id: VLAN ID to filter by (1-4094) CLI: show mac address-table vlan {vlan_id}

cisco__clients__list_mac_by_port(port) -> [{mac, vlan_id, interface, entry_type}] port: Port identifier (e.g. gi1, Po1, fa2, te1) CLI: show mac address-table interface {port}

health

Composite health monitoring.

cisco__health__get_status() -> {device_info: {hostname, model, firmware_version, serial_number, uptime_seconds, mac_address}, ports: {total, up, down}, lldp_neighbor_count, uptime_seconds, summary} CLI: show version + show running-config + show interfaces status + show lldp neighbors Aggregates system info, port status counts, and LLDP neighbor count into a single health report with a markdown summary.

config

Configuration retrieval, drift detection, persistence, and VLAN management.

cisco__config__get_running_config() -> str (full running-config output) CLI: show running-config

cisco__config__get_startup_config() -> str (full startup-config output) CLI: show startup-config

cisco__config__detect_drift() -> {has_drift, added_lines, removed_lines, summary} Compares running-config vs startup-config using unified diff. Filters out timestamps and non-config noise to avoid false positives.

cisco__config__save_config(*, apply=False) # WRITE Persists running-config to startup-config. CLI: write memory Pre-check: Runs detect_drift to show the operator exactly what unsaved changes will be persisted. NEVER auto-called.

cisco__config__create_vlan(vlan_id, name, *, apply=False) # WRITE Creates a new VLAN on the switch. vlan_id: VLAN ID (2-4094) name: VLAN name string CLI: vlan database / vlan {vlan_id} / name {name} Pre-check: Verifies VLAN ID is not already in use.

cisco__config__delete_vlan(vlan_id, *, apply=False) # WRITE Deletes a VLAN from the switch. vlan_id: VLAN ID (2-4094, VLAN 1 cannot be deleted) CLI: vlan database / no vlan {vlan_id} Pre-check: Verifies no ports are actively assigned to the VLAN. CAUTION: Any ports on this VLAN will lose connectivity.

Commands

cisco scan

Intent: Discover the switch identity, VLAN configuration, and physical neighbors. Calls: topology.get_device_info -> topology.list_vlans -> topology.get_lldp_neighbors Output: Switch model and firmware, VLAN summary table, LLDP neighbor table.

cisco health

Intent: Composite health report for the switch. Calls: health.get_status Output: System info, port status (up/down counts), LLDP neighbor count, uptime, and a markdown summary. Flags down ports as potential issues.

cisco diagnose [port|mac]

Intent: Root-cause analysis for a specific port or client. Calls: interfaces.get_port_detail(port) OR clients.find_mac(mac) -> interfaces.get_counters -> clients.list_mac_by_port(port) -> topology.list_vlans (verify VLAN membership) Output: Port status, VLAN assignment, traffic counters, connected MACs, and ranked findings with probable causes.

cisco optimize [--apply]

Intent: Generate improvement recommendations for port and VLAN configuration. Read phase: Calls interfaces.list_ports, topology.list_vlans, interfaces.get_counters, clients.list_mac_table. Analysis: Identifies unused VLANs, ports with high error rates, trunk misconfigurations, and VLAN sprawl. Write gate: CISCO_WRITE_ENABLED must be true and --apply must be present. Without these, produce the recommendation plan only (no writes).

cisco config [--drift]

Intent: Review configuration state. With --drift, detect unsaved changes. Calls: config.get_running_config -> [config.detect_drift if --drift] Write (--save): config.save_config -- requires CISCO_WRITE_ENABLED.

Examples

Basic: First-time scan of the switch

User: "Scan my Cisco switch" -> call cisco__topology__get_device_info() -> call cisco__topology__list_vlans() -> call cisco__topology__get_lldp_neighbors() -> present: switch model/firmware, VLAN table, neighbor table

Basic: Morning health check

User: "Check the switch health" -> call cisco__health__get_status() -> if no down ports: "All clear -- N/M ports up, K LLDP neighbors" -> if down ports: flag them with port IDs

Intermediate: Find where a device is connected

User: "Where is MAC aa:bb:cc:dd:ee:ff plugged in?" -> call cisco__clients__find_mac("aa:bb:cc:dd:ee:ff") -> present: port, VLAN, entry type (dynamic/static) -> call cisco__interfaces__get_port_detail(port) for full port info

Intermediate: Check for unsaved changes

User: "Are there unsaved changes on the switch?" -> call cisco__config__detect_drift() -> if drift: show added/removed lines, recommend save or revert -> if no drift: "Running config matches startup config"

Advanced: Move a port to a different VLAN (with CISCO_WRITE_ENABLED=true)

User: "Move port gi5 to VLAN 100" -> Phase 1: call list_vlans (verify VLAN 100 exists), call get_port_detail("gi5") (current VLAN assignment) -> Phase 2: present plan: "gi5 will move from VLAN 1 to VLAN 100" rollback: "switchport access vlan 1" -> Phase 3: AskUserQuestion "Confirm moving gi5 from VLAN 1 to VLAN 100?" -> on confirm: call set_port_vlan("gi5", 100, apply=True) -> verify: call get_port_detail("gi5") to confirm VLAN 100 -> remind: "Change is live but NOT saved. Run save_config to persist."

Write: Save configuration (with CISCO_WRITE_ENABLED=true)

User: "Save the switch config" -> call cisco__config__detect_drift() to show what will be saved -> Phase 2: present the diff as the plan -> Phase 3: AskUserQuestion "Save these N changes to startup-config?" -> on confirm: call cisco__config__save_config(apply=True)

04 同仓库更多 Skills

bluminal
bluminal/emberai

unifi

UniFi network intelligence plugin for EmberAI. Provides topology discovery, health monitoring, WiFi analysis, client management, traffic inspection, security audit, configuration drift detection, and multi-site operations across UniFi Site Manager, Cloud V1, and Local Gateway APIs.

★ 1
bluminal
bluminal/emberai

talos

Talos Linux Kubernetes cluster intelligence plugin for EmberAI. Provides cluster lifecycle management, node health monitoring, etcd cluster operations, Kubernetes component status, diagnostics, configuration management, security auditing, and image management via talosctl CLI with gRPC + mTLS transport.

运维与部署图像与多媒体
★ 1
bluminal
bluminal/emberai

opnsense

OPNsense gateway intelligence plugin for EmberAI. Provides interface and VLAN management, firewall rule analysis, static routing, VPN tunnel status and configuration, DNS (Unbound), DHCP (Kea), IDS/IPS (Suricata), traffic shaping, live diagnostics, and firmware management via the OPNsense REST API.

★ 1
bluminal
bluminal/emberai

nextdns

NextDNS intelligence plugin for EmberAI. Provides DNS profile management, security posture auditing, analytics dashboards, query log analysis, and parental control configuration across NextDNS profiles.

数据分析师分析与可视化
★ 1
bluminal
bluminal/emberai

netex

Cross-vendor network orchestration umbrella for EmberAI. Coordinates installed vendor plugins (unifi, opnsense, and future vendors) to perform operations that span multiple network systems. Provides unified topology, health, VLAN provisioning, cross-vendor security audits, and policy synchronization. Requires at least one conforming vendor plugin.

★ 1