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());
}
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());
}
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());
}
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;
}
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());
}
Aggregations