Implements get_member_details to get interface pool member details

This commit is contained in:
Simone Mainardi 2020-07-07 11:06:20 +02:00
parent f057c185e4
commit 69c7cd7acd
3 changed files with 12 additions and 1 deletions

View file

@ -24,12 +24,21 @@ end
-- ##############################################
-- @brief Given a member key, returns a table of member details such as member name.
function interface_pools:get_member_details(member)
-- Only the name is relevant for interfaces
return {name = getInterfaceName(member)}
end
-- ##############################################
-- @brief Returns a table of all possible interface ids, both assigned and unassigned to pool members
function interface_pools:get_all_members()
local res = {}
for ifid, ifname in pairs(interface.getIfNames()) do
res[ifid] = {ifid = ifid, ifname = ifname}
-- The key is the member id itself, which in this case is the interface id
res[ifid] = self:get_member_details(ifid)
end
return res