host-local: make Store interface support to get ip list by id

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>
This commit is contained in:
Bruce Ma
2019-06-01 17:37:24 +08:00
parent 0eddc554c0
commit 7f8ea631e5
3 changed files with 41 additions and 1 deletions

View File

@ -81,6 +81,16 @@ func (s *FakeStore) ReleaseByID(id string, ifname string) error {
return nil
}
func (s *FakeStore) GetByID(id string, ifname string) []net.IP {
var ips []net.IP
for k, v := range s.ipMap {
if v == id {
ips = append(ips, net.ParseIP(k))
}
}
return ips
}
func (s *FakeStore) SetIPMap(m map[string]string) {
s.ipMap = m
}