You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/05 18:17:49 UTC
[4/4] api_refactor: refactor network apis for admin pkg
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/CreateNetworkOfferingCmd.java
new file mode 100644
index 0000000..d85f575
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/CreateNetworkOfferingCmd.java
@@ -0,0 +1,234 @@
+// 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.api.admin.network.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.NetworkOfferingResponse;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.Service;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Availability;
+import com.cloud.user.Account;
+
+@Implementation(description="Creates a network offering.", responseObject=NetworkOfferingResponse.class, since="3.0.0")
+public class CreateNetworkOfferingCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(CreateNetworkOfferingCmd.class.getName());
+ private static final String _name = "createnetworkofferingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the network offering")
+ private String networkOfferingName;
+
+ @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network offering")
+ private String displayText;
+
+ @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering. Supported type in current release is GUEST only")
+ private String traffictype;
+
+ @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for the network offering.", length=4096)
+ private String tags;
+
+ @Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="true if network offering supports vlans")
+ private Boolean specifyVlan;
+
+ @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Optional")
+ private String availability;
+
+ @Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed")
+ private Integer networkRate;
+
+ @Parameter(name=ApiConstants.CONSERVE_MODE, type=CommandType.BOOLEAN, description="true if the network offering is IP conserve mode enabled")
+ private Boolean conserveMode;
+
+ @IdentityMapper(entityTableName="disk_offering")
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, description="the service offering ID used by virtual router provider")
+ private Long serviceOfferingId;
+
+ @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, required=true, description="guest type of the network offering: Shared or Isolated")
+ private String guestIptype;
+
+ @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, required=true, collectionType=CommandType.STRING, description="services supported by the network offering")
+ private List<String> supportedServices;
+
+ @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
+ private Map serviceProviderList;
+
+ @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
+ private Map serviceCapabilitystList;
+
+ @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if network offering supports specifying ip ranges; defaulted to false if not specified")
+ private Boolean specifyIpRanges;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getNetworkOfferingName() {
+ return networkOfferingName;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+
+ public String getTags() {
+ return tags;
+ }
+
+ public String getTraffictype() {
+ return traffictype;
+ }
+
+ public Boolean getSpecifyVlan() {
+ return specifyVlan == null ? false : specifyVlan;
+ }
+
+ public String getAvailability() {
+ return availability == null ? Availability.Optional.toString() : availability;
+ }
+
+ public Integer getNetworkRate() {
+ return networkRate;
+ }
+
+ public static String getName() {
+ return _name;
+ }
+
+ public Long getServiceOfferingId() {
+ return serviceOfferingId;
+ }
+
+ public List<String> getSupportedServices() {
+ return supportedServices;
+ }
+
+ public String getGuestIpType() {
+ return guestIptype;
+ }
+
+ public Boolean getSpecifyIpRanges() {
+ return specifyIpRanges == null ? false : specifyIpRanges;
+ }
+
+ public Boolean getConserveMode() {
+ if (conserveMode == null) {
+ return true;
+ }
+ return conserveMode;
+ }
+
+ public Map<String, List<String>> getServiceProviders() {
+ Map<String, List<String>> serviceProviderMap = null;
+ if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
+ serviceProviderMap = new HashMap<String, List<String>>();
+ Collection servicesCollection = serviceProviderList.values();
+ Iterator iter = servicesCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> services = (HashMap<String, String>) iter.next();
+ String service = services.get("service");
+ String provider = services.get("provider");
+ List<String> providerList = null;
+ if (serviceProviderMap.containsKey(service)) {
+ providerList = serviceProviderMap.get(service);
+ } else {
+ providerList = new ArrayList<String>();
+ }
+ providerList.add(provider);
+ serviceProviderMap.put(service, providerList);
+ }
+ }
+
+ return serviceProviderMap;
+ }
+
+ public Map<Capability, String> getServiceCapabilities(Service service) {
+ Map<Capability, String> capabilityMap = null;
+
+ if (serviceCapabilitystList != null && !serviceCapabilitystList.isEmpty()) {
+ capabilityMap = new HashMap <Capability, String>();
+ Collection serviceCapabilityCollection = serviceCapabilitystList.values();
+ Iterator iter = serviceCapabilityCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> svcCapabilityMap = (HashMap<String, String>) iter.next();
+ Capability capability = null;
+ String svc = (String) svcCapabilityMap.get("service");
+ String capabilityName = (String) svcCapabilityMap.get("capabilitytype");
+ String capabilityValue = (String) svcCapabilityMap.get("capabilityvalue");
+
+ if (capabilityName != null) {
+ capability = Capability.getCapability(capabilityName);
+ }
+
+ if ((capability == null) || (capabilityName == null) || (capabilityValue == null) ) {
+ throw new InvalidParameterValueException("Invalid capability:" + capabilityName + " capability value:" + capabilityValue);
+ }
+
+ if (svc.equalsIgnoreCase(service.getName())) {
+ capabilityMap.put(capability, capabilityValue);
+ } else {
+ //throw new InvalidParameterValueException("Service is not equal ")
+ }
+ }
+ }
+
+ return capabilityMap;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return _name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ NetworkOffering result = _configService.createNetworkOffering(this);
+ if (result != null) {
+ NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkOfferingCmd.java
new file mode 100644
index 0000000..2e0f098
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkOfferingCmd.java
@@ -0,0 +1,77 @@
+// 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.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.user.Account;
+
+@Implementation(description="Deletes a network offering.", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeleteNetworkOfferingCmd extends BaseCmd{
+ public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName());
+ private static final String s_name = "deletenetworkofferingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="network_offerings")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network offering")
+ private Long id;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _configService.deleteNetworkOffering(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkServiceProviderCmd.java
new file mode 100644
index 0000000..abfe7cb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteNetworkServiceProviderCmd.java
@@ -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 org.apache.cloudstack.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="Deletes a Network Service Provider.", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteNetworkServiceProviderCmd.class.getName());
+
+ private static final String s_name = "deletenetworkserviceproviderresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="physical_network_service_providers")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network service provider")
+ private Long id;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ try{
+ boolean result = _networkService.deleteNetworkServiceProvider(getId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
+ }
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ }
+ }
+
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_SERVICE_PROVIDER_DELETE;
+ }
+
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting Physical network ServiceProvider: " + getId();
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PhysicalNetworkServiceProvider;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/DeletePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/DeletePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/DeletePhysicalNetworkCmd.java
new file mode 100644
index 0000000..5d146bf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/DeletePhysicalNetworkCmd.java
@@ -0,0 +1,98 @@
+// 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.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Deletes a Physical Network.", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeletePhysicalNetworkCmd.class.getName());
+
+ private static final String s_name = "deletephysicalnetworkresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the Physical network")
+ private Long id;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Physical Network Id: " + id);
+ boolean result = _networkService.deletePhysicalNetwork(getId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network");
+ }
+ }
+
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting Physical network: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PHYSICAL_NETWORK_DELETE;
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PhysicalNetwork;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/DeleteStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/DeleteStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteStorageNetworkIpRangeCmd.java
new file mode 100755
index 0000000..5cb4eb7
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/DeleteStorageNetworkIpRangeCmd.java
@@ -0,0 +1,91 @@
+// 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.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="Deletes a storage network IP Range.", responseObject=SuccessResponse.class, since="3.0.0")
+public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteStorageNetworkIpRangeCmd.class);
+
+ private static final String s_name = "deletestoragenetworkiprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="dc_storage_network_ip_range")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the uuid of the storage network ip range")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_STORAGE_IP_RANGE_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Deleting storage ip range " + getId();
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ try {
+ _storageNetworkService.deleteIpRange(this);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } catch (Exception e) {
+ s_logger.warn("Failed to delete storage network ip range " + getId(), e);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/ListNetworkServiceProvidersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/ListNetworkServiceProvidersCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/ListNetworkServiceProvidersCmd.java
new file mode 100644
index 0000000..efaf15e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/ListNetworkServiceProvidersCmd.java
@@ -0,0 +1,105 @@
+// 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.api.admin.network.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.ProviderResponse;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+
+
+@Implementation(description="Lists network serviceproviders for a given physical network.", responseObject=ProviderResponse.class, since="3.0.0")
+public class ListNetworkServiceProvidersCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListNetworkServiceProvidersCmd.class.getName());
+ private static final String _name = "listnetworkserviceprovidersresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID")
+ private Long physicalNetworkId;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list providers by name")
+ private String name;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list providers by state")
+ private String state;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public void setPhysicalNetworkId(Long physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
+ }
+
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return _name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId(),
+ getName(), getState(), this.getStartIndex(), this.getPageSizeVal());
+ ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
+ List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
+ for (PhysicalNetworkServiceProvider serviceProvider : serviceProviders.first()) {
+ ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
+ serviceProvidersResponses.add(serviceProviderResponse);
+ }
+
+ response.setResponses(serviceProvidersResponses, serviceProviders.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/ListPhysicalNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/ListPhysicalNetworksCmd.java
new file mode 100644
index 0000000..e26e286
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/ListPhysicalNetworksCmd.java
@@ -0,0 +1,106 @@
+// 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.api.admin.network.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.PhysicalNetworkResponse;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.user.Account;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists physical networks", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
+public class ListPhysicalNetworksCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListPhysicalNetworksCmd.class.getName());
+
+ private static final String s_name = "listphysicalnetworksresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list physical network by id")
+ private Long id;
+
+ @IdentityMapper(entityTableName="data_center")
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID for the physical network")
+ private Long zoneId;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="search by name")
+ private String networkName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Pair<List<? extends PhysicalNetwork>, Integer> result = _networkService.searchPhysicalNetworks(getId(),getZoneId(),
+ this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getNetworkName());
+ if (result != null) {
+ ListResponse<PhysicalNetworkResponse> response = new ListResponse<PhysicalNetworkResponse>();
+ List<PhysicalNetworkResponse> networkResponses = new ArrayList<PhysicalNetworkResponse>();
+ for (PhysicalNetwork network : result.first()) {
+ PhysicalNetworkResponse networkResponse = _responseGenerator.createPhysicalNetworkResponse(network);
+ networkResponses.add(networkResponse);
+ }
+ response.setResponses(networkResponses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/ListSupportedNetworkServicesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/ListSupportedNetworkServicesCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/ListSupportedNetworkServicesCmd.java
new file mode 100644
index 0000000..6eaa9cf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/ListSupportedNetworkServicesCmd.java
@@ -0,0 +1,115 @@
+// 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.api.admin.network.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.ServiceResponse;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.network.Network.Service;
+import com.cloud.user.Account;
+
+
+@Implementation(description="Lists all network services provided by CloudStack or for the given Provider.", responseObject=ServiceResponse.class, since="3.0.0")
+public class ListSupportedNetworkServicesCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServicesCmd.class.getName());
+ private static final String _name = "listsupportednetworkservicesresponse";
+
+ @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="network service provider name")
+ private String providerName;
+
+ @Parameter(name=ApiConstants.SERVICE, type=CommandType.STRING, description="network service name to list providers and capabilities of")
+ private String serviceName;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+
+ public void setProviderName(String providerName) {
+ this.providerName = providerName;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return _name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends Network.Service> services;
+ if(getServiceName() != null){
+ Network.Service service = null;
+ if(serviceName != null){
+ service = Network.Service.getService(serviceName);
+ if(service == null){
+ throw new InvalidParameterValueException("Invalid Network Service=" + serviceName);
+ }
+ }
+ List<Network.Service> serviceList = new ArrayList<Network.Service>();
+ serviceList.add(service);
+ services = serviceList;
+ }else{
+ services = _networkService.listNetworkServices(getProviderName());
+ }
+
+ ListResponse<ServiceResponse> response = new ListResponse<ServiceResponse>();
+ List<ServiceResponse> servicesResponses = new ArrayList<ServiceResponse>();
+ for (Network.Service service : services) {
+ //skip gateway service
+ if (service == Service.Gateway) {
+ continue;
+ }
+ ServiceResponse serviceResponse = _responseGenerator.createNetworkServiceResponse(service);
+ servicesResponses.add(serviceResponse);
+ }
+
+ response.setResponses(servicesResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkOfferingCmd.java
new file mode 100755
index 0000000..cb44974
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkOfferingCmd.java
@@ -0,0 +1,112 @@
+// 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.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.NetworkOfferingResponse;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.user.Account;
+
+@Implementation(description="Updates a network offering.", responseObject=NetworkOfferingResponse.class)
+public class UpdateNetworkOfferingCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkOfferingCmd.class.getName());
+ private static final String _name = "updatenetworkofferingresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="network_offerings")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the network offering")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the network offering")
+ private String networkOfferingName;
+
+ @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the network offering")
+ private String displayText;
+
+ @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering." +
+ " Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering")
+ private String availability;
+
+ @Parameter(name=ApiConstants.SORT_KEY, type=CommandType.INTEGER, description="sort key of the network offering, integer")
+ private Integer sortKey;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
+ private String state;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getNetworkOfferingName() {
+ return networkOfferingName;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getAvailability() {
+ return availability;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public Integer getSortKey() {
+ return sortKey;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return _name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ NetworkOffering result = _configService.updateNetworkOffering(this);
+ if (result != null) {
+ NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkServiceProviderCmd.java
new file mode 100644
index 0000000..cdacdd8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateNetworkServiceProviderCmd.java
@@ -0,0 +1,111 @@
+// 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.api.admin.network.command;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.ProviderResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.user.Account;
+
+@Implementation(description="Updates a network serviceProvider of a physical network", responseObject=ProviderResponse.class, since="3.0.0")
+public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateNetworkServiceProviderCmd.class.getName());
+
+ private static final String s_name = "updatenetworkserviceproviderresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled/Shutdown the physical network service provider")
+ private String state;
+
+ @IdentityMapper(entityTableName="physical_network_service_providers")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="network service provider id")
+ private Long id;
+
+ @Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
+ private List<String> enabledServices;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getState() {
+ return state;
+ }
+
+ private Long getId() {
+ return id;
+ }
+
+ public List<String> getEnabledServices() {
+ return enabledServices;
+ }
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
+ if (result != null) {
+ ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }else {
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_SERVICE_PROVIDER_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating physical network ServiceProvider: " + getId();
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PhysicalNetworkServiceProvider;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/UpdatePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/UpdatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/UpdatePhysicalNetworkCmd.java
new file mode 100644
index 0000000..fccde13
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/UpdatePhysicalNetworkCmd.java
@@ -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.api.admin.network.command;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.PhysicalNetworkResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.user.Account;
+
+@Implementation(description="Updates a physical network", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
+public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdatePhysicalNetworkCmd.class.getName());
+
+ private static final String s_name = "updatephysicalnetworkresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @IdentityMapper(entityTableName="physical_network")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="physical network id")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
+ private String speed;
+
+ @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
+ private List<String> tags;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="Enabled/Disabled")
+ private String state;
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
+ private String vlan;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public List<String> getTags() {
+ return tags;
+ }
+
+ public String getNetworkSpeed() {
+ return speed;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getVlan() {
+ return vlan;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
+ PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating Physical network: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PHYSICAL_NETWORK_UPDATE;
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PhysicalNetwork;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/UpdateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateStorageNetworkIpRangeCmd.java
new file mode 100755
index 0000000..7552658
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/UpdateStorageNetworkIpRangeCmd.java
@@ -0,0 +1,120 @@
+// 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.api.admin.network.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.StorageNetworkIpRangeResponse;
+import com.cloud.dc.StorageNetworkIpRange;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="Update a Storage network IP range, only allowed when no IPs in this range have been allocated.", responseObject=StorageNetworkIpRangeResponse.class, since="3.0.0")
+public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateStorageNetworkIpRangeCmd.class);
+ private static final String s_name = "updatestoragenetworkiprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @IdentityMapper(entityTableName="dc_storage_network_ip_range")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="UUID of storage network ip range")
+ private Long id;
+
+ @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, description="the beginning IP address")
+ private String startIp;
+
+ @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, description="the ending IP address")
+ private String endIp;
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.INTEGER, description="Optional. the vlan the ip range sits on")
+ private Integer vlan;
+
+ @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, description="the netmask for storage network")
+ private String netmask;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+ public String getEndIp() {
+ return endIp;
+ }
+
+ public String getStartIp() {
+ return startIp;
+ }
+
+ public Integer getVlan() {
+ return vlan;
+ }
+
+ public String getNetmask() {
+ return netmask;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_STORAGE_IP_RANGE_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Update storage ip range " + getId() + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", vlan=" + getVlan() + ", netmask=" + getNetmask() + ']';
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ try {
+ StorageNetworkIpRange result = _storageNetworkService.updateIpRange(this);
+ StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } catch (Exception e) {
+ s_logger.warn("Update storage network IP range failed", e);
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ }
+
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/admin/network/command/listStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/listStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/listStorageNetworkIpRangeCmd.java
new file mode 100755
index 0000000..06b6e2c
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/listStorageNetworkIpRangeCmd.java
@@ -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 org.apache.cloudstack.api.admin.network.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.StorageNetworkIpRangeResponse;
+import com.cloud.dc.StorageNetworkIpRange;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+
+@Implementation(description="List a storage network IP range.", responseObject=StorageNetworkIpRangeResponse.class, since="3.0.0")
+public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListStorageNetworkIpRangeCmd.class);
+
+ String s_name = "liststoragenetworkiprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @IdentityMapper(entityTableName="dc_storage_network_ip_range")
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.")
+ private Long rangeId;
+
+ @IdentityMapper(entityTableName="host_pod_ref")
+ @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.")
+ private Long podId;
+
+ @IdentityMapper(entityTableName="data_center")
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.")
+ private Long zoneId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getRangeId() {
+ return rangeId;
+ }
+
+ public Long getPodId() {
+ return podId;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException {
+ try {
+ List<StorageNetworkIpRange> results = _storageNetworkService.listIpRange(this);
+ ListResponse<StorageNetworkIpRangeResponse> response = new ListResponse<StorageNetworkIpRangeResponse>();
+ List<StorageNetworkIpRangeResponse> resList = new ArrayList<StorageNetworkIpRangeResponse>(results.size());
+ for (StorageNetworkIpRange r : results) {
+ StorageNetworkIpRangeResponse resp = _responseGenerator.createStorageNetworkIpRangeResponse(r);
+ resList.add(resp);
+ }
+ response.setResponses(resList);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } catch (Exception e) {
+ s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
+ throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java
index 994e6d5..f158e43 100644
--- a/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java
@@ -16,7 +16,7 @@
// under the License.
package org.apache.cloudstack.api.user.network.command;
-import com.cloud.api.commands.DeleteNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/api/test/src/com/cloud/api/commands/test/AddNetworkServiceProviderCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/src/com/cloud/api/commands/test/AddNetworkServiceProviderCmdTest.java b/api/test/src/com/cloud/api/commands/test/AddNetworkServiceProviderCmdTest.java
index 446a161..b484916 100644
--- a/api/test/src/com/cloud/api/commands/test/AddNetworkServiceProviderCmdTest.java
+++ b/api/test/src/com/cloud/api/commands/test/AddNetworkServiceProviderCmdTest.java
@@ -22,6 +22,7 @@ import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.cloudstack.api.admin.network.command.AddNetworkServiceProviderCmd;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -29,7 +30,6 @@ import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.commands.AddNetworkServiceProviderCmd;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.NetworkService;
import com.cloud.network.PhysicalNetworkServiceProvider;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 5632fe6..efa5cd9 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -302,9 +302,9 @@ removeVpnUser=org.apache.cloudstack.api.user.vpn.command.RemoveVpnUserCmd;15
listVpnUsers=org.apache.cloudstack.api.user.vpn.command.ListVpnUsersCmd;15
#### network offering commands
-createNetworkOffering=com.cloud.api.commands.CreateNetworkOfferingCmd;1
-updateNetworkOffering=com.cloud.api.commands.UpdateNetworkOfferingCmd;1
-deleteNetworkOffering=com.cloud.api.commands.DeleteNetworkOfferingCmd;1
+createNetworkOffering=org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;1
+updateNetworkOffering=org.apache.cloudstack.api.admin.network.command.UpdateNetworkOfferingCmd;1
+deleteNetworkOffering=org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;1
listNetworkOfferings=org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;15
#### network commands
@@ -345,16 +345,16 @@ listHypervisorCapabilities=com.cloud.api.commands.ListHypervisorCapabilitiesCmd;
#### Physical Network commands
createPhysicalNetwork=com.cloud.api.commands.CreatePhysicalNetworkCmd;1
-deletePhysicalNetwork=com.cloud.api.commands.DeletePhysicalNetworkCmd;1
-listPhysicalNetworks=com.cloud.api.commands.ListPhysicalNetworksCmd;1
-updatePhysicalNetwork=com.cloud.api.commands.UpdatePhysicalNetworkCmd;1
+deletePhysicalNetwork=org.apache.cloudstack.api.admin.network.command.DeletePhysicalNetworkCmd;1
+listPhysicalNetworks=org.apache.cloudstack.api.admin.network.command.ListPhysicalNetworksCmd;1
+updatePhysicalNetwork=org.apache.cloudstack.api.admin.network.command.UpdatePhysicalNetworkCmd;1
#### Physical Network Service Provider commands
-listSupportedNetworkServices=com.cloud.api.commands.ListSupportedNetworkServicesCmd;1
-addNetworkServiceProvider=com.cloud.api.commands.AddNetworkServiceProviderCmd;1
-deleteNetworkServiceProvider=com.cloud.api.commands.DeleteNetworkServiceProviderCmd;1
-listNetworkServiceProviders=com.cloud.api.commands.ListNetworkServiceProvidersCmd;1
-updateNetworkServiceProvider=com.cloud.api.commands.UpdateNetworkServiceProviderCmd;1
+listSupportedNetworkServices=org.apache.cloudstack.api.admin.network.command.ListSupportedNetworkServicesCmd;1
+addNetworkServiceProvider=org.apache.cloudstack.api.admin.network.command.AddNetworkServiceProviderCmd;1
+deleteNetworkServiceProvider=org.apache.cloudstack.api.admin.network.command.DeleteNetworkServiceProviderCmd;1
+listNetworkServiceProviders=org.apache.cloudstack.api.admin.network.command.ListNetworkServiceProvidersCmd;1
+updateNetworkServiceProvider=org.apache.cloudstack.api.admin.network.command.UpdateNetworkServiceProviderCmd;1
#### Physical Network Traffic Type commands
addTrafficType=com.cloud.api.commands.AddTrafficTypeCmd;1
@@ -365,9 +365,9 @@ listTrafficTypeImplementors=com.cloud.api.commands.ListTrafficTypeImplementorsCm
#### Storage Network commands
createStorageNetworkIpRange=com.cloud.api.commands.CreateStorageNetworkIpRangeCmd;1
-deleteStorageNetworkIpRange=com.cloud.api.commands.DeleteStorageNetworkIpRangeCmd;1
-listStorageNetworkIpRange=com.cloud.api.commands.listStorageNetworkIpRangeCmd;1
-updateStorageNetworkIpRange=com.cloud.api.commands.UpdateStorageNetworkIpRangeCmd;1
+deleteStorageNetworkIpRange=org.apache.cloudstack.api.admin.network.command.DeleteStorageNetworkIpRangeCmd;1
+listStorageNetworkIpRange=org.apache.cloudstack.api.admin.network.command.ListStorageNetworkIpRangeCmd;1
+updateStorageNetworkIpRange=org.apache.cloudstack.api.admin.network.command.UpdateStorageNetworkIpRangeCmd;1
### Network Devices commands
addNetworkDevice=com.cloud.api.commands.AddNetworkDeviceCmd;1
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 4b9b336..bff0cd5 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -38,6 +38,8 @@ import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
+import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.UpdateNetworkOfferingCmd;
import org.apache.log4j.Logger;
import com.cloud.acl.SecurityChecker;
@@ -45,12 +47,11 @@ import com.cloud.alert.AlertManager;
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.commands.CreateDiskOfferingCmd;
-import com.cloud.api.commands.CreateNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;
import com.cloud.api.commands.CreateServiceOfferingCmd;
import com.cloud.api.commands.CreateVlanIpRangeCmd;
import com.cloud.api.commands.CreateZoneCmd;
import com.cloud.api.commands.DeleteDiskOfferingCmd;
-import com.cloud.api.commands.DeleteNetworkOfferingCmd;
import com.cloud.api.commands.DeletePodCmd;
import com.cloud.api.commands.DeleteServiceOfferingCmd;
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
@@ -60,7 +61,6 @@ import com.cloud.api.commands.LDAPRemoveCmd;
import org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;
import com.cloud.api.commands.UpdateCfgCmd;
import com.cloud.api.commands.UpdateDiskOfferingCmd;
-import com.cloud.api.commands.UpdateNetworkOfferingCmd;
import com.cloud.api.commands.UpdatePodCmd;
import com.cloud.api.commands.UpdateServiceOfferingCmd;
import com.cloud.api.commands.UpdateZoneCmd;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/server/src/com/cloud/network/StorageNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/StorageNetworkManagerImpl.java b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
index 3772f55..6413e49 100755
--- a/server/src/com/cloud/network/StorageNetworkManagerImpl.java
+++ b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
@@ -25,12 +25,12 @@ import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.api.admin.network.command.ListStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.admin.network.command.UpdateStorageNetworkIpRangeCmd;
import org.apache.log4j.Logger;
import com.cloud.api.commands.CreateStorageNetworkIpRangeCmd;
-import com.cloud.api.commands.DeleteStorageNetworkIpRangeCmd;
-import com.cloud.api.commands.UpdateStorageNetworkIpRangeCmd;
-import com.cloud.api.commands.listStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.admin.network.command.DeleteStorageNetworkIpRangeCmd;
import com.cloud.dc.HostPodVO;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.StorageNetworkIpAddressVO;
@@ -304,7 +304,7 @@ public class StorageNetworkManagerImpl implements StorageNetworkManager, Storage
}
@Override
- public List<StorageNetworkIpRange> listIpRange(listStorageNetworkIpRangeCmd cmd) {
+ public List<StorageNetworkIpRange> listIpRange(ListStorageNetworkIpRangeCmd cmd) {
Long rangeId = cmd.getRangeId();
Long podId = cmd.getPodId();
Long zoneId = cmd.getZoneId();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2121fbd4/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 73caf5b..c3496f0 100644
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -25,12 +25,12 @@ import javax.naming.ConfigurationException;
import javax.naming.NamingException;
import com.cloud.api.commands.CreateDiskOfferingCmd;
-import com.cloud.api.commands.CreateNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.CreateNetworkOfferingCmd;
import com.cloud.api.commands.CreateServiceOfferingCmd;
import com.cloud.api.commands.CreateVlanIpRangeCmd;
import com.cloud.api.commands.CreateZoneCmd;
import com.cloud.api.commands.DeleteDiskOfferingCmd;
-import com.cloud.api.commands.DeleteNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.DeleteNetworkOfferingCmd;
import com.cloud.api.commands.DeletePodCmd;
import com.cloud.api.commands.DeleteServiceOfferingCmd;
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
@@ -40,7 +40,7 @@ import com.cloud.api.commands.LDAPRemoveCmd;
import org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;
import com.cloud.api.commands.UpdateCfgCmd;
import com.cloud.api.commands.UpdateDiskOfferingCmd;
-import com.cloud.api.commands.UpdateNetworkOfferingCmd;
+import org.apache.cloudstack.api.admin.network.command.UpdateNetworkOfferingCmd;
import com.cloud.api.commands.UpdatePodCmd;
import com.cloud.api.commands.UpdateServiceOfferingCmd;
import com.cloud.api.commands.UpdateZoneCmd;