Netris Network Plugin Integration with CloudStack (#10458)

The Netris Plugin introduces Netris as a network service provider in CloudStack to be able to create and manage Virtual Private Clouds (VPCs) in CloudStack, being able to orchestrate the following network functionalities:

- Network segmentation with Netris-VXLAN isolation method
- Routing between "public" IP and network segments with an ACS ROUTED mode offering
- SourceNAT, DNAT, 1:1 NAT between "public" IP and network segments with an ACS NATTED mode offering
- Routing between VPC network segments (tiers in ACS nomenclature)
- Access Lists (ACLs) between VPC tiers and "public" network (TCP, UDP, ICMP) both as global egress rules and "public" IP specific ingress rules.
- ACLs between VPC network tiers (TCP, UDP, ICMP)
- External load balancing – between VPC network tiers and "public" IP
- Internal load balancing – between VPC network tiers
- CloudStack Virtual Router services (DHCP, DNS, UserData, Password Injection, etc…)
This commit is contained in:
Pearl Dsilva 2025-07-25 05:56:42 -04:00 committed by GitHub
parent ae50103704
commit 0d4147f3f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
249 changed files with 14202 additions and 1259 deletions

View File

@ -47,7 +47,7 @@ public class FirewallRuleTO implements InternalIdentity {
int[] srcPortRange;
boolean revoked;
boolean alreadyAdded;
private List<String> sourceCidrList;
protected List<String> sourceCidrList;
private List<String> destCidrList;
FirewallRule.Purpose purpose;
private Integer icmpType;

View File

@ -21,8 +21,6 @@ import com.cloud.network.rules.PortForwardingRule;
import com.cloud.utils.net.NetUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* PortForwardingRuleTO specifies one port forwarding rule.
*
@ -32,8 +30,6 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
String dstIp;
int[] dstPortRange;
List<String> sourceCidrList;
protected PortForwardingRuleTO() {
super();
}

View File

@ -17,7 +17,11 @@
package com.cloud.configuration;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.cloud.network.Network;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.command.admin.config.ResetCfgCmd;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
import org.apache.cloudstack.api.command.admin.network.CreateGuestNetworkIpv6PrefixCmd;
@ -373,4 +377,16 @@ public interface ConfigurationService {
List<? extends PortableIp> listPortableIps(long id);
Boolean isAccountAllowedToCreateOfferingsWithTags(IsAccountAllowedToCreateOfferingsWithTagsCmd cmd);
public static final Map<String, String> ProviderDetailKeyMap = Map.of(
Network.Provider.Nsx.getName(), ApiConstants.NSX_DETAIL_KEY,
Network.Provider.Netris.getName(), ApiConstants.NETRIS_DETAIL_KEY
);
public static boolean IsIpRangeForProvider(Network.Provider provider) {
if (Objects.isNull(provider)) {
return false;
}
return ProviderDetailKeyMap.containsKey(provider.getName());
}
}

View File

@ -499,6 +499,8 @@ public class EventTypes {
public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN";
public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE";
public static final String EVENT_ZONE_VXLAN_ASSIGN = "ZONE.VXLAN.ASSIGN";
public static final String EVENT_ZONE_VXLAN_RELEASE = "ZONE.VXLAN.RELEASE";
// Projects
public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE";

View File

@ -99,4 +99,5 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
boolean isForSystemVms();
boolean isForRouter();
}

View File

@ -206,6 +206,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider Tungsten = new Provider("Tungsten", false);
public static final Provider Nsx = new Provider("Nsx", false);
public static final Provider Netris = new Provider("Netris", false);
private final String name;
private final boolean isExternal;

View File

@ -129,7 +129,8 @@ public class Networks {
UnDecided(null, null),
OpenDaylight("opendaylight", String.class),
TUNGSTEN("tf", String.class),
NSX("nsx", String.class);
NSX("nsx", String.class),
Netris("netris", String.class);
private final String scheme;
private final Class<?> type;

View File

@ -0,0 +1,358 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;
import java.util.List;
public class SDNProviderNetworkRule {
protected long domainId;
protected long accountId;
protected long zoneId;
protected Long networkResourceId;
protected String networkResourceName;
protected boolean isVpcResource;
protected long vmId;
protected long ruleId;
protected String publicIp;
protected String vmIp;
protected String publicPort;
protected String privatePort;
protected String protocol;
protected String algorithm;
protected List<String> sourceCidrList;
protected List<String> destinationCidrList;
protected Integer icmpCode;
protected Integer icmpType;
protected String trafficType;
protected Network.Service service;
public long getDomainId() {
return domainId;
}
public void setDomainId(long domainId) {
this.domainId = domainId;
}
public long getAccountId() {
return accountId;
}
public void setAccountId(long accountId) {
this.accountId = accountId;
}
public long getZoneId() {
return zoneId;
}
public void setZoneId(long zoneId) {
this.zoneId = zoneId;
}
public Long getNetworkResourceId() {
return networkResourceId;
}
public void setNetworkResourceId(Long networkResourceId) {
this.networkResourceId = networkResourceId;
}
public String getNetworkResourceName() {
return networkResourceName;
}
public void setNetworkResourceName(String networkResourceName) {
this.networkResourceName = networkResourceName;
}
public boolean isVpcResource() {
return isVpcResource;
}
public void setVpcResource(boolean vpcResource) {
isVpcResource = vpcResource;
}
public long getVmId() {
return vmId;
}
public void setVmId(long vmId) {
this.vmId = vmId;
}
public long getRuleId() {
return ruleId;
}
public void setRuleId(long ruleId) {
this.ruleId = ruleId;
}
public String getPublicIp() {
return publicIp;
}
public void setPublicIp(String publicIp) {
this.publicIp = publicIp;
}
public String getVmIp() {
return vmIp;
}
public void setVmIp(String vmIp) {
this.vmIp = vmIp;
}
public String getPublicPort() {
return publicPort;
}
public void setPublicPort(String publicPort) {
this.publicPort = publicPort;
}
public String getPrivatePort() {
return privatePort;
}
public void setPrivatePort(String privatePort) {
this.privatePort = privatePort;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public void setAlgorithm(String algorithm) {
this.algorithm = algorithm;
}
public String getAlgorithm() {
return algorithm;
}
public Network.Service getService() {
return service;
}
public void setService(Network.Service service) {
this.service = service;
}
public Integer getIcmpCode() {
return icmpCode;
}
public void setIcmpCode(Integer icmpCode) {
this.icmpCode = icmpCode;
}
public Integer getIcmpType() {
return icmpType;
}
public void setIcmpType(Integer icmpType) {
this.icmpType = icmpType;
}
public List<String> getSourceCidrList() {
return sourceCidrList;
}
public void setSourceCidrList(List<String> sourceCidrList) {
this.sourceCidrList = sourceCidrList;
}
public List<String> getDestinationCidrList() {
return destinationCidrList;
}
public void setDestinationCidrList(List<String> destinationCidrList) {
this.destinationCidrList = destinationCidrList;
}
public String getTrafficType() {
return trafficType;
}
public void setTrafficType(String trafficType) {
this.trafficType = trafficType;
}
public static class Builder {
public long domainId;
public long accountId;
public long zoneId;
public Long networkResourceId;
public String networkResourceName;
public boolean isVpcResource;
public long vmId;
public long ruleId;
public String publicIp;
public String vmIp;
public String publicPort;
public String privatePort;
public String protocol;
public String algorithm;
public List<String> sourceCidrList;
public List<String> destinationCidrList;
public String trafficType;
public Integer icmpType;
public Integer icmpCode;
public Network.Service service;
public Builder() {
// Default constructor
}
public Builder setDomainId(long domainId) {
this.domainId = domainId;
return this;
}
public Builder setAccountId(long accountId) {
this.accountId = accountId;
return this;
}
public Builder setZoneId(long zoneId) {
this.zoneId = zoneId;
return this;
}
public Builder setNetworkResourceId(Long networkResourceId) {
this.networkResourceId = networkResourceId;
return this;
}
public Builder setNetworkResourceName(String networkResourceName) {
this.networkResourceName = networkResourceName;
return this;
}
public Builder setVpcResource(boolean isVpcResource) {
this.isVpcResource = isVpcResource;
return this;
}
public Builder setVmId(long vmId) {
this.vmId = vmId;
return this;
}
public Builder setRuleId(long ruleId) {
this.ruleId = ruleId;
return this;
}
public Builder setPublicIp(String publicIp) {
this.publicIp = publicIp;
return this;
}
public Builder setVmIp(String vmIp) {
this.vmIp = vmIp;
return this;
}
public Builder setPublicPort(String publicPort) {
this.publicPort = publicPort;
return this;
}
public Builder setPrivatePort(String privatePort) {
this.privatePort = privatePort;
return this;
}
public Builder setProtocol(String protocol) {
this.protocol = protocol;
return this;
}
public Builder setAlgorithm(String algorithm) {
this.algorithm = algorithm;
return this;
}
public Builder setTrafficType(String trafficType) {
this.trafficType = trafficType;
return this;
}
public Builder setIcmpType(Integer icmpType) {
this.icmpType = icmpType;
return this;
}
public Builder setIcmpCode(Integer icmpCode) {
this.icmpCode = icmpCode;
return this;
}
public Builder setSourceCidrList(List<String> sourceCidrList) {
this.sourceCidrList = sourceCidrList;
return this;
}
public Builder setDestinationCidrList(List<String> destinationCidrList) {
this.destinationCidrList = destinationCidrList;
return this;
}
public Builder setService(Network.Service service) {
this.service = service;
return this;
}
public SDNProviderNetworkRule build() {
SDNProviderNetworkRule rule = new SDNProviderNetworkRule();
rule.setDomainId(this.domainId);
rule.setAccountId(this.accountId);
rule.setZoneId(this.zoneId);
rule.setNetworkResourceId(this.networkResourceId);
rule.setNetworkResourceName(this.networkResourceName);
rule.setVpcResource(this.isVpcResource);
rule.setVmId(this.vmId);
rule.setVmIp(this.vmIp);
rule.setPublicIp(this.publicIp);
rule.setPublicPort(this.publicPort);
rule.setPrivatePort(this.privatePort);
rule.setProtocol(this.protocol);
rule.setRuleId(this.ruleId);
rule.setAlgorithm(this.algorithm);
rule.setIcmpType(this.icmpType);
rule.setIcmpCode(this.icmpCode);
rule.setSourceCidrList(this.sourceCidrList);
rule.setDestinationCidrList(this.destinationCidrList);
rule.setTrafficType(this.trafficType);
rule.setService(service);
return rule;
}
}
}

View File

@ -24,7 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable {
enum State {
Pending, Connecting, Connected, Disconnected, Error,
Pending, Connecting, Connected, Disconnected, Error, Removed
}
@Override

View File

@ -23,6 +23,7 @@ import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
@ -87,6 +88,14 @@ public interface NetworkElement extends Adapter {
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException;
/**
* Release IP from the network provider if reserved
* @param ipAddress
*/
default boolean releaseIp(IpAddress ipAddress) {
return true;
}
/**
* The network is being shutdown.
* @param network

View File

@ -17,12 +17,40 @@
package com.cloud.network.element;
import java.util.List;
import java.util.Objects;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.vpc.NetworkACLItem;
public interface PortForwardingServiceProvider extends NetworkElement, IpDeployingRequester {
static String getPublicPortRange(PortForwardingRule rule) {
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
String.valueOf(rule.getSourcePortStart()) :
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
}
static String getPrivatePFPortRange(PortForwardingRule rule) {
return rule.getDestinationPortStart() == rule.getDestinationPortEnd() ?
String.valueOf(rule.getDestinationPortStart()) :
String.valueOf(rule.getDestinationPortStart()).concat("-").concat(String.valueOf(rule.getDestinationPortEnd()));
}
static String getPrivatePortRange(FirewallRule rule) {
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
String.valueOf(rule.getSourcePortStart()) :
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
}
static String getPrivatePortRangeForACLRule(NetworkACLItem rule) {
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
String.valueOf(rule.getSourcePortStart()) :
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
}
/**
* Apply rules
* @param network

View File

@ -55,4 +55,8 @@ public interface VpcProvider extends NetworkElement {
boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
default boolean updateVpc(Vpc vpc, String previousVpcName) {
return true;
}
}

View File

@ -215,4 +215,8 @@ public interface NetworkGuru extends Adapter {
default boolean isSlaacV6Only() {
return true;
}
default boolean update(Network network, String prevNetworkName) {
return true;
}
}

View File

@ -0,0 +1,41 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.netris;
public class NetrisLbBackend {
private long vmId;
private String vmIp;
private int port;
public NetrisLbBackend(long vmId, String vmIp, int port) {
this.vmId = vmId;
this.vmIp = vmIp;
this.port = port;
}
public long getVmId() {
return vmId;
}
public String getVmIp() {
return vmIp;
}
public int getPort() {
return port;
}
}

View File

@ -0,0 +1,108 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.netris;
import com.cloud.network.SDNProviderNetworkRule;
import java.util.List;
public class NetrisNetworkRule {
public enum NetrisRuleAction {
PERMIT, DENY
}
private SDNProviderNetworkRule baseRule;
private NetrisRuleAction aclAction;
private List<NetrisLbBackend> lbBackends;
private String lbRuleName;
private String lbCidrList;
private String reason;
public NetrisNetworkRule(Builder builder) {
this.baseRule = builder.baseRule;
this.aclAction = builder.aclAction;
this.lbBackends = builder.lbBackends;
this.reason = builder.reason;
this.lbCidrList = builder.lbCidrList;
this.lbRuleName = builder.lbRuleName;
}
public NetrisRuleAction getAclAction() {
return aclAction;
}
public List<NetrisLbBackend> getLbBackends() {
return lbBackends;
}
public String getReason() {
return reason;
}
public String getLbCidrList() {return lbCidrList; }
public String getLbRuleName() { return lbRuleName; }
public SDNProviderNetworkRule getBaseRule() {
return baseRule;
}
// Builder class extending the parent builder
public static class Builder {
private SDNProviderNetworkRule baseRule;
private NetrisRuleAction aclAction;
private List<NetrisLbBackend> lbBackends;
private String reason;
private String lbCidrList;
private String lbRuleName;
public Builder baseRule(SDNProviderNetworkRule baseRule) {
this.baseRule = baseRule;
return this;
}
public Builder aclAction(NetrisRuleAction aclAction) {
this.aclAction = aclAction;
return this;
}
public Builder lbBackends(List<NetrisLbBackend> lbBackends) {
this.lbBackends = lbBackends;
return this;
}
public Builder reason(String reason) {
this.reason = reason;
return this;
}
public Builder lbCidrList(String lbCidrList) {
this.lbCidrList = lbCidrList;
return this;
}
public Builder lbRuleName(String lbRuleName) {
this.lbRuleName = lbRuleName;
return this;
}
public NetrisNetworkRule build() {
return new NetrisNetworkRule(this);
}
}
}

View File

@ -0,0 +1,30 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.netris;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface NetrisProvider extends InternalIdentity, Identity {
long getZoneId();
String getName();
String getUrl();
String getUsername();
String getSiteName();
String getTenantName();
String getNetrisTag();
}

View File

@ -0,0 +1,310 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.netris;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.SDNProviderNetworkRule;
import com.cloud.network.vpc.StaticRoute;
import com.cloud.network.vpc.Vpc;
import java.util.List;
/**
* Interface for Netris Services that provides methods to manage VPCs, networks,
* NAT rules, network rules, and static routes in an SDN (Software Defined Networking) environment.
*/
public interface NetrisService {
/**
* Creates IPAM (IP Address Management) allocations for zone-level public ranges.
*
* @param zoneId the ID of the zone
* @return true if the operation is successful, false otherwise
*/
boolean createIPAMAllocationsForZoneLevelPublicRanges(long zoneId);
/**
* Creates a VPC (Virtual Private Cloud) resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcId the ID of the VPC
* @param vpcName the name of the VPC
* @param sourceNatEnabled true if source NAT is enabled
* @param cidr the CIDR of the VPC
* @param isVpcNetwork true if it is a VPC network
* @return true if the operation is successful, false otherwise
*/
boolean createVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled, String cidr, boolean isVpcNetwork);
/**
* Updates an existing VPC resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcId the ID of the VPC
* @param vpcName the new name of the VPC
* @param previousVpcName the previous name of the VPC
* @return true if the operation is successful, false otherwise
*/
boolean updateVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, String previousVpcName);
/**
* Deletes a VPC resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpc the VPC to delete
* @return true if the operation is successful, false otherwise
*/
boolean deleteVpcResource(long zoneId, long accountId, long domainId, Vpc vpc);
/**
* Creates a virtual network (vNet) resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the name of the network
* @param networkId the ID of the network
* @param cidr the CIDR of the network
* @param globalRouting true if global routing is enabled
* @return true if the operation is successful, false otherwise
*/
boolean createVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr, Boolean globalRouting);
/**
* Updates an existing vNet resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the new name of the network
* @param networkId the ID of the network
* @param prevNetworkName the previous name of the network
* @return true if the operation is successful, false otherwise
*/
boolean updateVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String prevNetworkName);
/**
* Deletes an existing vNet resource.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the name of the network
* @param networkId the ID of the network
* @param cidr the CIDR of the network
* @return true if the operation is successful, false otherwise
*/
boolean deleteVnetResource(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr);
/**
* Creates a source NAT rule for a VPC or network.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the name of the network
* @param networkId the ID of the network
* @param isForVpc true if the rule applies to a VPC
* @param vpcCidr the VPC CIDR
* @param sourceNatIp the source NAT IP
* @return true if the operation is successful, false otherwise
*/
boolean createSnatRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, long networkId, boolean isForVpc, String vpcCidr, String sourceNatIp);
/**
* Creates a port forwarding rule for a VPC or network.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the name of the network
* @param networkId the ID of the network
* @param isForVpc true if the rule applies to a VPC
* @param vpcCidr the VPC CIDR
* @param networkRule the network rule to forward
* @return true if the operation is successful, false otherwise
*/
boolean createPortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
/**
* Deletes a port forwarding rule for a VPC or network.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param vpcName the name of the VPC
* @param vpcId the ID of the VPC
* @param networkName the name of the network
* @param networkId the ID of the network
* @param isForVpc true if the rule applies to a VPC
* @param vpcCidr the VPC CIDR
* @param networkRule the network rule to remove
* @return true if the operation is successful, false otherwise
*/
boolean deletePortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
/**
* Updates the source NAT IP for a specified VPC.
*
* @param vpc the VPC to updates
* @param address the new source NAT IP address
* @return true if the operation is successful, false otherwise
*/
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
/**
* Creates a static NAT rule for a specific VM.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param networkResourceName the name of the network resource
* @param networkResourceId the ID of the network resource
* @param isForVpc true if the rule applies to a VPC
* @param vpcCidr the VPC CIDR
* @param staticNatIp the static NAT IP
* @param vmIp the VM's IP address
* @param vmId the ID of the VM
* @return true if the operation is successful, false otherwise
*/
boolean createStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String vpcCidr, String staticNatIp, String vmIp, long vmId);
/**
* Deletes a static NAT rule for a specific VM.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param networkResourceName the name of the network resource
* @param networkResourceId the ID of the network resource
* @param isForVpc true if the rule applies to a VPC
* @param staticNatIp the static NAT IP
* @param vmId the ID of the VM
* @return true if the operation is successful, false otherwise
*/
boolean deleteStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String staticNatIp, long vmId);
/**
* Adds firewall rules to a specific network.
*
* @param network the target network
* @param firewallRules the list of firewall rules to add
* @return true if the operation is successful, false otherwise
*/
boolean addFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
/**
* Deletes firewall rules from a specific network.
*
* @param network the target network
* @param firewallRules the list of firewall rules to delete
* @return true if the operation is successful, false otherwise
*/
boolean deleteFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
/**
* Adds or updates a static route for a specific network or VPC.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param networkResourceName the name of the network resource
* @param networkResourceId the ID of the network resource
* @param isForVpc true if it is for a VPC
* @param prefix the IP prefix of the route
* @param nextHop the next hop address
* @param routeId the ID of the route
* @param updateRoute true if the route should be updated
* @return true if the operation is successful, false otherwise
*/
boolean addOrUpdateStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId, boolean updateRoute);
/**
* Deletes a specific static route for a network or VPC.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param networkResourceName the name of the network resource
* @param networkResourceId the ID of the network resource
* @param isForVpc true if it is for a VPC
* @param prefix the IP prefix of the route
* @param nextHop the next hop address
* @param routeId the ID of the route
* @return true if the operation is successful, false otherwise
*/
boolean deleteStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
/**
* Lists static routes for a specific network or VPC.
*
* @param zoneId the ID of the zone
* @param accountId the ID of the account
* @param domainId the ID of the domain
* @param networkResourceName the name of the network resource
* @param networkResourceId the ID of the network resource
* @param isForVpc true if it is for a VPC
* @param prefix the IP prefix of the route
* @param nextHop the next hop address
* @param routeId the ID of the route
* @return a list of static routes
*/
List<StaticRoute> listStaticRoutes(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
/**
* Releases a NAT IP address.
*
* @param zoneId the ID of the zone
* @param publicIp the public NAT IP to release
* @return true if the operation is successful, false otherwise
*/
boolean releaseNatIp(long zoneId, String publicIp);
/**
* Creates or updates a load balancer (LB) rule.
*
* @param rule the network rule for the load balancer
* @return true if the operation is successful, false otherwise
*/
boolean createOrUpdateLbRule(NetrisNetworkRule rule);
/**
* Deletes a load balancer (LB) rule.
*
* @param rule the network rule to delete
* @return true if the operation is successful, false otherwise
*/
boolean deleteLbRule(NetrisNetworkRule rule);
}

View File

@ -25,6 +25,7 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
Staged, // route been created but has never got through network rule conflict detection. Routes in this state can not be sent to VPC virtual router.
Add, // Add means the route has been created and has gone through network rule conflict detection.
Active, // Route has been sent to the VPC router and reported to be active.
Update,
Revoke, // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database.
Deleting // rule has been revoked and is scheduled for deletion
}
@ -32,7 +33,9 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
/**
* @return
*/
long getVpcGatewayId();
Long getVpcGatewayId();
String getNextHop();
/**
* @return

View File

@ -23,7 +23,8 @@ public class StaticRouteProfile implements StaticRoute {
private String targetCidr;
private long accountId;
private long domainId;
private long gatewayId;
private Long gatewayId;
private String nextHop;
private StaticRoute.State state;
private long vpcId;
String vlanTag;
@ -46,6 +47,18 @@ public class StaticRouteProfile implements StaticRoute {
ipAddress = gateway.getIp4Address();
}
public StaticRouteProfile(StaticRoute staticRoute) {
id = staticRoute.getId();
uuid = staticRoute.getUuid();
targetCidr = staticRoute.getCidr();
accountId = staticRoute.getAccountId();
domainId = staticRoute.getDomainId();
gatewayId = staticRoute.getVpcGatewayId();
state = staticRoute.getState();
vpcId = staticRoute.getVpcId();
gateway = staticRoute.getNextHop();
}
@Override
public long getAccountId() {
return accountId;
@ -57,10 +70,15 @@ public class StaticRouteProfile implements StaticRoute {
}
@Override
public long getVpcGatewayId() {
public Long getVpcGatewayId() {
return gatewayId;
}
@Override
public String getNextHop() {
return nextHop;
}
@Override
public String getCidr() {
return targetCidr;

View File

@ -32,6 +32,8 @@ public interface VpcOffering extends InternalIdentity, Identity {
public static final String redundantVPCOfferingName = "Redundant VPC offering";
public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode";
public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode";
public static final String DEFAULT_VPC_ROUTE_NETRIS_OFFERING_NAME = "VPC offering with Netris - Route Mode";
public static final String DEFAULT_VPC_NAT_NETRIS_OFFERING_NAME = "VPC offering with Netris - NAT Mode";
/**
*
@ -56,8 +58,6 @@ public interface VpcOffering extends InternalIdentity, Identity {
*/
boolean isDefault();
boolean isForNsx();
NetworkOffering.NetworkMode getNetworkMode();
/**

View File

@ -37,7 +37,7 @@ public interface VpcProvisioningService {
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
Map<String, List<String>> serviceProviders,
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
Long serviceOfferingId, Boolean forNsx, NetworkOffering.NetworkMode networkMode,
Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode,
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state,
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);

View File

@ -238,7 +238,7 @@ public interface VpcService {
* @param cidr
* @return
*/
StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException;
StaticRoute createStaticRoute(Long gatewayId, Long vpcId, String nextHop, String cidr) throws NetworkRuleConflictException;
/**
* Lists static routes based on parameters passed to the call

View File

@ -64,6 +64,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC = "DefaultNATNSXNetworkOfferingForVpc";
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC_WITH_ILB = "DefaultNATNSXNetworkOfferingForVpcWithInternalLB";
public static final String DEFAULT_ROUTED_NSX_OFFERING_FOR_VPC = "DefaultRoutedNSXNetworkOfferingForVpc";
public static final String DEFAULT_ROUTED_NETRIS_OFFERING_FOR_VPC = "DefaultRoutedNetrisNetworkOfferingForVpc";
public static final String DEFAULT_NAT_NETRIS_OFFERING_FOR_VPC = "DefaultNATNetrisNetworkOfferingForVpc";
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
public final static String QuickCloudNoServices = "QuickCloudNoServices";
@ -102,10 +104,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean isForVpc();
boolean isForTungsten();
boolean isForNsx();
NetworkMode getNetworkMode();
TrafficType getTrafficType();

View File

@ -227,6 +227,7 @@ public class ApiConstants {
public static final String FORMAT = "format";
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
public static final String FOR_SYSTEM_VMS = "forsystemvms";
public static final String FOR_PROVIDER = "forprovider";
public static final String FULL_PATH = "fullpath";
public static final String GATEWAY = "gateway";
public static final String IP6_GATEWAY = "ip6gateway";
@ -271,6 +272,7 @@ public class ApiConstants {
public static final String PREVIOUS_OWNER_ID = "previousownerid";
public static final String PREVIOUS_OWNER_NAME = "previousownername";
public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
public static final String NEXT_HOP = "nexthop";
public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash";
public static final String IMAGE_PATH = "imagepath";
public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported";
@ -352,6 +354,8 @@ public class ApiConstants {
public static final String MIN_CPU_NUMBER = "mincpunumber";
public static final String MIN_MEMORY = "minmemory";
public static final String MIGRATION_TYPE = "migrationtype";
public static final String MIGRATION_JOB_ID = "migrationjobid";
public static final String MIGRATION_JOB_STATUS = "migrationjobstatus";
public static final String MIGRATIONS = "migrations";
public static final String MEMORY = "memory";
public static final String MODE = "mode";
@ -488,6 +492,7 @@ public class ApiConstants {
public static final String SIGNATURE = "signature";
public static final String SIGNATURE_VERSION = "signatureversion";
public static final String SINCE = "since";
public static final String SITE_NAME = "sitename";
public static final String SIZE = "size";
public static final String SIZEGB = "sizegb";
public static final String SNAPSHOT = "snapshot";
@ -536,6 +541,7 @@ public class ApiConstants {
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
public static final String TIMEZONEOFFSET = "timezoneoffset";
public static final String TENANT_NAME = "tenantname";
public static final String TOTAL = "total";
public static final String TOTAL_SUBNETS = "totalsubnets";
public static final String TYPE = "type";
@ -912,6 +918,8 @@ public class ApiConstants {
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
public static final String VPC_NAME = "vpcname";
public static final String VPC_GATEWAY_ID = "vpcgatewayid";
public static final String VPC_GATEWAY_IP = "vpcgatewayip";
public static final String GATEWAY_ID = "gatewayid";
public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
public static final String RESOURCE_IDS = "resourceids";
@ -1207,6 +1215,9 @@ public class ApiConstants {
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
public static final String HAS_RULES = "hasrules";
public static final String NSX_DETAIL_KEY = "forNsx";
public static final String NETRIS_DETAIL_KEY = "forNetris";
public static final String NETRIS_TAG = "netristag";
public static final String NETRIS_VXLAN_ID = "netrisvxlanid";
public static final String DISK_PATH = "diskpath";
public static final String IMPORT_SOURCE = "importsource";
public static final String TEMP_PATH = "temppath";

View File

@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.admin.network;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@ -140,12 +141,19 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
description = "true if network offering is meant to be used for VPC, false otherwise.")
private Boolean forVpc;
@Deprecated
@Parameter(name = ApiConstants.FOR_NSX,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for NSX, false otherwise.",
since = "4.20.0")
private Boolean forNsx;
@Parameter(name = ApiConstants.PROVIDER,
type = CommandType.STRING,
description = "Name of the provider providing the service",
since = "4.21.0")
private String provider;
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
type = CommandType.BOOLEAN,
description = "true if network offering for NSX network offering supports Load balancer service.",
@ -257,18 +265,38 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return serviceOfferingId;
}
public boolean isExternalNetworkProvider() {
return Arrays.asList("NSX", "Netris").stream()
.anyMatch(s -> provider != null && s.equalsIgnoreCase(provider));
}
public boolean isForNsx() {
return provider != null && provider.equalsIgnoreCase("NSX");
}
public boolean isForNetris() {
return provider != null && provider.equalsIgnoreCase("Netris");
}
public String getProvider() {
return provider;
}
public List<String> getSupportedServices() {
if (!isForNsx()) {
if (!isExternalNetworkProvider()) {
return supportedServices == null ? new ArrayList<String>() : supportedServices;
} else {
List<String> services = new ArrayList<>(List.of(
Dhcp.getName(),
Dns.getName(),
StaticNat.getName(),
SourceNat.getName(),
PortForwarding.getName(),
UserData.getName()
));
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
services.addAll(Arrays.asList(
StaticNat.getName(),
SourceNat.getName(),
PortForwarding.getName()));
}
if (getNsxSupportsLbService()) {
services.add(Lb.getName());
}
@ -308,10 +336,6 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return forVpc;
}
public boolean isForNsx() {
return BooleanUtils.isTrue(forNsx);
}
public String getNetworkMode() {
return networkMode;
}
@ -345,7 +369,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = new HashMap<>();
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) {
Collection servicesCollection = serviceProviderList.values();
Iterator iter = servicesCollection.iterator();
while (iter.hasNext()) {
@ -361,17 +385,16 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
} else if (Boolean.TRUE.equals(forNsx)) {
getServiceProviderMapForNsx(serviceProviderMap);
} else if (isExternalNetworkProvider()) {
getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName());
}
return serviceProviderMap;
}
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
private void getServiceProviderMapForExternalProvider(Map<String, List<String>> serviceProviderMap, String provider) {
String routerProvider = Boolean.TRUE.equals(getForVpc()) ? VirtualRouterProvider.Type.VPCVirtualRouter.name() :
VirtualRouterProvider.Type.VirtualRouter.name();
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "SecurityGroup", "Connectivity",
"Gateway", "BaremetalPxeService"));
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "Gateway", "SecurityGroup", "Connectivity", "BaremetalPxeService"));
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
List<String> allServices = Service.listAllServices().stream().map(Service::getName).collect(Collectors.toList());
if (routerProvider.equals(VirtualRouterProvider.Type.VPCVirtualRouter.name())) {
@ -384,8 +407,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
continue;
if (routerSupported.contains(service))
serviceProviderMap.put(service, List.of(routerProvider));
else
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) || NetworkACL.getName().equalsIgnoreCase(service)) {
serviceProviderMap.put(service, List.of(provider));
}
if (!getNsxSupportsLbService()) {
serviceProviderMap.remove(Lb.getName());
}

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vlan;
import com.cloud.configuration.ConfigurationService;
import com.cloud.network.Network;
import com.cloud.utils.net.NetUtils;
import org.apache.cloudstack.api.APICommand;
@ -39,7 +41,6 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import java.util.Objects;
@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@ -114,8 +115,8 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not")
private Boolean forSystemVms;
@Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if the IP range is used for NSX resource", since = "4.20.0")
private boolean forNsx;
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "Provider name for which the IP range is reserved for", since = "4.21.0")
private String provider;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -157,12 +158,12 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
return startIp;
}
public boolean isForNsx() {
return !Objects.isNull(forNsx) && forNsx;
public Network.Provider getProvider() {
return Network.Provider.getProvider(provider);
}
public String getVlan() {
if ((vlan == null || vlan.isEmpty()) && !isForNsx()) {
if ((vlan == null || vlan.isEmpty()) && !ConfigurationService.IsIpRangeForProvider(getProvider())) {
vlan = "untagged";
}
return vlan;

View File

@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.admin.vpc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@ -25,10 +26,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.offering.NetworkOffering;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.collections.CollectionUtils;
@ -57,6 +60,7 @@ import static com.cloud.network.Network.Service.SourceNat;
import static com.cloud.network.Network.Service.PortForwarding;
import static com.cloud.network.Network.Service.NetworkACL;
import static com.cloud.network.Network.Service.UserData;
import static com.cloud.network.Network.Service.Gateway;
@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@ -112,12 +116,19 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
since = "4.13")
private List<Long> zoneIds;
@Deprecated
@Parameter(name = ApiConstants.FOR_NSX,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for NSX, false otherwise.",
since = "4.20.0")
private Boolean forNsx;
@Parameter(name = ApiConstants.PROVIDER,
type = CommandType.STRING,
description = "Name of the provider providing the service",
since = "4.21.0")
private String provider;
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
type = CommandType.BOOLEAN,
description = "true if network offering for NSX VPC offering supports Load balancer service.",
@ -158,20 +169,31 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
return StringUtils.isEmpty(displayText) ? vpcOfferingName : displayText;
}
public boolean isExternalNetworkProvider() {
return Arrays.asList("NSX", "Netris").stream()
.anyMatch(s -> provider != null && s.equalsIgnoreCase(provider));
}
public List<String> getSupportedServices() {
if (!isForNsx() && CollectionUtils.isEmpty(supportedServices)) {
if (!isExternalNetworkProvider() && CollectionUtils.isEmpty(supportedServices)) {
throw new InvalidParameterValueException("Supported services needs to be provided");
}
if (isForNsx()) {
if (isExternalNetworkProvider()) {
supportedServices = new ArrayList<>(List.of(
Dhcp.getName(),
Dns.getName(),
StaticNat.getName(),
SourceNat.getName(),
NetworkACL.getName(),
PortForwarding.getName(),
UserData.getName()
));
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
supportedServices.addAll(Arrays.asList(
StaticNat.getName(),
SourceNat.getName(),
PortForwarding.getName()));
}
if (NetworkOffering.NetworkMode.ROUTED.name().equalsIgnoreCase(getNetworkMode())) {
supportedServices.add(Gateway.getName());
}
if (getNsxSupportsLbService()) {
supportedServices.add(Lb.getName());
}
@ -179,8 +201,8 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
return supportedServices;
}
public boolean isForNsx() {
return BooleanUtils.isTrue(forNsx);
public String getProvider() {
return provider;
}
public String getNetworkMode() {
@ -193,7 +215,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = new HashMap<>();
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) {
Collection<? extends Map<String, String>> servicesCollection = serviceProviderList.values();
Iterator<? extends Map<String, String>> iter = servicesCollection.iterator();
while (iter.hasNext()) {
@ -213,16 +235,18 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
} else if (Boolean.TRUE.equals(forNsx)) {
getServiceProviderMapForNsx(serviceProviderMap);
} else if (isExternalNetworkProvider()) {
getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName());
}
return serviceProviderMap;
}
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
List<String> unsupportedServices = List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity",
"Gateway", "Firewall");
private void getServiceProviderMapForExternalProvider(Map<String, List<String>> serviceProviderMap, String provider) {
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity", "Firewall"));
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
unsupportedServices.add("Gateway");
}
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
List<String> allServices = Network.Service.listAllServices().stream().map(Network.Service::getName).collect(Collectors.toList());
for (String service : allServices) {
@ -230,8 +254,10 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
continue;
if (routerSupported.contains(service))
serviceProviderMap.put(service, List.of(VirtualRouterProvider.Type.VPCVirtualRouter.name()));
else
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) ||
Stream.of(NetworkACL.getName(), Gateway.getName()).anyMatch(s -> s.equalsIgnoreCase(service))) {
serviceProviderMap.put(service, List.of(provider));
}
}
if (!getNsxSupportsLbService()) {
serviceProviderMap.remove(Lb.getName());

View File

@ -108,6 +108,9 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if range is dedicated for system VMs", since = "4.20.0")
private Boolean forSystemVMs;
@Parameter(name = ApiConstants.FOR_PROVIDER, type = CommandType.BOOLEAN, description = "true if range is dedicated for external network provider", since = "4.21.0")
private Boolean forProvider;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -183,6 +186,10 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC
return BooleanUtils.isTrue(forSystemVMs);
}
public boolean isForProvider() {
return BooleanUtils.isTrue(forProvider);
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -27,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
@ -45,20 +46,40 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.GATEWAY_ID,
type = CommandType.UUID,
entityType = PrivateGatewayResponse.class,
required = true,
description = "the gateway id we are creating static route for")
description = "the gateway id we are creating static route for. Mutually exclusive with the nexthop parameter")
private Long gatewayId;
@Parameter(name = ApiConstants.VPC_ID,
type = CommandType.UUID,
entityType = VpcResponse.class,
description = "the vpc id for which the static route is created. This is required for nexthop parameter",
since = "4.21.0")
private Long vpcId;
@Parameter(name = ApiConstants.NEXT_HOP,
type = CommandType.STRING,
description = "the next hop of static route. Mutually exclusive with the gatewayid parameter",
since = "4.21.0")
private String nextHop;
@Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "static route cidr")
private String cidr;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public long getGatewayId() {
public Long getGatewayId() {
return gatewayId;
}
public Long getVpcId() {
return vpcId;
}
public String getNextHop() {
return nextHop;
}
public String getCidr() {
return cidr;
}
@ -69,7 +90,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
try {
StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr());
StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getVpcId(), getNextHop(), getCidr());
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException ex) {
@ -114,11 +135,8 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
@Override
public long getEntityOwnerId() {
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
if (gateway == null) {
throw new InvalidParameterValueException("Invalid gateway id is specified");
}
return _entityMgr.findById(Vpc.class, gateway.getVpcId()).getAccountId();
Long vpcId = getSyncObjId();
return _entityMgr.findById(Vpc.class, vpcId).getAccountId();
}
@Override
@ -128,11 +146,20 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
@Override
public Long getSyncObjId() {
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
if (gateway == null) {
throw new InvalidParameterValueException("Invalid id is specified for the gateway");
if (gatewayId != null) {
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
if (gateway == null) {
throw new InvalidParameterValueException("Invalid id is specified for the gateway");
}
return gateway.getVpcId();
} else if (vpcId != null) {
Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
if (vpc == null) {
throw new InvalidParameterValueException("Invalid vpc id is specified");
}
return vpc.getId();
}
return gateway.getVpcId();
throw new InvalidParameterValueException("One of vpcId or gatewayId must be specified");
}
@Override

View File

@ -28,6 +28,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.context.CallContext;
@ -44,9 +45,16 @@ public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd {
type = CommandType.UUID,
entityType = VpcResponse.class,
required = true,
description = "public ip address id of the vpn gateway")
description = "id of the vpc")
private Long vpcId;
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
type = CommandType.UUID,
entityType = IPAddressResponse.class,
description = "the public IP address ID for which VPN gateway is being enabled. By default the source NAT IP or router IP will be used.",
since = "4.21.0")
private Long ipAddressId;
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;
@ -58,6 +66,10 @@ public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd {
return vpcId;
}
public Long getIpAddressId() {
return ipAddressId;
}
@Deprecated
public Boolean getDisplay() {
return display;

View File

@ -55,10 +55,6 @@ public class AsyncJobResponse extends BaseResponse {
@Param(description = "the async command executed")
private String cmd;
@SerializedName("jobstatus")
@Param(description = "the current job status-should be 0 for PENDING")
private Integer jobStatus;
@SerializedName("jobprocstatus")
@Param(description = "the progress information of the PENDING job")
private Integer jobProcStatus;
@ -123,11 +119,6 @@ public class AsyncJobResponse extends BaseResponse {
this.cmd = cmd;
}
@Override
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}
public void setJobProcStatus(Integer jobProcStatus) {
this.jobProcStatus = jobProcStatus;
}

View File

@ -50,13 +50,13 @@ public class ClusterDrsPlanMigrationResponse extends BaseResponse {
@Param(description = "Destination host for VM migration")
String destHostName;
@SerializedName(ApiConstants.JOB_ID)
@SerializedName(ApiConstants.MIGRATION_JOB_ID)
@Param(description = "id of VM migration async job")
private Long jobId;
private Long migrationJobId;
@SerializedName(ApiConstants.JOB_STATUS)
@SerializedName(ApiConstants.MIGRATION_JOB_STATUS)
@Param(description = "Job status of VM migration async job")
private JobInfo.Status jobStatus;
private JobInfo.Status migrationJobStatus;
public ClusterDrsPlanMigrationResponse(String vmId, String vmName, String srcHostId, String srcHostName,
@ -68,8 +68,8 @@ public class ClusterDrsPlanMigrationResponse extends BaseResponse {
this.srcHostName = srcHostName;
this.destHostId = destHostId;
this.destHostName = destHostName;
this.jobId = jobId;
this.jobStatus = jobStatus;
this.migrationJobId = jobId;
this.migrationJobStatus = jobStatus;
this.setObjectName(ApiConstants.MIGRATIONS);
}
}

View File

@ -175,6 +175,10 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
@Param(description="true if range is dedicated for System VMs")
private boolean forSystemVms;
@SerializedName(ApiConstants.FOR_PROVIDER)
@Param(description="true if range is dedicated for external network providers", since = "4.21.0")
private boolean forProvider;
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
@ -332,4 +336,8 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
public void setForSystemVms(boolean forSystemVms) {
this.forSystemVms = forSystemVms;
}
public void setForProvider(boolean forProvider) {
this.forProvider = forProvider;
}
}

View File

@ -211,14 +211,6 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
@Param(description = "Name of the VPC to which this network belongs", since = "4.15")
private String vpcName;
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID)
@Param(description = "the ID of the Network associated with this network")
private String associatedNetworkId;
@SerializedName(ApiConstants.ASSOCIATED_NETWORK)
@Param(description = "the name of the Network associated with this network")
private String associatedNetworkName;
@SerializedName(ApiConstants.TUNGSTEN_VIRTUAL_ROUTER_UUID)
@Param(description = "Tungsten-Fabric virtual router the network belongs to")
private String tungstenVirtualRouterUuid;
@ -619,14 +611,6 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
this.vpcName = vpcName;
}
public void setAssociatedNetworkId(String associatedNetworkId) {
this.associatedNetworkId = associatedNetworkId;
}
public void setAssociatedNetworkName(String associatedNetworkName) {
this.associatedNetworkName = associatedNetworkName;
}
@Override
public void setResourceIconResponse(ResourceIconResponse icon) {
this.icon = icon;

View File

@ -42,9 +42,17 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
@Param(description = "VPC the static route belongs to")
private String vpcId;
@SerializedName(ApiConstants.GATEWAY_ID)
@SerializedName(ApiConstants.VPC_GATEWAY_ID)
@Param(description = "VPC gateway the route is created for")
private String gatewayId;
private String vpcGatewayId;
@SerializedName(ApiConstants.VPC_GATEWAY_IP)
@Param(description = "IP of VPC gateway the route is created for", since = "4.21.0")
private String vpcGatewayIp;
@SerializedName(ApiConstants.NEXT_HOP)
@Param(description = "Next hop of the static route", since = "4.21.0")
private String nextHop;
@SerializedName(ApiConstants.CIDR)
@Param(description = "static route CIDR")
@ -95,8 +103,16 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
this.vpcId = vpcId;
}
public void setGatewayId(String gatewayId) {
this.gatewayId = gatewayId;
public void setVpcGatewayId(String vpcGatewayId) {
this.vpcGatewayId = vpcGatewayId;
}
public void setVpcGatewayIp(String vpcGatewayIp) {
this.vpcGatewayIp = vpcGatewayIp;
}
public void setNextHop(String nextHop) {
this.nextHop = nextHop;
}
public void setCidr(String cidr) {

View File

@ -38,14 +38,6 @@ public class SystemVmResponse extends BaseResponseWithAnnotations {
@Param(description = "the system VM type")
private String systemVmType;
@SerializedName("jobid")
@Param(description = "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
private String jobId;
@SerializedName("jobstatus")
@Param(description = "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
private Integer jobStatus;
@SerializedName("zoneid")
@Param(description = "the Zone ID for the system VM")
private String zoneId;

View File

@ -127,9 +127,9 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
@Param(description = "indicates whether VLAN IP range is dedicated to system vms or not")
private Boolean forSystemVms;
@SerializedName(ApiConstants.FOR_NSX)
@Param(description = "indicates whether IP range is dedicated to NSX resources or not")
private Boolean forNsx;
@SerializedName(ApiConstants.PROVIDER)
@Param(description = "indicates to which provider the IP range is dedicated to", since = "4.21.0")
private String provider;
public void setId(String id) {
this.id = id;
@ -249,7 +249,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
this.ip6Cidr = ip6Cidr;
}
public void setForNsx(Boolean forNsx) {
this.forNsx = forNsx;
public void setProvider(String provider) {
this.provider = provider;
}
}

View File

@ -145,10 +145,15 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
@Param(description = "the type of the zone - core or edge", since = "4.18.0")
String type;
@Deprecated(since = "4.21.0")
@SerializedName(ApiConstants.NSX_ENABLED)
@Param(description = "true, if zone is NSX enabled", since = "4.20.0")
private boolean nsxEnabled = false;
@SerializedName(ApiConstants.PROVIDER)
@Param(description = "External network provider if any", since = "4.21.0")
private String provider = null;
@SerializedName(ApiConstants.MULTI_ARCH)
@Param(description = "true, if zone contains clusters and hosts from different CPU architectures", since = "4.20")
private boolean multiArch;
@ -381,6 +386,14 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
return nsxEnabled;
}
public String getProvider() {
return provider;
}
public void setProvider(String provider) {
this.provider = provider;
}
@Override
public void setResourceIconResponse(ResourceIconResponse resourceIconResponse) {
this.resourceIconResponse = resourceIconResponse;

View File

@ -1092,6 +1092,11 @@
<artifactId>cloud-plugin-network-nsx</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-netris</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-tungsten</artifactId>

View File

@ -25,7 +25,6 @@ import java.util.Map;
public class CheckS2SVpnConnectionsAnswer extends Answer {
Map<String, Boolean> ipToConnected;
Map<String, String> ipToDetail;
String details;
protected CheckS2SVpnConnectionsAnswer() {
ipToConnected = new HashMap<String, Boolean>();

View File

@ -36,6 +36,7 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
String routerIpv6Gateway = null;
String routerIpv6Cidr = null;
boolean isVrGuestGateway = false;
long networkId;
public NicTO getNic() {
return nic;
@ -123,4 +124,12 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
public void setVrGuestGateway(boolean vrGuestGateway) {
isVrGuestGateway = vrGuestGateway;
}
public long getNetworkId() {
return networkId;
}
public void setNetworkId(long networkId) {
this.networkId = networkId;
}
}

View File

@ -76,6 +76,7 @@ public class SetGuestNetworkConfigItem extends AbstractConfigItemFacade {
guestNetwork.setRouterIp6Gateway(command.getRouterIpv6Gateway());
guestNetwork.setRouterIp6Cidr(command.getRouterIpv6Cidr());
guestNetwork.setVrGuestGateway(command.isVrGuestGateway());
guestNetwork.setNetworkId(command.getNetworkId());
return generateConfigItems(guestNetwork);
}

View File

@ -38,6 +38,7 @@ public class GuestNetwork extends ConfigBase {
private String routerIp6Gateway;
private String routerIp6Cidr;
private boolean isVrGuestGateway;
long networkId;
private Integer mtu;
@ -211,4 +212,12 @@ public class GuestNetwork extends ConfigBase {
public void setVrGuestGateway(boolean vrGuestGateway) {
isVrGuestGateway = vrGuestGateway;
}
public long getNetworkId() {
return networkId;
}
public void setNetworkId(long networkId) {
this.networkId = networkId;
}
}

View File

@ -75,13 +75,17 @@ public class ArrayTypeAdaptor<T> implements JsonDeserializer<T[]>, JsonSerialize
try {
clazz = Class.forName(name);
} catch (ClassNotFoundException e) {
throw new CloudRuntimeException("can't find " + name);
throw new JsonParseException("can't find " + name);
}
T cmd = (T)_gson.fromJson(entry.getValue(), clazz);
cmds.add(cmd);
}
Class<?> type = ((Class<?>)typeOfT).getComponentType();
T[] ts = (T[])Array.newInstance(type, cmds.size());
return cmds.toArray(ts);
try {
Class<?> type = Class.forName(typeOfT.getTypeName().replace("[]", ""));
T[] ts = (T[])Array.newInstance(type, cmds.size());
return cmds.toArray(ts);
} catch (ClassNotFoundException e) {
throw new CloudRuntimeException("can't find " + typeOfT.getTypeName());
}
}
}

View File

@ -0,0 +1,46 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.transport;
import junit.framework.TestCase;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.junit.Assert;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.CheckS2SVpnConnectionsAnswer;
import com.cloud.agent.transport.Request.Version;
public class ResponseTest extends TestCase {
protected Logger logger = LogManager.getLogger(getClass());
public void testCheckS2SVpnConnectionsAnswer() {
logger.info("Testing CheckS2SVpnConnectionsAnswer");
String content = "[{\"com.cloud.agent.api.CheckS2SVpnConnectionsAnswer\":{\"ipToConnected\":{\"10.0.53.13\":true}," +
"\"ipToDetail\":{\"10.0.53.13\":\"IPsec SA found;Site-to-site VPN have connected\"}," +
"\"details\":\"10.0.53.13:0:IPsec SA found;Site-to-site VPN have connected\\u0026\\n\"," +
"\"result\":true,\"contextMap\":{},\"wait\":0,\"bypassHostMaintenance\":false}}]";
Response response = new Response(Version.v2, 1L, 2L, 3L, 1L, (short)1, content);
Answer answer = response.getAnswer();
Assert.assertTrue(answer instanceof CheckS2SVpnConnectionsAnswer);
}
}

View File

@ -85,4 +85,7 @@ mvn install:install-file -Dfile=juniper-contrail-api-1.0-SNAPSHOT.jar -DgroupId=
# From https://github.com/radu-todirica/tungsten-api/raw/master/net/juniper/tungsten/juniper-tungsten-api/2.0/juniper-tungsten-api-2.0.jar
mvn install:install-file -Dfile=juniper-tungsten-api-2.0.jar -DgroupId=net.juniper.tungsten -DartifactId=juniper-tungsten-api -Dversion=2.0 -Dpackaging=jar
# Netris Integration
mvn install:install-file -Dfile=netris-java-sdk-1.0.0.jar -DgroupId=io.netris -DartifactId=netris-java-sdk -Dversion=1.0.0 -Dpackaging=jar
exit 0

View File

@ -112,6 +112,9 @@ public interface NetworkOrchestrationService {
static final ConfigKey<Boolean> NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false",
"Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null);
ConfigKey<Boolean> NETRIS_ENABLED = new ConfigKey<>(Boolean.class, "netris.plugin.enable", "Advanced", "false",
"Indicates whether to enable the Netris plugin", false, ConfigKey.Scope.Zone, null);
List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
throws ConcurrentOperationException;

View File

@ -223,6 +223,7 @@ public interface ConfigurationManager {
* @param forVpc
* @param forTungsten
* @param forNsx
* @param forNetris
* @param domainIds
* @param zoneIds
* @return network offering object
@ -232,11 +233,11 @@ public interface ConfigurationManager {
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc,
Boolean forTungsten, boolean forNsx, NetworkOffering.NetworkMode networkMode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol,
Boolean forTungsten, boolean forNsx, boolean forNetris, NetworkOffering.NetworkMode networkMode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol,
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP,
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, boolean forNsx)
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, Provider provider)
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;

View File

@ -275,5 +275,9 @@ public class PublicIp implements PublicIpAddress {
return false;
}
@Override
public boolean isForRouter() {
return _addr.isForRouter();
}
}

View File

@ -54,6 +54,8 @@ public interface RulesManager extends RulesService {
boolean disableStaticNat(long ipAddressId, Account caller, long callerUserId, boolean releaseIpIfElastic) throws ResourceUnavailableException;
boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke);
/**
* @param networkId
* @param continueOnError

View File

@ -93,5 +93,5 @@ public interface NetworkACLManager {
boolean applyACLToPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException;
boolean reorderAclRules(VpcVO vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems);
boolean reorderAclRules(VpcVO vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems, Network.Provider networkProvider);
}

View File

@ -195,4 +195,20 @@ public interface VpcManager {
* @return
*/
boolean isSrcNatIpRequired(long vpcOfferingId);
boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId);
List<StaticRouteVO> getVpcStaticRoutes(Long vpcId);
List<StaticRouteProfile> getVpcStaticRoutes(List<? extends StaticRoute> routes);
boolean isProviderSupportServiceInVpc(long vpcId, Service service, Provider provider);
IPAddressVO getIpAddressForVpcVr(Vpc vpc, IPAddressVO ipAddress, boolean allocateIpIfNeeded);
boolean configStaticNatForVpcVr(Vpc vpc, IPAddressVO ipAddress);
void reconfigStaticNatForVpcVr(Long vpcId);
boolean applyStaticRouteForVpcVpnIfNeeded(Long vpcId, boolean updateAllVpn) throws ResourceUnavailableException;
}

View File

@ -43,6 +43,8 @@ import com.cloud.bgp.BGPService;
import com.cloud.dc.VlanDetailsVO;
import com.cloud.dc.dao.ASNumberDao;
import com.cloud.dc.dao.VlanDetailsDao;
import com.cloud.network.dao.Ipv6GuestPrefixSubnetNetworkMapDao;
import com.cloud.network.dao.NetrisProviderDao;
import com.cloud.network.dao.NsxProviderDao;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.annotation.AnnotationService;
@ -355,9 +357,13 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
@Inject
private NsxProviderDao nsxProviderDao;
@Inject
private NetrisProviderDao netrisProviderDao;
@Inject
private ASNumberDao asNumberDao;
@Inject
private BGPService bgpService;
@Inject
private Ipv6GuestPrefixSubnetNetworkMapDao ipv6GuestPrefixSubnetNetworkMapDao;
@Override
public List<NetworkGuru> getNetworkGurus() {
@ -558,27 +564,27 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false);
}
//#2 - SG enabled network offering
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
null, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false);
}
//#3 - shared network offering with no SG service
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
null, true, false, false, false, null,null, null, true, null, null, false);
null, true, false, false, false, false, null, null, null, true, null, null, false);
}
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE, "Offering for Tungsten Shared Security group enabled networks",
TrafficType.Guest, null, true, Availability.Optional, null, defaultTungstenSharedSGEnabledNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
null, true, false, null, false, null, true, false, true, false, null, null,null, true, null, null, false);
null, true, false, null, false, null, true, false, true, false, false, null, null, null, true, null, null, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -588,15 +594,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null,
true, false, false, false, null, null,null, true, null, null, false);
true, false, false, false, false, null, null, null, true, null, null, false);
}
//#5 - default vpc offering with LB service
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false);
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false);
}
//#6 - default vpc offering with no LB service
@ -605,14 +610,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
defaultVPCOffProviders.remove(Service.Lb);
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false);
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false);
}
//#7 - isolated offering with source nat disabled
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null,
true, null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
true, null, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false);
}
//#8 - network offering with internal lb service
@ -634,7 +639,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, true, null, null, false);
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false);
offering.setInternalLb(true);
offering.setPublicLb(false);
_networkOfferingDao.update(offering.getId(), offering);
@ -665,7 +670,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false);
offering.setDedicatedLB(false);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -822,6 +827,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (domainId != null && aclType == ACLType.Domain) {
_networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null || subdomainAccess);
}
String ipv6Cidr = network.getIp6Cidr();
String ipv6Gateway = network.getIp6Gateway();
if (StringUtils.isNoneBlank(ipv6Cidr, ipv6Gateway)) {
ipv6Service.assignIpv6SubnetToNetwork(ipv6Cidr, networkPersisted.getId());
}
}
});
guru.setup(network, relatedFile);
@ -1056,7 +1066,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return Transaction.execute(new TransactionCallback<NicVO>() {
@Override
public NicVO doInTransaction(TransactionStatus status) {
NicVO vo = _nicDao.findByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId);
NicVO vo = _nicDao.findNonPlaceHolderByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId);
if (vo == null) {
applyProfileToNic(nic, profile, deviceId);
vo = _nicDao.persist(nic);
@ -1083,10 +1093,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return null;
}
if (isNicAllocatedForNsxPublicNetworkOnVR(network, profile, vm)) {
if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Nsx)) {
String guruName = "NsxPublicNetworkGuru";
NetworkGuru nsxGuru = AdapterBase.getAdapterByName(networkGurus, guruName);
nsxGuru.allocate(network, profile, vm);
} else if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Netris)) {
String guruName = "NetrisPublicNetworkGuru";
NetworkGuru netrisGuru = AdapterBase.getAdapterByName(networkGurus, guruName);
netrisGuru.allocate(network, profile, vm);
}
if (isDefaultNic != null) {
@ -1149,7 +1163,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return new Pair<NicProfile, Integer>(vmNic, Integer.valueOf(deviceId));
}
private boolean isNicAllocatedForNsxPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm) {
private boolean isNicAllocatedForProviderPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm, Provider provider) {
if (ObjectUtils.anyNull(network, requested, vm)) {
return false;
}
@ -1159,7 +1173,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return false;
}
long dataCenterId = vm.getVirtualMachine().getDataCenterId();
if (nsxProviderDao.findByZoneId(dataCenterId) == null) {
if (Provider.Nsx == provider && nsxProviderDao.findByZoneId(dataCenterId) == null) {
return false;
} else if (Provider.Netris == provider && netrisProviderDao.findByZoneId(dataCenterId) == null) {
return false;
}
@ -1169,14 +1185,16 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (CollectionUtils.isEmpty(ips)) {
return false;
}
ips = ips.stream().filter(x -> !x.getAddress().addr().equals(requested.getIPv4Address())).collect(Collectors.toList());
IPAddressVO ip = ips.get(0);
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), ApiConstants.NSX_DETAIL_KEY);
String detailKey = Provider.Nsx == provider ? ApiConstants.NSX_DETAIL_KEY : ApiConstants.NETRIS_DETAIL_KEY;
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), detailKey);
if (vlanDetail == null) {
return false;
}
boolean isForNsx = vlanDetail.getValue().equalsIgnoreCase("true");
return isForNsx && !ip.isForSystemVms();
boolean isForProvider = vlanDetail.getValue().equalsIgnoreCase("true");
return isForProvider && !ip.isForSystemVms();
}
private void setMtuDetailsInVRNic(final Pair<NetworkVO, VpcVO> networks, Network network, NicVO vo) {
@ -1694,6 +1712,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
}
}
}
reconfigureAndApplyStaticRouteForVpcVpn(network);
} finally {
for (final NetworkElement element : networkElements) {
if (element instanceof AggregatedCommandExecutor && providersToImplement.contains(element.getProvider())) {
@ -1703,6 +1722,17 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
}
}
private void reconfigureAndApplyStaticRouteForVpcVpn(Network network) {
if (network.getVpcId() != null) {
_vpcMgr.reconfigStaticNatForVpcVr(network.getVpcId());
try {
_vpcMgr.applyStaticRouteForVpcVpnIfNeeded(network.getVpcId(), true);
} catch (ResourceUnavailableException e) {
logger.error("Unable to apply static routes for vpc " + network.getVpcId() + " due to " + e.getMessage());
}
}
}
private void implementNetworkElements(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering, final List<Provider> providersToImplement)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
for (NetworkElement element : networkElements) {
@ -1939,6 +1969,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
ip.setOneToOneNat(false);
ip.setAssociatedWithVmId(null);
ip.setVmIp(null);
ip.setForRouter(false);
_ipAddressDao.update(ip.getId(), ip);
}
}
@ -3296,6 +3327,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
}
}
}
reconfigureAndApplyStaticRouteForVpcVpn(network);
return success;
}
@ -4877,6 +4909,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes,
GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion,
PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled,
TUNGSTEN_ENABLED, NSX_ENABLED };
TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED };
}
}

View File

@ -64,4 +64,6 @@ public interface VlanDao extends GenericDao<VlanVO, Long> {
List<VlanVO> listIpv6RangeByZoneIdAndVlanId(long zoneId, String vlanId);
List<VlanVO> listIpv6SupportingVlansByZone(long zoneId);
List<VlanVO> listVlansForExternalNetworkProvider(long zoneId, String detailKey);
}

View File

@ -26,6 +26,7 @@ import java.util.Map;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.dc.VlanDetailsVO;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@ -67,6 +68,8 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
protected SearchBuilder<VlanVO> ZoneVlanIp6Search;
protected SearchBuilder<VlanVO> ZoneIp6Search;
protected SearchBuilder<VlanVO> ZoneVlansSearch;
protected SearchBuilder<VlanVO> ProviderVlanSearch;
protected SearchBuilder<VlanDetailsVO> VlanDetailsProviderSearch;
protected SearchBuilder<AccountVlanMapVO> AccountVlanMapSearch;
protected SearchBuilder<DomainVlanMapVO> DomainVlanMapSearch;
@ -79,6 +82,8 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
protected DomainVlanMapDao _domainVlanMapDao;
@Inject
protected IPAddressDao _ipAddressDao;
@Inject
protected VlanDetailsDao vlanDetailsDao;
@Override
public VlanVO findByZoneAndVlanId(long zoneId, String vlanId) {
@ -277,6 +282,19 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
ZoneVlansSearch.and("zoneId", ZoneVlansSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
ZoneVlansSearch.and("vlan", ZoneVlansSearch.entity().getVlanTag(), SearchCriteria.Op.IN);
ZoneVlansSearch.done();
ProviderVlanSearch = createSearchBuilder();
ProviderVlanSearch.and("removed", ProviderVlanSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
ProviderVlanSearch.and("dataCenterId", ProviderVlanSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
VlanDetailsProviderSearch = vlanDetailsDao.createSearchBuilder();
VlanDetailsProviderSearch.and("name", VlanDetailsProviderSearch.entity().getName(), SearchCriteria.Op.EQ);
VlanDetailsProviderSearch.and("value", VlanDetailsProviderSearch.entity().getValue(), SearchCriteria.Op.EQ);
ProviderVlanSearch.join("VlanDetailsProviderSearch", VlanDetailsProviderSearch, ProviderVlanSearch.entity().getId(),
VlanDetailsProviderSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
VlanDetailsProviderSearch.done();
ProviderVlanSearch.done();
return result;
}
@ -434,4 +452,13 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
return listBy(sc);
}
@Override
public List<VlanVO> listVlansForExternalNetworkProvider(long zoneId, String detailKey) {
SearchCriteria<VlanVO> sc = ProviderVlanSearch.create();
sc.setParameters("dataCenterId", zoneId);
sc.setJoinParameters("VlanDetailsProviderSearch", "name", detailKey);
sc.setJoinParameters("VlanDetailsProviderSearch", "value", "true");
return search(sc, null);
}
}

View File

@ -197,6 +197,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
address.setSourceNat(false);
address.setOneToOneNat(false);
address.setAssociatedWithVmId(null);
address.setForRouter(false);
address.setState(State.Free);
address.setAssociatedWithNetworkId(null);
address.setVpcId(null);

View File

@ -117,6 +117,9 @@ public class IPAddressVO implements IpAddress {
@Column(name = "forsystemvms")
private boolean forSystemVms = false;
@Column(name = "for_router")
private boolean forRouter = false;
@Column(name= GenericDao.REMOVED_COLUMN)
private Date removed;
@ -388,4 +391,13 @@ public class IPAddressVO implements IpAddress {
public boolean isForSystemVms() {
return forSystemVms;
}
@Override
public boolean isForRouter() {
return forRouter;
}
public void setForRouter(boolean forRouter) {
this.forRouter = forRouter;
}
}

View File

@ -0,0 +1,24 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.dao;
import com.cloud.network.element.NetrisProviderVO;
import com.cloud.utils.db.GenericDao;
public interface NetrisProviderDao extends GenericDao<NetrisProviderVO, Long> {
NetrisProviderVO findByZoneId(long zoneId);
}

View File

@ -0,0 +1,52 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.dao;
import com.cloud.network.element.NetrisProviderVO;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import org.springframework.stereotype.Component;
@Component
@DB()
public class NetrisProviderDaoImpl extends GenericDaoBase<NetrisProviderVO, Long> implements NetrisProviderDao {
final SearchBuilder<NetrisProviderVO> allFieldsSearch;
public NetrisProviderDaoImpl() {
super();
allFieldsSearch = createSearchBuilder();
allFieldsSearch.and("id", allFieldsSearch.entity().getId(),
SearchCriteria.Op.EQ);
allFieldsSearch.and("uuid", allFieldsSearch.entity().getUuid(),
SearchCriteria.Op.EQ);
allFieldsSearch.and("hostname", allFieldsSearch.entity().getUrl(),
SearchCriteria.Op.EQ);
allFieldsSearch.and("zone_id", allFieldsSearch.entity().getZoneId(),
SearchCriteria.Op.EQ);
allFieldsSearch.done();
}
@Override
public NetrisProviderVO findByZoneId(long zoneId) {
SearchCriteria<NetrisProviderVO> sc = allFieldsSearch.create();
sc.setParameters("zone_id", zoneId);
return findOneBy(sc);
}
}

View File

@ -33,4 +33,6 @@ public interface RemoteAccessVpnDao extends GenericDao<RemoteAccessVpnVO, Long>
List<RemoteAccessVpnVO> findByAccount(Long accountId);
List<RemoteAccessVpnVO> listByNetworkId(Long networkId);
List<RemoteAccessVpnVO> listByVpcId(Long vpcId);
}

View File

@ -85,4 +85,11 @@ public class RemoteAccessVpnDaoImpl extends GenericDaoBase<RemoteAccessVpnVO, Lo
sc.setParameters("networkId", networkId);
return listBy(sc);
}
@Override
public List<RemoteAccessVpnVO> listByVpcId(Long vpcId) {
SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
sc.setParameters("vpcId", vpcId);
return listBy(sc);
}
}

View File

@ -20,4 +20,6 @@ import com.cloud.utils.db.GenericDao;
public interface Site2SiteVpnGatewayDao extends GenericDao<Site2SiteVpnGatewayVO, Long> {
Site2SiteVpnGatewayVO findByVpcId(long vpcId);
Site2SiteVpnGatewayVO findByPublicIpAddress(long ipAddressId);
}

View File

@ -35,6 +35,7 @@ public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatew
protected Site2SiteVpnGatewayDaoImpl() {
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("ipAddressId", AllFieldsSearch.entity().getAddrId(), SearchCriteria.Op.EQ);
AllFieldsSearch.done();
}
@ -44,4 +45,11 @@ public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatew
sc.setParameters("vpcId", vpcId);
return findOneBy(sc);
}
@Override
public Site2SiteVpnGatewayVO findByPublicIpAddress(long ipAddressId) {
SearchCriteria<Site2SiteVpnGatewayVO> sc = AllFieldsSearch.create();
sc.setParameters("ipAddressId", ipAddressId);
return findOneBy(sc);
}
}

View File

@ -0,0 +1,265 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.element;
import com.cloud.network.netris.NetrisProvider;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.UUID;
@Entity
@Table(name = "netris_providers")
public class NetrisProviderVO implements NetrisProvider {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
long id;
@Column(name = "uuid")
private String uuid;
@Column(name = "name")
private String name;
@Column(name = "zone_id")
private long zoneId;
@Column(name = "host_id")
private long hostId;
@Column(name = "url")
private String url;
@Column(name = "username")
private String username;
@Column(name = "password")
private String password;
@Column(name = "site_name")
private String siteName;
@Column(name = "tenant_name")
private String tenantName;
@Column(name = "netris_tag")
private String netrisTag;
@Column(name = "created")
private Date created;
@Column(name = "removed")
private Date removed;
public NetrisProviderVO() {
this.uuid = UUID.randomUUID().toString();
}
@Override
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public long getZoneId() {
return zoneId;
}
public void setZoneId(long zoneId) {
this.zoneId = zoneId;
}
public long getHostId() {
return hostId;
}
public void setHostId(long hostId) {
this.hostId = hostId;
}
@Override
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSiteName() {
return siteName;
}
public void setSiteName(String siteName) {
this.siteName = siteName;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public String getNetrisTag() {
return netrisTag;
}
public void setNetrisTag(String netrisTag) {
this.netrisTag = netrisTag;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getRemoved() {
return removed;
}
public void setRemoved(Date removed) {
this.removed = removed;
}
public static final class Builder {
private long zoneId;
private long hostId;
private String name;
private String url;
private String username;
private String password;
private String siteName;
private String tenantName;
private String netrisTag;
public Builder() {
// Default constructor
}
public Builder setZoneId(long zoneId) {
this.zoneId = zoneId;
return this;
}
public Builder setHostId(long hostId) {
this.hostId = hostId;
return this;
}
public Builder setName(String name) {
this.name = name;
return this;
}
public Builder setUrl(String url) {
this.url = url;
return this;
}
public Builder setUsername(String username) {
this.username = username;
return this;
}
public Builder setPassword(String password) {
this.password = password;
return this;
}
public Builder setSiteName(String siteName) {
this.siteName = siteName;
return this;
}
public Builder setTenantName(String tenantName) {
this.tenantName = tenantName;
return this;
}
public Builder setNetrisTag(String netrisTag) {
this.netrisTag = netrisTag;
return this;
}
public NetrisProviderVO build() {
NetrisProviderVO provider = new NetrisProviderVO();
provider.setZoneId(this.zoneId);
provider.setHostId(this.hostId);
provider.setUuid(UUID.randomUUID().toString());
provider.setName(this.name);
provider.setUrl(this.url);
provider.setUsername(this.username);
provider.setPassword(this.password);
provider.setSiteName(this.siteName);
provider.setTenantName(this.tenantName);
provider.setNetrisTag(this.netrisTag);
provider.setCreated(new Date());
return provider;
}
}
}

View File

@ -27,6 +27,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.cloud.utils.db.GenericDao;
@ -42,7 +43,10 @@ public class StaticRouteVO implements StaticRoute {
String uuid;
@Column(name = "vpc_gateway_id", updatable = false)
long vpcGatewayId;
Long vpcGatewayId;
@Column(name = "next_hop")
private String nextHop;
@Column(name = "cidr")
private String cidr;
@ -67,6 +71,9 @@ public class StaticRouteVO implements StaticRoute {
uuid = UUID.randomUUID().toString();
}
@Transient
boolean forVpn = false;
/**
* @param vpcGatewayId
* @param cidr
@ -74,7 +81,7 @@ public class StaticRouteVO implements StaticRoute {
* @param accountId TODO
* @param domainId TODO
*/
public StaticRouteVO(long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId) {
public StaticRouteVO(Long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId, String nextHop) {
super();
this.vpcGatewayId = vpcGatewayId;
this.cidr = cidr;
@ -82,14 +89,32 @@ public class StaticRouteVO implements StaticRoute {
this.vpcId = vpcId;
this.accountId = accountId;
this.domainId = domainId;
this.nextHop = nextHop;
uuid = UUID.randomUUID().toString();
}
public StaticRouteVO(String cidr, Long vpcId, long accountId, long domainId, String nextHop, State state, boolean forVpn) {
super();
this.cidr = cidr;
this.state = state;
this.vpcId = vpcId;
this.accountId = accountId;
this.domainId = domainId;
this.nextHop = nextHop;
uuid = UUID.randomUUID().toString();
this.forVpn = forVpn;
}
@Override
public long getVpcGatewayId() {
public Long getVpcGatewayId() {
return vpcGatewayId;
}
@Override
public String getNextHop() {
return nextHop;
}
@Override
public String getCidr() {
return cidr;
@ -145,4 +170,8 @@ public class StaticRouteVO implements StaticRoute {
public String getName() {
return null;
}
public boolean isForVpn() {
return forVpn;
}
}

View File

@ -60,9 +60,6 @@ public class VpcOfferingVO implements VpcOffering {
@Column(name = "default")
boolean isDefault = false;
@Column(name = "for_nsx")
boolean forNsx = false;
@Column(name = "network_mode")
NetworkOffering.NetworkMode networkMode;
@ -159,14 +156,6 @@ public class VpcOfferingVO implements VpcOffering {
return isDefault;
}
public boolean isForNsx() {
return forNsx;
}
public void setForNsx(boolean forNsx) {
this.forNsx = forNsx;
}
public NetworkOffering.NetworkMode getNetworkMode() {
return networkMode;
}

View File

@ -18,6 +18,7 @@ package com.cloud.network.vpc.dao;
import java.util.List;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
import com.cloud.network.vpc.VpcOfferingServiceMapVO;
import com.cloud.utils.db.GenericDao;
@ -37,4 +38,8 @@ public interface VpcOfferingServiceMapDao extends GenericDao<VpcOfferingServiceM
VpcOfferingServiceMapVO findByServiceProviderAndOfferingId(String service, String provider, long vpcOfferingId);
boolean isProviderForVpcOffering(Network.Provider provider, long vpcOfferingId);
List<VpcOfferingServiceMapVO> listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service);
}

View File

@ -19,6 +19,7 @@ package com.cloud.network.vpc.dao;
import java.util.List;
import com.cloud.network.Network;
import org.springframework.stereotype.Component;
import com.cloud.network.Network.Service;
@ -110,4 +111,22 @@ public class VpcOfferingServiceMapDaoImpl extends GenericDaoBase<VpcOfferingServ
return findOneBy(sc);
}
@Override
public boolean isProviderForVpcOffering(Network.Provider provider, long vpcOfferingId) {
SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
sc.setParameters("vpcOffId", vpcOfferingId);
sc.setParameters("provider", provider.getName());
return findOneBy(sc) != null;
}
@Override
public List<VpcOfferingServiceMapVO> listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service) {
SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
sc.setParameters("vpcOffId", vpcOfferingId);
sc.setParameters("service", service.getName());
return customSearch(sc, null);
}
}

View File

@ -68,8 +68,15 @@ public class VpcServiceMapDaoImpl extends GenericDaoBase<VpcServiceMapVO, Long>
@Override
public boolean canProviderSupportServiceInVpc(long vpcId, Service service, Provider provider) {
// TODO Auto-generated method stub
return false;
SearchCriteria<VpcServiceMapVO> sc = AllFieldsSearch.create();
sc.setParameters("vpcId", vpcId);
sc.setParameters("service", service.getName());
sc.setParameters("provider", provider.getName());
if (findOneBy(sc) != null) {
return true;
} else {
return false;
}
}
@Override

View File

@ -134,12 +134,6 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name = "for_vpc")
boolean forVpc;
@Column(name = "for_tungsten")
boolean forTungsten = false;
@Column(name = "for_nsx")
boolean forNsx = false;
@Column(name = "network_mode")
NetworkMode networkMode;
@ -200,24 +194,6 @@ public class NetworkOfferingVO implements NetworkOffering {
this.forVpc = isForVpc;
}
@Override
public boolean isForTungsten() {
return forTungsten;
}
public void setForTungsten(boolean forTungsten) {
this.forTungsten = forTungsten;
}
@Override
public boolean isForNsx() {
return forNsx;
}
public void setForNsx(boolean forNsx) {
this.forNsx = forNsx;
}
@Override
public NetworkMode getNetworkMode() {
return networkMode;

View File

@ -46,8 +46,12 @@ public interface NicDao extends GenericDao<NicVO, Long> {
NicVO findByNetworkIdAndTypeIncludingRemoved(long networkId, VirtualMachine.Type vmType);
NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType);
NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId);
NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId);
NicVO findByNetworkIdAndMacAddress(long networkId, String mac);
NicVO findDefaultNicForVM(long instanceId);

View File

@ -69,6 +69,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
AllFieldsSearch.and("secondaryip", AllFieldsSearch.entity().getSecondaryIp(), Op.EQ);
AllFieldsSearch.and("nicid", AllFieldsSearch.entity().getId(), Op.EQ);
AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ);
AllFieldsSearch.and("strategyNEQ", AllFieldsSearch.entity().getReservationStrategy(), Op.NEQ);
AllFieldsSearch.and("reserverName",AllFieldsSearch.entity().getReserver(),Op.EQ);
AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
AllFieldsSearch.and("deviceid", AllFieldsSearch.entity().getDeviceId(), Op.EQ);
@ -195,6 +196,15 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
return findByNetworkIdAndTypeInternal(networkId, vmType, true);
}
@Override
public NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
sc.setParameters("network", networkId);
sc.setParameters("vmType", vmType);
sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString());
return findOneBy(sc);
}
@Override
public NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
@ -222,6 +232,16 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
return findOneBy(sc);
}
@Override
public NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
sc.setParameters("address", ip4Address);
sc.setParameters("network", networkId);
sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString());
return findOneBy(sc);
}
@Override
public NicVO findByNetworkIdAndMacAddress(long networkId, String mac) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();

View File

@ -138,6 +138,7 @@
<bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
<bean id="ovsProviderDaoImpl" class="com.cloud.network.dao.OvsProviderDaoImpl" />
<bean id="nsxControllerDaoImpl" class="com.cloud.network.dao.NsxProviderDaoImpl" />
<bean id="netrisProviderDaoImpl" class="com.cloud.network.dao.NetrisProviderDaoImpl" />
<bean id="tungstenControllerDaoImpl" class="com.cloud.network.dao.TungstenProviderDaoImpl"/>
<bean id="physicalNetworkDaoImpl" class="com.cloud.network.dao.PhysicalNetworkDaoImpl" />
<bean id="physicalNetworkIsolationMethodDaoImpl" class="com.cloud.network.dao.PhysicalNetworkIsolationMethodDaoImpl" />

View File

@ -238,6 +238,43 @@ CREATE TABLE IF NOT EXISTS `cloud`.`gui_themes_details` (
CONSTRAINT `fk_gui_themes_details__gui_theme_id` FOREIGN KEY (`gui_theme_id`) REFERENCES `gui_themes`(`id`)
);
-- Netris Plugin
CREATE TABLE `cloud`.`netris_providers` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
`uuid` varchar(40),
`zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID',
`host_id` bigint unsigned NOT NULL COMMENT 'Host ID',
`name` varchar(40),
`url` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`site_name` varchar(255) NOT NULL,
`tenant_name` varchar(255) NOT NULL,
`netris_tag` varchar(255) NOT NULL,
`created` datetime NOT NULL COMMENT 'created date',
`removed` datetime COMMENT 'removed date if not null',
PRIMARY KEY (`id`),
CONSTRAINT `fk_netris_providers__zone_id` FOREIGN KEY `fk_netris_providers__zone_id` (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
INDEX `i_netris_providers__zone_id`(`zone_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Drop the Tungsten and NSX columns from the network offerings (replaced by checking the provider on the ntwk_offering_service_map table)
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_tungsten`;
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_nsx`;
-- Drop the Tungsten and NSX columns from the VPC offerings (replaced by checking the provider on the vpc_offering_service_map table)
ALTER TABLE `cloud`.`vpc_offerings` DROP COLUMN `for_nsx`;
-- Add next_hop to the static_routes table
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.static_routes', 'next_hop', 'varchar(50) COMMENT "next hop of the static route" AFTER `vpc_gateway_id`');
-- Add `for_router` to `user_ip_address` table
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_ip_address', 'for_router', 'tinyint(1) DEFAULT 0 COMMENT "True if the ip address is used by Domain Router to expose services"');
-- Add Netris Autoscaling rules
INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW());
INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW());
-- Rename user_vm_details to vm_instance_details
ALTER TABLE `cloud`.`user_vm_details` RENAME TO `cloud`.`vm_instance_details`;
ALTER TABLE `cloud`.`vm_instance_details` DROP FOREIGN KEY `fk_user_vm_details__vm_id`;

View File

@ -59,8 +59,6 @@ SELECT
`network_offerings`.`supports_public_access` AS `supports_public_access`,
`network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`,
`network_offerings`.`for_vpc` AS `for_vpc`,
`network_offerings`.`for_tungsten` AS `for_tungsten`,
`network_offerings`.`for_nsx` AS `for_nsx`,
`network_offerings`.`network_mode` AS `network_mode`,
`network_offerings`.`service_package_id` AS `service_package_id`,
`network_offerings`.`routing_mode` AS `routing_mode`,

View File

@ -28,7 +28,6 @@ select
`vpc_offerings`.`display_text` AS `display_text`,
`vpc_offerings`.`state` AS `state`,
`vpc_offerings`.`default` AS `default`,
`vpc_offerings`.`for_nsx` AS `for_nsx`,
`vpc_offerings`.`network_mode` AS `network_mode`,
`vpc_offerings`.`created` AS `created`,
`vpc_offerings`.`removed` AS `removed`,

View File

@ -51,6 +51,10 @@ public class BridgeVifDriver extends VifDriverBase {
private String _controlCidr = NetUtils.getLinkLocalCIDR();
private Long libvirtVersion;
private static boolean isVxlanOrNetris(String protocol) {
return protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme()) || protocol.equals(Networks.BroadcastDomainType.Netris.scheme());
}
@Override
public void configure(Map<String, Object> params) throws ConfigurationException {
@ -177,7 +181,7 @@ public class BridgeVifDriver extends VifDriverBase {
protected boolean isBroadcastTypeVlanOrVxlan(final NicTO nic) {
return nic != null && (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan);
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Netris);
}
protected boolean isValidProtocolAndVnetId(final String vNetId, final String protocol) {
@ -284,7 +288,7 @@ public class BridgeVifDriver extends VifDriverBase {
private String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
String nic = _pifs.get(pifKey);
if (nic == null || protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
if (nic == null || isVxlanOrNetris(protocol)) {
// if not found in bridge map, maybe traffic label refers to pif already?
File pif = new File("/sys/class/net/" + pifKey);
if (pif.isDirectory()) {
@ -292,7 +296,7 @@ public class BridgeVifDriver extends VifDriverBase {
}
}
String brName = "";
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
if (isVxlanOrNetris(protocol)) {
brName = generateVxnetBrName(nic, vNetId);
} else {
brName = generateVnetBrName(nic, vNetId);
@ -304,7 +308,7 @@ public class BridgeVifDriver extends VifDriverBase {
private void createVnet(String vnetId, String pif, String brName, String protocol) throws InternalErrorException {
synchronized (_vnetBridgeMonitor) {
String script = _modifyVlanPath;
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
if (isVxlanOrNetris(protocol)) {
script = _modifyVxlanPath;
}
final Script command = new Script(script, _timeout, logger);

View File

@ -24,7 +24,6 @@ import java.util.Set;
import javax.inject.Inject;
import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
import com.cloud.api.commands.DisableCiscoNexusVSMCmd;
import com.cloud.api.commands.EnableCiscoNexusVSMCmd;

View File

@ -2646,7 +2646,6 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
forVpc, true, false, false);
if (forNsx) {
defaultKubernetesServiceNetworkOffering.setNetworkMode(NetworkOffering.NetworkMode.NATTED);
defaultKubernetesServiceNetworkOffering.setForNsx(true);
}
defaultKubernetesServiceNetworkOffering.setSupportsVmAutoScaling(true);
defaultKubernetesServiceNetworkOffering.setState(NetworkOffering.State.Enabled);

View File

@ -701,7 +701,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
metricsResponse.setCpuTotal(hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
metricsResponse.setCpuUsed(hostResponse.getCpuUsed(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
metricsResponse.setCpuAllocated(hostResponse.getCpuAllocated(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
metricsResponse.setLoadAverage(hostResponse.getAverageLoad());
metricsResponse.setCpuAverageLoad(hostResponse.getAverageLoad());
metricsResponse.setMemTotal(hostResponse.getMemoryTotal());
metricsResponse.setMemAllocated(hostResponse.getMemoryAllocated());
metricsResponse.setMemUsed(hostResponse.getMemoryUsed());

View File

@ -52,10 +52,6 @@ public class HostMetricsResponse extends HostResponse {
@Param(description = "the total cpu allocated in Ghz")
private String cpuAllocated;
@SerializedName("cpuloadaverage")
@Param(description = "the average cpu load the last minute")
private Double loadAverage;
@SerializedName("memorytotalgb")
@Param(description = "the total memory capacity in GiB")
private String memTotal;
@ -132,12 +128,6 @@ public class HostMetricsResponse extends HostResponse {
}
}
public void setLoadAverage(final Double loadAverage) {
if (loadAverage != null) {
this.loadAverage = loadAverage;
}
}
public void setCpuAllocated(final String cpuAllocated, final Integer cpuNumber, final Long cpuSpeed) {
if (cpuAllocated != null && cpuNumber != null && cpuSpeed != null) {
this.cpuAllocated = String.format("%.2f Ghz", parseCPU(cpuAllocated) * cpuNumber * cpuSpeed / (100.0 * 1000.0));

View File

@ -22,7 +22,6 @@ import org.apache.cloudstack.api.MetricConstants;
import org.apache.cloudstack.api.response.ManagementServerResponse;
import java.util.Date;
import java.util.List;
public class ManagementServerMetricsResponse extends ManagementServerResponse {
@ -30,14 +29,6 @@ public class ManagementServerMetricsResponse extends ManagementServerResponse {
@Param(description = "the number of processors available to the JVM")
private Integer availableProcessors;
@SerializedName(MetricConstants.LAST_AGENTS)
@Param(description = "the last agents this Management Server is responsible for, before shutdown or preparing for maintenance", since = "4.21.0.0")
private List<String> lastAgents;
@SerializedName(MetricConstants.AGENTS)
@Param(description = "the agents this Management Server is responsible for", since = "4.21.0.0")
private List<String> agents;
@SerializedName(MetricConstants.AGENT_COUNT)
@Param(description = "the number of agents this Management Server is responsible for")
private Integer agentCount;
@ -130,14 +121,6 @@ public class ManagementServerMetricsResponse extends ManagementServerResponse {
this.availableProcessors = availableProcessors;
}
public void setLastAgents(List<String> lastAgents) {
this.lastAgents = lastAgents;
}
public void setAgents(List<String> agents) {
this.agents = agents;
}
public void setAgentCount(int agentCount) {
this.agentCount = agentCount;
}

View File

@ -217,7 +217,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
ConfigurationManager configMgr = (ConfigurationManager) _configService;
NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText,
TrafficType.Public, null, true, Availability.Optional, null, serviceProviderMap, true,
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, false, false, null, null, null, true, null, null, false);
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, false, false, false, null, null, null, true, null, null, false);
long id = voffer.getId();
_networkOfferingDao.update(id, voffer);
return _networkOfferingDao.findById(id);
@ -252,7 +252,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
ConfigurationManager configMgr = (ConfigurationManager)_configService;
NetworkOfferingVO voffer =
configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true,
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), false, false, null, null, null, true, null, null, false);
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), false, false, false, null, null, null, true, null, null, false);
if (offeringName.equals(vpcRouterOfferingName)) {
voffer.setInternalLb(true);
}
@ -293,7 +293,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
}
serviceProviderMap.put(svc, providerSet);
}
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, false, null, null, null, VpcOffering.State.Enabled, null, false);
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, null, null, null, null, VpcOffering.State.Enabled, null, false);
long id = vpcOffer.getId();
_vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
return _vpcOffDao.findById(id);

View File

@ -0,0 +1,44 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-network-netris</artifactId>
<name>Apache CloudStack Plugin - Netris</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>4.21.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>io.netris</groupId>
<artifactId>netris-java-sdk</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.seancfoley</groupId>
<artifactId>ipaddress</artifactId>
<version>5.5.1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack;
import com.cloud.agent.api.StartupCommand;
import com.cloud.host.Host;
public class StartupNetrisCommand extends StartupCommand {
public StartupNetrisCommand() {
super(Host.Type.L2Networking);
}
}

View File

@ -0,0 +1,48 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class AddOrUpdateNetrisStaticRouteCommand extends NetrisCommand {
private String prefix;
private String nextHop;
private Long routeId;
private boolean updateRoute;
public AddOrUpdateNetrisStaticRouteCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, String prefix, String nextHop, Long routeId, boolean updateRoute) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.prefix = prefix;
this.nextHop = nextHop;
this.routeId = routeId;
this.updateRoute = updateRoute;
}
public String getPrefix() {
return prefix;
}
public String getNextHop() {
return nextHop;
}
public Long getRouteId() {
return routeId;
}
public boolean isUpdateRoute() {
return updateRoute;
}
}

View File

@ -0,0 +1,119 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
import org.apache.cloudstack.resource.NetrisPortGroup;
public class CreateNetrisACLCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private String action;
private String destPrefix;
private String sourcePrefix;
private Integer destPortStart;
private Integer destPortEnd;
private Integer icmpType;
private String protocol;
private NetrisPortGroup portGroup;
private String netrisAclName;
private String reason;
public CreateNetrisACLCommand(long zoneId, Long accountId, Long domainId, String name, Long id, String vpcName, Long vpcId, boolean isVpc, String action,
String sourcePrefix, String destPrefix, Integer destPortStart, Integer destPortEnd, String protocol) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.vpcName = vpcName;
this.vpcId = vpcId;
this.action = action;
this.sourcePrefix = sourcePrefix;
this.destPrefix = destPrefix;
this.destPortStart = destPortStart;
this.destPortEnd = destPortEnd;
this.protocol = protocol;
}
public String getVpcName() {
return vpcName;
}
public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}
public Long getVpcId() {
return vpcId;
}
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
public String getAction() {
return action;
}
public String getDestPrefix() {
return destPrefix;
}
public String getSourcePrefix() {
return sourcePrefix;
}
public Integer getDestPortStart() {
return destPortStart;
}
public Integer getDestPortEnd() {
return destPortEnd;
}
public String getProtocol() {
return protocol;
}
public NetrisPortGroup getPortGroup() {
return portGroup;
}
public void setPortGroup(NetrisPortGroup portGroup) {
this.portGroup = portGroup;
}
public Integer getIcmpType() {
return icmpType;
}
public void setIcmpType(Integer icmpType) {
this.icmpType = icmpType;
}
public String getNetrisAclName() {
return netrisAclName;
}
public void setNetrisAclName(String netrisAclName) {
this.netrisAclName = netrisAclName;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}

View File

@ -0,0 +1,84 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class CreateNetrisVnetCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private String cidr;
private Integer vxlanId;
private String gateway;
private String netrisTag;
private String ipv6Cidr;
private Boolean globalRouting;
public CreateNetrisVnetCommand(Long zoneId, Long accountId, Long domainId, String vpcName, Long vpcId, String vNetName, Long networkId, String cidr, String gateway, boolean isVpc) {
super(zoneId, accountId, domainId, vNetName, networkId, isVpc);
this.vpcId = vpcId;
this.vpcName = vpcName;
this.cidr = cidr;
this.gateway = gateway;
}
public Long getVpcId() {
return vpcId;
}
public String getVpcName() {
return vpcName;
}
public String getCidr() {
return cidr;
}
public Integer getVxlanId() {
return vxlanId;
}
public void setVxlanId(Integer vxlanId) {
this.vxlanId = vxlanId;
}
public String getGateway() {
return gateway;
}
public String getNetrisTag() {
return netrisTag;
}
public void setNetrisTag(String netrisTag) {
this.netrisTag = netrisTag;
}
public String getIpv6Cidr() {
return ipv6Cidr;
}
public void setIpv6Cidr(String ipv6Cidr) {
this.ipv6Cidr = ipv6Cidr;
}
public Boolean isGlobalRouting() {
return globalRouting;
}
public void setGlobalRouting(Boolean globalRouting) {
this.globalRouting = globalRouting;
}
}

View File

@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class CreateNetrisVpcCommand extends NetrisCommand {
private final String cidr;
public CreateNetrisVpcCommand(long zoneId, long accountId, long domainId, String name, String cidr, long vpcId, boolean isVpc) {
super(zoneId, accountId, domainId, name, vpcId, isVpc);
this.cidr = cidr;
}
public String getCidr() {
return cidr;
}
}

View File

@ -0,0 +1,119 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
import org.apache.cloudstack.resource.NetrisPortGroup;
public class CreateOrUpdateNetrisACLCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private String action;
private String destPrefix;
private String sourcePrefix;
private Integer destPortStart;
private Integer destPortEnd;
private Integer icmpType;
private String protocol;
private NetrisPortGroup portGroup;
private String netrisAclName;
private String reason;
public CreateOrUpdateNetrisACLCommand(long zoneId, Long accountId, Long domainId, String name, Long id, String vpcName, Long vpcId, boolean isVpc, String action,
String sourcePrefix, String destPrefix, Integer destPortStart, Integer destPortEnd, String protocol) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.vpcName = vpcName;
this.vpcId = vpcId;
this.action = action;
this.sourcePrefix = sourcePrefix;
this.destPrefix = destPrefix;
this.destPortStart = destPortStart;
this.destPortEnd = destPortEnd;
this.protocol = protocol;
}
public String getVpcName() {
return vpcName;
}
public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}
public Long getVpcId() {
return vpcId;
}
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
public String getAction() {
return action;
}
public String getDestPrefix() {
return destPrefix;
}
public String getSourcePrefix() {
return sourcePrefix;
}
public Integer getDestPortStart() {
return destPortStart;
}
public Integer getDestPortEnd() {
return destPortEnd;
}
public String getProtocol() {
return protocol;
}
public NetrisPortGroup getPortGroup() {
return portGroup;
}
public void setPortGroup(NetrisPortGroup portGroup) {
this.portGroup = portGroup;
}
public Integer getIcmpType() {
return icmpType;
}
public void setIcmpType(Integer icmpType) {
this.icmpType = icmpType;
}
public String getNetrisAclName() {
return netrisAclName;
}
public void setNetrisAclName(String netrisAclName) {
this.netrisAclName = netrisAclName;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}

View File

@ -0,0 +1,90 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
import com.cloud.network.netris.NetrisLbBackend;
import java.util.List;
public class CreateOrUpdateNetrisLoadBalancerRuleCommand extends NetrisCommand {
private final String publicPort;
private final String privatePort;
private final String algorithm;
private final String protocol;
List<NetrisLbBackend> lbBackends;
private String publicIp;
private final Long lbId;
private String cidrList;
private String ruleName;
public CreateOrUpdateNetrisLoadBalancerRuleCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc,
List<NetrisLbBackend> lbBackends, long lbId, String publicIp, String publicPort,
String privatePort, String algorithm, String protocol) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.lbId = lbId;
this.publicIp = publicIp;
this.publicPort = publicPort;
this.privatePort = privatePort;
this.algorithm = algorithm;
this.protocol = protocol;
this.lbBackends = lbBackends;
}
public String getPublicPort() {
return publicPort;
}
public String getPrivatePort() {
return privatePort;
}
public String getAlgorithm() {
return algorithm;
}
public String getProtocol() {
return protocol;
}
public List<NetrisLbBackend> getLbBackends() {
return lbBackends;
}
public Long getLbId() {
return lbId;
}
public String getPublicIp() {
return publicIp;
}
public String getCidrList() {
return cidrList;
}
public void setCidrList(String cidrList) {
this.cidrList = cidrList;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
}

View File

@ -0,0 +1,148 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class CreateOrUpdateNetrisNatCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private String vpcCidr;
private String natRuleName;
private String natIp;
private String natRuleType;
// Parameters for DNAT
private String protocol;
private String sourceAddress;
private String sourcePort;
private String destinationAddress;
private String destinationPort;
private String state;
// Parameters for SNAT (Static NAT)
private String vmIp;
public CreateOrUpdateNetrisNatCommand(long zoneId, Long accountId, Long domainId, String vpcName, Long vpcId, String vNetName, Long networkId, boolean isVpc, String vpcCidr) {
super(zoneId, accountId, domainId, vNetName, networkId, isVpc);
this.vpcName = vpcName;
this.vpcId = vpcId;
this.vpcCidr = vpcCidr;
}
public String getVpcName() {
return vpcName;
}
public Long getVpcId() {
return vpcId;
}
public String getNatIp() {
return natIp;
}
public void setNatRuleName(String natRuleName) {
this.natRuleName = natRuleName;
}
public String getNatRuleName() {
return natRuleName;
}
public String getVpcCidr() {
return vpcCidr;
}
public void setNatIp(String natIp) {
this.natIp = natIp;
}
public String getVmIp() {
return vmIp;
}
public void setVmIp(String vmIp) {
this.vmIp = vmIp;
}
public String getNatRuleType() {
return natRuleType;
}
public void setNatRuleType(String natRuleType) {
this.natRuleType = natRuleType;
}
public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
public void setVpcCidr(String vpcCidr) {
this.vpcCidr = vpcCidr;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getSourceAddress() {
return sourceAddress;
}
public void setSourceAddress(String sourceAddress) {
this.sourceAddress = sourceAddress;
}
public String getSourcePort() {
return sourcePort;
}
public void setSourcePort(String sourcePort) {
this.sourcePort = sourcePort;
}
public String getDestinationAddress() {
return destinationAddress;
}
public void setDestinationAddress(String destinationAddress) {
this.destinationAddress = destinationAddress;
}
public String getDestinationPort() {
return destinationPort;
}
public void setDestinationPort(String destinationPort) {
this.destinationPort = destinationPort;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}

View File

@ -0,0 +1,46 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
import java.util.List;
public class DeleteNetrisACLCommand extends NetrisCommand {
Long vpcId;
String vpcName;
List<String> aclRuleNames;
public DeleteNetrisACLCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, Long vpcId, String vpcName) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.vpcId = vpcId;
this.vpcName = vpcName;
}
public Long getVpcId() {
return vpcId;
}
public String getVpcName() {
return vpcName;
}
public List<String> getAclRuleNames() {
return aclRuleNames;
}
public void setAclRuleNames(List<String> aclRuleNames) {
this.aclRuleNames = aclRuleNames;
}
}

View File

@ -0,0 +1,52 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class DeleteNetrisLoadBalancerRuleCommand extends NetrisCommand {
private Long lbId;
private String ruleName;
private String cidrList;
public DeleteNetrisLoadBalancerRuleCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, Long lbId) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.lbId = lbId;
}
public Long getLbId() {
return lbId;
}
public void setLbId(Long lbId) {
this.lbId = lbId;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getCidrList() {
return cidrList;
}
public void setCidrList(String cidrList) {
this.cidrList = cidrList;
}
}

View File

@ -0,0 +1,72 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class DeleteNetrisNatRuleCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private String natRuleType;
private String natRuleName;
private String natIp;
public DeleteNetrisNatRuleCommand(long zoneId, Long accountId, Long domainId, String vpcName, Long vpcId, String vNetName, Long networkId, boolean isVpc) {
super(zoneId, accountId, domainId, vNetName, networkId, isVpc);
this.vpcName = vpcName;
this.vpcId = vpcId;
}
public String getVpcName() {
return vpcName;
}
public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}
public Long getVpcId() {
return vpcId;
}
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
public String getNatRuleType() {
return natRuleType;
}
public void setNatRuleType(String natRuleType) {
this.natRuleType = natRuleType;
}
public String getNatRuleName() {
return natRuleName;
}
public void setNatRuleName(String natRuleName) {
this.natRuleName = natRuleName;
}
public String getNatIp() {
return natIp;
}
public void setNatIp(String natIp) {
this.natIp = natIp;
}
}

View File

@ -0,0 +1,23 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class DeleteNetrisStaticRouteCommand extends AddOrUpdateNetrisStaticRouteCommand {
public DeleteNetrisStaticRouteCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, String prefix, String nextHop, Long routeId) {
super(zoneId, accountId, domainId, name, id, isVpc, prefix, nextHop, routeId, false);
}
}

View File

@ -0,0 +1,51 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class DeleteNetrisVnetCommand extends NetrisCommand {
private String vpcName;
private Long vpcId;
private final String vNetCidr;
private String vNetV6Cidr;
public DeleteNetrisVnetCommand(long zoneId, long accountId, long domainId, String name, long id, String vpcName, Long vpcId, String vNetCidr, boolean isVpc) {
super(zoneId, accountId, domainId, name, id, isVpc);
this.vpcName = vpcName;
this.vpcId = vpcId;
this.vNetCidr = vNetCidr;
}
public String getVpcName() {
return vpcName;
}
public Long getVpcId() {
return vpcId;
}
public String getVNetCidr() {
return vNetCidr;
}
public String getvNetV6Cidr() {
return vNetV6Cidr;
}
public void setvNetV6Cidr(String vNetV6Cidr) {
this.vNetV6Cidr = vNetV6Cidr;
}
}

View File

@ -0,0 +1,30 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class DeleteNetrisVpcCommand extends NetrisCommand {
private final String cidr;
public DeleteNetrisVpcCommand(long zoneId, long accountId, long domainId, String name, String cidr, long vpcId, boolean isVpc) {
super(zoneId, accountId, domainId, name, vpcId, isVpc);
this.cidr = cidr;
}
public String getCidr() {
return cidr;
}
}

View File

@ -0,0 +1,36 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
import com.cloud.agent.api.Command;
import com.cloud.network.vpc.StaticRoute;
import java.util.List;
public class ListNetrisStaticRoutesAnswer extends NetrisAnswer {
List<StaticRoute> staticRoutes;
public ListNetrisStaticRoutesAnswer(final Command command, final List<StaticRoute> staticRoutes) {
super(command, true, "OK");
this.staticRoutes = staticRoutes;
}
public List<StaticRoute> getStaticRoutes() {
return staticRoutes;
}
}

View File

@ -0,0 +1,23 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.agent.api;
public class ListNetrisStaticRoutesCommand extends AddOrUpdateNetrisStaticRouteCommand {
public ListNetrisStaticRoutesCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, String prefix, String nextHop, Long routeId) {
super(zoneId, accountId, domainId, name, id, isVpc, prefix, nextHop, routeId, false);
}
}

Some files were not shown because too many files have changed in this diff Show More