def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get("priority", CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger("akanda.rug.openstack.common.notification.%s" % message["event_type"]) getattr(logger, priority)(jsonutils.dumps(message))
def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger('akanda.rug.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from akanda.rug.common.i18n import _LE from akanda.rug.openstack.common import log as logging LOG = logging.getLogger(__name__) def periodic_task(*args, **kwargs): """Decorator to indicate that a method is a periodic task. This decorator can be used in two ways: 1. Without arguments '@periodic_task', this will be run on every tick of the periodic scheduler. 2. With arguments, @periodic_task(ticks_between_runs=N), this will be run on every N ticks of the periodic scheduler. """ def decorator(f): f._periodic_task = True
import itertools import socket import time import uuid import netaddr from oslo.config import cfg from neutronclient.v2_0 import client from akanda.rug.common.linux import ip_lib from akanda.rug.openstack.common import importutils from akanda.rug.openstack.common import context from akanda.rug.openstack.common.rpc import proxy from akanda.rug.openstack.common import log as logging LOG = logging.getLogger(__name__) # copied from Quantum source DEVICE_OWNER_ROUTER_MGT = "network:router_management" DEVICE_OWNER_ROUTER_INT = "network:router_interface" DEVICE_OWNER_ROUTER_GW = "network:router_gateway" DEVICE_OWNER_FLOATINGIP = "network:floatingip" DEVICE_OWNER_RUG = "network:akanda" PLUGIN_RPC_TOPIC = 'q-plugin' STATUS_ACTIVE = 'ACTIVE' STATUS_BUILD = 'BUILD' STATUS_DOWN = 'DOWN' STATUS_ERROR = 'ERROR'