diff options
Diffstat (limited to 'holmes-actions')
3 files changed, 39 insertions, 4 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java index fb8a8ca..40390b8 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java @@ -73,7 +73,7 @@ public class AaiQuery { } private String getResourceLinksResponse(String vserverId, String vserverName) throws CorrelationException { - String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VNF_ADDR) + "vserver-id:EQUALS:" + vserverId); + String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VM_ADDR) + "vserver-id:EQUALS:" + vserverId); String response = getResponse(url); if ("".equals(response) || "{}".equals(response)) { url = getBaseUrl(AaiConfig.AAI_VM_ADDR + "vserver-name:EQUALS:" + vserverName); @@ -83,7 +83,7 @@ public class AaiQuery { } private String getVnfDataResponse(String vnfId, String vnfName) throws CorrelationException { - String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VM_ADDR)+ "vnf-id=" + vnfId); + String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VNF_ADDR)+ "vnf-id=" + vnfId); String response = getResponse(url); if ("".equals(response) || "{}".equals(response)) { url = getBaseUrl(AaiConfig.AAI_VNF_ADDR + "vnf-name=" + vnfName); @@ -113,7 +113,7 @@ public class AaiQuery { private String getMsbSuffixAddr(String suffixUrl) { String[] addrSplits = suffixUrl.substring(1).split("/"); String ret = addrSplits[1]; - addrSplits[1] = addrSplits[2]; + addrSplits[1] = addrSplits[0] + "-" + addrSplits[2]; addrSplits[2] = ret; StringBuffer stringBuffer = new StringBuffer(); for (String split : addrSplits) { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java new file mode 100644 index 0000000..579abf8 --- /dev/null +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java @@ -0,0 +1,35 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.onap.holmes.common.utils; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class DroolsLog { + + public static void printError(String msg) { + log.error("Drools Log: " + msg); + } + + public static void printWarn(String msg) { + log.warn("Drools Log: " + msg); + } + + public static void printInfo(String msg) { + log.info("Drools Log: " + msg); + } + + public static void printDebug(String msg) { + log.debug("Drools Log: " + msg); + } +} diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java index 59f8848..34a6c46 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java @@ -354,7 +354,7 @@ public class AaiQueryTest { public void testAaiQuery_getMsbSuffixAddr_Ok() throws Exception { PowerMock.resetAll(); String url = "/aai/v11/network/generic-vnfs/generic-vnf?"; - String expect = "/aai/network/v11/generic-vnfs/generic-vnf?"; + String expect = "/aai/aai-network/v11/generic-vnfs/generic-vnf?"; aaiQuery = new AaiQuery(); PowerMock.replayAll(); String actual = Whitebox.invokeMethod(aaiQuery, "getMsbSuffixAddr", url); |