23 lines
1.2 KiB
Bash
23 lines
1.2 KiB
Bash
# Local notes and NetBox comments (v2 token on fsn, v1 token on lab).
|
|
config <<'EOF'
|
|
resolver:
|
|
strategies: [management_subnet, primary_ip]
|
|
management_subnets: [10.231.1.0/24]
|
|
EOF
|
|
check "refresh" netssh cache refresh
|
|
host=fsn/fsn1-pve1.hoster.test
|
|
check "set local note" netssh notes set $host "first line"
|
|
check "append local note" netssh notes append $host "second line"
|
|
expect_eq "show local note" "first line
|
|
second line" netssh notes show $host
|
|
expect_eq "note from stdin" "piped" bash -c "echo piped | netssh notes set $host && netssh notes show $host"
|
|
|
|
expect_eq "read NetBox comments (v2 token)" "Proxmox node 1" netssh notes show $host --netbox
|
|
check "append NetBox comments" netssh notes append $host --netbox "checked by netssh test"
|
|
expect_out "NetBox has the new line" "checked by netssh test" curl -s -H "Authorization: Bearer $FSN_TOKEN" "$FSN_URL/api/dcim/devices/?name=fsn1-pve1.hoster.test"
|
|
check "restore NetBox comments" netssh notes set $host --netbox "Proxmox node 1"
|
|
|
|
check "set NetBox comments (v1 token)" netssh notes set lab/lab-db1 --netbox "lab note"
|
|
expect_eq "read them back" "lab note" netssh notes show lab/lab-db1 --netbox
|
|
check "clear them" netssh notes set lab/lab-db1 --netbox ""
|