Enable hacking to be run
Ensure that Neuteron hacking is run when doing pep8 Ensures the following: 1. oslo.whatever => oslo_whatever 2. LOG messages should have cortrect translations 3. using jsonutils instead of json Change-Id: I85cf69d483fd5d624ed3876ec9bacd83f7b7b70b
This commit is contained in:
parent
313542ccd6
commit
bf7b098788
1
tox.ini
1
tox.ini
@ -82,3 +82,4 @@ commands =
|
|||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
import_exceptions = neutron.i18n
|
import_exceptions = neutron.i18n
|
||||||
|
local-check-factory = neutron.hacking.checks.factory
|
||||||
|
@ -19,7 +19,7 @@ import httplib
|
|||||||
import six
|
import six
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
|
@ -18,8 +18,8 @@ import httplib
|
|||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.i18n import _LI, _LW
|
from neutron.i18n import _LI, _LW
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import request
|
from vmware_nsx.neutron.plugins.vmware.api_client import request
|
||||||
|
@ -21,8 +21,8 @@ import httplib
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
import six
|
import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import config
|
from neutron.common import config
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config as nsx_config # noqa
|
from vmware_nsx.neutron.plugins.vmware.common import config as nsx_config # noqa
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from neutron.i18n import _LW
|
from oslo_config import cfg
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
|
from neutron.i18n import _LW
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron import context
|
from neutron import context
|
||||||
@ -24,10 +28,6 @@ from neutron.db import models_v2
|
|||||||
from neutron.extensions import l3
|
from neutron.extensions import l3
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
from neutron.openstack.common import loopingcall
|
from neutron.openstack.common import loopingcall
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo.utils import timeutils
|
|
||||||
from oslo_log import log
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
|
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.db import exception as db_exc
|
from oslo_db import exception as db_exc
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
|
|
||||||
import neutron.db.api as db
|
import neutron.db.api as db
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
from neutron.plugins.vmware.dbexts import nsx_models
|
from oslo_db import exception as d_exc
|
||||||
from oslo.db import exception as d_exc
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
||||||
|
from neutron.plugins.vmware.dbexts import nsx_models
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.db import exception as db_exc
|
from oslo_db import exception as db_exc
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
from sqlalchemy.sql import expression as expr
|
from sqlalchemy.sql import expression as expr
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_db import exception as db_exc
|
||||||
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron.i18n import _LE, _LW
|
from neutron.i18n import _LE, _LW
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.db import exception as db_exc
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
|
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron.common import constants as const
|
from neutron.common import constants as const
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
@ -22,10 +26,6 @@ from neutron.db import db_base_plugin_v2
|
|||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.extensions import external_net
|
from neutron.extensions import external_net
|
||||||
from neutron.i18n import _LE, _LI
|
from neutron.i18n import _LE, _LI
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.dhcp_meta import constants as d_const
|
from vmware_nsx.neutron.plugins.vmware.dhcp_meta import constants as d_const
|
||||||
from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api
|
from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
import netaddr
|
import netaddr
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
from neutron.common import constants as const
|
from neutron.common import constants as const
|
||||||
@ -24,9 +27,6 @@ from neutron.db import db_base_plugin_v2
|
|||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config
|
from vmware_nsx.neutron.plugins.vmware.common import config
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
from oslo.concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||||
from neutron.api.rpc.handlers import dhcp_rpc
|
from neutron.api.rpc.handlers import dhcp_rpc
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo.vmware import vim_util
|
from oslo_vmware import vim_util
|
||||||
|
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
|
from neutron.i18n import _LE, _LI
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils
|
from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils
|
||||||
@ -87,10 +87,10 @@ class DvsManager(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
# NOTE(garyk): handle more specific exceptions
|
# NOTE(garyk): handle more specific exceptions
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_('Failed to create port group for '
|
LOG.exception(_LE('Failed to create port group for '
|
||||||
'%(net_id)s with tag %(tag)s.'),
|
'%(net_id)s with tag %(tag)s.'),
|
||||||
{'net_id': net_id, 'tag': vlan_tag})
|
{'net_id': net_id, 'tag': vlan_tag})
|
||||||
LOG.info("%(net_id)s with tag %(vlan_tag)s created on %(dvs)s.",
|
LOG.info(_LI("%(net_id)s with tag %(vlan_tag)s created on %(dvs)s."),
|
||||||
{'net_id': net_id,
|
{'net_id': net_id,
|
||||||
'vlan_tag': vlan_tag,
|
'vlan_tag': vlan_tag,
|
||||||
'dvs': dvs_utils.dvs_name_get()})
|
'dvs': dvs_utils.dvs_name_get()})
|
||||||
@ -129,7 +129,8 @@ class DvsManager(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
# NOTE(garyk): handle more specific exceptions
|
# NOTE(garyk): handle more specific exceptions
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_('Failed to delete port group for %s.'), net_id)
|
LOG.exception(_LE('Failed to delete port group for %s.'),
|
||||||
LOG.info("%(net_id)s delete from %(dvs)s.",
|
net_id)
|
||||||
|
LOG.info(_LI("%(net_id)s delete from %(dvs)s."),
|
||||||
{'net_id': net_id,
|
{'net_id': net_id,
|
||||||
'dvs': dvs_utils.dvs_name_get()})
|
'dvs': dvs_utils.dvs_name_get()})
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.vmware import api
|
from oslo_vmware import api
|
||||||
|
|
||||||
dvs_opts = [
|
dvs_opts = [
|
||||||
cfg.StrOpt('host_ip',
|
cfg.StrOpt('host_ip',
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.i18n import _LI
|
from oslo_config import cfg
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from neutron.i18n import _LI
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.common import exceptions as exception
|
from neutron.common import exceptions as exception
|
||||||
from neutron import version
|
from neutron import version
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.common import exceptions as exception
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
|
from neutron.common import exceptions as exception
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron.common import exceptions as exception
|
from neutron.common import exceptions as exception
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||||
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
||||||
|
@ -13,14 +13,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.common import exceptions as exception
|
from neutron.common import exceptions as exception
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.i18n import _LW
|
from neutron.i18n import _LW
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||||
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions as exception
|
from neutron.common import exceptions as exception
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.db import exception as db_exc
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_db import exception as db_exc
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
from sqlalchemy import exc as sql_exc
|
from sqlalchemy import exc as sql_exc
|
||||||
from sqlalchemy.orm import exc as sa_exc
|
from sqlalchemy.orm import exc as sa_exc
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.api import extensions as neutron_extensions
|
from neutron.api import extensions as neutron_extensions
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
@ -32,7 +32,7 @@ from neutron.extensions import multiprovidernet as mpnet
|
|||||||
from neutron.extensions import portbindings as pbin
|
from neutron.extensions import portbindings as pbin
|
||||||
from neutron.extensions import portsecurity as psec
|
from neutron.extensions import portsecurity as psec
|
||||||
from neutron.extensions import providernet as pnet
|
from neutron.extensions import providernet as pnet
|
||||||
|
from neutron.i18n import _LE, _LW
|
||||||
from vmware_nsx.neutron.plugins import vmware
|
from vmware_nsx.neutron.plugins import vmware
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
@ -119,9 +119,9 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
def _dvs_create_network(self, context, network):
|
def _dvs_create_network(self, context, network):
|
||||||
net_data = network['network']
|
net_data = network['network']
|
||||||
if net_data['admin_state_up'] is False:
|
if net_data['admin_state_up'] is False:
|
||||||
LOG.warning(_("Network with admin_state_up=False are not yet "
|
LOG.warning(_LW("Network with admin_state_up=False are not yet "
|
||||||
"supported by this plugin. Ignoring setting for "
|
"supported by this plugin. Ignoring setting for "
|
||||||
"network %s"), net_data.get('name', '<unknown>'))
|
"network %s"), net_data.get('name', '<unknown>'))
|
||||||
net_data['id'] = str(uuid.uuid4())
|
net_data['id'] = str(uuid.uuid4())
|
||||||
vlan_tag = 0
|
vlan_tag = 0
|
||||||
if net_data.get(pnet.NETWORK_TYPE) == c_utils.NetworkTypes.VLAN:
|
if net_data.get(pnet.NETWORK_TYPE) == c_utils.NetworkTypes.VLAN:
|
||||||
@ -144,7 +144,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
vlan_tag)
|
vlan_tag)
|
||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_('Failed to create network'))
|
LOG.exception(_LE('Failed to create network'))
|
||||||
self._dvs.delete_port_group(dvs_id)
|
self._dvs.delete_port_group(dvs_id)
|
||||||
|
|
||||||
new_net[pnet.NETWORK_TYPE] = net_data.get(pnet.NETWORK_TYPE)
|
new_net[pnet.NETWORK_TYPE] = net_data.get(pnet.NETWORK_TYPE)
|
||||||
@ -164,7 +164,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
try:
|
try:
|
||||||
self._dvs.delete_port_group(dvs_id)
|
self._dvs.delete_port_group(dvs_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_('Unable to delete DVS port group %s'), id)
|
LOG.exception(_LE('Unable to delete DVS port group %s'), id)
|
||||||
self.handle_network_dhcp_access(context, id, action='delete_network')
|
self.handle_network_dhcp_access(context, id, action='delete_network')
|
||||||
|
|
||||||
def delete_network(self, context, id):
|
def delete_network(self, context, id):
|
||||||
@ -232,8 +232,8 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
# remove ATTR_NOT_SPECIFIED
|
# remove ATTR_NOT_SPECIFIED
|
||||||
port_data[addr_pair.ADDRESS_PAIRS] = []
|
port_data[addr_pair.ADDRESS_PAIRS] = []
|
||||||
|
|
||||||
LOG.debug(_("create_port completed on NSX for tenant "
|
LOG.debug("create_port completed on NSX for tenant "
|
||||||
"%(tenant_id)s: (%(id)s)"), port_data)
|
"%(tenant_id)s: (%(id)s)", port_data)
|
||||||
|
|
||||||
self._process_portbindings_create_and_update(context,
|
self._process_portbindings_create_and_update(context,
|
||||||
port['port'],
|
port['port'],
|
||||||
@ -289,7 +289,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
self._process_port_port_security_update(
|
self._process_port_port_security_update(
|
||||||
context, port['port'], ret_port)
|
context, port['port'], ret_port)
|
||||||
|
|
||||||
LOG.debug(_("Updating port: %s"), port)
|
LOG.debug("Updating port: %s", port)
|
||||||
self._process_portbindings_create_and_update(context,
|
self._process_portbindings_create_and_update(context,
|
||||||
port['port'],
|
port['port'],
|
||||||
ret_port)
|
ret_port)
|
||||||
|
@ -13,11 +13,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
import stevedore
|
import stevedore
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
|
from neutron.i18n import _LE, _LI
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
|
||||||
|
|
||||||
@ -32,14 +33,14 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager):
|
|||||||
# Mapping from type name to DriverManager
|
# Mapping from type name to DriverManager
|
||||||
self.drivers = {}
|
self.drivers = {}
|
||||||
|
|
||||||
LOG.info(_("Configured router type driver names: %s"),
|
LOG.info(_LI("Configured router type driver names: %s"),
|
||||||
ROUTER_TYPE_DRIVERS)
|
ROUTER_TYPE_DRIVERS)
|
||||||
super(RouterTypeManager, self).__init__(
|
super(RouterTypeManager, self).__init__(
|
||||||
'vmware_nsx.neutron.nsxv.router_type_drivers',
|
'vmware_nsx.neutron.nsxv.router_type_drivers',
|
||||||
ROUTER_TYPE_DRIVERS,
|
ROUTER_TYPE_DRIVERS,
|
||||||
invoke_on_load=True,
|
invoke_on_load=True,
|
||||||
invoke_args=(plugin,))
|
invoke_args=(plugin,))
|
||||||
LOG.info(_("Loaded type driver names: %s"), self.names())
|
LOG.info(_LI("Loaded type driver names: %s"), self.names())
|
||||||
self._register_types()
|
self._register_types()
|
||||||
self._check_tenant_router_types(cfg.CONF.nsxv.tenant_router_types)
|
self._check_tenant_router_types(cfg.CONF.nsxv.tenant_router_types)
|
||||||
|
|
||||||
@ -47,15 +48,15 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager):
|
|||||||
for ext in self:
|
for ext in self:
|
||||||
router_type = ext.obj.get_type()
|
router_type = ext.obj.get_type()
|
||||||
if router_type in self.drivers:
|
if router_type in self.drivers:
|
||||||
LOG.error(_("Type driver '%(new_driver)s' ignored because "
|
LOG.error(_LE("Type driver '%(new_driver)s' ignored because "
|
||||||
"type driver '%(old_driver)s' is already "
|
"type driver '%(old_driver)s' is already "
|
||||||
"registered for type '%(type)s'"),
|
"registered for type '%(type)s'"),
|
||||||
{'new_driver': ext.name,
|
{'new_driver': ext.name,
|
||||||
'old_driver': self.drivers[router_type].name,
|
'old_driver': self.drivers[router_type].name,
|
||||||
'type': router_type})
|
'type': router_type})
|
||||||
else:
|
else:
|
||||||
self.drivers[router_type] = ext
|
self.drivers[router_type] = ext
|
||||||
LOG.info(_("Registered types: %s"), self.drivers.keys())
|
LOG.info(_LI("Registered types: %s"), self.drivers.keys())
|
||||||
|
|
||||||
def _check_tenant_router_types(self, types):
|
def _check_tenant_router_types(self, types):
|
||||||
self.tenant_router_types = []
|
self.tenant_router_types = []
|
||||||
@ -67,7 +68,7 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager):
|
|||||||
"Service terminated!") % router_type
|
"Service terminated!") % router_type
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise SystemExit(msg)
|
raise SystemExit(msg)
|
||||||
LOG.info(_("Tenant router_types: %s"), self.tenant_router_types)
|
LOG.info(_LI("Tenant router_types: %s"), self.tenant_router_types)
|
||||||
|
|
||||||
def get_tenant_router_driver(self, context, router_type):
|
def get_tenant_router_driver(self, context, router_type):
|
||||||
driver = self.drivers.get(router_type)
|
driver = self.drivers.get(router_type)
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
from sqlalchemy.orm import exc as sa_exc
|
from sqlalchemy.orm import exc as sa_exc
|
||||||
|
|
||||||
from neutron.api import extensions as neutron_extensions
|
from neutron.api import extensions as neutron_extensions
|
||||||
@ -46,13 +46,12 @@ from neutron.extensions import portbindings as pbin
|
|||||||
from neutron.extensions import portsecurity as psec
|
from neutron.extensions import portsecurity as psec
|
||||||
from neutron.extensions import providernet as pnet
|
from neutron.extensions import providernet as pnet
|
||||||
from neutron.extensions import securitygroup as ext_sg
|
from neutron.extensions import securitygroup as ext_sg
|
||||||
from neutron.i18n import _LE, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.vmware.extensions import (
|
from neutron.plugins.vmware.extensions import (
|
||||||
advancedserviceproviders as as_providers)
|
advancedserviceproviders as as_providers)
|
||||||
from neutron.plugins.vmware.extensions import (
|
from neutron.plugins.vmware.extensions import (
|
||||||
vnicindex as ext_vnic_idx)
|
vnicindex as ext_vnic_idx)
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins import vmware
|
from vmware_nsx.neutron.plugins import vmware
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
@ -457,8 +456,8 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
try:
|
try:
|
||||||
h, c = self.nsx_v.vcns.add_member_to_security_group(
|
h, c = self.nsx_v.vcns.add_member_to_security_group(
|
||||||
sg_id, vnic_id)
|
sg_id, vnic_id)
|
||||||
LOG.info(_("Added %s(sg_id)s member to NSX security "
|
LOG.info(_LI("Added %s(sg_id)s member to NSX security "
|
||||||
"group %(vnic_id)s"),
|
"group %(vnic_id)s"),
|
||||||
{'sg_id': sg_id, 'vnic_id': vnic_id})
|
{'sg_id': sg_id, 'vnic_id': vnic_id})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug("NSX security group %(sg_id)s member add "
|
LOG.debug("NSX security group %(sg_id)s member add "
|
||||||
@ -693,7 +692,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
self._delete_dhcp_edge_service(context, id)
|
self._delete_dhcp_edge_service(context, id)
|
||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_('Failed to delete network'))
|
LOG.exception(_LE('Failed to delete network'))
|
||||||
|
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
self._process_l3_delete(context, id)
|
self._process_l3_delete(context, id)
|
||||||
@ -752,10 +751,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
original_network[psec.PORTSECURITY] !=
|
original_network[psec.PORTSECURITY] !=
|
||||||
net_attrs[psec.PORTSECURITY])
|
net_attrs[psec.PORTSECURITY])
|
||||||
if psec_update and not net_attrs[psec.PORTSECURITY]:
|
if psec_update and not net_attrs[psec.PORTSECURITY]:
|
||||||
LOG.warning(_("Disabling port-security on network %s would "
|
LOG.warning(_LW("Disabling port-security on network %s would "
|
||||||
"require instance in the network to have VM tools "
|
"require instance in the network to have VM tools "
|
||||||
"installed in order for security-groups to "
|
"installed in order for security-groups to "
|
||||||
"function properly."))
|
"function properly."))
|
||||||
|
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
net_res = super(NsxVPluginV2, self).update_network(context, id,
|
net_res = super(NsxVPluginV2, self).update_network(context, id,
|
||||||
@ -848,10 +847,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
self._update_vnic_assigned_addresses(
|
self._update_vnic_assigned_addresses(
|
||||||
context.session, original_port, vnic_id)
|
context.session, original_port, vnic_id)
|
||||||
else:
|
else:
|
||||||
LOG.warning(_("port-security is disabled on port %(id)s, "
|
LOG.warning(_LW("port-security is disabled on port %(id)s, "
|
||||||
"VM tools must be installed on instance "
|
"VM tools must be installed on instance "
|
||||||
"%(device_id)s for security-groups to function "
|
"%(device_id)s for security-groups to "
|
||||||
"properly "),
|
"function properly."),
|
||||||
{'id': id,
|
{'id': id,
|
||||||
'device_id': original_port['device_id']})
|
'device_id': original_port['device_id']})
|
||||||
|
|
||||||
@ -921,10 +920,11 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
self._update_vnic_assigned_addresses(
|
self._update_vnic_assigned_addresses(
|
||||||
context.session, ret_port, vnic_id)
|
context.session, ret_port, vnic_id)
|
||||||
if not has_port_security and has_security_groups:
|
if not has_port_security and has_security_groups:
|
||||||
LOG.warning(_("port-security is disabled on port %(id)s, "
|
LOG.warning(_LW("port-security is disabled on "
|
||||||
"VM tools must be installed on instance "
|
"port %(id)s, "
|
||||||
"%(device_id)s for security-groups to "
|
"VM tools must be installed on instance "
|
||||||
"function properly "),
|
"%(device_id)s for security-groups to "
|
||||||
|
"function properly "),
|
||||||
{'id': id,
|
{'id': id,
|
||||||
'device_id': original_port['device_id']})
|
'device_id': original_port['device_id']})
|
||||||
if delete_security_groups or has_security_groups:
|
if delete_security_groups or has_security_groups:
|
||||||
@ -1846,7 +1846,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
try:
|
try:
|
||||||
self.nsx_v.vcns.edges_lock_operation()
|
self.nsx_v.vcns.edges_lock_operation()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.info(_("Unable to set manager lock operation"))
|
LOG.info(_LI("Unable to set manager lock operation"))
|
||||||
|
|
||||||
def _validate_config(self):
|
def _validate_config(self):
|
||||||
if not self.nsx_v.vcns.validate_dvs(cfg.CONF.nsxv.dvs_id):
|
if not self.nsx_v.vcns.validate_dvs(cfg.CONF.nsxv.dvs_id):
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
|
|
||||||
|
@ -12,14 +12,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron import context as neutron_context
|
from neutron import context as neutron_context
|
||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
|
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
|
||||||
from vmware_nsx.neutron.plugins.vmware.plugins import nsx_v
|
from vmware_nsx.neutron.plugins.vmware.plugins import nsx_v
|
||||||
|
@ -19,14 +19,15 @@ import hmac
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.db import exception as db_exc
|
from oslo_db import exception as db_exc
|
||||||
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron import context as neutron_context
|
from neutron import context as neutron_context
|
||||||
from oslo_log import log as logging
|
from neutron.i18n import _LE
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsxv_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsxv_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
||||||
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
|
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
|
||||||
@ -155,8 +156,8 @@ class NsxVMetadataProxyHandler:
|
|||||||
if internal_net:
|
if internal_net:
|
||||||
self.nsxv_plugin.delete_network(self.context, internal_net)
|
self.nsxv_plugin.delete_network(self.context, internal_net)
|
||||||
|
|
||||||
LOG.exception(_("Exception %s while creating internal network "
|
LOG.exception(_LE("Exception %s while creating internal "
|
||||||
"for metadata service"), e)
|
"network for metadata service"), e)
|
||||||
|
|
||||||
# Update the new network_id in DB
|
# Update the new network_id in DB
|
||||||
nsxv_db.update_nsxv_internal_network(
|
nsxv_db.update_nsxv_internal_network(
|
||||||
@ -307,8 +308,8 @@ class NsxVMetadataProxyHandler:
|
|||||||
|
|
||||||
if rtr_id:
|
if rtr_id:
|
||||||
self.nsxv_plugin.delete_router(self.context, rtr_id)
|
self.nsxv_plugin.delete_router(self.context, rtr_id)
|
||||||
LOG.exception(_("Exception %s while creating internal edge "
|
LOG.exception(_LE("Exception %s while creating internal edge "
|
||||||
"for metadata service"), e)
|
"for metadata service"), e)
|
||||||
|
|
||||||
def _get_address_groups(self, context, network_id, device_id, is_proxy):
|
def _get_address_groups(self, context, network_id, device_id, is_proxy):
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from oslo.serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions
|
from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.i18n import _LE, _LI, _LW
|
from neutron.i18n import _LE, _LI, _LW
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
||||||
@ -497,7 +497,7 @@ class EdgeApplianceDriver(object):
|
|||||||
header = self.vcns.deploy_edge(edge,
|
header = self.vcns.deploy_edge(edge,
|
||||||
async=False)[0]
|
async=False)[0]
|
||||||
edge_id = header['location'].split('/')[-1]
|
edge_id = header['location'].split('/')[-1]
|
||||||
LOG.debug(_("VCNS: deploying edge %s"), edge_id)
|
LOG.debug("VCNS: deploying edge %s", edge_id)
|
||||||
|
|
||||||
self.callbacks.edge_deploy_started_sync(
|
self.callbacks.edge_deploy_started_sync(
|
||||||
jobdata['context'], edge_id, name,
|
jobdata['context'], edge_id, name,
|
||||||
@ -512,7 +512,7 @@ class EdgeApplianceDriver(object):
|
|||||||
jobdata['context'], edge_id, name, jobdata['router_id'],
|
jobdata['context'], edge_id, name, jobdata['router_id'],
|
||||||
dist, False)
|
dist, False)
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(_("NSXv: deploy edge failed."))
|
LOG.exception(_LE("NSXv: deploy edge failed."))
|
||||||
|
|
||||||
def update_edge(self, router_id, edge_id, name, internal_network,
|
def update_edge(self, router_id, edge_id, name, internal_network,
|
||||||
jobdata=None, dist=False, loadbalancer_enable=True,
|
jobdata=None, dist=False, loadbalancer_enable=True,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.db import db_base_plugin_v2
|
from neutron.db import db_base_plugin_v2
|
||||||
from neutron.i18n import _, _LE
|
from neutron.i18n import _, _LE
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.i18n import _LE, _LW
|
from neutron.i18n import _LE, _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from neutron.i18n import _LE
|
from neutron.i18n import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.utils import excutils
|
|
||||||
from oslo_concurrency import lockutils
|
from oslo_concurrency import lockutils
|
||||||
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import excutils
|
||||||
from sqlalchemy.orm import exc as sa_exc
|
from sqlalchemy.orm import exc as sa_exc
|
||||||
|
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
@ -702,9 +702,9 @@ class EdgeManager(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
_('Failed to delete vnic %(vnic_index)d '
|
_LE('Failed to delete vnic %(vnic_index)d '
|
||||||
'tunnel %(tunnel_index)d on edge '
|
'tunnel %(tunnel_index)d on edge '
|
||||||
'%(edge_id)s'),
|
'%(edge_id)s'),
|
||||||
{'vnic_index': old_vnic_index,
|
{'vnic_index': old_vnic_index,
|
||||||
'tunnel_index': old_tunnel_index,
|
'tunnel_index': old_tunnel_index,
|
||||||
'edge_id': edge_id})
|
'edge_id': edge_id})
|
||||||
@ -1361,8 +1361,8 @@ def delete_interface(nsxv_manager, context, router_id, network_id,
|
|||||||
edge_vnic_binding = nsxv_db.get_edge_vnic_binding(
|
edge_vnic_binding = nsxv_db.get_edge_vnic_binding(
|
||||||
context.session, edge_id, network_id)
|
context.session, edge_id, network_id)
|
||||||
if not edge_vnic_binding:
|
if not edge_vnic_binding:
|
||||||
LOG.warning(_("Failed to find the network %(net_id)s "
|
LOG.warning(_LW("Failed to find the network %(net_id)s "
|
||||||
"corresponding vnic index on edge %(edge_id)s"),
|
"corresponding vnic index on edge %(edge_id)s"),
|
||||||
{'net_id': network_id,
|
{'net_id': network_id,
|
||||||
'edge_id': edge_id})
|
'edge_id': edge_id})
|
||||||
|
|
||||||
@ -1429,8 +1429,8 @@ def check_network_in_use_at_backend(context, network_id):
|
|||||||
context.session, network_id)
|
context.session, network_id)
|
||||||
if not edge_vnic_bindings:
|
if not edge_vnic_bindings:
|
||||||
return
|
return
|
||||||
LOG.warning(_('NSXv: network is still in use at the backend'))
|
LOG.warning(_LW('NSXv: network is still in use at the backend'))
|
||||||
LOG.error(_('NSXv: network is still in use at the backend'))
|
LOG.error(_LE('NSXv: network is still in use at the backend'))
|
||||||
|
|
||||||
|
|
||||||
class NsxVCallbacks(object):
|
class NsxVCallbacks(object):
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from oslo.serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.vshield import vcns
|
from vmware_nsx.neutron.plugins.vmware.vshield import vcns
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
import retrying
|
import retrying
|
||||||
import xml.etree.ElementTree as et
|
import xml.etree.ElementTree as et
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
|
||||||
cfg.CONF.use_stderr = False
|
cfg.CONF.use_stderr = False
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.openstack.common import uuidutils
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
|
from neutron.openstack.common import uuidutils
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from oslo.db import exception as d_exc
|
from oslo_db import exception as d_exc
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_config import cfg
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
from neutron.common import test_lib
|
from neutron.common import test_lib
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from webob import exc
|
from webob import exc
|
||||||
import webtest
|
import webtest
|
||||||
|
|
||||||
@ -33,7 +33,6 @@ from neutron.tests.unit import test_api_v2
|
|||||||
from neutron.tests.unit import test_db_plugin
|
from neutron.tests.unit import test_db_plugin
|
||||||
from neutron.tests.unit import test_extensions
|
from neutron.tests.unit import test_extensions
|
||||||
from neutron.tests.unit import testlib_plugin
|
from neutron.tests.unit import testlib_plugin
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.dbexts import networkgw_db
|
from vmware_nsx.neutron.plugins.vmware.dbexts import networkgw_db
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from neutron.extensions import multiprovidernet as mpnet
|
from neutron.extensions import multiprovidernet as mpnet
|
||||||
|
@ -16,13 +16,12 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.plugins.vmware.extensions import qos as ext_qos
|
from neutron.plugins.vmware.extensions import qos as ext_qos
|
||||||
from neutron.tests.unit import test_extensions
|
from neutron.tests.unit import test_extensions
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.dbexts import qos_db
|
from vmware_nsx.neutron.plugins.vmware.dbexts import qos_db
|
||||||
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
||||||
from vmware_nsx.neutron.tests.unit import vmware
|
from vmware_nsx.neutron.tests.unit import vmware
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.db import exception as d_exc
|
from oslo_db import exception as d_exc
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron import context as neutron_context
|
from neutron import context as neutron_context
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from vmware_nsx.neutron.plugins.vmware.vshield import nsxv_loadbalancer
|
from vmware_nsx.neutron.plugins.vmware.vshield import nsxv_loadbalancer
|
||||||
@ -79,7 +78,7 @@ class NsxvLoadbalancerTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
def test_get_edge_loadbalancer(self):
|
def test_get_edge_loadbalancer(self):
|
||||||
h = None
|
h = None
|
||||||
v = json.loads(self.EDGE_OBJ_JSON)
|
v = jsonutils.loads(self.EDGE_OBJ_JSON)
|
||||||
|
|
||||||
with mock.patch.object(self._vcns, 'do_request',
|
with mock.patch.object(self._vcns, 'do_request',
|
||||||
return_value=(h, v)) as mock_do_request:
|
return_value=(h, v)) as mock_do_request:
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from neutron.tests.unit import test_api_v2
|
from oslo_serialization import jsonutils
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
|
|
||||||
|
from neutron.tests.unit import test_api_v2
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import utils as nsx_utils
|
from vmware_nsx.neutron.plugins.vmware.common import utils as nsx_utils
|
||||||
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import test_lib
|
from neutron.common import test_lib
|
||||||
|
@ -14,12 +14,13 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import constants as n_consts
|
from neutron.common import constants as n_consts
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from neutron.tests.unit import testlib_api
|
from neutron.tests.unit import testlib_api
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception
|
from vmware_nsx.neutron.plugins.vmware.api_client import exception
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import exceptions as exp
|
from neutron.common import exceptions as exp
|
||||||
from neutron import context
|
from neutron import context
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.vmware import api
|
from oslo_vmware import api
|
||||||
|
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils
|
from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
import fixtures
|
import fixtures
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import client
|
from vmware_nsx.neutron.plugins.vmware.api_client import client
|
||||||
from vmware_nsx.neutron.plugins.vmware.api_client import version
|
from vmware_nsx.neutron.plugins.vmware.api_client import version
|
||||||
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
||||||
|
@ -18,8 +18,8 @@ import uuid
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.db import exception as db_exc
|
from oslo_db import exception as db_exc
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from sqlalchemy import exc as sql_exc
|
from sqlalchemy import exc as sql_exc
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
@ -18,9 +18,9 @@ import contextlib
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
@ -443,12 +443,10 @@ class TestPortsV2(NsxVPluginV2TestCase,
|
|||||||
instance with existing port.
|
instance with existing port.
|
||||||
"""
|
"""
|
||||||
with self.port() as port:
|
with self.port() as port:
|
||||||
with mock.patch(PLUGIN_NAME + '._create_dhcp_static_binding') as (
|
with mock.patch(PLUGIN_NAME + '._create_dhcp_static_binding'):
|
||||||
_create_dhcp_static_binding_mock):
|
|
||||||
update = {'port': {'device_owner'}}
|
update = {'port': {'device_owner'}}
|
||||||
self.new_update_request('ports',
|
self.new_update_request('ports',
|
||||||
update, port['port']['id'])
|
update, port['port']['id'])
|
||||||
_create_dhcp_static_binding_mock.assert_called_once()
|
|
||||||
|
|
||||||
def test_create_port_public_network_with_ip(self):
|
def test_create_port_public_network_with_ip(self):
|
||||||
with self.network(shared=True) as network:
|
with self.network(shared=True) as network:
|
||||||
@ -1307,15 +1305,13 @@ class TestExclusiveRouterTestCase(L3NatTest,
|
|||||||
p1_id = p1['port']['id']
|
p1_id = p1['port']['id']
|
||||||
p2_id = p2['port']['id']
|
p2_id = p2['port']['id']
|
||||||
with self.floatingip_with_assoc(port_id=p1_id) as fip:
|
with self.floatingip_with_assoc(port_id=p1_id) as fip:
|
||||||
with self._mock_edge_router_update_with_exception() as (
|
with self._mock_edge_router_update_with_exception():
|
||||||
update_edge):
|
|
||||||
self.assertRaises(object,
|
self.assertRaises(object,
|
||||||
p.update_floatingip,
|
p.update_floatingip,
|
||||||
context.get_admin_context(),
|
context.get_admin_context(),
|
||||||
fip['floatingip']['id'],
|
fip['floatingip']['id'],
|
||||||
floatingip={'floatingip':
|
floatingip={'floatingip':
|
||||||
{'port_id': p2_id}})
|
{'port_id': p2_id}})
|
||||||
update_edge.assert_called_once()
|
|
||||||
res = self._list(
|
res = self._list(
|
||||||
'floatingips', query_params="port_id=%s" % p1_id)
|
'floatingips', query_params="port_id=%s" % p1_id)
|
||||||
self.assertEqual(len(res['floatingips']), 1)
|
self.assertEqual(len(res['floatingips']), 1)
|
||||||
@ -1345,13 +1341,11 @@ class TestExclusiveRouterTestCase(L3NatTest,
|
|||||||
'floating_network_id': public_network_id,
|
'floating_network_id': public_network_id,
|
||||||
'port_id': port_id}}
|
'port_id': port_id}}
|
||||||
|
|
||||||
with self._mock_edge_router_update_with_exception() as (
|
with self._mock_edge_router_update_with_exception():
|
||||||
update_edge):
|
|
||||||
self.assertRaises(object,
|
self.assertRaises(object,
|
||||||
p.create_floatingip,
|
p.create_floatingip,
|
||||||
context.get_admin_context(),
|
context.get_admin_context(),
|
||||||
floatingip=floatingip)
|
floatingip=floatingip)
|
||||||
update_edge.assert_called_once()
|
|
||||||
res = self._list(
|
res = self._list(
|
||||||
'floatingips', query_params="port_id=%s" % port_id)
|
'floatingips', query_params="port_id=%s" % port_id)
|
||||||
self.assertEqual(len(res['floatingips']), 0)
|
self.assertEqual(len(res['floatingips']), 0)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from oslo.serialization import jsonutils as json
|
from oslo_serialization import jsonutils
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
@ -100,7 +100,7 @@ class FakeVcns(object):
|
|||||||
'moduleName': 'vShield Edge',
|
'moduleName': 'vShield Edge',
|
||||||
'errorData': None
|
'errorData': None
|
||||||
}
|
}
|
||||||
return (header, json.dumps(response))
|
return (header, jsonutils.dumps(response))
|
||||||
|
|
||||||
self._job_idx = self._job_idx + 1
|
self._job_idx = self._job_idx + 1
|
||||||
job_id = "jobdata-%d" % self._job_idx
|
job_id = "jobdata-%d" % self._job_idx
|
||||||
@ -382,7 +382,8 @@ class FakeVcns(object):
|
|||||||
# The lswitch is created via VCNS API so the fake nsx_api will not
|
# The lswitch is created via VCNS API so the fake nsx_api will not
|
||||||
# see it. Added to fake nsx_api here.
|
# see it. Added to fake nsx_api here.
|
||||||
if self._fake_nsx_api:
|
if self._fake_nsx_api:
|
||||||
lswitch = self._fake_nsx_api._add_lswitch(json.dumps(lsconfig))
|
lswitch = self._fake_nsx_api._add_lswitch(
|
||||||
|
jsonutils.dumps(lsconfig))
|
||||||
else:
|
else:
|
||||||
lswitch = lsconfig
|
lswitch = lsconfig
|
||||||
lswitch['uuid'] = uuidutils.generate_uuid()
|
lswitch['uuid'] = uuidutils.generate_uuid()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron import context
|
from neutron import context
|
||||||
|
Loading…
Reference in New Issue
Block a user