Fix build errors after merge from master

This commit is contained in:
Koushik Das 2013-03-12 23:40:35 +05:30
parent 7c20b120c2
commit 99e88ecbf9
14 changed files with 218 additions and 154 deletions

View File

@ -30,7 +30,7 @@ public class ConfigureNexusVsmForAsaCommand extends Command {
private String _asaInPortProfile;
public ConfigureNexusVsmForAsaCommand(long vlanId, String ipAddress,
String vsmUsername, String vsmPassword, String vsmIp, String asaInPortProfile) {
String vsmUsername, String vsmPassword, String vsmIp, String asaInPortProfile) {
super();
this._vlanId = vlanId;
this._ipAddress = ipAddress;
@ -61,35 +61,35 @@ public class ConfigureNexusVsmForAsaCommand extends Command {
this._ipAddress = _ipAddress;
}
public String getVsmUsername() {
return _vsmUsername;
}
public String getVsmUsername() {
return _vsmUsername;
}
public void setVsmUsername(String _vsmUsername) {
this._vsmUsername = _vsmUsername;
}
public void setVsmUsername(String _vsmUsername) {
this._vsmUsername = _vsmUsername;
}
public String getVsmPassword() {
return _vsmPassword;
}
public String getVsmPassword() {
return _vsmPassword;
}
public void setVsmPassword(String _vsmPassword) {
this._vsmPassword = _vsmPassword;
}
public void setVsmPassword(String _vsmPassword) {
this._vsmPassword = _vsmPassword;
}
public String getVsmIp() {
return _vsmIp;
}
public String getVsmIp() {
return _vsmIp;
}
public void setVsmIp(String _vsmIp) {
this._vsmIp = _vsmIp;
}
public void setVsmIp(String _vsmIp) {
this._vsmIp = _vsmIp;
}
public String getAsaInPortProfile() {
return _asaInPortProfile;
}
public String getAsaInPortProfile() {
return _asaInPortProfile;
}
public void setAsaInPortProfile(String _asaInPortProfile) {
this._asaInPortProfile = _asaInPortProfile;
}
public void setAsaInPortProfile(String _asaInPortProfile) {
this._asaInPortProfile = _asaInPortProfile;
}
}

View File

@ -16,12 +16,13 @@
// under the License.
package com.cloud.api.commands;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
@ -42,7 +43,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class AddCiscoAsa1000vResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(AddCiscoAsa1000vResourceCmd.class.getName());
private static final String s_name = "addCiscoAsa1000vResource";
@PlugService CiscoAsa1000vService _ciscoAsa1000vService;
@Inject CiscoAsa1000vService _ciscoAsa1000vService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -94,12 +95,12 @@ public class AddCiscoAsa1000vResourceCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add Cisco ASA 1000v appliance due to internal error.");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Cisco ASA 1000v appliance due to internal error.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -16,12 +16,13 @@
// under the License.
package com.cloud.api.commands;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.log4j.Logger;
@ -41,7 +42,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class AddCiscoVnmcResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(AddCiscoVnmcResourceCmd.class.getName());
private static final String s_name = "addCiscoVnmcResource";
@PlugService CiscoVnmcElementService _ciscoVnmcElementService;
@Inject CiscoVnmcElementService _ciscoVnmcElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -93,12 +94,12 @@ public class AddCiscoVnmcResourceCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add Cisco VNMC controller due to internal error.");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Cisco VNMC controller due to internal error.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -16,11 +16,13 @@
// under the License.
package com.cloud.api.commands;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
@ -39,7 +41,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class DeleteCiscoAsa1000vResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(DeleteCiscoAsa1000vResourceCmd.class.getName());
private static final String s_name = "deleteCiscoAsa1000vResource";
@PlugService CiscoAsa1000vService _ciscoAsa1000vService;
@Inject CiscoAsa1000vService _ciscoAsa1000vService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -69,12 +71,12 @@ public class DeleteCiscoAsa1000vResourceCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete Cisco ASA 1000v appliance.");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Cisco ASA 1000v appliance.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -16,11 +16,13 @@
// under the License.
package com.cloud.api.commands;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
@ -39,7 +41,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class DeleteCiscoVnmcResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(DeleteCiscoVnmcResourceCmd.class.getName());
private static final String s_name = "deleteCiscoVnmcResource";
@PlugService CiscoVnmcElementService _ciscoVnmcElementService;
@Inject CiscoVnmcElementService _ciscoVnmcElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -69,12 +71,12 @@ public class DeleteCiscoVnmcResourceCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete Cisco Vnmc resource.");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Cisco Vnmc resource.");
}
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -19,14 +19,14 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.BaseCmd.CommandType;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.log4j.Logger;
@ -46,7 +46,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
private static final Logger s_logger = Logger.getLogger(ListCiscoAsa1000vResourcesCmd.class.getName());
private static final String s_name = "listCiscoAsa1000vResources";
@PlugService CiscoAsa1000vService _ciscoAsa1000vService;
@Inject CiscoAsa1000vService _ciscoAsa1000vService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -97,9 +97,9 @@ public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -19,12 +19,13 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
@ -45,7 +46,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
private static final Logger s_logger = Logger.getLogger(ListCiscoVnmcResourcesCmd.class.getName());
private static final String s_name = "listCiscoVnmcResources";
@PlugService CiscoVnmcElementService _ciscoVnmcElementService;
@Inject CiscoVnmcElementService _ciscoVnmcElementService;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -91,9 +92,9 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (CloudRuntimeException runtimeExcp) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}

View File

@ -31,26 +31,26 @@ public class CiscoVnmcResourceResponse extends BaseResponse {
@SerializedName(ApiConstants.RESOURCE_ID) @Parameter(description="resource id of the Cisco VNMC controller")
private String id;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
@Parameter(description="the physical network to which this VNMC belongs to", entityType = PhysicalNetworkResponse.class)
private Long physicalNetworkId ;
public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
return physicalNetworkId;
}
public String getProviderName() {
return providerName;
}
public String getProviderName() {
return providerName;
}
public String getResourceName() {
return resourceName;
}
public String getResourceName() {
return resourceName;
}
@SerializedName(ApiConstants.PROVIDER) @Parameter(description="name of the provider")
@SerializedName(ApiConstants.PROVIDER) @Parameter(description="name of the provider")
private String providerName;
@SerializedName(RESOURCE_NAME)
@Parameter(description="Cisco VNMC resource name")
private String resourceName;
@ -70,5 +70,5 @@ public class CiscoVnmcResourceResponse extends BaseResponse {
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
}

View File

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
@ -38,7 +39,7 @@ import com.cloud.host.dao.HostDao;
import com.cloud.host.dao.HostDetailsDao;
import com.cloud.network.Network.Provider;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkVO;
import com.cloud.network.dao.PhysicalNetworkVO;
import com.cloud.network.dao.CiscoVnmcDao;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.PhysicalNetworkDao;
@ -48,13 +49,12 @@ import com.cloud.network.element.CiscoVnmcElementService;
import com.cloud.network.resource.CiscoVnmcResource;
import com.cloud.resource.ResourceManager;
import com.cloud.resource.ServerResource;
import com.cloud.utils.component.Inject;
import com.cloud.utils.component.Manager;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
ResourceManager _resourceMgr;
ResourceManager _resourceMgr;
@Inject
PhysicalNetworkDao _physicalNetworkDao;
@Inject
@ -74,8 +74,8 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
CiscoVnmcConnection _vnmcConnection;
@Override
public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd) {
@Override
public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd) {
String deviceName = Provider.CiscoVnmc.getName();
NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName);
Long physicalNetworkId = cmd.getPhysicalNetworkId();
@ -113,7 +113,7 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
Map<String, Object> hostdetails = new HashMap<String,Object>();
hostdetails.putAll(params);
ServerResource resource = new CiscoVnmcResource();
ServerResource resource = new CiscoVnmcResource();
Transaction txn = Transaction.currentTxn();
try {
@ -138,81 +138,108 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
txn.rollback();
throw new CloudRuntimeException(e.getMessage());
}
}
}
@Override
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(
CiscoVnmcController CiscoVnmcResourceVO) {
// TODO Auto-generated method stub
return null;
}
@Override
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(
CiscoVnmcController CiscoVnmcResourceVO) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean deleteCiscoVnmcResource(DeleteCiscoVnmcResourceCmd cmd) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean deleteCiscoVnmcResource(DeleteCiscoVnmcResourceCmd cmd) {
// TODO Auto-generated method stub
return false;
}
@Override
public List<CiscoVnmcControllerVO> listCiscoVnmcResources(
ListCiscoVnmcResourcesCmd cmd) {
Long physicalNetworkId = cmd.getPhysicalNetworkId();
Long CiscoVnmcResourceId = cmd.getCiscoVnmcResourceId();
List<CiscoVnmcControllerVO> responseList = new ArrayList<CiscoVnmcControllerVO>();
@Override
public List<CiscoVnmcControllerVO> listCiscoVnmcResources(
ListCiscoVnmcResourcesCmd cmd) {
Long physicalNetworkId = cmd.getPhysicalNetworkId();
Long CiscoVnmcResourceId = cmd.getCiscoVnmcResourceId();
List<CiscoVnmcControllerVO> responseList = new ArrayList<CiscoVnmcControllerVO>();
if (physicalNetworkId == null && CiscoVnmcResourceId == null) {
throw new InvalidParameterValueException("Either physical network Id or vnmc device Id must be specified");
}
if (physicalNetworkId == null && CiscoVnmcResourceId == null) {
throw new InvalidParameterValueException("Either physical network Id or vnmc device Id must be specified");
}
if (CiscoVnmcResourceId != null) {
CiscoVnmcControllerVO CiscoVnmcResource = _ciscoVnmcDao.findById(CiscoVnmcResourceId);
if (CiscoVnmcResource == null) {
throw new InvalidParameterValueException("Could not find Cisco Vnmc device with id: " + CiscoVnmcResource);
}
responseList.add(CiscoVnmcResource);
}
else {
PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
}
responseList = _ciscoVnmcDao.listByPhysicalNetwork(physicalNetworkId);
}
if (CiscoVnmcResourceId != null) {
CiscoVnmcControllerVO CiscoVnmcResource = _ciscoVnmcDao.findById(CiscoVnmcResourceId);
if (CiscoVnmcResource == null) {
throw new InvalidParameterValueException("Could not find Cisco Vnmc device with id: " + CiscoVnmcResource);
}
responseList.add(CiscoVnmcResource);
}
else {
PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
}
responseList = _ciscoVnmcDao.listByPhysicalNetwork(physicalNetworkId);
}
return responseList;
}
return responseList;
}
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean start() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean start() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean stop() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean stop() {
// TODO Auto-generated method stub
return false;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Class<?>> getCommands() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Class<?>> getCommands() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setName(String name) {
// TODO Auto-generated method stub
}
@Override
public void setConfigParams(Map<String, Object> params) {
// TODO Auto-generated method stub
}
@Override
public Map<String, Object> getConfigParams() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getRunLevel() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setRunLevel(int level) {
// TODO Auto-generated method stub
}
}

View File

@ -31,7 +31,7 @@ public class CiscoVnmcDaoImpl extends GenericDaoBase<CiscoVnmcControllerVO, Long
implements CiscoVnmcDao {
protected final SearchBuilder<CiscoVnmcControllerVO> physicalNetworkIdSearch;
public CiscoVnmcDaoImpl() {
physicalNetworkIdSearch = createSearchBuilder();
physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);

View File

@ -29,7 +29,7 @@ import com.cloud.utils.component.PluggableService;
public interface CiscoAsa1000vService extends PluggableService {
public CiscoAsa1000vDevice addCiscoAsa1000vResource(AddCiscoAsa1000vResourceCmd cmd);
public CiscoAsa1000vDevice addCiscoAsa1000vResource(AddCiscoAsa1000vResourceCmd cmd);
public CiscoAsa1000vResourceResponse createCiscoAsa1000vResourceResponse(
CiscoAsa1000vDevice ciscoAsa1000vDeviceVO);

View File

@ -25,6 +25,7 @@ import java.util.Set;
import java.util.UUID;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
@ -78,8 +79,9 @@ import com.cloud.network.CiscoNexusVSMDeviceVO;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.NetworkManager;
import com.cloud.network.NetworkModel;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkVO;
import com.cloud.network.dao.PhysicalNetworkVO;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
@ -111,7 +113,6 @@ import com.cloud.resource.ServerResource;
import com.cloud.resource.UnableDeleteHostException;
import com.cloud.user.Account;
import com.cloud.utils.component.AdapterBase;
import com.cloud.utils.component.Inject;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.NicProfile;
@ -135,6 +136,8 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
ConfigurationManager _configMgr;
@Inject
NetworkManager _networkMgr;
@Inject
NetworkModel _networkModel;
@Inject
PhysicalNetworkDao _physicalNetworkDao;
@ -285,7 +288,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
return true;
}
if (!_networkMgr.isProviderSupportServiceInNetwork(network.getId(), Service.SourceNat, Provider.CiscoVnmc)) {
if (!_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.SourceNat, Provider.CiscoVnmc)) {
s_logger.error("SourceNat service is not provided by Cisco Vnmc device on network " + network.getName());
return false;
}
@ -610,7 +613,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
List<? extends FirewallRule> rules)
throws ResourceUnavailableException {
if (!_networkMgr.isProviderSupportServiceInNetwork(network.getId(), Service.Firewall, Provider.CiscoVnmc)) {
if (!_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Firewall, Provider.CiscoVnmc)) {
s_logger.error("Firewall service is not provided by Cisco Vnmc device on network " + network.getName());
return false;
}
@ -639,7 +642,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
List<FirewallRuleTO> rulesTO = new ArrayList<FirewallRuleTO>();
for (FirewallRule rule : rules) {
IpAddress sourceIp = _networkMgr.getIp(rule.getSourceIpAddressId());
IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
FirewallRuleTO ruleTO = new FirewallRuleTO(rule, null, sourceIp.getAddress().addr());
rulesTO.add(ruleTO);
}
@ -664,7 +667,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
public boolean applyPFRules(Network network, List<PortForwardingRule> rules)
throws ResourceUnavailableException {
if (!_networkMgr.isProviderSupportServiceInNetwork(network.getId(), Service.PortForwarding, Provider.CiscoVnmc)) {
if (!_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.PortForwarding, Provider.CiscoVnmc)) {
s_logger.error("Port forwarding service is not provided by Cisco Vnmc device on network " + network.getName());
return false;
}
@ -693,7 +696,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
List<PortForwardingRuleTO> rulesTO = new ArrayList<PortForwardingRuleTO>();
for (PortForwardingRule rule : rules) {
IpAddress sourceIp = _networkMgr.getIp(rule.getSourceIpAddressId());
IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
Vlan vlan = _vlanDao.findById(sourceIp.getVlanId());
PortForwardingRuleTO ruleTO = new PortForwardingRuleTO(rule, vlan.getVlanTag(), sourceIp.getAddress().addr());
rulesTO.add(ruleTO);
@ -719,7 +722,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
public boolean applyStaticNats(Network network,
List<? extends StaticNat> rules)
throws ResourceUnavailableException {
if (!_networkMgr.isProviderSupportServiceInNetwork(network.getId(), Service.StaticNat, Provider.CiscoVnmc)) {
if (!_networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.StaticNat, Provider.CiscoVnmc)) {
s_logger.error("Static NAT service is not provided by Cisco Vnmc device on network " + network.getName());
return false;
}
@ -748,7 +751,7 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
List<StaticNatRuleTO> rulesTO = new ArrayList<StaticNatRuleTO>();
for (StaticNat rule : rules) {
IpAddress sourceIp = _networkMgr.getIp(rule.getSourceIpAddressId());
IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
StaticNatRuleTO ruleTO = new StaticNatRuleTO(0, sourceIp.getAddress().addr(), null,
null, rule.getDestIpAddress(), null, null, null, rule.isForRevoke(), false);
rulesTO.add(ruleTO);

View File

@ -30,7 +30,7 @@ public interface CiscoVnmcElementService extends PluggableService {
//public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd);
public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd);
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(
CiscoVnmcController CiscoVnmcResourceVO);

View File

@ -61,7 +61,7 @@ import com.cloud.utils.cisco.n1kv.vsm.VsmCommand.SwitchPortMode;
import com.cloud.utils.exception.ExecutionException;
import com.cloud.utils.net.NetUtils;
public class CiscoVnmcResource implements ServerResource{
public class CiscoVnmcResource implements ServerResource {
private String _name;
private String _zoneId;
@ -688,4 +688,31 @@ public class CiscoVnmcResource implements ServerResource{
return new Answer(cmd, true, "Success");
}
@Override
public void setName(String name) {
// TODO Auto-generated method stub
}
@Override
public void setConfigParams(Map<String, Object> params) {
// TODO Auto-generated method stub
}
@Override
public Map<String, Object> getConfigParams() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getRunLevel() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setRunLevel(int level) {
// TODO Auto-generated method stub
}
}