blob: 7fde19d534c3593a9cc772f0c9210872cde65faf [file] [log] [blame]
Sapan Bhatia0a56fdc2017-04-21 15:12:57 +02001@property
2def gateway_ip(self):
3 if not self.address_pool:
4 return None
5 return self.address_pool.gateway_ip
6
7@property
8def gateway_mac(self):
9 if not self.address_pool:
10 return None
11 return self.address_pool.gateway_mac
12
13@property
14def cidr(self):
15 if not self.address_pool:
16 return None
17 return self.address_pool.cidr
18
19@property
20def netbits(self):
21 # return number of bits in the network portion of the cidr
22 if self.cidr:
23 parts = self.cidr.split("/")
24 if len(parts) == 2:
25 return int(parts[1].strip())
26 return None
27
28def cleanup_addresspool(self):
29 if self.address_pool:
30 ap = self.address_pool
31 if ap:
32 ap[0].put_address(self.public_ip)
33 self.public_ip = None
34
35def delete(self, *args, **kwargs):
36 self.cleanup_addresspool()
37 super(VRouterTenant, self).delete(*args, **kwargs)
38