diff options
Diffstat (limited to 'adapters')
4 files changed, 33 insertions, 10 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java index 0e25729610..00e5c4aaec 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java @@ -127,13 +127,6 @@ public class NssmfManager { break; case TRANSPORT: - AllocateTnNssi tn = nssmiAllocate.getAllocateTnNssi(); - assertObjectNotNull(tn); - assertObjectNotNull(tn.getNsiInfo()); - assertObjectNotNull(tn.getNsiInfo().getNsiId()); - nsiId = tn.getNsiInfo().getNsiId(); - allocateReq = marshal(tn); - allocateUrl = AllocateTnNssi.URL; break; } diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index ad41b0f050..eb6cba5510 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -298,7 +298,7 @@ <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> - <version>1.4.0</version> + <version>1.4.1</version> </dependency> <!-- added for unit testing --> diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index ef2577d6fe..10f39f717f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -49,6 +49,7 @@ import org.apache.commons.validator.routines.InetAddressValidator; import org.onap.aai.domain.yang.Flavor; import org.onap.aai.domain.yang.Image; import org.onap.aai.domain.yang.L3InterfaceIpv4AddressList; +import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.PInterface; @@ -303,6 +304,8 @@ public class HeatBridgeImpl implements HeatBridgeApi { Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT); List<String> portIds = extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE); + if (portIds == null) + return; for (String portId : portIds) { Port port = osClient.getPortById(portId); Network network = osClient.getNetworkById(port.getNetworkId()); @@ -320,7 +323,7 @@ public class HeatBridgeImpl implements HeatBridgeApi { lIf.setInterfaceRole(port.getvNicType()); } boolean isL2Multicast = false; - if (port.getProfile().get("trusted") != null) { + if (port.getProfile() != null && port.getProfile().get("trusted") != null) { String trusted = port.getProfile().get("trusted").toString(); if (Boolean.parseBoolean(trusted)) { isL2Multicast = true; @@ -522,6 +525,20 @@ public class HeatBridgeImpl implements HeatBridgeApi { .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()) .lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)), Optional.of(lInterfaceIp)); + } else if (InetAddressValidator.getInstance().isValidInet6Address(ipAddress)) { + Subnet subnet = osClient.getSubnetById(ip.getSubnetId()); + IPAddressString cidr = new IPAddressString(subnet.getCidr()); + L3InterfaceIpv6AddressList ipv6 = new L3InterfaceIpv6AddressList(); + ipv6.setL3InterfaceIpv6Address(ipAddress); + ipv6.setNeutronNetworkId(port.getNetworkId()); + ipv6.setNeutronSubnetId(ip.getSubnetId()); + ipv6.setL3InterfaceIpv6PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString())); + + transaction.createIfNotExists( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()) + .lInterface(lIf.getInterfaceName()).l3InterfaceIpv6AddressList(ipAddress)), + Optional.of(ipv6)); } } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index 8c21e3f7f7..03f6c737f3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -423,6 +423,18 @@ public class HeatBridgeImplTest { when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId, HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id")); + IP ip = mock(IP.class); + + Set<IP> ipSet = new HashSet<>(); + ipSet.add(ip); + when(ip.getIpAddress()).thenReturn("2606:ae00:2e60:100::226"); + when(ip.getSubnetId()).thenReturn("testSubnetId"); + when(port.getFixedIps()).thenAnswer(x -> ipSet); + + Subnet subnet = mock(Subnet.class); + when(subnet.getCidr()).thenReturn("169.254.100.0/24"); + when(osClient.getSubnetById("testSubnetId")).thenReturn(subnet); + Network network = mock(Network.class); when(network.getId()).thenReturn("test-network-id"); when(network.getNetworkType()).thenReturn(NetworkType.VLAN); @@ -446,8 +458,9 @@ public class HeatBridgeImplTest { heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner"); // Assert - verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(transaction, times(20)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); verify(osClient, times(5)).getPortById(anyString()); + verify(osClient, times(5)).getSubnetById("testSubnetId"); verify(osClient, times(10)).getNetworkById(anyString()); } |