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/06 00:01:15 UTC

[10/10] git commit: api_refactor: move network api for admin pkg

api_refactor: move network api for admin pkg

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/678181ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/678181ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/678181ac

Branch: refs/heads/api_refactoring
Commit: 678181ac35ad83240ce7bb1505bc32ce12d8990f
Parents: ee0a4a4
Author: Rohit Yadav <bh...@apache.org>
Authored: Wed Dec 5 13:59:54 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Wed Dec 5 13:59:54 2012 -0800

----------------------------------------------------------------------
 .../api/commands/CreatePhysicalNetworkCmd.java     |  175 ---------------
 .../commands/CreateStorageNetworkIpRangeCmd.java   |  127 -----------
 .../com/cloud/network/StorageNetworkService.java   |    2 +-
 .../network/command/CreatePhysicalNetworkCmd.java  |  175 +++++++++++++++
 .../command/CreateStorageNetworkIpRangeCmd.java    |  127 +++++++++++
 .../command/ListStorageNetworkIpRangeCmd.java      |  108 +++++++++
 .../command/listStorageNetworkIpRangeCmd.java      |  108 ---------
 client/tomcatconf/commands.properties.in           |    4 +-
 .../cloud/network/StorageNetworkManagerImpl.java   |    2 +-
 9 files changed, 414 insertions(+), 414 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/678181ac/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java
deleted file mode 100644
index 39829b2..0000000
--- a/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java
+++ /dev/null
@@ -1,175 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-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.PhysicalNetworkResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-
-@Implementation(description="Creates a physical network", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
-public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
-    public static final Logger s_logger = Logger.getLogger(CreatePhysicalNetworkCmd.class.getName());
-
-    private static final String s_name = "createphysicalnetworkresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the physical network")
-    private Long zoneId;
-
-    @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
-    private String vlan;
-
-    @Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
-    private String speed;
-
-    @IdentityMapper(entityTableName="domain")
-    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a physical network")
-    private Long domainId;
-
-    @Parameter(name=ApiConstants.BROADCAST_DOMAIN_RANGE, type=CommandType.STRING, description="the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic")
-    private String broadcastDomainRange;
-
-    @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
-    private List<String> tags;
-
-    @Parameter(name=ApiConstants.ISOLATION_METHODS, type=CommandType.LIST, collectionType=CommandType.STRING, description="the isolation method for the physical network[VLAN/L3/GRE]")
-    private List<String> isolationMethods;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the physical network")
-    private String networkName;
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public List<String> getTags() {
-        return tags;
-    }
-
-    @Override
-    public String getEntityTable() {
-        return "physical_network";
-    }
-
-    public Long getZoneId() {
-        return zoneId;
-    }
-
-    public String getVlan() {
-        return vlan;
-    }
-
-    public Long getDomainId() {
-        return domainId;
-    }
-
-    public String getBroadcastDomainRange() {
-        return broadcastDomainRange;
-    }
-
-    public List<String> getIsolationMethods() {
-        return isolationMethods;
-    }
-
-    public String getNetworkSpeed() {
-        return speed;
-    }
-
-    public String getNetworkName() {
-        return networkName;
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
-    }
-
-    @Override
-    public String getCreateEventType() {
-        return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
-    }
-
-    @Override
-    public String getCreateEventDescription() {
-        return "creating Physical Network";
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "creating Physical Network. Id: "+getEntityId();
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Physical Network Id: "+getEntityId());
-        PhysicalNetwork result = _networkService.getCreatedPhysicalNetwork(getEntityId());
-        if (result != null) {
-            PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        }else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
-        }
-    }
-
-    @Override
-    public void create() throws ResourceAllocationException {
-        PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags(), getNetworkName());
-        if (result != null) {
-            setEntityId(result.getId());
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
-        }
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.PhysicalNetwork;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/678181ac/api/src/com/cloud/api/commands/CreateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateStorageNetworkIpRangeCmd.java b/api/src/com/cloud/api/commands/CreateStorageNetworkIpRangeCmd.java
deleted file mode 100755
index 49a4395..0000000
--- a/api/src/com/cloud/api/commands/CreateStorageNetworkIpRangeCmd.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-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="Creates a Storage network IP range.", responseObject=StorageNetworkIpRangeResponse.class, since="3.0.0")
-public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(CreateStorageNetworkIpRangeCmd.class);
-
-    private static final String s_name = "createstoragenetworkiprangeresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-    @IdentityMapper(entityTableName="host_pod_ref")
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, required=true, description="UUID of pod where the ip range belongs to")
-    private Long podId;
-
-    @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, 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, default to Null when it is not specificed which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table")
-    private Integer vlan;
-
-    @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask for storage network")
-    private String netmask;
-
-    @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway for storage network")
-    private String gateway;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getEndIp() {
-        return endIp;
-    }
-
-    public Long getPodId() {
-        return podId;
-    }
-
-    public String getStartIp() {
-        return startIp;
-    }
-
-    public Integer getVlan() {
-        return vlan;
-    }
-
-    public String getNetmask() {
-        return netmask;
-    }
-
-    public String getGateWay() {
-        return gateway;
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_STORAGE_IP_RANGE_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Creating storage ip range from " + getStartIp() + " to " + getEndIp() + " with vlan " + getVlan();
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
-            ResourceAllocationException {
-        try {
-            StorageNetworkIpRange result = _storageNetworkService.createIpRange(this);
-            StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } catch (Exception e) {
-            s_logger.warn("Create 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/678181ac/api/src/com/cloud/network/StorageNetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/StorageNetworkService.java b/api/src/com/cloud/network/StorageNetworkService.java
index 1cc92ed..7a7c5ca 100755
--- a/api/src/com/cloud/network/StorageNetworkService.java
+++ b/api/src/com/cloud/network/StorageNetworkService.java
@@ -19,7 +19,7 @@ package com.cloud.network;
 import java.sql.SQLException;
 import java.util.List;
 
-import com.cloud.api.commands.CreateStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.admin.network.command.CreateStorageNetworkIpRangeCmd;
 import org.apache.cloudstack.api.admin.network.command.DeleteStorageNetworkIpRangeCmd;
 import org.apache.cloudstack.api.admin.network.command.UpdateStorageNetworkIpRangeCmd;
 import org.apache.cloudstack.api.admin.network.command.ListStorageNetworkIpRangeCmd;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/678181ac/api/src/org/apache/cloudstack/api/admin/network/command/CreatePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/CreatePhysicalNetworkCmd.java
new file mode 100644
index 0000000..5216e72
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/CreatePhysicalNetworkCmd.java
@@ -0,0 +1,175 @@
+// 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.BaseAsyncCreateCmd;
+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.PhysicalNetworkResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Creates a physical network", responseObject=PhysicalNetworkResponse.class, since="3.0.0")
+public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
+    public static final Logger s_logger = Logger.getLogger(CreatePhysicalNetworkCmd.class.getName());
+
+    private static final String s_name = "createphysicalnetworkresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the physical network")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
+    private String vlan;
+
+    @Parameter(name=ApiConstants.NETWORK_SPEED, type=CommandType.STRING, description="the speed for the physical network[1G/10G]")
+    private String speed;
+
+    @IdentityMapper(entityTableName="domain")
+    @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="domain ID of the account owning a physical network")
+    private Long domainId;
+
+    @Parameter(name=ApiConstants.BROADCAST_DOMAIN_RANGE, type=CommandType.STRING, description="the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic")
+    private String broadcastDomainRange;
+
+    @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="Tag the physical network")
+    private List<String> tags;
+
+    @Parameter(name=ApiConstants.ISOLATION_METHODS, type=CommandType.LIST, collectionType=CommandType.STRING, description="the isolation method for the physical network[VLAN/L3/GRE]")
+    private List<String> isolationMethods;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the physical network")
+    private String networkName;
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public List<String> getTags() {
+        return tags;
+    }
+
+    @Override
+    public String getEntityTable() {
+        return "physical_network";
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getVlan() {
+        return vlan;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public String getBroadcastDomainRange() {
+        return broadcastDomainRange;
+    }
+
+    public List<String> getIsolationMethods() {
+        return isolationMethods;
+    }
+
+    public String getNetworkSpeed() {
+        return speed;
+    }
+
+    public String getNetworkName() {
+        return networkName;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
+    }
+
+    @Override
+    public String getCreateEventType() {
+        return EventTypes.EVENT_PHYSICAL_NETWORK_CREATE;
+    }
+
+    @Override
+    public String getCreateEventDescription() {
+        return "creating Physical Network";
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "creating Physical Network. Id: "+getEntityId();
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Physical Network Id: "+getEntityId());
+        PhysicalNetwork result = _networkService.getCreatedPhysicalNetwork(getEntityId());
+        if (result != null) {
+            PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        }else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
+        }
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags(), getNetworkName());
+        if (result != null) {
+            setEntityId(result.getId());
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
+        }
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.PhysicalNetwork;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/678181ac/api/src/org/apache/cloudstack/api/admin/network/command/CreateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/network/command/CreateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/admin/network/command/CreateStorageNetworkIpRangeCmd.java
new file mode 100755
index 0000000..5c0273b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/network/command/CreateStorageNetworkIpRangeCmd.java
@@ -0,0 +1,127 @@
+// 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="Creates a Storage network IP range.", responseObject=StorageNetworkIpRangeResponse.class, since="3.0.0")
+public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(CreateStorageNetworkIpRangeCmd.class);
+
+    private static final String s_name = "createstoragenetworkiprangeresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="host_pod_ref")
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, required=true, description="UUID of pod where the ip range belongs to")
+    private Long podId;
+
+    @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, 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, default to Null when it is not specificed which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table")
+    private Integer vlan;
+
+    @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask for storage network")
+    private String netmask;
+
+    @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway for storage network")
+    private String gateway;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getEndIp() {
+        return endIp;
+    }
+
+    public Long getPodId() {
+        return podId;
+    }
+
+    public String getStartIp() {
+        return startIp;
+    }
+
+    public Integer getVlan() {
+        return vlan;
+    }
+
+    public String getNetmask() {
+        return netmask;
+    }
+
+    public String getGateWay() {
+        return gateway;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_STORAGE_IP_RANGE_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Creating storage ip range from " + getStartIp() + " to " + getEndIp() + " with vlan " + getVlan();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException {
+        try {
+            StorageNetworkIpRange result = _storageNetworkService.createIpRange(this);
+            StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } catch (Exception e) {
+            s_logger.warn("Create 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/678181ac/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/678181ac/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
deleted file mode 100755
index 06b6e2c..0000000
--- a/api/src/org/apache/cloudstack/api/admin/network/command/listStorageNetworkIpRangeCmd.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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/678181ac/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 0504b27..2c50991 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -344,7 +344,7 @@ updateHypervisorCapabilities=com.cloud.api.commands.UpdateHypervisorCapabilities
 listHypervisorCapabilities=com.cloud.api.commands.ListHypervisorCapabilitiesCmd;1
 
 #### Physical Network commands
-createPhysicalNetwork=com.cloud.api.commands.CreatePhysicalNetworkCmd;1
+createPhysicalNetwork=org.apache.cloudstack.api.admin.network.command.CreatePhysicalNetworkCmd;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
@@ -364,7 +364,7 @@ updateTrafficType=com.cloud.api.commands.UpdateTrafficTypeCmd;1
 listTrafficTypeImplementors=com.cloud.api.commands.ListTrafficTypeImplementorsCmd;1
 
 #### Storage Network commands
-createStorageNetworkIpRange=com.cloud.api.commands.CreateStorageNetworkIpRangeCmd;1
+createStorageNetworkIpRange=org.apache.cloudstack.api.admin.network.command.CreateStorageNetworkIpRangeCmd;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

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/678181ac/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 6413e49..04dfcd3 100755
--- a/server/src/com/cloud/network/StorageNetworkManagerImpl.java
+++ b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
@@ -25,11 +25,11 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.api.admin.network.command.CreateStorageNetworkIpRangeCmd;
 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 org.apache.cloudstack.api.admin.network.command.DeleteStorageNetworkIpRangeCmd;
 import com.cloud.dc.HostPodVO;
 import com.cloud.dc.StorageNetworkIpRange;