| import os |
| import base64 |
| from netaddr import IPAddress, IPNetwork |
| from django.db.models import F, Q |
| from planetstack.config import Config |
| from observer.openstacksyncstep import OpenStackSyncStep |
| from core.models.slice import Slice, SliceDeployments |
| from util.logger import Logger, logging |
| from observer.steps.sync_slice_deployments import * |
| |
| logger = Logger(level=logging.INFO) |
| |
| class SyncSlices(OpenStackSyncStep): |
| provides=[Slice] |
| requested_interval=0 |
| |
| def sync_record(self, slice): |
| for slice_deployment in SliceDeployment.objects.filter(slice=slice): |
| # bump the 'updated' timestamp and trigger observer to update |
| # slice across all deployments |
| slice_deployment.save() |
| |
| def delete_record(self, slice): |
| slice_deployment_deleter = SyncSliceDeployment().delete_record |
| for slice_deployment in SliceDeployment.objects.filter(slice=slice): |
| try: |
| slice_deployment_deleter(slice_deployment) |
| except Exception,e: |
| logger.log_exc("Failed to delete slice_deployment %s" % slice_deployment) |
| raise e |