{%
local connect_exist = false
local print_table = {}
for _, connect in pairs(connect_table) do
table.insert(print_table, {id = tonumber(connect.Id), src = connect.Source, dst = connect.Destination, avail = connect.Availability})
if connect.Id == option then
connect_exist = true
if connect.CurrentConnectStatus == 1 then
echo('Set serial port direction successfully.')
else
echo('Set serial port direction failed.')
end
break
end
end
if not connect_exist then
table.sort(print_table, function (a, b) return a.id < b.id end)
echo('Usage: ipmcset -d serialdir -v <option> [-s <systemid>]\nOptions are:\n')
for _, v in ipairs(print_table) do
if v.avail ~= 2 then
echo(string.format(' %-3d Serial switch from %s to %s\n', v.id, v.src, v.dst))
end
end
end
%}