This is an automated email from the ASF dual-hosted git repository.

pearl11594 pushed a commit to branch nsx-integration
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/nsx-integration by this push:
     new 33a29dce036 add route advertisement
33a29dce036 is described below

commit 33a29dce036da702f04039d003864bc70e40b33e
Author: Pearl Dsilva <pearl1...@gmail.com>
AuthorDate: Mon Sep 25 12:09:14 2023 -0400

    add route advertisement
---
 .../main/java/org/apache/cloudstack/resource/NsxResource.java  |  3 +++
 .../java/org/apache/cloudstack/utils/NsxApiClientUtils.java    | 10 ++++++++++
 .../java/com/cloud/configuration/ConfigurationManagerImpl.java | 10 +++++-----
 ui/src/views/infra/zone/ZoneWizardLaunchZone.vue               |  2 +-
 ui/src/views/infra/zone/ZoneWizardNetworkSetupStep.vue         |  2 +-
 5 files changed, 20 insertions(+), 7 deletions(-)

diff --git 
a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/resource/NsxResource.java
 
b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/resource/NsxResource.java
index 65192d00cef..f918b3f0e9f 100644
--- 
a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/resource/NsxResource.java
+++ 
b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/resource/NsxResource.java
@@ -63,6 +63,8 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import static java.util.Objects.isNull;
+import static 
org.apache.cloudstack.utils.NsxApiClientUtils.RouteAdvertisementType.TIER1_CONNECTED;
+import static 
org.apache.cloudstack.utils.NsxApiClientUtils.RouteAdvertisementType.TIER1_IPSEC_LOCAL_ENDPOINT;
 import static 
org.apache.cloudstack.utils.NsxApiClientUtils.HAMode.ACTIVE_STANDBY;
 import static 
org.apache.cloudstack.utils.NsxApiClientUtils.FailoverMode.PREEMPTIVE;
 import static 
org.apache.cloudstack.utils.NsxApiClientUtils.PoolAllocation.ROUTING;
@@ -253,6 +255,7 @@ public class NsxResource implements ServerResource {
                 .setPoolAllocation(ROUTING.name())
                 .setHaMode(ACTIVE_STANDBY.name())
                 .setFailoverMode(PREEMPTIVE.name())
+                .setRouteAdvertisementTypes(List.of(TIER1_CONNECTED.name(), 
TIER1_IPSEC_LOCAL_ENDPOINT.name()))
                 .setId(name)
                 .setDisplayName(name)
 //                .setChildren(
diff --git 
a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxApiClientUtils.java
 
b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxApiClientUtils.java
index 4a05122e91a..26aad6ad635 100644
--- 
a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxApiClientUtils.java
+++ 
b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxApiClientUtils.java
@@ -64,6 +64,16 @@ public class NsxApiClientUtils {
         OVERLAY,
         VLAN
     }
+
+    public enum  RouteAdvertisementType {
+        TIER1_STATIC_ROUTES,
+        TIER1_CONNECTED,
+        TIER1_NAT,
+        TIER1_LB_VIP,
+        TIER1_LB_SNAT,
+        TIER1_DNS_FORWARDER_IP,
+        TIER1_IPSEC_LOCAL_ENDPOINT
+    }
     public static ApiClient createApiClient(String hostname, String port, 
String username, char[] password) {
         String controllerUrl = String.format("https://%s:%s";, hostname, port);
         HttpConfiguration.SslConfiguration.Builder sslConfigBuilder = new 
HttpConfiguration.SslConfiguration.Builder();
diff --git 
a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java 
b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index c249c7081b0..5e0fd8d4196 100644
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2531,14 +2531,14 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
                 }
                 // we should actually find the mapping and remove if it exists
                 // but we don't know about vmware/plugin/hypervisors at this 
point
-                NsxProviderVO nsxProvider = 
nsxProviderDao.findByZoneId(zoneId);
-                if (Objects.nonNull(nsxProvider)) {
-                    nsxProviderDao.remove(nsxProvider.getId());
-                }
-
                 final boolean success = _zoneDao.remove(zoneId);
 
                 if (success) {
+                    NsxProviderVO nsxProvider = 
nsxProviderDao.findByZoneId(zoneId);
+                    if (Objects.nonNull(nsxProvider)) {
+                        nsxProviderDao.remove(nsxProvider.getId());
+                    }
+
                     // delete template refs for this zone
                     templateZoneDao.deleteByZoneId(zoneId);
                     // delete all capacity records for the zone
diff --git a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue 
b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
index 60a237d404a..5f0f2d385f9 100644
--- a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
+++ b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
@@ -1062,7 +1062,7 @@ export default {
       try {
         if (!this.stepData.stepMove.includes('addNsxController')) {
           const providerParams = {}
-          providerParams.name = this.prefillContent?.name || ''
+          providerParams.name = this.prefillContent?.nsxName || ''
           providerParams.nsxproviderhostname = 
this.prefillContent?.nsxHostname || ''
           providerParams.nsxproviderport = this.prefillContent?.nsxPort || ''
           providerParams.username = this.prefillContent?.username || ''
diff --git a/ui/src/views/infra/zone/ZoneWizardNetworkSetupStep.vue 
b/ui/src/views/infra/zone/ZoneWizardNetworkSetupStep.vue
index 465241276af..6c7ea3eba08 100644
--- a/ui/src/views/infra/zone/ZoneWizardNetworkSetupStep.vue
+++ b/ui/src/views/infra/zone/ZoneWizardNetworkSetupStep.vue
@@ -381,7 +381,7 @@ export default {
       const fields = [
         {
           title: 'label.nsx.provider.name',
-          key: 'name',
+          key: 'nsxName',
           placeHolder: 'message.installwizard.tooltip.nsx.provider.name',
           required: true
         },

Reply via email to