Merge "NSX|P: Set ipsec endpoints advertisment"
This commit is contained in:
commit
732ba2a2c8
@ -194,6 +194,7 @@ class NSXpIPsecVpnDriver(common_driver.NSXcommonIPsecVpnDriver):
|
|||||||
services = self.vpn_plugin.get_vpnservices(
|
services = self.vpn_plugin.get_vpnservices(
|
||||||
context.elevated(), filters=filters)
|
context.elevated(), filters=filters)
|
||||||
rule_name_pref = 'VPN advertisement service'
|
rule_name_pref = 'VPN advertisement service'
|
||||||
|
has_connections = False
|
||||||
for srv in services:
|
for srv in services:
|
||||||
# use only services with non-errored connections
|
# use only services with non-errored connections
|
||||||
filters = {'vpnservice_id': [srv['id']],
|
filters = {'vpnservice_id': [srv['id']],
|
||||||
@ -202,6 +203,7 @@ class NSXpIPsecVpnDriver(common_driver.NSXcommonIPsecVpnDriver):
|
|||||||
context.elevated(), filters=filters)
|
context.elevated(), filters=filters)
|
||||||
if not connections:
|
if not connections:
|
||||||
continue
|
continue
|
||||||
|
has_connections = True
|
||||||
if srv['subnet_id']:
|
if srv['subnet_id']:
|
||||||
subnet = self.l3_plugin.get_subnet(
|
subnet = self.l3_plugin.get_subnet(
|
||||||
context.elevated(), srv['subnet_id'])
|
context.elevated(), srv['subnet_id'])
|
||||||
@ -223,6 +225,10 @@ class NSXpIPsecVpnDriver(common_driver.NSXcommonIPsecVpnDriver):
|
|||||||
self._nsxpolicy.tier1.update_advertisement_rules(
|
self._nsxpolicy.tier1.update_advertisement_rules(
|
||||||
router_id, rules, name_prefix=rule_name_pref)
|
router_id, rules, name_prefix=rule_name_pref)
|
||||||
|
|
||||||
|
# Also update the ipsec endpoints advertisement
|
||||||
|
self._nsxpolicy.tier1.update_route_advertisement(
|
||||||
|
router_id, ipsec_endpoints=has_connections)
|
||||||
|
|
||||||
def _nsx_tags(self, context, object):
|
def _nsx_tags(self, context, object):
|
||||||
return self._nsxpolicy.build_v3_tags_payload(
|
return self._nsxpolicy.build_v3_tags_payload(
|
||||||
object, resource_type='os-vpn-connection-id',
|
object, resource_type='os-vpn-connection-id',
|
||||||
|
Loading…
Reference in New Issue
Block a user