Examples of VcNetwork


Examples of com.vmware.aurora.vc.VcNetwork

   @Override
   public boolean isNetworkExistInVc(String networkName)
         throws VcProviderException {
      boolean result = false;
      refreshNetwork();
      VcNetwork network = VcResourceUtils.findNetworkInVC(networkName);
      if (network != null) {
         result = true;
      }
      return result;
   }
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

   @Override
   public List<VcNetwork> getAvailableNetworks() throws VcProviderException {
      List<NetworkEntity> networkList = networkDao.findAllNetworks();
      List<VcNetwork> result = new ArrayList<VcNetwork>();
      for (NetworkEntity networkEntity : networkList) {
         VcNetwork network =
               VcResourceUtils.findNetworkInVC(networkEntity.getPortGroup());
         if (network != null) {
            result.add(network);
         } else {
            logger.warn("Could not find the network in the vCenter. Network name: "
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

   @Override
   public boolean isNetworkSharedInCluster(String networkName,
         String clusterName) throws VcProviderException {
      boolean result = true;
      refreshNetwork();
      VcNetwork vcNetwork = getNetworkByName(networkName);
      if (vcNetwork == null) {
         return false;
      } else {
         String portGroupName = vcNetwork.getName();
         List<VcHost> hosts = getHostsByClusterName(clusterName);
         for (VcHost vcHost : hosts) {
            List<VcNetwork> networks = vcHost.getNetworks();
            boolean found = false;
            for (VcNetwork network : networks) {
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

      refreshNetwork();
      Set<String> networkNames = new HashSet<String>();
      networkNames.addAll(networkList);
      Set<String> portGroupNames = new HashSet<String>();
      for (String networkName : networkNames) {
         VcNetwork vcNetwork = getNetworkByName(networkName);
         if (vcNetwork == null) {
            throw VcProviderException.NETWORK_NOT_FOUND(networkName);
         }
         portGroupNames.add(vcNetwork.getName());
      }

      List<String> noNetworkHosts = new ArrayList<String>();
      for (com.vmware.bdd.spectypes.VcCluster cluster : clusters) {
         List<VcHost> hosts = getHostsByClusterName(cluster.getName());
         for (VcHost vcHost : hosts) {
            // check each host has all the networks
            List<VcNetwork> vcNetworks = vcHost.getNetworks();
            List<String> hostNetworkNames = new ArrayList<String>();
            for (VcNetwork vcNetwork : vcNetworks) {
               hostNetworkNames.add(vcNetwork.getName());
            }
            if (!hostNetworkNames.containsAll(portGroupNames)) {
               logger.info("host" + vcHost.getName() + " has networks " + vcNetworks
                     + " does not have target network " + portGroupNames);
               noNetworkHosts.add(vcHost.getName());
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

         List<com.vmware.bdd.spectypes.VcCluster> clusters) {
      refreshNetwork();

      Set<String> portGroupNames = new HashSet<String>();
      for (String networkName : networkList) {
         VcNetwork vcNetwork = getNetworkByName(networkName);
         if (vcNetwork == null) {
            throw VcProviderException.NETWORK_NOT_FOUND(networkName);
         }
         portGroupNames.add(vcNetwork.getName());
      }

      for (com.vmware.bdd.spectypes.VcCluster cluster : clusters) {
         List<VcHost> hosts = getHostsByClusterName(cluster.getName());
         for (VcHost vcHost : hosts) {
            List<VcNetwork> vcNetworks = vcHost.getNetworks();
            List<String> hostNetworkNames = new ArrayList<String>();
            for (VcNetwork vcNetwork : vcNetworks) {
               hostNetworkNames.add(vcNetwork.getName());
            }
            if (hostNetworkNames.containsAll(portGroupNames)) {
               return true;
            }
         }
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

   public static void setNetworkSchema(ConfigSpecImpl spec, VcCluster cluster,
         NetworkSchema networkSchema, VcVirtualMachine vcVm) throws Exception {
      List<VirtualDeviceSpec> changes = new ArrayList<VirtualDeviceSpec>();

      for (NetworkSchema.Network network : networkSchema.networks) {
         VcNetwork vN = cluster.getNetwork(network.vcNetwork);
         if (vN == null) {
            logger.error("Network " + network.vcNetwork + " is not defined on cluster " + cluster.getName());
            throw new Exception("Network " + network.vcNetwork + " is not defined on cluster " + cluster.getName());
         }
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

      Assert.assertEquals(ds.getName(), "test_1");
   }

   @Test
   public void testFindNetworkInVC() {
      VcNetwork net = VcResourceUtils.findNetworkInVC("port2");
      Assert.assertNull(net);
      net = VcResourceUtils.findNetworkInVC("port1");
      Assert.assertNotNull(net);
   }
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

      List<VcCluster> clusters = new ArrayList<VcCluster>();
      clusters.add(cluster1);
      Mockito.when(cluster1.getDatastore("test_1")).thenReturn(ds1);
     
      List<VcNetwork> nets = new ArrayList<VcNetwork>();
      VcNetwork net1 = Mockito.mock(VcNetwork.class);
      Mockito.when(net1.getName()).thenReturn("port1");
      nets.add(net1);
      Mockito.when(cluster1.getAllNetworks()).thenReturn(nets);

      Mockito.when(cluster1.getName()).thenReturn("cluster1");
      List<VcHost> hosts = new ArrayList<VcHost>();
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

            networkDao.findNetworkByName(anyString);
            result = network;
         }
      };
      resSvc.setNetworkDao(networkDao);
      VcNetwork vcNetwork = resSvc.getNetworkByName("testNetwork");
      Assert.assertNotNull(vcNetwork);
   }
View Full Code Here

Examples of com.vmware.aurora.vc.VcNetwork

            AuAssert.check(newRp.getPath().equals(rp.getPath()));
            AuAssert.check(newRp.getName().equals(rp.getName()));
         }

         for (VcNetwork net : cluster.getSharedNetworks()) {
            VcNetwork newNet = VcCache.get(net.getId());
            System.out.println(newNet + ", id=" + newNet.getId());
            AuAssert.check(net.getId().equals(newNet.getId()));
         }

         for (VcDatastore ds : cluster.getSharedDatastores()) {
            VcDatastore newDs = VcCache.get(ds.getId());
            System.out.println(newDs + ", id=" + newDs.getId());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.