Search in sources :

Example 1 with NetworkInfo

use of org.onap.so.openstack.beans.NetworkInfo in project so by onap.

the class MsoNeutronUtilsTest method updateNetworkTest.

@Test
public void updateNetworkTest() throws Exception {
    StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
    StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
    NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe", MsoNeutronUtils.NetworkType.PROVIDER, "PROVIDER", vlans);
    Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9", networkInfo.getId());
}
Also used : NetworkInfo(org.onap.so.openstack.beans.NetworkInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 2 with NetworkInfo

use of org.onap.so.openstack.beans.NetworkInfo in project so by onap.

the class MsoNeutronUtilsTest method updateNetworkTest_NetworkTypeAsMultiProvider.

@Test
public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
    StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
    StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
    NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe", MsoNeutronUtils.NetworkType.MULTI_PROVIDER, "PROVIDER", vlans);
    Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9", networkInfo.getId());
}
Also used : NetworkInfo(org.onap.so.openstack.beans.NetworkInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 3 with NetworkInfo

use of org.onap.so.openstack.beans.NetworkInfo in project so by onap.

the class MsoNeutronUtilsTest method createNetworkTest_NetworkTypeAsMultiProvider.

@Test
public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
    StubOpenStack.mockOpenstackPostNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json");
    NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.MULTI_PROVIDER, "networkName", "PROVIDER", vlans);
    Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9", networkInfo.getId());
}
Also used : NetworkInfo(org.onap.so.openstack.beans.NetworkInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 4 with NetworkInfo

use of org.onap.so.openstack.beans.NetworkInfo in project so by onap.

the class NetworkInfoMapper method map.

/**
 * Capture the data from a Neutron Network object.
 *
 * For MSO, there are assumptions regarding all networks. - Everything will be a provider network - All provider
 * networks are VLANs - Multiple VLANs are supported, and indicated by multi-provider segments. Each will have the
 * same physical network & network type "vlan".
 *
 * @param network
 */
public NetworkInfo map() {
    final NetworkInfo info = new NetworkInfo();
    if (network == null) {
        info.setStatus(NetworkStatus.NOTFOUND);
    } else {
        info.setName(network.getName());
        info.setId(network.getId());
        info.setStatus(this.mapStatus(network.getStatus()));
        Pair<Optional<String>, List<Integer>> result = locateVlanInformation(network);
        Optional<String> value0 = result.getValue0();
        if (value0.isPresent()) {
            info.setProvider(value0.get());
        }
        info.setVlans(result.getValue1());
        info.setSubnets(network.getSubnets());
    }
    return info;
}
Also used : Optional(java.util.Optional) NetworkInfo(org.onap.so.openstack.beans.NetworkInfo) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with NetworkInfo

use of org.onap.so.openstack.beans.NetworkInfo in project so by onap.

the class NetworkInfoMapperTest method mapFields.

@Test
public void mapFields() {
    Network network = new Network();
    network.setId("id");
    network.setName("name");
    network.setSubnets(Arrays.asList("string1", "string2"));
    NetworkInfoMapper mapper = new NetworkInfoMapper(network);
    NetworkInfo mapped = mapper.map();
    assertEquals("name", mapped.getName());
    assertEquals("id", mapped.getId());
    assertEquals(network.getSubnets(), mapped.getSubnets());
}
Also used : NetworkInfo(org.onap.so.openstack.beans.NetworkInfo) Network(com.woorea.openstack.quantum.model.Network) Test(org.junit.Test)

Aggregations

NetworkInfo (org.onap.so.openstack.beans.NetworkInfo)12 Test (org.junit.Test)10 BaseTest (org.onap.so.BaseTest)6 Network (com.woorea.openstack.quantum.model.Network)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 NetworkException (org.onap.so.adapters.network.exceptions.NetworkException)1 CloudSite (org.onap.so.db.catalog.beans.CloudSite)1 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)1 NetworkResource (org.onap.so.db.catalog.beans.NetworkResource)1 StackInfo (org.onap.so.openstack.beans.StackInfo)1 MsoException (org.onap.so.openstack.exceptions.MsoException)1 NetworkType (org.onap.so.openstack.utils.MsoNeutronUtils.NetworkType)1