示例#1
0
  /**
   * It test the dto from the Network specification.
   *
   * @throws Exception
   */
  @Test
  public void testFromDtoII() throws Exception {
    NetworkDto networkDto = new NetworkDto(NETWORK_NAME);
    SubNetworkDto subNetworkDto = new SubNetworkDto(SUBNETWORK_NAME, CIDR);
    networkDto.addSubNetworkDto(subNetworkDto);
    Network net = networkDto.fromDto(VDC, REGION);

    assertEquals(net.getNetworkName(), NETWORK_NAME);
    assertEquals(net.getSubNets().size(), 1);
    for (SubNetwork subNet : net.getSubNets()) {
      assertEquals(subNet.getName(), SUBNETWORK_NAME);
    }
  }
示例#2
0
  /**
   * Create network and subnet test.
   *
   * @throws Exception
   */
  @Test
  public void testCloneSubNets() throws Exception {

    Network network = new Network();
    SubNetwork subnet = new SubNetwork(SUBNETWORK_NAME, VDC, REGION);
    network.addSubNet(subnet);

    Set<SubNetwork> subNets = network.cloneSubNets();

    assertEquals(subNets.size(), 1);
    for (SubNetwork subNet : subNets) {
      assertEquals(subNet.getName(), SUBNETWORK_NAME);
    }
  }
示例#3
0
  /**
   * It tests the creation of network, subnetwork and router.
   *
   * @throws Exception
   */
  @Test
  public void testCreateNetworkAndSubNetAndRouter() throws Exception {

    Network network = new Network(NETWORK_NAME, VDC, REGION);
    SubNetwork subnet = new SubNetwork(SUBNETWORK_NAME, VDC, REGION);
    network.addSubNet(subnet);
    RouterInstance router = new RouterInstance(ID_PUBLIC_NET, ROUTER_NAME);

    router.setIdRouter(ID);
    assertEquals(network.getNetworkName(), NETWORK_NAME);
    assertEquals(network.getSubNets().size(), 1);
    for (SubNetwork subNet : network.getSubNets()) {
      assertEquals(subNet.getName(), SUBNETWORK_NAME);
    }
  }
示例#4
0
  /**
   * Create network and subnet test.
   *
   * @throws Exception
   */
  @Test
  public void testCreateNetworkAndSubNet() throws Exception {

    Network network = new Network(NETWORK_NAME, VDC, REGION);

    SubNetwork subnet = new SubNetwork(SUBNETWORK_NAME, VDC, REGION);
    network.addSubNet(subnet);
    assertEquals(network.getNetworkName(), NETWORK_NAME);
    assertEquals(network.getVdc(), VDC);
    assertEquals(network.getRegion(), REGION);
    assertEquals(network.getSubNets().size(), 1);
    for (SubNetwork subNet : network.getSubNets()) {
      assertEquals(subNet.getName(), SUBNETWORK_NAME);
      assertEquals(subNet.getVdc(), VDC);
      assertEquals(subNet.getRegion(), REGION);
    }
  }