org.dasein.cloud.cloudstack.network.CSVlanCapabilities Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dasein-cloud-cloudstack Show documentation
Show all versions of dasein-cloud-cloudstack Show documentation
Implements the Dasein Cloud API for Cloud.com Cloudstack-based public and private clouds.
/**
* Copyright (C) 2009-2015 Dell, Inc.
*
* ====================================================================
* Licensed 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.dasein.cloud.cloudstack.network;
import org.dasein.cloud.AbstractCapabilities;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.Requirement;
import org.dasein.cloud.VisibleScope;
import org.dasein.cloud.cloudstack.CSCloud;
import org.dasein.cloud.network.IPVersion;
import org.dasein.cloud.network.VLANCapabilities;
import org.dasein.cloud.util.NamingConstraints;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Locale;
/**
* Describes the capabilities of Cloudstack with respect to Dasein vlan operations.
* Created by Danielle Mayne: 3/03/14 12:51 PM
* @author Danielle Mayne
* @version 2014.03 initial version
* @since 2014.03
*/
public class CSVlanCapabilities extends AbstractCapabilities implements VLANCapabilities {
public CSVlanCapabilities(@Nonnull CSCloud cloud) { super(cloud); }
@Override
public boolean allowsNewNetworkInterfaceCreation() throws CloudException, InternalException {
return false;
}
@Override
public boolean allowsNewVlanCreation() throws CloudException, InternalException {
return getProvider().hasApi("createNetwork");
}
@Override
public boolean allowsNewRoutingTableCreation() throws CloudException, InternalException {
return false;
}
@Override
public boolean allowsNewSubnetCreation() throws CloudException, InternalException {
return false;
}
@Override
public boolean allowsMultipleTrafficTypesOverSubnet() throws CloudException, InternalException {
if( getSubnetSupport().equals(Requirement.NONE) ) {
return false;
}
int count = 0;
for( IPVersion version : listSupportedIPVersions() ) {
count++;
if( count > 1 ) {
return true;
}
}
return false;
}
@Override
public boolean allowsMultipleTrafficTypesOverVlan() throws CloudException, InternalException {
int count = 0;
for( IPVersion version : listSupportedIPVersions() ) {
count++;
if( count > 1 ) {
return true;
}
}
return false;
}
@Override
public int getMaxNetworkInterfaceCount() throws CloudException, InternalException {
return 0;
}
@Override
public int getMaxVlanCount() throws CloudException, InternalException {
return AbstractCapabilities.LIMIT_UNLIMITED;
}
@Nonnull
@Override
public String getProviderTermForNetworkInterface(@Nonnull Locale locale) {
return "NIC";
}
@Nonnull
@Override
public String getProviderTermForSubnet(@Nonnull Locale locale) {
return "";
}
@Nonnull
@Override
public String getProviderTermForVlan(@Nonnull Locale locale) {
return "network";
}
@Nonnull
@Override
public Requirement getRoutingTableSupport() throws CloudException, InternalException {
return Requirement.NONE;
}
@Nonnull
@Override
public Requirement getSubnetSupport() throws CloudException, InternalException {
return Requirement.NONE;
}
@Nullable
@Override
public VisibleScope getVLANVisibleScope() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Nonnull
@Override
public Requirement identifySubnetDCRequirement() throws CloudException, InternalException {
return Requirement.NONE;
}
@Override
public boolean isNetworkInterfaceSupportEnabled() throws CloudException, InternalException {
return false;
}
@Override
public boolean isSubnetDataCenterConstrained() throws CloudException, InternalException {
return true;
}
@Override
public boolean isVlanDataCenterConstrained() throws CloudException, InternalException {
return true;
}
@Nonnull
@Override
public Iterable listSupportedIPVersions() throws CloudException, InternalException {
return Collections.singletonList(IPVersion.IPV4);
}
@Override
public boolean supportsInternetGatewayCreation() throws CloudException, InternalException {
return false;
}
@Override
public boolean supportsRawAddressRouting() throws CloudException, InternalException {
return false;
}
@Nonnull
@Override
public NamingConstraints getVlanNamingConstraints() {
// not sure what these are from the api docs, but from the UI they don't seem
// to restrict on much of anything
return NamingConstraints.getAlphaNumeric(1, 255);
}
}