Search in sources :

Example 1 with ContrailSubnetPool

use of org.onap.so.adapters.network.beans.ContrailSubnetPool in project so by onap.

the class ContrailSubnetPoolMapper method map.

public ContrailSubnetPool map() {
    ContrailSubnetPool result = new ContrailSubnetPool();
    if (pool != null) {
        result.setStart(pool.getStart());
        result.setEnd(pool.getEnd());
    }
    return result;
}
Also used : ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool)

Example 2 with ContrailSubnetPool

use of org.onap.so.adapters.network.beans.ContrailSubnetPool in project so by onap.

the class ContrailSubnetMappersTest method contrailSubnetPoolMapperTest.

@Test
public void contrailSubnetPoolMapperTest() {
    Pool pool = new Pool();
    pool.setStart("start");
    pool.setEnd("end");
    ContrailSubnetPoolMapper mapper = new ContrailSubnetPoolMapper(pool);
    ContrailSubnetPool csPool = mapper.map();
    assertEquals("start", csPool.getStart());
    assertEquals("end", csPool.getEnd());
}
Also used : ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) Pool(org.onap.so.openstack.beans.Pool) Test(org.junit.Test)

Example 3 with ContrailSubnetPool

use of org.onap.so.adapters.network.beans.ContrailSubnetPool in project so by onap.

the class ContrailSubnetMappersTest method createContrailSubnetPoolInvalidTest.

@Test
public void createContrailSubnetPoolInvalidTest() {
    List<Pool> pools = new ArrayList<>();
    Pool pool1 = new Pool();
    pool1.setStart("start1");
    pool1.setEnd("end1");
    Pool pool2 = new Pool();
    pool2.setStart("start2");
    pools.add(pool1);
    pools.add(pool2);
    Subnet subnet = new Subnet();
    subnet.setAllocationPools(pools);
    ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
    ContrailSubnet result = mapper.map();
    List<ContrailSubnetPool> cspools = result.getAllocationPools();
    assertEquals(1, cspools.size());
    assertEquals("start1", cspools.get(0).getStart());
    assertEquals("end1", cspools.get(0).getEnd());
}
Also used : ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) ArrayList(java.util.ArrayList) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) Pool(org.onap.so.openstack.beans.Pool) Subnet(org.onap.so.openstack.beans.Subnet) ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) Test(org.junit.Test)

Example 4 with ContrailSubnetPool

use of org.onap.so.adapters.network.beans.ContrailSubnetPool in project so by onap.

the class ContrailSubnetMappersTest method createContrailSubnetPoolTest.

@Test
public void createContrailSubnetPoolTest() {
    List<Pool> pools = new ArrayList<>();
    Pool pool1 = new Pool();
    pool1.setStart("start1");
    pool1.setEnd("end1");
    Pool pool2 = new Pool();
    pool2.setStart("start2");
    pool2.setEnd("end2");
    pools.add(pool1);
    pools.add(pool2);
    Subnet subnet = new Subnet();
    subnet.setAllocationPools(pools);
    ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
    ContrailSubnet result = mapper.map();
    List<ContrailSubnetPool> cspools = result.getAllocationPools();
    assertEquals(2, cspools.size());
    assertEquals("start2", cspools.get(1).getStart());
    assertEquals("end2", cspools.get(1).getEnd());
}
Also used : ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) ArrayList(java.util.ArrayList) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) Pool(org.onap.so.openstack.beans.Pool) Subnet(org.onap.so.openstack.beans.Subnet) ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) Test(org.junit.Test)

Example 5 with ContrailSubnetPool

use of org.onap.so.adapters.network.beans.ContrailSubnetPool in project so by onap.

the class ContrailSubnetMappersTest method createContrailSubnetPoolEmptyTest.

@Test
public void createContrailSubnetPoolEmptyTest() {
    Subnet subnet = new Subnet();
    ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet);
    ContrailSubnet result = mapper.map();
    List<ContrailSubnetPool> cspools = result.getAllocationPools();
    assertEquals(true, cspools.isEmpty());
}
Also used : ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) ContrailSubnetPool(org.onap.so.adapters.network.beans.ContrailSubnetPool) Subnet(org.onap.so.openstack.beans.Subnet) ContrailSubnet(org.onap.so.adapters.network.beans.ContrailSubnet) Test(org.junit.Test)

Aggregations

ContrailSubnetPool (org.onap.so.adapters.network.beans.ContrailSubnetPool)5 Test (org.junit.Test)4 ContrailSubnet (org.onap.so.adapters.network.beans.ContrailSubnet)3 Pool (org.onap.so.openstack.beans.Pool)3 Subnet (org.onap.so.openstack.beans.Subnet)3 ArrayList (java.util.ArrayList)2