Allow NSX plugins to work without VPNaaS
When neutron VPNaaS is not configured, the NSX plugins should come up and work even if the neutron-vpnaas code is not installed. This patch moves a constant the plugin needs to a file without neutron_vpnaas imports so that the plugin doesn't have to import it. Change-Id: I4c0893128fe8fd9c4797531bdb31d6407d18f034
This commit is contained in:
parent
f7318af8a0
commit
3eb130a2b4
|
@ -116,7 +116,7 @@ from vmware_nsx.services.lbaas.nsx_v3 import lb_driver_v2
|
||||||
from vmware_nsx.services.qos.common import utils as qos_com_utils
|
from vmware_nsx.services.qos.common import utils as qos_com_utils
|
||||||
from vmware_nsx.services.qos.nsx_v3 import driver as qos_driver
|
from vmware_nsx.services.qos.nsx_v3 import driver as qos_driver
|
||||||
from vmware_nsx.services.trunk.nsx_v3 import driver as trunk_driver
|
from vmware_nsx.services.trunk.nsx_v3 import driver as trunk_driver
|
||||||
from vmware_nsx.services.vpnaas.nsxv3 import ipsec_driver
|
from vmware_nsx.services.vpnaas.nsxv3 import ipsec_utils
|
||||||
from vmware_nsxlib.v3 import core_resources as nsx_resources
|
from vmware_nsxlib.v3 import core_resources as nsx_resources
|
||||||
from vmware_nsxlib.v3 import exceptions as nsx_lib_exc
|
from vmware_nsxlib.v3 import exceptions as nsx_lib_exc
|
||||||
from vmware_nsxlib.v3 import nsx_constants as nsxlib_consts
|
from vmware_nsxlib.v3 import nsx_constants as nsxlib_consts
|
||||||
|
@ -2384,7 +2384,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||||
raise n_exc.InvalidInput(error_message=err_msg)
|
raise n_exc.InvalidInput(error_message=err_msg)
|
||||||
|
|
||||||
def _assert_on_vpn_port_change(self, port_data):
|
def _assert_on_vpn_port_change(self, port_data):
|
||||||
if port_data['device_owner'] == ipsec_driver.VPN_PORT_OWNER:
|
if port_data['device_owner'] == ipsec_utils.VPN_PORT_OWNER:
|
||||||
msg = _('Can not update/delete VPNaaS port %s') % port_data['id']
|
msg = _('Can not update/delete VPNaaS port %s') % port_data['id']
|
||||||
raise n_exc.InvalidInput(error_message=msg)
|
raise n_exc.InvalidInput(error_message=msg)
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ from vmware_nsxlib.v3 import vpn_ipsec
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
IPSEC = 'ipsec'
|
IPSEC = 'ipsec'
|
||||||
VPN_PORT_OWNER = 'vpnservice'
|
|
||||||
|
|
||||||
|
|
||||||
class RouterWithSNAT(nexception.BadRequest):
|
class RouterWithSNAT(nexception.BadRequest):
|
||||||
|
@ -379,7 +378,7 @@ class NSXv3IPsecVpnDriver(service_drivers.VpnDriver):
|
||||||
def _find_vpn_service_port(self, context, router_id):
|
def _find_vpn_service_port(self, context, router_id):
|
||||||
"""Look for the neutron port created for the vpnservice of a router"""
|
"""Look for the neutron port created for the vpnservice of a router"""
|
||||||
filters = {'device_id': ['router-' + router_id],
|
filters = {'device_id': ['router-' + router_id],
|
||||||
'device_owner': [VPN_PORT_OWNER]}
|
'device_owner': [ipsec_utils.VPN_PORT_OWNER]}
|
||||||
ports = self.l3_plugin.get_ports(context, filters=filters)
|
ports = self.l3_plugin.get_ports(context, filters=filters)
|
||||||
if ports:
|
if ports:
|
||||||
return ports[0]
|
return ports[0]
|
||||||
|
@ -731,7 +730,7 @@ class NSXv3IPsecVpnDriver(service_drivers.VpnDriver):
|
||||||
'name': 'VPN local address port',
|
'name': 'VPN local address port',
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'device_id': 'router-' + vpnservice.router['id'],
|
'device_id': 'router-' + vpnservice.router['id'],
|
||||||
'device_owner': VPN_PORT_OWNER,
|
'device_owner': ipsec_utils.VPN_PORT_OWNER,
|
||||||
'fixed_ips': constants.ATTR_NOT_SPECIFIED,
|
'fixed_ips': constants.ATTR_NOT_SPECIFIED,
|
||||||
'mac_address': constants.ATTR_NOT_SPECIFIED,
|
'mac_address': constants.ATTR_NOT_SPECIFIED,
|
||||||
'port_security_enabled': False,
|
'port_security_enabled': False,
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
from vmware_nsxlib.v3 import vpn_ipsec
|
from vmware_nsxlib.v3 import vpn_ipsec
|
||||||
|
|
||||||
|
VPN_PORT_OWNER = 'vpnservice'
|
||||||
|
|
||||||
ENCRYPTION_ALGORITHM_MAP = {
|
ENCRYPTION_ALGORITHM_MAP = {
|
||||||
'aes-128': vpn_ipsec.EncryptionAlgorithmTypes.ENCRYPTION_ALGORITHM_128,
|
'aes-128': vpn_ipsec.EncryptionAlgorithmTypes.ENCRYPTION_ALGORITHM_128,
|
||||||
'aes-256': vpn_ipsec.EncryptionAlgorithmTypes.ENCRYPTION_ALGORITHM_256,
|
'aes-256': vpn_ipsec.EncryptionAlgorithmTypes.ENCRYPTION_ALGORITHM_256,
|
||||||
|
|
Loading…
Reference in New Issue