vmware-nsx/neutron/plugins/embrane/common/constants.py
Ivar Lazzaro 3c95d18311 Embrane Neutron Plugin
Implements blueprint embrane-neutron-plugin

This commit implements the main Embrane plugin, which covers
route and extratoute extensions.

The plugin will rely on existing plugins for leveraging L2 networks,
for now it only supports OpenVSwitch and vlan networks, but more
supports are to come if the model is approved (or a different one
is suggested).

Change-Id: I90aff8ec4324bd3a7c59c411374db6a118d1a72b
2013-08-25 14:22:38 -07:00

85 lines
3.4 KiB
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Embrane, Inc.
# All Rights Reserved.
#
# 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.
#
# @author: Ivar Lazzaro, Embrane, Inc.
from heleosapi import exceptions as h_exc
from neutron.plugins.common import constants
# Router specific constants
UTIF_LIMIT = 7
QUEUE_TIMEOUT = 300
class Status:
# Transient
CREATING = constants.PENDING_CREATE
UPDATING = constants.PENDING_UPDATE
DELETING = constants.PENDING_DELETE
# Final
ACTIVE = constants.ACTIVE
ERROR = constants.ERROR
READY = constants.INACTIVE
DELETED = "DELETED" # not visible
class Events:
CREATE_ROUTER = "create_router"
UPDATE_ROUTER = "update_router"
DELETE_ROUTER = "delete_router"
GROW_ROUTER_IF = "grow_router_if"
SHRINK_ROUTER_IF = "shrink_router_if"
SET_NAT_RULE = "set_nat_rule"
RESET_NAT_RULE = "reset_nat_rule"
operation_filter = {
Status.ACTIVE: [Events.DELETE_ROUTER, Events.GROW_ROUTER_IF,
Events.SHRINK_ROUTER_IF, Events.UPDATE_ROUTER,
Events.SET_NAT_RULE, Events.RESET_NAT_RULE],
Status.READY: [Events.DELETE_ROUTER, Events.GROW_ROUTER_IF,
Events.SHRINK_ROUTER_IF, Events.UPDATE_ROUTER],
Status.ERROR: [Events.DELETE_ROUTER, Events.SHRINK_ROUTER_IF],
Status.UPDATING: [Events.DELETE_ROUTER, Events.SHRINK_ROUTER_IF,
Events.RESET_NAT_RULE],
Status.CREATING: [Events.DELETE_ROUTER, Events.CREATE_ROUTER],
Status.DELETING: [Events.DELETE_ROUTER]}
_DVA_PENDING_ERROR_MSG = _("Dva is pending for the following reason: %s")
_DVA_NOT_FOUNT_ERROR_MSG = _("Dva can't be found to execute the operation, "
"probably was cancelled through the heleos UI")
_DVA_BROKEN_ERROR_MSG = _("Dva seems to be broken for reason %s")
_DVA_BROKEN_INTERFACE_ERROR_MSG = _("Dva interface seems to be broken "
"for reason %s")
_DVA_CREATION_FAILED_ERROR_MSG = _("Dva creation failed reason %s")
_DVA_CREATION_PENDING_ERROR_MSG = _("Dva creation is in pending state "
"for reason %s")
_CFG_FAILED_ERROR_MSG = _("Dva configuration failed for reason %s")
_DVA_DEL_FAILED_ERROR_MSG = _("Failed to delete the backend "
"router for reason %s. Please remove "
"it manually through the heleos UI")
error_map = {h_exc.PendingDva: _DVA_PENDING_ERROR_MSG,
h_exc.DvaNotFound: _DVA_NOT_FOUNT_ERROR_MSG,
h_exc.BrokenDva: _DVA_BROKEN_ERROR_MSG,
h_exc.BrokenInterface: _DVA_BROKEN_INTERFACE_ERROR_MSG,
h_exc.DvaCreationFailed: _DVA_CREATION_FAILED_ERROR_MSG,
h_exc.DvaCreationPending: _DVA_CREATION_PENDING_ERROR_MSG,
h_exc.ConfigurationFailed: _CFG_FAILED_ERROR_MSG,
h_exc.DvaDeleteFailed: _DVA_DEL_FAILED_ERROR_MSG}