blob: 51f9fcba6fc722f8851d932fc8dcd0fd9de141fd [file] [log] [blame]
Tony Mack387a73f2013-09-18 07:59:14 -04001from core.models import Network
2from deleter import Deleter
3
4class NetworkDeleter(Deleter):
5 model='Network'
6
7 def call(self, pk):
8 network = Network.objects.get(pk=pk)
9 if (network.router_id) and (network.subnet_id):
10 self.driver.delete_router_interface(network.router_id, network.subnet_id)
11 if network.subnet_id:
12 self.driver.delete_subnet(network.subnet_id)
13 if network.router_id:
14 self.driver.delete_router(network.router_id)
15 if network.network_id:
16 self.driver.delete_network(network.network_id)
17 network.delete()