enet-validator/scripts/session/test_newmac.ps1

15 lines
1.1 KiB
PowerShell
Raw Permalink Normal View History

[Console]::OutputEncoding = [Text.Encoding]::UTF8
Set-ExecutionPolicy -Scope Process Bypass -Force
Import-Module Posh-SSH
$sec = ConvertTo-SecureString "0" -AsPlainText -Force
$cred = New-Object PSCredential("tonycao", $sec)
$s = New-SSHSession -ComputerName 192.168.58.7 -Credential $cred -AcceptKey -ConnectionTimeout 15
# restart butler with NEW MAC (new device identity), NO relay -> host must re-claim, local AERE
$r = Invoke-SSHCommand -SSHSession $s -Command "pkill -f 'enet-validator device'; sleep 1; cd ~/enet-validator && nohup ./target/release/enet-validator device 192.168.58.7 00161cf12e89 300 > ~/butler.log 2>&1 & sleep 2; pgrep -af 'enet-validator device' | head -1"
Write-Host ($r.Output -join "`n")
Write-Host "--- waiting 90s for host auto-claim of new device ---"
Start-Sleep -Seconds 90
$r = Invoke-SSHCommand -SSHSession $s -Command "echo AECH次数:; grep -c 'AECH' ~/butler.log; echo 注册次数:; grep -c 'sub=01' ~/butler.log; echo DMX行数:; grep -c 'DMX #' ~/butler.log; echo '---'; grep -E 'AECH|注册|DMX #1 ' ~/butler.log | head -10"
Write-Host ($r.Output -join "`n")
Remove-SSHSession $s | Out-Null