blob: 28d24ccd4e77a73c2d2ecd20c7f7616276e09261 [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
3from planetstack.config import Config
Tony Mack66646d52013-09-24 21:47:12 -04004from observer.openstacksyncstep import OpenStackSyncStep
Sapan Bhatia475c5972014-11-05 10:32:41 -05005from core.models.site import Deployment
Sapan Bhatia24836f12013-08-27 10:16:05 -04006
Tony Mack66646d52013-09-24 21:47:12 -04007class SyncExternalRoutes(OpenStackSyncStep):
8 # XXX what does this provide?
9 provides=[]
10 requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently
Sapan Bhatia2ef36c82013-09-02 14:30:37 -040011
Tony Macka76b8952013-10-05 23:36:30 -040012 def call(self, **args):
Sapan Bhatia475c5972014-11-05 10:32:41 -050013 deployments = Deployment.objects.all()
14 self.driver = self.driver.admin_driver(deployment=deployments[0],tenant='admin')
Tony Mack66646d52013-09-24 21:47:12 -040015 routes = self.driver.get_external_routes()
16 subnets = self.driver.shell.quantum.list_subnets()['subnets']
17 for subnet in subnets:
18 try:
19 self.driver.add_external_route(subnet, routes)
20 except:
21 logger.log_exc("failed to add external route for subnet %s" % subnet)