blob: 394f4a5e12312e804f9342a69d417782991da86c [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:
Scott Baker4435ce32017-05-26 09:44:24 -070032 ap.put_address(self.public_ip)
Sapan Bhatia0a56fdc2017-04-21 15:12:57 +020033 self.public_ip = None
34
35def delete(self, *args, **kwargs):
36 self.cleanup_addresspool()
37 super(VRouterTenant, self).delete(*args, **kwargs)
38