Add more show and analyze commands
[netvirt.git] / resources / tools / odltools / odltools / mdsal / models / id_manager.py
1 from odltools.mdsal.models.model import Model
2
3
4 NAME = "id-manager"
5
6
7 def id_pools(store, args):
8     return IdPools(NAME, IdPools.CONTAINER, store, args)
9
10
11 class IdPools(Model):
12     CONTAINER = "id-pools"
13     ID_POOL = "id-pool"
14
15     def get_id_pools(self):
16         return self.data[self.CONTAINER][self.ID_POOL]
17
18     def get_id_pools_by_key(self, key="pool-name"):
19         d = {}
20         idpools = self.get_id_pools()
21         if idpools is None:
22             return None
23         for idpool in idpools:
24             d[idpool[key]] = idpool
25         return d