aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 7bba136da2..dfe5912fbf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -25,6 +25,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -162,7 +164,8 @@ public class HeatStackAudit {
auditVserver.setLInterfaces(new LInterfaces());
auditVserver.setVserverId(novaResource.getPhysicalResourceId());
Stream<Resource> filteredNeutronNetworks = resources.getList().stream()
- .filter(network -> network.getRequiredBy().contains(novaResource.getLogicalResourceId()));
+ .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId()))
+ .filter(resource -> "OS::Neutron::Port".equals(resource.getType()));
filteredNeutronNetworks.forEach(network -> {
LInterface lInterface = new LInterface();
lInterface.setInterfaceId(network.getPhysicalResourceId());
@@ -173,11 +176,13 @@ public class HeatStackAudit {
return vserversToAudit;
}
- protected Optional<String> extractResourcePathFromHref(String href) {
- URI uri;
+ protected Optional<String> extractResourcePathFromHref(String href) {
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", "")+RESOURCES);
+ Optional<String> stackPath = extractStackPathFromHref(href);
+ if (stackPath.isPresent()){
+ return Optional.of(stackPath.get()+RESOURCES);
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}
@@ -185,10 +190,14 @@ public class HeatStackAudit {
}
protected Optional<String> extractStackPathFromHref(String href) {
- URI uri;
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", ""));
+ URI uri = new URI(href);
+ Pattern p = Pattern.compile("/stacks.*");
+ Matcher m = p.matcher(uri.getPath());
+ if (m.find()){
+ return Optional.of(m.group());
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}