incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chirad...@apache.org
Subject [3/16] git commit: Network-refactor: Move code from NetworkManager to NetworkModel. NetworkModel is intended as a read-only view on the network model. This includes Networks, Nics, Ip address, PhysicalNetwork, NetworkOfferings, etc The code in configure(
Date Wed, 09 Jan 2013 23:50:01 GMT
Network-refactor: Move code from NetworkManager to NetworkModel.
NetworkModel is intended as a read-only view on the network model.
This includes Networks, Nics, Ip address, PhysicalNetwork, NetworkOfferings, etc
The code in configure() and start() is used to support queries on the network model which is now the responsibility of the NetworkModel service

Network-refactor: Fix tests so that they get injected with the required NetworkModel mock

Signed-off-by: Chiradeep Vittal <chiradeep@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/6b6d8c57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6b6d8c57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6b6d8c57

Branch: refs/heads/network-refactor
Commit: 6b6d8c5710536bcc0070535c5e01427227373d77
Parents: 5a830c4
Author: Chiradeep Vittal <chiradeep@apache.org>
Authored: Tue Jan 8 11:27:04 2013 -0800
Committer: Chiradeep Vittal <chiradeep@apache.org>
Committed: Wed Jan 9 15:49:01 2013 -0800

----------------------------------------------------------------------
 .../configuration/DefaultComponentLibrary.java     |    2 +
 .../src/com/cloud/network/NetworkManagerImpl.java  |   78 +--
 server/src/com/cloud/network/NetworkModelImpl.java |  109 ++-
 .../network/element/VpcVirtualRouterElement.java   |    6 +-
 .../com/cloud/network/MockNetworkModelImpl.java    |  798 +++++++++++++++
 .../security/SecurityGroupManagerImpl2Test.java    |    2 +
 .../com/cloud/network/vpn/RemoteAccessVpnTest.java |    2 +
 7 files changed, 916 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/src/com/cloud/configuration/DefaultComponentLibrary.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
index 32a6be7..f57c691 100755
--- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java
+++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
@@ -74,6 +74,7 @@ import com.cloud.maint.UpgradeManagerImpl;
 import com.cloud.maint.dao.AgentUpgradeDaoImpl;
 import com.cloud.network.ExternalLoadBalancerUsageManagerImpl;
 import com.cloud.network.NetworkManagerImpl;
+import com.cloud.network.NetworkModelImpl;
 import com.cloud.network.NetworkServiceImpl;
 import com.cloud.network.StorageNetworkManagerImpl;
 import com.cloud.network.as.AutoScaleManagerImpl;
@@ -382,6 +383,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
         addManager("resource limit manager", ResourceLimitManagerImpl.class);
         addManager("network service", NetworkServiceImpl.class);
         addManager("network manager", NetworkManagerImpl.class);
+        addManager("network model", NetworkModelImpl.class);
         addManager("download manager", DownloadMonitorImpl.class);
         addManager("upload manager", UploadMonitorImpl.class);
         addManager("keystore manager", KeystoreManagerImpl.class);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/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 f256a18..8ff3bba 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -106,7 +106,6 @@ import com.cloud.network.dao.FirewallRulesDao;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.LoadBalancerDao;
 import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkDomainDao;
 import com.cloud.network.dao.NetworkServiceMapDao;
 import com.cloud.network.dao.PhysicalNetworkDao;
 import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
@@ -145,7 +144,6 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.org.Grouping;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
-import com.cloud.user.DomainManager;
 import com.cloud.user.ResourceLimitService;
 import com.cloud.user.User;
 import com.cloud.user.UserContext;
@@ -158,7 +156,6 @@ import com.cloud.utils.component.Manager;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
@@ -175,9 +172,9 @@ import com.cloud.vm.ReservationContextImpl;
 import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfileImpl;
 import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.VirtualMachineProfileImpl;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
@@ -275,29 +272,20 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
     @Inject
     NetworkModel _networkModel;
 
-
-    private final HashMap<String, NetworkOfferingVO> _systemNetworks = new HashMap<String, NetworkOfferingVO>(5);
-    static Long _privateOfferingId = null;
-
     ScheduledExecutorService _executor;
 
     SearchBuilder<IPAddressVO> AssignIpAddressSearch;
     SearchBuilder<IPAddressVO> AssignIpAddressFromPodVlanSearch;
-    SearchBuilder<IPAddressVO> IpAddressSearch;
-    SearchBuilder<NicVO> NicForTrafficTypeSearch;
 
     int _networkGcWait;
     int _networkGcInterval;
     String _networkDomain;
-    boolean _allowSubdomainNetworkAccess;
     int _networkLockTimeout;
 
     private Map<String, String> _configs;
 
     HashMap<Long, Long> _lastNetworkIdsToFree = new HashMap<Long, Long>();
 
-    static HashMap<Service, List<Provider>> s_serviceToImplementedProvidersMap = new HashMap<Service, List<Provider>>();
-    static HashMap<String, String> s_providerToNetworkElementMap = new HashMap<String, String>();
 
     @Override
     public PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException {
@@ -891,23 +879,7 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
 
         _networkLockTimeout = NumbersUtil.parseInt(_configs.get(Config.NetworkLockTimeout.key()), 600);
 
-        NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPublicNetwork, TrafficType.Public, true);
-        publicNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(publicNetworkOffering);
-        _systemNetworks.put(NetworkOfferingVO.SystemPublicNetwork, publicNetworkOffering);
-        NetworkOfferingVO managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemManagementNetwork, TrafficType.Management, false);
-        managementNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(managementNetworkOffering);
-        _systemNetworks.put(NetworkOfferingVO.SystemManagementNetwork, managementNetworkOffering);
-        NetworkOfferingVO controlNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemControlNetwork, TrafficType.Control, false);
-        controlNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(controlNetworkOffering);
-        _systemNetworks.put(NetworkOfferingVO.SystemControlNetwork, controlNetworkOffering);
-        NetworkOfferingVO storageNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemStorageNetwork, TrafficType.Storage, true);
-        storageNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(storageNetworkOffering);
-        _systemNetworks.put(NetworkOfferingVO.SystemStorageNetwork, storageNetworkOffering);
-        NetworkOfferingVO privateGatewayNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering,
-                GuestType.Isolated);
-        privateGatewayNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(privateGatewayNetworkOffering);
-        _systemNetworks.put(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering, privateGatewayNetworkOffering);
-        _privateOfferingId = privateGatewayNetworkOffering.getId();
+        
 
 
         // populate providers
@@ -1086,27 +1058,8 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
         AssignIpAddressFromPodVlanSearch.join("vlan", podVlanSearch, podVlanSearch.entity().getId(), AssignIpAddressFromPodVlanSearch.entity().getVlanId(), JoinType.INNER);
         AssignIpAddressFromPodVlanSearch.done();
 
-        IpAddressSearch = _ipAddressDao.createSearchBuilder();
-        IpAddressSearch.and("accountId", IpAddressSearch.entity().getAllocatedToAccountId(), Op.EQ);
-        IpAddressSearch.and("dataCenterId", IpAddressSearch.entity().getDataCenterId(), Op.EQ);
-        IpAddressSearch.and("vpcId", IpAddressSearch.entity().getVpcId(), Op.EQ);
-        IpAddressSearch.and("associatedWithNetworkId", IpAddressSearch.entity().getAssociatedWithNetworkId(), Op.EQ);
-        SearchBuilder<VlanVO> virtualNetworkVlanSB = _vlanDao.createSearchBuilder();
-        virtualNetworkVlanSB.and("vlanType", virtualNetworkVlanSB.entity().getVlanType(), Op.EQ);
-        IpAddressSearch.join("virtualNetworkVlanSB", virtualNetworkVlanSB, IpAddressSearch.entity().getVlanId(), virtualNetworkVlanSB.entity().getId(), JoinBuilder.JoinType.INNER);
-        IpAddressSearch.done();
-
-        NicForTrafficTypeSearch = _nicDao.createSearchBuilder();
-        SearchBuilder<NetworkVO> networkSearch = _networksDao.createSearchBuilder();
-        NicForTrafficTypeSearch.join("network", networkSearch, networkSearch.entity().getId(), NicForTrafficTypeSearch.entity().getNetworkId(), JoinType.INNER);
-        NicForTrafficTypeSearch.and("instance", NicForTrafficTypeSearch.entity().getInstanceId(), Op.EQ);
-        networkSearch.and("traffictype", networkSearch.entity().getTrafficType(), Op.EQ);
-        NicForTrafficTypeSearch.done();
-
         _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Network-Scavenger"));
 
-        _allowSubdomainNetworkAccess = Boolean.valueOf(_configs.get(Config.SubDomainNetworkAccess.key()));
-
         _agentMgr.registerForHostEvents(this, true, false, true);
 
         s_logger.info("Network Manager is configured.");
@@ -1122,33 +1075,6 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
     @Override
     public boolean start() {
 
-        // populate s_serviceToImplementedProvidersMap & s_providerToNetworkElementMap with current _networkElements
-        // Need to do this in start() since _networkElements are not completely configured until then.
-        for (NetworkElement element : _networkElements) {
-            Map<Service, Map<Capability, String>> capabilities = element.getCapabilities();
-            Provider implementedProvider = element.getProvider();
-            if (implementedProvider != null) {
-                if (s_providerToNetworkElementMap.containsKey(implementedProvider.getName())) {
-                    s_logger.error("Cannot start NetworkManager: Provider <-> NetworkElement must be a one-to-one map, " +
-                            "multiple NetworkElements found for Provider: " + implementedProvider.getName());
-                    return false;
-                }
-                s_providerToNetworkElementMap.put(implementedProvider.getName(), element.getName());
-            }
-            if (capabilities != null && implementedProvider != null) {
-                for (Service service : capabilities.keySet()) {
-                    if (s_serviceToImplementedProvidersMap.containsKey(service)) {
-                        List<Provider> providers = s_serviceToImplementedProvidersMap.get(service);
-                        providers.add(implementedProvider);
-                    } else {
-                        List<Provider> providers = new ArrayList<Provider>();
-                        providers.add(implementedProvider);
-                        s_serviceToImplementedProvidersMap.put(service, providers);
-                    }
-                }
-            }
-        }
-
         _executor.scheduleWithFixedDelay(new NetworkGarbageCollector(), _networkGcInterval, _networkGcInterval, TimeUnit.SECONDS);
         return true;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 819c57b..e9d4fbb 100644
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -27,6 +27,9 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
 import org.apache.log4j.Logger;
 
 import com.cloud.configuration.Config;
@@ -81,9 +84,13 @@ import com.cloud.user.DomainManager;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.component.Adapters;
 import com.cloud.utils.component.Inject;
+import com.cloud.utils.component.Manager;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.JoinBuilder.JoinType;
+import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.Nic;
@@ -95,8 +102,8 @@ import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
-
-public class NetworkModelImpl  implements NetworkModel{
+@Local(value = { NetworkModel.class})
+public class NetworkModelImpl  implements NetworkModel, Manager{
     static final Logger s_logger = Logger.getLogger(NetworkModelImpl.class);
 
     String _name;
@@ -164,8 +171,8 @@ public class NetworkModelImpl  implements NetworkModel{
     SearchBuilder<NicVO> NicForTrafficTypeSearch;
 
    
-    String _networkDomain;
-    boolean _allowSubdomainNetworkAccess;
+    private String _networkDomain;
+    private boolean _allowSubdomainNetworkAccess;
 
     private Map<String, String> _configs;
 
@@ -1731,4 +1738,98 @@ public class NetworkModelImpl  implements NetworkModel{
             return false;
         }
     }
+
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        _name = name;
+        _configs = _configDao.getConfiguration("Network", params);
+        _networkDomain = _configs.get(Config.GuestDomainSuffix.key());
+        _allowSubdomainNetworkAccess = Boolean.valueOf(_configs.get(Config.SubDomainNetworkAccess.key()));
+
+        NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPublicNetwork, TrafficType.Public, true);
+        publicNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(publicNetworkOffering);
+        _systemNetworks.put(NetworkOfferingVO.SystemPublicNetwork, publicNetworkOffering);
+        NetworkOfferingVO managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemManagementNetwork, TrafficType.Management, false);
+        managementNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(managementNetworkOffering);
+        _systemNetworks.put(NetworkOfferingVO.SystemManagementNetwork, managementNetworkOffering);
+        NetworkOfferingVO controlNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemControlNetwork, TrafficType.Control, false);
+        controlNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(controlNetworkOffering);
+        _systemNetworks.put(NetworkOfferingVO.SystemControlNetwork, controlNetworkOffering);
+        NetworkOfferingVO storageNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemStorageNetwork, TrafficType.Storage, true);
+        storageNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(storageNetworkOffering);
+        _systemNetworks.put(NetworkOfferingVO.SystemStorageNetwork, storageNetworkOffering);
+        NetworkOfferingVO privateGatewayNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering,
+                GuestType.Isolated);
+        privateGatewayNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(privateGatewayNetworkOffering);
+        _systemNetworks.put(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering, privateGatewayNetworkOffering);
+        _privateOfferingId = privateGatewayNetworkOffering.getId();
+        
+        
+        IpAddressSearch = _ipAddressDao.createSearchBuilder();
+        IpAddressSearch.and("accountId", IpAddressSearch.entity().getAllocatedToAccountId(), Op.EQ);
+        IpAddressSearch.and("dataCenterId", IpAddressSearch.entity().getDataCenterId(), Op.EQ);
+        IpAddressSearch.and("vpcId", IpAddressSearch.entity().getVpcId(), Op.EQ);
+        IpAddressSearch.and("associatedWithNetworkId", IpAddressSearch.entity().getAssociatedWithNetworkId(), Op.EQ);
+        SearchBuilder<VlanVO> virtualNetworkVlanSB = _vlanDao.createSearchBuilder();
+        virtualNetworkVlanSB.and("vlanType", virtualNetworkVlanSB.entity().getVlanType(), Op.EQ);
+        IpAddressSearch.join("virtualNetworkVlanSB", virtualNetworkVlanSB, IpAddressSearch.entity().getVlanId(), virtualNetworkVlanSB.entity().getId(), JoinBuilder.JoinType.INNER);
+        IpAddressSearch.done();
+        
+        NicForTrafficTypeSearch = _nicDao.createSearchBuilder();
+        SearchBuilder<NetworkVO> networkSearch = _networksDao.createSearchBuilder();
+        NicForTrafficTypeSearch.join("network", networkSearch, networkSearch.entity().getId(), NicForTrafficTypeSearch.entity().getNetworkId(), JoinType.INNER);
+        NicForTrafficTypeSearch.and("instance", NicForTrafficTypeSearch.entity().getInstanceId(), Op.EQ);
+        networkSearch.and("traffictype", networkSearch.entity().getTrafficType(), Op.EQ);
+        NicForTrafficTypeSearch.done();
+        
+        s_logger.info("Network Model is configured.");
+
+        return true;
+    }
+
+ 
+    @Override
+    public boolean start() {
+        // populate s_serviceToImplementedProvidersMap & s_providerToNetworkElementMap with current _networkElements
+        // Need to do this in start() since _networkElements are not completely configured until then.
+        for (NetworkElement element : _networkElements) {
+            Map<Service, Map<Capability, String>> capabilities = element.getCapabilities();
+            Provider implementedProvider = element.getProvider();
+            if (implementedProvider != null) {
+                if (s_providerToNetworkElementMap.containsKey(implementedProvider.getName())) {
+                    s_logger.error("Cannot start NetworkModel: Provider <-> NetworkElement must be a one-to-one map, " +
+                            "multiple NetworkElements found for Provider: " + implementedProvider.getName());
+                    return false;
+                }
+                s_providerToNetworkElementMap.put(implementedProvider.getName(), element.getName());
+            }
+            if (capabilities != null && implementedProvider != null) {
+                for (Service service : capabilities.keySet()) {
+                    if (s_serviceToImplementedProvidersMap.containsKey(service)) {
+                        List<Provider> providers = s_serviceToImplementedProvidersMap.get(service);
+                        providers.add(implementedProvider);
+                    } else {
+                        List<Provider> providers = new ArrayList<Provider>();
+                        providers.add(implementedProvider);
+                        s_serviceToImplementedProvidersMap.put(service, providers);
+                    }
+                }
+            }
+        }
+        s_logger.info("Started Network Model");
+        return true;
+    }
+
+   
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+
+    @Override
+    public String getName() {
+        return _name;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index ab748b2..1bc6b9c 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -60,7 +60,11 @@ import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.VirtualMachineProfile;
-@Local(value = {NetworkElement.class, Site2SiteVpnServiceProvider.class})
+@Local(value = {NetworkElement.class, FirewallServiceProvider.class, 
+        DhcpServiceProvider.class, UserDataServiceProvider.class, 
+        StaticNatServiceProvider.class, LoadBalancingServiceProvider.class,
+        PortForwardingServiceProvider.class, IpDeployer.class,
+        Site2SiteVpnServiceProvider.class, NetworkACLServiceProvider.class})
 public class VpcVirtualRouterElement extends VirtualRouterElement implements VpcProvider, Site2SiteVpnServiceProvider, NetworkACLServiceProvider{
     private static final Logger s_logger = Logger.getLogger(VpcVirtualRouterElement.class);
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/test/com/cloud/network/MockNetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkModelImpl.java b/server/test/com/cloud/network/MockNetworkModelImpl.java
new file mode 100644
index 0000000..80b9c0f
--- /dev/null
+++ b/server/test/com/cloud/network/MockNetworkModelImpl.java
@@ -0,0 +1,798 @@
+// 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.network;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import com.cloud.dc.Vlan;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.addr.PublicIp;
+import com.cloud.network.element.NetworkElement;
+import com.cloud.network.element.UserDataServiceProvider;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.user.Account;
+import com.cloud.utils.component.Manager;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.VirtualMachine;
+
+@Local(value = {NetworkModel.class})
+public class MockNetworkModelImpl implements NetworkModel, Manager {
+
+    /* (non-Javadoc)
+     * @see com.cloud.utils.component.Manager#configure(java.lang.String, java.util.Map)
+     */
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.utils.component.Manager#start()
+     */
+    @Override
+    public boolean start() {
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.utils.component.Manager#stop()
+     */
+    @Override
+    public boolean stop() {
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.utils.component.Manager#getName()
+     */
+    @Override
+    public String getName() {
+        return "MockNetworkModelImpl";
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listPublicIpsAssignedToGuestNtwk(long, long, java.lang.Boolean)
+     */
+    @Override
+    public List<IPAddressVO> listPublicIpsAssignedToGuestNtwk(long accountId, long associatedNetworkId,
+            Boolean sourceNat) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getSystemAccountNetworkOfferings(java.lang.String[])
+     */
+    @Override
+    public List<NetworkOfferingVO> getSystemAccountNetworkOfferings(String... offeringNames) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNics(long)
+     */
+    @Override
+    public List<? extends Nic> getNics(long vmId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNextAvailableMacAddressInNetwork(long)
+     */
+    @Override
+    public String getNextAvailableMacAddressInNetwork(long networkConfigurationId)
+            throws InsufficientAddressCapacityException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#validateRule(com.cloud.network.rules.FirewallRule)
+     */
+    @Override
+    public boolean validateRule(FirewallRule rule) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getPublicIpAddress(long)
+     */
+    @Override
+    public PublicIpAddress getPublicIpAddress(long ipAddressId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listPodVlans(long)
+     */
+    @Override
+    public List<? extends Vlan> listPodVlans(long podId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listNetworksUsedByVm(long, boolean)
+     */
+    @Override
+    public List<NetworkVO> listNetworksUsedByVm(long vmId, boolean isSystem) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNicInNetwork(long, long)
+     */
+    @Override
+    public Nic getNicInNetwork(long vmId, long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNicsForTraffic(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public List<? extends Nic> getNicsForTraffic(long vmId, TrafficType type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultNetworkForVm(long)
+     */
+    @Override
+    public Network getDefaultNetworkForVm(long vmId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultNic(long)
+     */
+    @Override
+    public Nic getDefaultNic(long vmId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getUserDataUpdateProvider(com.cloud.network.Network)
+     */
+    @Override
+    public UserDataServiceProvider getUserDataUpdateProvider(Network network) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#networkIsConfiguredForExternalNetworking(long, long)
+     */
+    @Override
+    public boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkServiceCapabilities(long, com.cloud.network.Network.Service)
+     */
+    @Override
+    public Map<Capability, String> getNetworkServiceCapabilities(long networkId, Service service) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#areServicesSupportedByNetworkOffering(long, com.cloud.network.Network.Service[])
+     */
+    @Override
+    public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkWithSecurityGroupEnabled(java.lang.Long)
+     */
+    @Override
+    public NetworkVO getNetworkWithSecurityGroupEnabled(Long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getIpOfNetworkElementInVirtualNetwork(long, long)
+     */
+    @Override
+    public String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listNetworksForAccount(long, long, com.cloud.network.Network.GuestType)
+     */
+    @Override
+    public List<NetworkVO> listNetworksForAccount(long accountId, long zoneId, GuestType type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listAllNetworksInAllZonesByType(com.cloud.network.Network.GuestType)
+     */
+    @Override
+    public List<NetworkVO> listAllNetworksInAllZonesByType(GuestType type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getGlobalGuestDomainSuffix()
+     */
+    @Override
+    public String getGlobalGuestDomainSuffix() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getStartIpAddress(long)
+     */
+    @Override
+    public String getStartIpAddress(long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getIpInNetwork(long, long)
+     */
+    @Override
+    public String getIpInNetwork(long vmId, long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getIpInNetworkIncludingRemoved(long, long)
+     */
+    @Override
+    public String getIpInNetworkIncludingRemoved(long vmId, long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getPodIdForVlan(long)
+     */
+    @Override
+    public Long getPodIdForVlan(long vlanDbId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listNetworkOfferingsForUpgrade(long)
+     */
+    @Override
+    public List<Long> listNetworkOfferingsForUpgrade(long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isSecurityGroupSupportedInNetwork(com.cloud.network.Network)
+     */
+    @Override
+    public boolean isSecurityGroupSupportedInNetwork(Network network) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isProviderSupportServiceInNetwork(long, com.cloud.network.Network.Service, com.cloud.network.Network.Provider)
+     */
+    @Override
+    public boolean isProviderSupportServiceInNetwork(long networkId, Service service, Provider provider) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isProviderEnabledInPhysicalNetwork(long, java.lang.String)
+     */
+    @Override
+    public boolean isProviderEnabledInPhysicalNetwork(long physicalNetowrkId, String providerName) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkTag(com.cloud.hypervisor.Hypervisor.HypervisorType, com.cloud.network.Network)
+     */
+    @Override
+    public String getNetworkTag(HypervisorType hType, Network network) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getElementServices(com.cloud.network.Network.Provider)
+     */
+    @Override
+    public List<Service> getElementServices(Provider provider) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#canElementEnableIndividualServices(com.cloud.network.Network.Provider)
+     */
+    @Override
+    public boolean canElementEnableIndividualServices(Provider provider) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#areServicesSupportedInNetwork(long, com.cloud.network.Network.Service[])
+     */
+    @Override
+    public boolean areServicesSupportedInNetwork(long networkId, Service... services) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isNetworkSystem(com.cloud.network.Network)
+     */
+    @Override
+    public boolean isNetworkSystem(Network network) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkOfferingServiceCapabilities(com.cloud.offering.NetworkOffering, com.cloud.network.Network.Service)
+     */
+    @Override
+    public Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getPhysicalNetworkId(com.cloud.network.Network)
+     */
+    @Override
+    public Long getPhysicalNetworkId(Network network) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getAllowSubdomainAccessGlobal()
+     */
+    @Override
+    public boolean getAllowSubdomainAccessGlobal() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isProviderForNetwork(com.cloud.network.Network.Provider, long)
+     */
+    @Override
+    public boolean isProviderForNetwork(Provider provider, long networkId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isProviderForNetworkOffering(com.cloud.network.Network.Provider, long)
+     */
+    @Override
+    public boolean isProviderForNetworkOffering(Provider provider, long networkOfferingId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#canProviderSupportServices(java.util.Map)
+     */
+    @Override
+    public void canProviderSupportServices(Map<Provider, Set<Service>> providersMap) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getPhysicalNetworkInfo(long, com.cloud.hypervisor.Hypervisor.HypervisorType)
+     */
+    @Override
+    public List<PhysicalNetworkSetupInfo> getPhysicalNetworkInfo(long dcId, HypervisorType hypervisorType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#canAddDefaultSecurityGroup()
+     */
+    @Override
+    public boolean canAddDefaultSecurityGroup() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listNetworkOfferingServices(long)
+     */
+    @Override
+    public List<Service> listNetworkOfferingServices(long networkOfferingId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#areServicesEnabledInZone(long, com.cloud.offering.NetworkOffering, java.util.List)
+     */
+    @Override
+    public boolean areServicesEnabledInZone(long zoneId, NetworkOffering offering, List<Service> services) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getIpToServices(java.util.List, boolean, boolean)
+     */
+    @Override
+    public Map<PublicIp, Set<Service>> getIpToServices(List<PublicIp> publicIps, boolean rulesRevoked,
+            boolean includingFirewall) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getProviderToIpList(com.cloud.network.Network, java.util.Map)
+     */
+    @Override
+    public Map<Provider, ArrayList<PublicIp>> getProviderToIpList(Network network,
+            Map<PublicIp, Set<Service>> ipToServices) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#checkIpForService(com.cloud.network.IPAddressVO, com.cloud.network.Network.Service, java.lang.Long)
+     */
+    @Override
+    public boolean checkIpForService(IPAddressVO ip, Service service, Long networkId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#checkCapabilityForProvider(java.util.Set, com.cloud.network.Network.Service, com.cloud.network.Network.Capability, java.lang.String)
+     */
+    @Override
+    public void checkCapabilityForProvider(Set<Provider> providers, Service service, Capability cap, String capValue) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultUniqueProviderForService(java.lang.String)
+     */
+    @Override
+    public Provider getDefaultUniqueProviderForService(String serviceName) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#checkNetworkPermissions(com.cloud.user.Account, com.cloud.network.Network)
+     */
+    @Override
+    public void checkNetworkPermissions(Account owner, Network network) {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultManagementTrafficLabel(long, com.cloud.hypervisor.Hypervisor.HypervisorType)
+     */
+    @Override
+    public String getDefaultManagementTrafficLabel(long zoneId, HypervisorType hypervisorType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultStorageTrafficLabel(long, com.cloud.hypervisor.Hypervisor.HypervisorType)
+     */
+    @Override
+    public String getDefaultStorageTrafficLabel(long zoneId, HypervisorType hypervisorType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultPublicTrafficLabel(long, com.cloud.hypervisor.Hypervisor.HypervisorType)
+     */
+    @Override
+    public String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultGuestTrafficLabel(long, com.cloud.hypervisor.Hypervisor.HypervisorType)
+     */
+    @Override
+    public String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getElementImplementingProvider(java.lang.String)
+     */
+    @Override
+    public NetworkElement getElementImplementingProvider(String providerName) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getAccountNetworkDomain(long, long)
+     */
+    @Override
+    public String getAccountNetworkDomain(long accountId, long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultNetworkDomain()
+     */
+    @Override
+    public String getDefaultNetworkDomain() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNtwkOffDistinctProviders(long)
+     */
+    @Override
+    public List<Provider> getNtwkOffDistinctProviders(long ntwkOffId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listPublicIpsAssignedToAccount(long, long, java.lang.Boolean)
+     */
+    @Override
+    public List<IPAddressVO> listPublicIpsAssignedToAccount(long accountId, long dcId, Boolean sourceNat) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getPhysicalNtwksSupportingTrafficType(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
+     */
+    @Override
+    public boolean isPrivateGateway(Nic guestNic) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkCapabilities(long)
+     */
+    @Override
+    public Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getSystemNetworkByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDedicatedNetworkDomain(long)
+     */
+    @Override
+    public Long getDedicatedNetworkDomain(long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkOfferingServiceProvidersMap(long)
+     */
+    @Override
+    public Map<Service, Set<Provider>> getNetworkOfferingServiceProvidersMap(long networkOfferingId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listSupportedNetworkServiceProviders(java.lang.String)
+     */
+    @Override
+    public List<? extends Provider> listSupportedNetworkServiceProviders(String serviceName) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#listNetworksByVpc(long)
+     */
+    @Override
+    public List<? extends Network> listNetworksByVpc(long vpcId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#canUseForDeploy(com.cloud.network.Network)
+     */
+    @Override
+    public boolean canUseForDeploy(Network network) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getExclusiveGuestNetwork(long)
+     */
+    @Override
+    public Network getExclusiveGuestNetwork(long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#findPhysicalNetworkId(long, java.lang.String, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetworkRate(long, java.lang.Long)
+     */
+    @Override
+    public Integer getNetworkRate(long networkId, Long vmId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isVmPartOfNetwork(long, long)
+     */
+    @Override
+    public boolean isVmPartOfNetwork(long vmId, long ntwkId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDefaultPhysicalNetworkByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNetwork(long)
+     */
+    @Override
+    public Network getNetwork(long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getIp(long)
+     */
+    @Override
+    public IpAddress getIp(long sourceIpAddressId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#isNetworkAvailableInDomain(long, long)
+     */
+    @Override
+    public boolean isNetworkAvailableInDomain(long networkId, long domainId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getNicProfile(com.cloud.vm.VirtualMachine, long, java.lang.String)
+     */
+    @Override
+    public NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getAvailableIps(com.cloud.network.Network, java.lang.String)
+     */
+    @Override
+    public Set<Long> getAvailableIps(Network network, String requestedIp) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.NetworkModel#getDomainNetworkDomain(long, long)
+     */
+    @Override
+    public String getDomainNetworkDomain(long domainId, long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/test/com/cloud/network/security/SecurityGroupManagerImpl2Test.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/security/SecurityGroupManagerImpl2Test.java b/server/test/com/cloud/network/security/SecurityGroupManagerImpl2Test.java
index c4b4e94..9c3e331 100644
--- a/server/test/com/cloud/network/security/SecurityGroupManagerImpl2Test.java
+++ b/server/test/com/cloud/network/security/SecurityGroupManagerImpl2Test.java
@@ -33,6 +33,7 @@ import com.cloud.configuration.dao.ConfigurationDaoImpl;
 import com.cloud.domain.dao.DomainDaoImpl;
 import com.cloud.event.dao.UsageEventDaoImpl;
 import com.cloud.network.MockNetworkManagerImpl;
+import com.cloud.network.MockNetworkModelImpl;
 import com.cloud.network.security.dao.SecurityGroupDaoImpl;
 import com.cloud.network.security.dao.SecurityGroupRuleDaoImpl;
 import com.cloud.network.security.dao.SecurityGroupRulesDaoImpl;
@@ -81,6 +82,7 @@ public class SecurityGroupManagerImpl2Test extends TestCase {
         locator.addManager("VirtualMachineManager", MockVirtualMachineManagerImpl.class);
         locator.addManager("UserVmManager", MockUserVmManagerImpl.class);
         locator.addManager("NetworkManager", MockNetworkManagerImpl.class);
+        locator.addManager("NetworkModel", MockNetworkModelImpl.class);
         locator.addManager("AccountManager", MockAccountManagerImpl.class); 
         locator.addManager("DomainManager", MockDomainManagerImpl.class); 
         locator.addManager("ProjectManager", MockProjectManagerImpl.class);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6b6d8c57/server/test/com/cloud/network/vpn/RemoteAccessVpnTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/vpn/RemoteAccessVpnTest.java b/server/test/com/cloud/network/vpn/RemoteAccessVpnTest.java
index f18626a..25d52e7 100644
--- a/server/test/com/cloud/network/vpn/RemoteAccessVpnTest.java
+++ b/server/test/com/cloud/network/vpn/RemoteAccessVpnTest.java
@@ -19,6 +19,7 @@ import com.cloud.domain.dao.DomainDaoImpl;
 import com.cloud.event.dao.UsageEventDaoImpl;
 import com.cloud.network.MockFirewallManagerImpl;
 import com.cloud.network.MockNetworkManagerImpl;
+import com.cloud.network.MockNetworkModelImpl;
 import com.cloud.network.MockRulesManagerImpl;
 import com.cloud.network.dao.FirewallRulesDaoImpl;
 import com.cloud.network.dao.IPAddressDaoImpl;
@@ -53,6 +54,7 @@ public class RemoteAccessVpnTest {
 		locator.addManager("AccountManager", MockAccountManagerImpl.class);
 		locator.addManager("DomainManager", MockDomainManagerImpl.class);
 		locator.addManager("NetworkManager", MockNetworkManagerImpl.class);
+	    locator.addManager("NetworkModel", MockNetworkModelImpl.class);
 		locator.addManager("RulesManager", MockRulesManagerImpl.class);
 		locator.addManager("FirewallManager", MockFirewallManagerImpl.class);
 	}


Mime
View raw message