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/04 11:02:56 UTC

[24/55] [abbrv] api_refactor: refactor network apis

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkACLCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkACLCmd.java
new file mode 100644
index 0000000..d34d07d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkACLCmd.java
@@ -0,0 +1,121 @@
+// 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.user.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.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Deletes a Network ACL", responseObject=SuccessResponse.class)
+public class DeleteNetworkACLCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DeleteNetworkACLCmd.class.getName());
+    private static final String s_name = "deletenetworkaclresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="firewall_rules")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network ACL")
+    private Long id;
+
+    // unexposed parameter needed for events logging
+    @IdentityMapper(entityTableName="account")
+    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, expose=false)
+    private Long ownerId;
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_FIREWALL_CLOSE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  ("Deleting Network ACL id=" + id);
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        if (ownerId == null) {
+            FirewallRule rule = _networkACLService.getNetworkACL(id);
+            if (rule == null) {
+                throw new InvalidParameterValueException("Unable to find network ACL by id=" + id);
+            } else {
+                ownerId = rule.getAccountId();
+            }
+        }
+        return ownerId;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException {
+        UserContext.current().setEventDetails("Network ACL Id: " + id);
+        boolean result = _networkACLService.revokeNetworkACL(id, true);
+
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network ACL");
+        }
+    }
+
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return _firewallService.getFirewallRule(id).getNetworkId();
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.FirewallRule;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/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
new file mode 100644
index 0000000..994e6d5
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/DeleteNetworkCmd.java
@@ -0,0 +1,109 @@
+// 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.user.network.command;
+
+import com.cloud.api.commands.DeleteNetworkOfferingCmd;
+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.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Deletes a network", responseObject=SuccessResponse.class)
+public class DeleteNetworkCmd extends BaseAsyncCmd{
+    public static final Logger s_logger = Logger.getLogger(DeleteNetworkOfferingCmd.class.getName());
+    private static final String s_name = "deletenetworkresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network")
+    private Long id;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Network Id: " + id);
+        boolean result = _networkService.deleteNetwork(id);
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network");
+        }
+    }
+
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return id;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_DELETE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Deleting network: " + id;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Network network = _networkService.getNetwork(id);
+        if (network == null) {
+            throw new InvalidParameterValueException("Networkd id=" + id + " doesn't exist");
+        } else {
+            return _networkService.getNetwork(id).getAccountId();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkACLsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkACLsCmd.java
new file mode 100644
index 0000000..4696ab8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkACLsCmd.java
@@ -0,0 +1,94 @@
+// 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.user.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.BaseListTaggedResourcesCmd;
+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.NetworkACLResponse;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.utils.Pair;
+
+@Implementation(description="Lists all network ACLs", responseObject=NetworkACLResponse.class)
+public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListNetworkACLsCmd.class.getName());
+
+    private static final String s_name = "listnetworkaclsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="firewall_rules")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="Lists network ACL with the specified ID.")
+    private Long id;
+
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="list network ACLs by network Id")
+    private Long networkId;
+
+    @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list network ACLs by traffic type - Ingress or Egress")
+    private String trafficType;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getTrafficType() {
+        return trafficType;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public void execute(){
+        Pair<List<? extends FirewallRule>,Integer> result = _networkACLService.listNetworkACLs(this);
+        ListResponse<NetworkACLResponse> response = new ListResponse<NetworkACLResponse>();
+        List<NetworkACLResponse> aclResponses = new ArrayList<NetworkACLResponse>();
+
+        for (FirewallRule acl : result.first()) {
+            NetworkACLResponse ruleData = _responseGenerator.createNetworkACLResponse(acl);
+            aclResponses.add(ruleData);
+        }
+        response.setResponses(aclResponses, result.second());
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkOfferingsCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkOfferingsCmd.java
new file mode 100644
index 0000000..71d760b
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworkOfferingsCmd.java
@@ -0,0 +1,191 @@
+// 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.user.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.NetworkOfferingResponse;
+import com.cloud.offering.NetworkOffering;
+
+
+@Implementation(description="Lists all available network offerings.", responseObject=NetworkOfferingResponse.class)
+public class ListNetworkOfferingsCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
+    private static final String _name = "listnetworkofferingsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="network_offerings")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list network offerings by id")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list network offerings by name")
+    private String networkOfferingName;
+
+    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="list network offerings by display text")
+    private String displayText;
+
+    @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="list by traffic type")
+    private String trafficType;
+
+    @Parameter(name=ApiConstants.IS_DEFAULT, type=CommandType.BOOLEAN, description="true if need to list only default network offerings. Default value is false")
+    private Boolean isDefault;
+
+    @Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="the tags for the network offering.")
+    private Boolean specifyVlan;
+
+    @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required")
+    private String availability;
+
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
+    private String state;
+
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.")
+    private Long networkId;
+
+    @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="list network offerings by guest type: Shared or Isolated")
+    private String guestIpType;
+
+    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list network offerings supporting certain services")
+    private List<String> supportedServices;
+
+    @Parameter(name=ApiConstants.SOURCE_NAT_SUPPORTED, type=CommandType.BOOLEAN, description="true if need to list only netwok offerings where source nat is supported, false otherwise")
+    private Boolean sourceNatSupported;
+
+    @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if need to list only network offerings which support specifying ip ranges")
+    private Boolean specifyIpRanges;
+
+    @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="list network offerings by tags", length=4096)
+    private String tags;
+
+    @Parameter(name=ApiConstants.IS_TAGGED, type=CommandType.BOOLEAN, description="true if offering has tags specified")
+    private Boolean isTagged;
+
+    @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="the network offering can be used" +
+            " only for network creation inside the VPC")
+    private Boolean forVpc;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getNetworkOfferingName() {
+        return networkOfferingName;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public String getTrafficType() {
+        return trafficType;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Boolean getIsDefault() {
+        return isDefault;
+    }
+
+    public Boolean getSpecifyVlan() {
+        return specifyVlan;
+    }
+
+    public String getAvailability() {
+        return availability;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public Long getNetworkId() {
+        return networkId;
+    }
+
+    public String getGuestIpType() {
+        return guestIpType;
+    }
+
+    public List<String> getSupportedServices() {
+        return supportedServices;
+    }
+
+    public Boolean getSourceNatSupported() {
+        return sourceNatSupported;
+    }
+
+    public Boolean getSpecifyIpRanges() {
+        return specifyIpRanges;
+    }
+
+    public String getTags() {
+        return tags;
+    }
+
+    public Boolean isTagged() {
+        return isTagged;
+    }
+
+    public Boolean getForVpc() {
+        return forVpc;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return _name;
+    }
+
+    @Override
+    public void execute(){
+        List<? extends NetworkOffering> offerings = _configService.searchForNetworkOfferings(this);
+        ListResponse<NetworkOfferingResponse> response = new ListResponse<NetworkOfferingResponse>();
+        List<NetworkOfferingResponse> offeringResponses = new ArrayList<NetworkOfferingResponse>();
+        for (NetworkOffering offering : offerings) {
+            NetworkOfferingResponse offeringResponse = _responseGenerator.createNetworkOfferingResponse(offering);
+            offeringResponses.add(offeringResponse);
+        }
+
+        response.setResponses(offeringResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworksCmd.java
new file mode 100644
index 0000000..945fbb6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/ListNetworksCmd.java
@@ -0,0 +1,164 @@
+// 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.user.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.BaseListTaggedResourcesCmd;
+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.NetworkResponse;
+import com.cloud.network.Network;
+
+
+@Implementation(description="Lists all available networks.", responseObject=NetworkResponse.class)
+public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
+    private static final String _name = "listnetworksresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list networks by id")
+    private Long id;
+
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the network")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
+    private String guestIpType;
+
+    @Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")
+    private Boolean isSystem;
+
+    @Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="list networks by ACL (access control list) type. Supported values are Account and Domain")
+    private String aclType;
+
+    @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, description="type of the traffic")
+    private String trafficType;
+
+    @IdentityMapper(entityTableName="physical_network")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="list networks by physical network id")
+    private Long physicalNetworkId;
+
+    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list networks supporting certain services")
+    private List<String> supportedServices;
+
+    @Parameter(name=ApiConstants.RESTART_REQUIRED, type=CommandType.BOOLEAN, description="list networks by restartRequired")
+
+    private Boolean restartRequired;
+
+    @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if need to list only networks which support specifying ip ranges")
+    private Boolean specifyIpRanges;
+
+    @IdentityMapper(entityTableName="vpc")
+    @Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="List networks by VPC")
+    private Long vpcId;
+
+    @Parameter(name=ApiConstants.CAN_USE_FOR_DEPLOY, type=CommandType.BOOLEAN, description="list networks available for vm deployment")
+    private Boolean canUseForDeploy;
+
+    @Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="the network belongs to vpc")
+    private Boolean forVpc;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public String getGuestIpType() {
+        return guestIpType;
+    }
+
+    public Boolean getIsSystem() {
+        return isSystem;
+    }
+
+    public String getAclType() {
+        return aclType;
+    }
+
+    public String getTrafficType() {
+        return trafficType;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public List<String> getSupportedServices() {
+        return supportedServices;
+    }
+
+    public Boolean getRestartRequired() {
+        return restartRequired;
+    }
+
+    public Boolean getSpecifyIpRanges() {
+        return specifyIpRanges;
+    }
+
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+    public Boolean canUseForDeploy() {
+        return canUseForDeploy;
+    }
+
+    public Boolean getForVpc() {
+        return forVpc;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return _name;
+    }
+
+    @Override
+    public void execute(){
+        List<? extends Network> networks = _networkService.searchForNetworks(this);
+        ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
+        List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
+        for (Network network : networks) {
+            NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
+            networkResponses.add(networkResponse);
+        }
+
+        response.setResponses(networkResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/RestartNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/RestartNetworkCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/RestartNetworkCmd.java
new file mode 100644
index 0000000..5065937
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/RestartNetworkCmd.java
@@ -0,0 +1,130 @@
+// 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.user.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.IPAddressResponse;
+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.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+
+@Implementation(description="Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules", responseObject=IPAddressResponse.class)
+public class RestartNetworkCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RestartNetworkCmd.class.getName());
+    private static final String s_name = "restartnetworkresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The id of the network to restart.")
+    private Long id;
+
+    @Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, required=false, description="If cleanup old network elements")
+    private Boolean cleanup;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getNetworkId() {
+        Network network = _networkService.getNetwork(id);
+        if (network == null) {
+            throw new InvalidParameterValueException("Unable to find network by id " + id);
+        } else {
+            return network.getId();
+        }
+    }
+
+    public Boolean getCleanup() {
+        if (cleanup != null) {
+            return cleanup;
+        }
+        return true;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "addressinfo";
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
+        boolean result = _networkService.restartNetwork(this, getCleanup());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart network");
+        }
+    }
+
+    @Override
+    public String getSyncObjType() {
+        return BaseAsyncCmd.networkSyncObject;
+    }
+
+    @Override
+    public Long getSyncObjId() {
+        return id;
+    }
+
+    public String getEventDescription() {
+        return  "Restarting network: " + getNetworkId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_RESTART;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Network network = _networkService.getNetwork(id);
+        if (network == null) {
+            throw new InvalidParameterValueException("Networkd id=" + id + " doesn't exist");
+        } else {
+            return _networkService.getNetwork(id).getAccountId();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/api/src/org/apache/cloudstack/api/user/network/command/UpdateNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/network/command/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/user/network/command/UpdateNetworkCmd.java
new file mode 100644
index 0000000..2b3dd29
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/user/network/command/UpdateNetworkCmd.java
@@ -0,0 +1,152 @@
+// 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.user.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.NetworkResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+
+@Implementation(description="Updates a network", responseObject=NetworkResponse.class)
+public class UpdateNetworkCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmd.class.getName());
+
+    private static final String s_name = "updatenetworkresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @IdentityMapper(entityTableName="networks")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the network")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the new name for the network")
+    private String name;
+
+    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the new display text for the network")
+    private String displayText;
+
+    @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
+    private String networkDomain;
+
+    @Parameter(name=ApiConstants.CHANGE_CIDR, type=CommandType.BOOLEAN, description="Force update even if cidr type is different")
+    private Boolean changeCidr;
+
+    @IdentityMapper(entityTableName="network_offerings")
+    @Parameter(name=ApiConstants.NETWORK_OFFERING_ID, type=CommandType.LONG, description="network offering ID")
+    private Long networkOfferingId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getNetworkName() {
+        return name;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    private String getNetworkDomain() {
+        return networkDomain;
+    }
+
+    private Long getNetworkOfferingId() {
+        return networkOfferingId;
+    }
+
+    public Boolean getChangeCidr() {
+        if (changeCidr != null) {
+            return changeCidr;
+        }
+        return false;
+    }
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Network network = _networkService.getNetwork(id);
+        if (network == null) {
+            throw new InvalidParameterValueException("Networkd id=" + id + " doesn't exist");
+        } else {
+            return _networkService.getNetwork(id).getAccountId();
+        }
+    }
+
+    @Override
+    public void execute() throws InsufficientCapacityException, ConcurrentOperationException{
+        User callerUser = _accountService.getActiveUser(UserContext.current().getCallerUserId());
+        Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId());
+        Network network = _networkService.getNetwork(id);
+        if (network == null) {
+            throw new InvalidParameterValueException("Couldn't find network by id");
+        }
+
+        Network result = null;
+        if (network.getVpcId() != null) {
+            result = _vpcService.updateVpcGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+                    callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
+        } else {
+            result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+                    callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
+        }
+
+        if (result != null) {
+            NetworkResponse response = _responseGenerator.createNetworkResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Updating network: " + getId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NETWORK_UPDATE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index faa3166..abf8dd3 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -306,14 +306,14 @@ listVpnUsers=com.cloud.api.commands.ListVpnUsersCmd;15
 createNetworkOffering=com.cloud.api.commands.CreateNetworkOfferingCmd;1
 updateNetworkOffering=com.cloud.api.commands.UpdateNetworkOfferingCmd;1
 deleteNetworkOffering=com.cloud.api.commands.DeleteNetworkOfferingCmd;1
-listNetworkOfferings=com.cloud.api.commands.ListNetworkOfferingsCmd;15
+listNetworkOfferings=org.apache.cloudstack.api.user.network.command.ListNetworkOfferingsCmd;15
 
 #### network commands
-createNetwork=com.cloud.api.commands.CreateNetworkCmd;15
-deleteNetwork=com.cloud.api.commands.DeleteNetworkCmd;15
-listNetworks=com.cloud.api.commands.ListNetworksCmd;15
-restartNetwork=com.cloud.api.commands.RestartNetworkCmd;15
-updateNetwork=com.cloud.api.commands.UpdateNetworkCmd;15
+createNetwork=org.apache.cloudstack.api.user.network.command.CreateNetworkCmd;15
+deleteNetwork=org.apache.cloudstack.api.user.network.command.DeleteNetworkCmd;15
+listNetworks=org.apache.cloudstack.api.user.network.command.ListNetworksCmd;15
+restartNetwork=org.apache.cloudstack.api.user.network.command.RestartNetworkCmd;15
+updateNetwork=org.apache.cloudstack.api.user.network.command.UpdateNetworkCmd;15
 
 #### SSH key pair commands
 registerSSHKeyPair=com.cloud.api.commands.RegisterSSHKeyPairCmd;15
@@ -399,9 +399,9 @@ listPrivateGateways=org.apache.cloudstack.api.user.vpc.command.ListPrivateGatewa
 deletePrivateGateway=com.cloud.api.commands.DeletePrivateGatewayCmd;1
 
 #### Network ACL commands
-createNetworkACL=com.cloud.api.commands.CreateNetworkACLCmd;15
-deleteNetworkACL=com.cloud.api.commands.DeleteNetworkACLCmd;15
-listNetworkACLs=com.cloud.api.commands.ListNetworkACLsCmd;15
+createNetworkACL=org.apache.cloudstack.api.user.network.command.CreateNetworkACLCmd;15
+deleteNetworkACL=org.apache.cloudstack.api.user.network.command.DeleteNetworkACLCmd;15
+listNetworkACLs=org.apache.cloudstack.api.user.network.command.ListNetworkACLsCmd;15
 
 #### Static route commands
 createStaticRoute=org.apache.cloudstack.api.user.vpc.command.CreateStaticRouteCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/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 467f7e0..4b9b336 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -57,7 +57,7 @@ import com.cloud.api.commands.DeleteVlanIpRangeCmd;
 import com.cloud.api.commands.DeleteZoneCmd;
 import com.cloud.api.commands.LDAPConfigCmd;
 import com.cloud.api.commands.LDAPRemoveCmd;
-import com.cloud.api.commands.ListNetworkOfferingsCmd;
+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;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index f4868e7..a451141 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -40,6 +40,7 @@ import java.util.concurrent.TimeUnit;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.api.user.network.command.CreateNetworkCmd;
 import org.apache.log4j.Logger;
 
 import com.cloud.acl.ControlledEntity.ACLType;
@@ -56,10 +57,9 @@ import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.alert.AlertManager;
-import com.cloud.api.commands.CreateNetworkCmd;
-import com.cloud.api.commands.ListNetworksCmd;
+import org.apache.cloudstack.api.user.network.command.ListNetworksCmd;
 import com.cloud.api.commands.ListTrafficTypeImplementorsCmd;
-import com.cloud.api.commands.RestartNetworkCmd;
+import org.apache.cloudstack.api.user.network.command.RestartNetworkCmd;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.Resource.ResourceType;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
index b126c0e..dc08af2 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
@@ -26,7 +26,7 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 
 import com.cloud.acl.SecurityChecker.AccessType;
-import com.cloud.api.commands.ListNetworkACLsCmd;
+import org.apache.cloudstack.api.user.network.command.ListNetworkACLsCmd;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java
index a038e71..fef1eb0 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -25,10 +25,10 @@ import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
 import com.cloud.acl.ControlledEntity.ACLType;
-import com.cloud.api.commands.CreateNetworkCmd;
-import com.cloud.api.commands.ListNetworksCmd;
+import org.apache.cloudstack.api.user.network.command.CreateNetworkCmd;
+import org.apache.cloudstack.api.user.network.command.ListNetworksCmd;
 import com.cloud.api.commands.ListTrafficTypeImplementorsCmd;
-import com.cloud.api.commands.RestartNetworkCmd;
+import org.apache.cloudstack.api.user.network.command.RestartNetworkCmd;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Vlan;
 import com.cloud.dc.Vlan.VlanType;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/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 f8fc6a7..73caf5b 100644
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -37,7 +37,7 @@ import com.cloud.api.commands.DeleteVlanIpRangeCmd;
 import com.cloud.api.commands.DeleteZoneCmd;
 import com.cloud.api.commands.LDAPConfigCmd;
 import com.cloud.api.commands.LDAPRemoveCmd;
-import com.cloud.api.commands.ListNetworkOfferingsCmd;
+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;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/47ae62e4/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 2ac39f0..344b59e 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -25,13 +25,13 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.api.user.network.command.ListNetworksCmd;
 import org.apache.log4j.Logger;
 
 import com.cloud.acl.ControlledEntity.ACLType;
-import com.cloud.api.commands.CreateNetworkCmd;
-import com.cloud.api.commands.ListNetworksCmd;
+import org.apache.cloudstack.api.user.network.command.CreateNetworkCmd;
 import com.cloud.api.commands.ListTrafficTypeImplementorsCmd;
-import com.cloud.api.commands.RestartNetworkCmd;
+import org.apache.cloudstack.api.user.network.command.RestartNetworkCmd;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Vlan;
 import com.cloud.dc.Vlan.VlanType;