Package com.cloud.network.dao

Examples of com.cloud.network.dao.PhysicalNetworkVO


    NetworkOffering offering = mock(NetworkOffering.class);
    when(offering.getId()).thenReturn(42L);
    when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
    when(offering.getGuestType()).thenReturn(GuestType.Isolated);
 
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(true);
   
    assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
   
    // Not supported TrafficType != Guest
    when(offering.getTrafficType()).thenReturn(TrafficType.Management);
    assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
   
    // Not supported: GuestType Shared
    when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
    when(offering.getGuestType()).thenReturn(GuestType.Shared);
    assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
   
    // Not supported: Basic networking
    when(offering.getGuestType()).thenReturn(GuestType.Isolated);
    assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet) == true);
   
    // Not supported: IsolationMethod != STT
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
    assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
   
  }
View Full Code Here


  }
 
 
  @Test
  public void testDesign() {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

    assertTrue(designednetwork.getBroadcastDomainType() == BroadcastDomainType.Lswitch);   
  }
 
  @Test
  public void testDesignNoElementOnPhysicalNetwork() {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
   
    NetworkOffering offering = mock(NetworkOffering.class);
View Full Code Here

    assertTrue(designednetwork == null)
  }
 
  @Test
  public void testDesignNoIsolationMethodSTT() {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "VLAN" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Collections.<NiciraNvpDeviceVO> emptyList());
   
    NetworkOffering offering = mock(NetworkOffering.class);
View Full Code Here

    assertTrue(designednetwork == null);     
  }
 
  @Test
  public void testDesignNoConnectivityInOffering() {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

    assertTrue(designednetwork == null);   
  }
 
  @Test
  public void testImplement() throws InsufficientVirtualNetworkCapcityException {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

    verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
  }

  @Test
  public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

    verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
  }
 
  @Test
  public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

    @Override
    public Network design(NetworkOffering offering, DeploymentPlan plan,
                          Network userSpecified, Account owner) {
        s_logger.debug("design called");
        // Check if the isolation type of the related physical network is MIDO
        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
        if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("MIDO")) {
            s_logger.debug("Refusing to design this network, the physical isolation type is not MIDO");
            return null;
        }

        s_logger.debug("Physical isolation type is MIDO, asking GuestNetworkGuru to design this network");
View Full Code Here

    verify(agentmgr, times(1)).easySend(eq(42L), (Command)any());
  }
 
  @Test
  public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException {
    PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
    when(physnetdao.findById((Long) any())).thenReturn(physnet);
    when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" }));
    when(physnet.getId()).thenReturn(42L);
   
    NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class);
    when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device }));
    when(device.getId()).thenReturn(1L);
   
View Full Code Here

TOP

Related Classes of com.cloud.network.dao.PhysicalNetworkVO

Copyright © 2018 www.massapicom. 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.