mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 06:40:45 +08:00
Add quick-connect sessions with credential retry, raw interactive drivers, bootstrap banner replay, Huawei telnet prompt cleanup, and session rename/delete in the tree. Co-authored-by: Cursor <cursoragent@cursor.com>
729 lines
15 KiB
TypeScript
729 lines
15 KiB
TypeScript
export type IntegrationStatus = {
|
|
netx_api: { status: "up" | "down" | "unknown"; [k: string]: unknown };
|
|
db: { status: "up" | "down" | "unknown"; latency_ms?: number; error?: string; [k: string]: unknown };
|
|
oclaw_bridge?: {
|
|
status: "up" | "down" | "unknown";
|
|
mode?: string;
|
|
enabled?: boolean;
|
|
connected?: boolean;
|
|
queue_size?: number;
|
|
published_ok?: number;
|
|
published_fail?: number;
|
|
latency_ms?: number;
|
|
error_kind?: string;
|
|
error?: string;
|
|
[k: string]: unknown;
|
|
};
|
|
};
|
|
|
|
export type UmeKeyAlertRuleItem = {
|
|
notification_id: string;
|
|
match_type: "notification_id" | "keyword";
|
|
match_value: string;
|
|
enabled: boolean;
|
|
label: string;
|
|
ne_types?: string[];
|
|
created_at: string;
|
|
updated_at: string;
|
|
forward_stats?: {
|
|
attempts: number;
|
|
published_ok: number;
|
|
last_forwarded_at: string;
|
|
};
|
|
};
|
|
|
|
export type UmeInventoryNeTypeItem = {
|
|
ne_type: string;
|
|
ne_count: number;
|
|
};
|
|
|
|
export type UmeKeyAlertForwarderStatus = {
|
|
enabled: boolean;
|
|
operational?: boolean;
|
|
paused?: boolean;
|
|
connected: boolean;
|
|
queue_size: number;
|
|
url: string;
|
|
published_ok?: number;
|
|
published_fail?: number;
|
|
queued_total?: number;
|
|
};
|
|
|
|
export type UmeKeyAlertMonitorResponse = {
|
|
ok: boolean;
|
|
rules: UmeKeyAlertRuleItem[];
|
|
total?: number;
|
|
page?: number;
|
|
page_size?: number;
|
|
config?: {
|
|
forward_on_clear: boolean;
|
|
};
|
|
forwarder: UmeKeyAlertForwarderStatus;
|
|
};
|
|
|
|
export type UmeSyncJobItem = {
|
|
id: number;
|
|
domain: string;
|
|
status: string;
|
|
trigger_mode: string;
|
|
pulled_count: number;
|
|
inserted_count: number;
|
|
updated_count: number;
|
|
deleted?: number;
|
|
error_message?: string;
|
|
started_at: string;
|
|
ended_at?: string | null;
|
|
};
|
|
|
|
export type UmeWsLogEntry = {
|
|
ts: string;
|
|
level: string;
|
|
message: string;
|
|
subscription_id?: string;
|
|
};
|
|
|
|
export type UmeWsConnectionStatus = {
|
|
state: string;
|
|
label: string;
|
|
detail?: string;
|
|
};
|
|
|
|
export type UmeAlarmSubscriptionStatus = {
|
|
ok?: boolean;
|
|
created?: boolean;
|
|
already_exists?: boolean;
|
|
active: boolean;
|
|
subscription_id?: string;
|
|
wss_uri?: string;
|
|
topic?: string;
|
|
server_subscription_lost?: boolean;
|
|
server_subscription_lost_reason?: string;
|
|
current_alarms_mode?: "wss" | "rest";
|
|
wss_active_for_current_alarms?: boolean;
|
|
scheduled_sync_skipped?: boolean;
|
|
needs_local_cleanup?: boolean;
|
|
ume_already_missing?: boolean;
|
|
cleared_local?: boolean;
|
|
message?: string;
|
|
ws_connection?: UmeWsConnectionStatus;
|
|
ws_consumer_status?: string;
|
|
ws_consumer_last_error?: string;
|
|
ws_consumer_last_run_at?: string | null;
|
|
ws_logs?: UmeWsLogEntry[];
|
|
};
|
|
|
|
export type UmeSyncStatusResponse = {
|
|
total?: number;
|
|
page?: number;
|
|
page_size?: number;
|
|
items: UmeSyncJobItem[];
|
|
latest_by_domain?: Record<string, UmeSyncJobItem>;
|
|
alarm_subscription?: UmeAlarmSubscriptionStatus;
|
|
runtime_tasks?: Array<{
|
|
task: string;
|
|
status: string;
|
|
paused?: boolean;
|
|
last_run_at?: string | null;
|
|
last_error?: string;
|
|
interval_s?: number | null;
|
|
interval_label?: string;
|
|
}>;
|
|
};
|
|
|
|
export type UmeNeItem = {
|
|
ne_id: string;
|
|
ne_name: string;
|
|
user_label: string;
|
|
ip_address: string;
|
|
ipv6_address?: string;
|
|
ne_type: string;
|
|
device_level?: string;
|
|
host_name?: string;
|
|
location?: string;
|
|
hardware_version?: string;
|
|
loopback?: string;
|
|
consistent_state?: string;
|
|
interface_version?: string;
|
|
mac?: string;
|
|
admin_status?: string;
|
|
address_type?: string;
|
|
connection_status?: string;
|
|
maintain_status?: string;
|
|
net_mask?: string;
|
|
create_time?: string;
|
|
creator?: string;
|
|
last_seen_at?: string;
|
|
};
|
|
|
|
export type UmeAlarmItem = {
|
|
alarm_key: string;
|
|
ne_id: string;
|
|
ne_name: string;
|
|
user_label: string;
|
|
host_name?: string;
|
|
ne_type?: string;
|
|
object_name: string;
|
|
event_type: string;
|
|
native_probable_cause: string;
|
|
perceived_severity: string;
|
|
is_cleared: string;
|
|
time_created: string;
|
|
last_seen_at?: string;
|
|
};
|
|
|
|
export type ConnectStatus = "unknown" | "testing" | "pass" | "fail";
|
|
|
|
export type ManagedNeItem = {
|
|
id: string;
|
|
name: string;
|
|
vendor: string;
|
|
device_type: string;
|
|
ip_address: string;
|
|
port: number;
|
|
protocol: string;
|
|
username: string;
|
|
connect_status: ConnectStatus;
|
|
connect_message: string;
|
|
connect_detail: string;
|
|
connect_tested_at: string | null;
|
|
tags: string;
|
|
remark: string;
|
|
hop_enabled: boolean;
|
|
hop_vendor: string;
|
|
hop_host: string;
|
|
hop_port: number;
|
|
hop_protocol: string;
|
|
hop_username: string;
|
|
hop_command_template: string;
|
|
hop_vrf: string;
|
|
hop_target_auth_mode: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
};
|
|
|
|
export type ManagedNeListResponse = {
|
|
total: number;
|
|
page: number;
|
|
page_size: number;
|
|
items: ManagedNeItem[];
|
|
};
|
|
|
|
export type ManagedNeMeta = {
|
|
device_types: string[];
|
|
vendors: string[];
|
|
};
|
|
|
|
export type ManagedNeImportResult = {
|
|
inserted: number;
|
|
updated: number;
|
|
failed: Array<{ row: number; reason: string }>;
|
|
};
|
|
|
|
export type CliConnectProfileItem = {
|
|
id: string;
|
|
name: string;
|
|
is_default: boolean;
|
|
username: string;
|
|
port: number;
|
|
protocol: string;
|
|
device_type_default: string;
|
|
vendor_default: string;
|
|
ne_type_rules: string;
|
|
hop_enabled: boolean;
|
|
hop_vendor: string;
|
|
hop_host: string;
|
|
hop_port: number;
|
|
hop_protocol: string;
|
|
hop_username: string;
|
|
hop_command_template: string;
|
|
hop_vrf: string;
|
|
hop_target_auth_mode: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
};
|
|
|
|
export type CliMeta = {
|
|
credentials_configured: boolean;
|
|
default_profile_configured: boolean;
|
|
cli_profile_ready: boolean;
|
|
};
|
|
|
|
export type CliTargetItem = {
|
|
source: string;
|
|
id: string;
|
|
ume_ne_id?: string | null;
|
|
name: string;
|
|
ip_address: string;
|
|
ne_type?: string;
|
|
vendor?: string;
|
|
device_type?: string;
|
|
protocol?: string;
|
|
username?: string;
|
|
has_password?: boolean;
|
|
connect_status: string;
|
|
cli_profile_ready?: boolean;
|
|
};
|
|
|
|
export type CliTargetListResponse = {
|
|
total: number;
|
|
page: number;
|
|
page_size: number;
|
|
items: CliTargetItem[];
|
|
};
|
|
|
|
export type UmeCliOverrideItem = {
|
|
ume_ne_id: string;
|
|
profile_id: string | null;
|
|
username_override: string;
|
|
device_type_override: string;
|
|
vendor_override: string;
|
|
connect_status: string;
|
|
connect_message: string;
|
|
connect_detail: string;
|
|
connect_tested_at: string | null;
|
|
updated_at: string;
|
|
};
|
|
|
|
export type EligibleNeItem = {
|
|
id: string;
|
|
name: string;
|
|
vendor: string;
|
|
device_type: string;
|
|
ip_address: string;
|
|
connect_status: string;
|
|
connect_tested_at: string | null;
|
|
};
|
|
|
|
export type CollectionJobItem = {
|
|
id: string;
|
|
title: string;
|
|
commands: string;
|
|
status: string;
|
|
ne_count: number;
|
|
success_count: number;
|
|
fail_count: number;
|
|
output_count: number;
|
|
error_message: string;
|
|
created_at: string;
|
|
started_at: string | null;
|
|
ended_at: string | null;
|
|
last_run_at: string | null;
|
|
};
|
|
|
|
export type CollectionRunItem = {
|
|
id: string;
|
|
job_id: string;
|
|
ne_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
status: string;
|
|
message: string;
|
|
output_rel_path: string;
|
|
has_output: boolean;
|
|
started_at: string | null;
|
|
ended_at: string | null;
|
|
};
|
|
|
|
export type CollectionJobDetail = {
|
|
job: CollectionJobItem;
|
|
};
|
|
|
|
export type CollectionRunList = {
|
|
total: number;
|
|
page: number;
|
|
page_size: number;
|
|
items: CollectionRunItem[];
|
|
};
|
|
|
|
export type UmeTokenStatus = {
|
|
ok?: boolean;
|
|
has_token: boolean;
|
|
expires_in_s: number;
|
|
expires_at_epoch_s: number;
|
|
auth_header: string;
|
|
token_preview?: string;
|
|
changed?: boolean;
|
|
error_kind?: string;
|
|
error?: string;
|
|
};
|
|
|
|
export type TopologyMapItem = {
|
|
id: string;
|
|
name: string;
|
|
remark: string;
|
|
node_count: number;
|
|
edge_count: number;
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
};
|
|
|
|
export type TopologyNodeItem = {
|
|
id: string;
|
|
map_id: string;
|
|
managed_ne_id: string;
|
|
ume_ne_id: string;
|
|
label: string;
|
|
x: number;
|
|
y: number;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
vendor: string;
|
|
protocol: string;
|
|
connect_status: string;
|
|
};
|
|
|
|
export type TopologyEdgeItem = {
|
|
id: string;
|
|
map_id: string;
|
|
source_node_id: string;
|
|
target_node_id: string;
|
|
source_port: string;
|
|
target_port: string;
|
|
source: string;
|
|
stroke_color?: string;
|
|
stroke_width?: number;
|
|
line_style?: string;
|
|
discovered_at?: string | null;
|
|
};
|
|
|
|
export type TopologyGraph = {
|
|
map: TopologyMapItem;
|
|
nodes: TopologyNodeItem[];
|
|
edges: TopologyEdgeItem[];
|
|
};
|
|
|
|
export type TopologyDiscoverUnmatched = {
|
|
remote_name: string;
|
|
remote_ip: string;
|
|
local_port: string;
|
|
remote_port: string;
|
|
};
|
|
|
|
export type TopologyDiscoverLink = {
|
|
peer_node_id?: string;
|
|
peer_ne_id?: string;
|
|
peer_name?: string;
|
|
peer_ip?: string;
|
|
local_port?: string;
|
|
remote_port?: string;
|
|
protocol?: string;
|
|
action?: string;
|
|
};
|
|
|
|
export type TopologyDiscoverNeResult = {
|
|
ne_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
ok: boolean;
|
|
command: string;
|
|
neighbors: number;
|
|
edges_added: number;
|
|
edges_updated: number;
|
|
unmatched_count?: number;
|
|
unmatched?: TopologyDiscoverUnmatched[];
|
|
links?: TopologyDiscoverLink[];
|
|
parser_key?: string;
|
|
parser_stub?: boolean;
|
|
error: string;
|
|
raw_preview: string;
|
|
};
|
|
|
|
export type TopologyDiscoverOut = {
|
|
map_id: string;
|
|
protocol: string;
|
|
scanned: number;
|
|
edges_added: number;
|
|
edges_updated: number;
|
|
edges_stale?: number;
|
|
results: TopologyDiscoverNeResult[];
|
|
graph: TopologyGraph | null;
|
|
};
|
|
|
|
export type TopologyDiscoverStreamHandlers = {
|
|
onStart?: (ev: { map_id: string; protocol: string; total: number }) => void;
|
|
onNeStart?: (ev: {
|
|
index: number;
|
|
total: number;
|
|
ne_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
}) => void;
|
|
onNeResult?: (ev: {
|
|
index: number;
|
|
total: number;
|
|
result: TopologyDiscoverNeResult;
|
|
edges_added: number;
|
|
edges_updated: number;
|
|
}) => void;
|
|
onDone?: (report: TopologyDiscoverOut) => void;
|
|
onError?: (detail: string) => void;
|
|
};
|
|
|
|
export type ConfigSyncTargetRef = {
|
|
source: "managed" | "ume";
|
|
id: string;
|
|
};
|
|
|
|
export type ConfigSyncPolicy = {
|
|
enabled: boolean;
|
|
interval_days: number;
|
|
concurrency: number;
|
|
scope_mode: string;
|
|
selected_targets: ConfigSyncTargetRef[];
|
|
history_keep: number;
|
|
updated_at?: string | null;
|
|
};
|
|
|
|
export type ConfigSyncCycle = {
|
|
id: string;
|
|
trigger_mode: string;
|
|
status: string;
|
|
concurrency: number;
|
|
planned_count: number;
|
|
success_count: number;
|
|
fail_count: number;
|
|
skip_count: number;
|
|
error_message: string;
|
|
started_at?: string | null;
|
|
ended_at?: string | null;
|
|
created_at?: string | null;
|
|
};
|
|
|
|
export type ConfigSyncTask = {
|
|
id: string;
|
|
cycle_id: string;
|
|
source: string;
|
|
target_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
vendor: string;
|
|
status: string;
|
|
message: string;
|
|
started_at?: string | null;
|
|
ended_at?: string | null;
|
|
};
|
|
|
|
export type ConfigSyncDashboard = {
|
|
policy: ConfigSyncPolicy;
|
|
snapshot_count: number;
|
|
last_cycle: ConfigSyncCycle | null;
|
|
running_cycle: ConfigSyncCycle | null;
|
|
next_due_at?: string | null;
|
|
fail_by_vendor: Record<string, number>;
|
|
};
|
|
|
|
export type NeConfigSnapshotMeta = {
|
|
source: string;
|
|
target_id: string;
|
|
vendor: string;
|
|
device_type: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
config_sha256: string;
|
|
config_alt_sha256: string;
|
|
plain_size: number;
|
|
plain_alt_size: number;
|
|
zlib_size: number;
|
|
zlib_alt_size: number;
|
|
has_alt: boolean;
|
|
commands: string[];
|
|
collected_at?: string | null;
|
|
last_cycle_id: string;
|
|
};
|
|
|
|
export type NeConfigSnapshotDetail = NeConfigSnapshotMeta & {
|
|
config_text: string;
|
|
config_alt_text: string;
|
|
};
|
|
|
|
export type PortTrafficDevice = {
|
|
id: string;
|
|
source: string;
|
|
ne_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
vendor: string;
|
|
note: string;
|
|
status: string;
|
|
interval_sec: number;
|
|
retention_days: number;
|
|
concurrency: number;
|
|
collect_running: boolean;
|
|
target_count: number;
|
|
active_target_count: number;
|
|
last_collect_started_at?: string | null;
|
|
last_collect_ended_at?: string | null;
|
|
last_error: string;
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
};
|
|
|
|
/** @deprecated use PortTrafficDevice */
|
|
export type PortTrafficTask = PortTrafficDevice;
|
|
|
|
export type PortTrafficTarget = {
|
|
id: string;
|
|
device_id: string;
|
|
task_id?: string;
|
|
series_id?: string;
|
|
source: string;
|
|
target_id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
vendor: string;
|
|
ifname: string;
|
|
if_description: string;
|
|
bw_bps: number;
|
|
status: string;
|
|
last_error: string;
|
|
last_sample_at?: string | null;
|
|
created_at?: string | null;
|
|
};
|
|
|
|
export type PortTrafficEvent = {
|
|
id: string;
|
|
device_id: string;
|
|
target_row_id: string;
|
|
ifname: string;
|
|
level: string;
|
|
message: string;
|
|
created_at?: string | null;
|
|
};
|
|
|
|
export type PortTrafficBoardPanel = {
|
|
id: string;
|
|
board_id: string;
|
|
title: string;
|
|
target_id: string;
|
|
range_hours: number;
|
|
baseline: "off" | "day" | "week" | "shift" | "custom" | string;
|
|
offset_hours: number;
|
|
baseline_target_id: string;
|
|
y_mode: "auto" | "current" | "util" | string;
|
|
ord: number;
|
|
col_span: number;
|
|
row_span: number;
|
|
stale: boolean;
|
|
target: PortTrafficTarget | null;
|
|
baseline_target: PortTrafficTarget | null;
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
};
|
|
|
|
export type PortTrafficBoardPanelIn = {
|
|
id?: string;
|
|
title?: string;
|
|
target_id: string;
|
|
range_hours?: number;
|
|
baseline?: string;
|
|
offset_hours?: number;
|
|
baseline_target_id?: string;
|
|
y_mode?: string;
|
|
ord?: number;
|
|
col_span?: number;
|
|
row_span?: number;
|
|
};
|
|
|
|
export type PortTrafficBoardSummary = {
|
|
id: string;
|
|
name: string;
|
|
remark: string;
|
|
cols: number;
|
|
panel_count: number;
|
|
created_by: string;
|
|
updated_by: string;
|
|
created_at?: string | null;
|
|
updated_at?: string | null;
|
|
};
|
|
|
|
export type PortTrafficBoard = PortTrafficBoardSummary & {
|
|
panels: PortTrafficBoardPanel[];
|
|
};
|
|
|
|
export type PortTrafficSeries = {
|
|
id: string;
|
|
device_id: string;
|
|
task_id?: string;
|
|
title: string;
|
|
status: string;
|
|
active_target: PortTrafficTarget | null;
|
|
retired_target_count: number;
|
|
created_at?: string | null;
|
|
};
|
|
|
|
export type PortTrafficIfaceIn = {
|
|
ifname: string;
|
|
if_description?: string;
|
|
bw_bps?: number;
|
|
};
|
|
|
|
export type PortTrafficTargetIn = PortTrafficIfaceIn & {
|
|
source?: "managed" | "ume";
|
|
target_id?: string;
|
|
ne_name?: string;
|
|
ne_ip?: string;
|
|
vendor?: string;
|
|
};
|
|
|
|
export type PortTrafficDiscoverPort = {
|
|
ifname: string;
|
|
attribute: string;
|
|
mode: string;
|
|
bw_raw: string;
|
|
bw_bps: number;
|
|
admin: string;
|
|
phy: string;
|
|
prot: string;
|
|
description: string;
|
|
};
|
|
|
|
export type PortTrafficDiscoverResponse = {
|
|
source: string;
|
|
id: string;
|
|
ne_name: string;
|
|
ne_ip: string;
|
|
vendor: string;
|
|
vendor_key: string;
|
|
ports: PortTrafficDiscoverPort[];
|
|
};
|
|
|
|
export type PortTrafficSamplePoint = {
|
|
ts: string;
|
|
in_bps: number;
|
|
out_bps: number;
|
|
in_util_pct: number;
|
|
out_util_pct: number;
|
|
bw_bps: number;
|
|
rate_period_sec: number;
|
|
ts_raw?: string | null;
|
|
};
|
|
|
|
export type PortTrafficSamples = {
|
|
target: PortTrafficTarget;
|
|
points: PortTrafficSamplePoint[];
|
|
};
|
|
|
|
export type PortTrafficCompare = {
|
|
meta: {
|
|
target_id: string;
|
|
baseline: string;
|
|
offset_hours: number;
|
|
range_hours: number;
|
|
current_target: PortTrafficTarget | null;
|
|
baseline_target: PortTrafficTarget | null;
|
|
baseline_target_id: string;
|
|
};
|
|
current: PortTrafficSamplePoint[];
|
|
baseline: PortTrafficSamplePoint[];
|
|
};
|
|
|
|
export type PortTrafficDashboard = {
|
|
device_count: number;
|
|
running_device_count: number;
|
|
active_target_count: number;
|
|
sample_count_24h: number;
|
|
last_sample_at?: string | null;
|
|
task_count?: number;
|
|
running_task_count?: number;
|
|
};
|
|
|