You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2023/10/24 17:01:55 UTC
[cloudstack] branch nsx-static-nat created (now 07a031d1c8c)
This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a change to branch nsx-static-nat
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
at 07a031d1c8c fix issues with static nat
This branch includes the following new commits:
new 07a031d1c8c fix issues with static nat
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[cloudstack] 01/01: fix issues with static nat
Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a commit to branch nsx-static-nat
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit 07a031d1c8c356a8c64127b0172142835730b42f
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Tue Oct 24 13:01:43 2023 -0400
fix issues with static nat
---
api/src/main/java/com/cloud/offering/NetworkOffering.java | 2 +-
.../nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java | 2 --
.../src/main/java/org/apache/cloudstack/service/NsxServiceImpl.java | 4 ++--
.../src/main/java/org/apache/cloudstack/utils/NsxControllerUtils.java | 2 +-
server/src/main/java/com/cloud/server/ConfigurationServerImpl.java | 3 ++-
5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/api/src/main/java/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java
index 6a68ab1246a..17338e9bd29 100644
--- a/api/src/main/java/com/cloud/offering/NetworkOffering.java
+++ b/api/src/main/java/com/cloud/offering/NetworkOffering.java
@@ -58,7 +58,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
public static final String DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE = "DefaultTungstenSharedNetworkOfferingWithSGService";
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
- public static final String DEFAULT_ROUTER_NSX_OFFERING = "DefaultRouteNSXNetworkOffering";
+ public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
public final static String QuickCloudNoServices = "QuickCloudNoServices";
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
index b1a555140fd..1004b49d72c 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java
@@ -26,13 +26,11 @@ import com.vmware.nsx_policy.infra.Sites;
import com.vmware.nsx_policy.infra.Tier1s;
import com.vmware.nsx_policy.infra.sites.EnforcementPoints;
import com.vmware.nsx_policy.infra.tier_0s.LocaleServices;
-import com.vmware.nsx_policy.infra.tier_1s.Nat;
import com.vmware.nsx_policy.infra.tier_1s.nat.NatRules;
import com.vmware.nsx_policy.model.ApiError;
import com.vmware.nsx_policy.model.DhcpRelayConfig;
import com.vmware.nsx_policy.model.EnforcementPointListResult;
import com.vmware.nsx_policy.model.LocaleServicesListResult;
-import com.vmware.nsx_policy.model.PolicyNat;
import com.vmware.nsx_policy.model.PolicyNatRule;
import com.vmware.nsx_policy.model.Segment;
import com.vmware.nsx_policy.model.SegmentSubnet;
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxServiceImpl.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxServiceImpl.java
index df667890f8c..82957e48970 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxServiceImpl.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxServiceImpl.java
@@ -63,7 +63,7 @@ public class NsxServiceImpl implements NsxService {
return result.getResult();
}
- public boolean createStaticNatRule(long zoneId, long accountId, long domainId, long vpcId,
+ public boolean createStaticNatRule(long zoneId, long domainId, long accountId, long vpcId,
long vmId, String publicIp, String vmIp) {
VpcVO vpc = vpcDao.findById(vpcId);
if (Objects.isNull(vpc)) {
@@ -75,7 +75,7 @@ public class NsxServiceImpl implements NsxService {
return result.getResult();
}
- public boolean deleteStaticNatRule(long zoneId, long accountId, long domainId, long vpcId) {
+ public boolean deleteStaticNatRule(long zoneId, long domainId, long accountId, long vpcId) {
VpcVO vpc = vpcDao.findById(vpcId);
if (Objects.isNull(vpc)) {
throw new CloudRuntimeException(String.format("Failed to find VPC with id: %s", vpcId));
diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxControllerUtils.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxControllerUtils.java
index 6ed428d6a49..0d5a9aedf1b 100644
--- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxControllerUtils.java
+++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxControllerUtils.java
@@ -76,7 +76,7 @@ public class NsxControllerUtils {
return String.format("D%s-A%s-Z%s-V%s-S%s-%s", domainId, accountId, zoneId, vpcId, networkId, suffix);
}
- public static String getStaticNatRuleName(long zoneId, long domainId, long accountId, Long vpcId) {
+ public static String getStaticNatRuleName(long domainId, long accountId, long zoneId, Long vpcId) {
String suffix = "-STATICNAT";
return getTier1GatewayName(domainId, accountId, zoneId, vpcId) + suffix;
}
diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
index f7ada1fccf1..3ee97e7812c 100644
--- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
@@ -1003,6 +1003,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
defaultNSXNetworkOfferingProviders.put(Service.Dhcp, Provider.VPCVirtualRouter);
defaultNSXNetworkOfferingProviders.put(Service.Dns, Provider.VPCVirtualRouter );
defaultNSXNetworkOfferingProviders.put(Service.SourceNat, Provider.Nsx);
+ defaultNSXNetworkOfferingProviders.put(Service.StaticNat, Provider.Nsx);
defaultNSXNetworkOfferingProviders.put(Service.UserData, Provider.VPCVirtualRouter);
final Map<Network.Service, Network.Provider> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
@@ -1224,7 +1225,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
// Offering #10 - network offering for nsx provider - ROUTED mode
NetworkOfferingVO defaultRouteNSXNetworkOffering =
- new NetworkOfferingVO(NetworkOffering.DEFAULT_NAT_NSX_OFFERING, "Offering for NSX enabled networks - NAT mode",
+ new NetworkOfferingVO(NetworkOffering.DEFAULT_ROUTED_NSX_OFFERING, "Offering for NSX enabled networks - Route mode",
TrafficType.Guest, false, false, null, null, true, Availability.Optional, null, GuestType.Isolated, false, false, false, false, false, true);
defaultRouteNSXNetworkOffering.setForNsx(true);
defaultRouteNSXNetworkOffering.setNsxMode(NetworkOffering.NsxMode.ROUTED.name());