diff options
Diffstat (limited to 'holmes-actions/src/main/java/org')
26 files changed, 119 insertions, 147 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiJsonParserUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiJsonParserUtil.java index 0a9e4f7..2772c01 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiJsonParserUtil.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiJsonParserUtil.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * org.onap.holmes.common.aai * ================================================================================ - * Copyright (C) 2018-2021 Huawei, ZTE. All rights reserved. + * Copyright (C) 2018-2023 Huawei, ZTE. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import lombok.extern.slf4j.Slf4j; -import org.onap.holmes.common.config.MicroServiceConfig; import org.springframework.stereotype.Component; import java.util.regex.Matcher; @@ -78,8 +77,4 @@ public class AaiJsonParserUtil { } return null; } - - public static String getHostAddr() { - return MicroServiceConfig.getMsbServerAddrWithHttpPrefix(); - } } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java index 40551ab..f8d739b 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn.java @@ -1,5 +1,5 @@ /** - * Copyright 2018-2022 ZTE Corporation. + * Copyright 2018-2023 ZTE Corporation. * <p> * 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 @@ -17,13 +17,13 @@ package org.onap.holmes.common.aai; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import jakarta.ws.rs.client.Entity; import org.onap.holmes.common.aai.config.AaiConfig; import org.onap.holmes.common.config.MicroServiceConfig; import org.onap.holmes.common.utils.JerseyClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.ws.rs.client.Entity; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -69,7 +69,7 @@ public class AaiQuery4Ccvpn { params.put("pnfName", pnfName); params.put("ifName", ifName); - String response = get(getPath(AaiConfig.MsbConsts.AAI_LINK_QUERY, params) + String response = get(getPath(AaiConfig.AaiConsts.AAI_LINK_QUERY, params) + (status == null ? "" : String.format("&operational-status=%s", status))); JsonObject linkInfo = getInfo(response, "p-interface", "logical-link"); @@ -147,20 +147,20 @@ public class AaiQuery4Ccvpn { params.put("networkId", networkId); params.put("pnfName", pnfName); params.put("ifName", ifName); - String r = get(getPath(AaiConfig.MsbConsts.AAI_TP_UPDATE, params)); + String r = get(getPath(AaiConfig.AaiConsts.AAI_TP_UPDATE, params)); JsonObject jsonObject = JsonParser.parseString(r).getAsJsonObject(); body.put("resource-version", jsonObject.get("resource-version").toString()); - put(getPath(AaiConfig.MsbConsts.AAI_TP_UPDATE, params), body); + put(getPath(AaiConfig.AaiConsts.AAI_TP_UPDATE, params), body); } public void updateLogicLinkStatus(String linkName, Map<String, Object> body) { - String r = get(getPath(AaiConfig.MsbConsts.AAI_LINK_UPDATE, "linkName", linkName)); + String r = get(getPath(AaiConfig.AaiConsts.AAI_LINK_UPDATE, "linkName", linkName)); JsonObject jsonObject = JsonParser.parseString(r).getAsJsonObject(); body.put("resource-version", jsonObject.get("resource-version").toString()); body.put("link-type", jsonObject.get("link-type").toString()); - put(getPath(AaiConfig.MsbConsts.AAI_LINK_UPDATE, "linkName", linkName), body); + put(getPath(AaiConfig.AaiConsts.AAI_LINK_UPDATE, "linkName", linkName), body); } private JsonObject getVpnBindingInfo(String networkId, String pnfName, @@ -170,17 +170,17 @@ public class AaiQuery4Ccvpn { params.put("pnfName", pnfName); params.put("ifName", ifName); params.put("status", status); - String response = get(getPath(AaiConfig.MsbConsts.AAI_VPN_ADDR, params)); + String response = get(getPath(AaiConfig.AaiConsts.AAI_VPN_ADDR, params)); return getInfo(response, "p-interface", "vpn-binding"); } private JsonObject getConnectivityInfo(String vpnId) { - String response = get(getPath(AaiConfig.MsbConsts.AAI_CONN_ADDR, "vpnId", vpnId)); + String response = get(getPath(AaiConfig.AaiConsts.AAI_CONN_ADDR, "vpnId", vpnId)); return getInfo(response, "vpn-binding", "connectivity"); } private JsonObject getServiceInstanceByConn(String connectivityId) { - String response = get(getPath(AaiConfig.MsbConsts.AAI_SERVICE_INSTANCE_ADDR_4_CCVPN, + String response = get(getPath(AaiConfig.AaiConsts.AAI_SERVICE_INSTANCE_ADDR_4_CCVPN, "connectivityId", connectivityId)); return getInfo(response, "connectivity", "service-instance"); } @@ -241,10 +241,6 @@ public class AaiQuery4Ccvpn { return null; } - private String getHostAddr() { - return MicroServiceConfig.getMsbServerAddrWithHttpPrefix(); - } - private String extractValueFromJsonArray(JsonArray relationshipData, String keyName) { if (relationshipData != null) { for (int i = 0; i < relationshipData.size(); ++i) { @@ -258,10 +254,10 @@ public class AaiQuery4Ccvpn { } private String get(String path) { - return JerseyClient.newInstance().path(path).headers(headers).get(getHostAddr()); + return JerseyClient.newInstance().path(path).headers(headers).get(MicroServiceConfig.getAaiAddr()); } private String put(String path, Map<String, Object> body) { - return JerseyClient.newInstance().path(path).headers(headers).put(getHostAddr(), Entity.json(body)); + return JerseyClient.newInstance().path(path).headers(headers).put(MicroServiceConfig.getAaiAddr(), Entity.json(body)); } } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2.java index a9d9e53..05fba60 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2.java @@ -25,6 +25,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import lombok.extern.slf4j.Slf4j; import org.onap.holmes.common.aai.config.AaiConfig; +import org.onap.holmes.common.config.MicroServiceConfig; import org.onap.holmes.common.utils.JerseyClient; import org.springframework.stereotype.Service; @@ -57,8 +58,8 @@ public class AaiQuery4Ccvpn2 { private String getSiteVNFId(String siteService) { String response = JerseyClient.newInstance() .headers(headers) - .path(AaiConfig.MsbConsts.AAI_SITE_RESOURCES_QUERY) - .get(getHostAddr()); + .path(AaiConfig.AaiConsts.AAI_SITE_RESOURCES_QUERY) + .get(MicroServiceConfig.getAaiAddr()); JsonObject resObj = JsonParser.parseString(response).getAsJsonObject(); JsonArray siteResources = extractJsonArray(resObj, "site-resource"); if (siteResources != null) { @@ -85,9 +86,9 @@ public class AaiQuery4Ccvpn2 { private JsonObject getServiceInstanceByVnfId(String vnfId) { String resStr = JerseyClient.newInstance() .headers(headers) - .path(getPath(AaiConfig.MsbConsts.AAI_SITE_VNF_QUERY, + .path(getPath(AaiConfig.AaiConsts.AAI_SITE_VNF_QUERY, "vnfId", vnfId)) - .get(getHostAddr()); + .get(MicroServiceConfig.getAaiAddr()); return getInfo(resStr, "service-instance"); } @@ -101,7 +102,7 @@ public class AaiQuery4Ccvpn2 { String res = JerseyClient.newInstance() .headers(headers) .path(getPath(serviceInstancePath)) - .get(getHostAddr()); + .get(MicroServiceConfig.getAaiAddr()); JsonObject instance = JsonParser.parseString(res).getAsJsonObject(); String[] params = new String[2]; Pattern pattern = Pattern.compile("/aai/v\\d+/business/customers/customer/(.+)" + diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQueryMdons.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQueryMdons.java index d6ba800..60b53f9 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQueryMdons.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQueryMdons.java @@ -1,5 +1,5 @@ /** - * Copyright 2020 - 2022 Fujitsu Limited, ZTE Corporation + * Copyright 2020 - 2023 Fujitsu Limited, ZTE Corporation * <p> * 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 @@ -17,6 +17,9 @@ package org.onap.holmes.common.aai; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; import org.onap.holmes.common.aai.config.AaiConfig; import org.onap.holmes.common.config.MicroServiceConfig; import org.onap.holmes.common.exception.CorrelationException; @@ -25,9 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; import java.util.HashMap; import java.util.Map; diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/config/AaiConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/config/AaiConfig.java index bc6575f..beb6792 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/config/AaiConfig.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/config/AaiConfig.java @@ -43,76 +43,40 @@ public class AaiConfig { } - private static final String AAI_PREF = "/aai/"; + private static final String AAI_PREF = "/aai/" + AAI_API_VERSION; - public static final String AAI_VNF_ADDR = AAI_PREF + "v11/network/generic-vnfs/generic-vnf"; + public static final String AAI_VNF_ADDR = AAI_PREF +"/network/generic-vnfs/generic-vnf"; - public static final String AAI_TP_UPDATE = AAI_PREF + AAI_API_VERSION + AAI_PNF_URL_SUF; + public static final String AAI_TP_UPDATE = AAI_PREF + AAI_PNF_URL_SUF; - public static final String AAI_LINK_QUERY = AAI_PREF + AAI_API_VERSION + AAI_PNF_URL_SUF; + public static final String AAI_LINK_QUERY = AAI_PREF + AAI_PNF_URL_SUF; - public static final String AAI_LINK_UPDATE = AAI_PREF + AAI_API_VERSION + "/network/logical-links/logical-link/{linkName}"; + public static final String AAI_LINK_UPDATE = AAI_PREF + "/network/logical-links/logical-link/{linkName}"; - public static final String AAI_TP_ADDR = AAI_PREF + AAI_API_VERSION + "/network/pnfs/pnf/{node-Id}/p-interfaces/p-interface/{tp-id}"; + public static final String AAI_TP_ADDR = AAI_PREF + "/network/pnfs/pnf/{node-Id}/p-interfaces/p-interface/{tp-id}"; - public static final String AAI_VPN_ADDR = AAI_PREF + AAI_API_VERSION + AAI_PNF_URL_SUF; + public static final String AAI_VPN_ADDR = AAI_PREF + AAI_PNF_URL_SUF; - public static final String AAI_CONN_ADDR = AAI_PREF + AAI_API_VERSION + "/network/vpn-bindings/vpn-binding/{vpnId}"; + public static final String AAI_CONN_ADDR = AAI_PREF + "/network/vpn-bindings/vpn-binding/{vpnId}"; - public static final String AAI_SERVICE_INSTANCE_ADDR_4_CCVPN = AAI_PREF + AAI_API_VERSION + "/network/connectivities/connectivity/{connectivityId}"; + public static final String AAI_SERVICE_INSTANCE_ADDR_4_CCVPN = AAI_PREF + "/network/connectivities/connectivity/{connectivityId}"; - public static final String AAI_SERVICE_INSTANCES_ADDR_4_CCVPN = AAI_PREF + AAI_API_VERSION + "/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}"; + public static final String AAI_SERVICE_INSTANCES_ADDR_4_CCVPN = AAI_PREF + "/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}"; - public static final String AAI_VM_ADDR = AAI_PREF + "v11/search/nodes-query?search-node-type=vserver&filter="; + public static final String AAI_VM_ADDR = AAI_PREF + "/search/nodes-query?search-node-type=vserver&filter="; public static final String AAI_SERVICE = AAI_SERVICE_INSTANCES_ADDR_4_CCVPN + "/service-instances/service-instance/{instance-id}"; - public static final String AAI_PNF = AAI_PREF + AAI_API_VERSION + "/network/pnfs/pnf/{pnfName}"; + public static final String AAI_PNF = AAI_PREF + "/network/pnfs/pnf/{pnfName}"; public static final String AAI_PNF_VALUE = AAI_PNF + "?depth=all"; - public static final String AAI_PNF_ID = AAI_PREF + AAI_API_VERSION + "/network/pnfs?pnf-id={pnfId}"; - } - - - public static class MsbConsts { - - private MsbConsts() { - - } - - private static final String AAI_MSB_PREF = "/api"; - - private static final String AAI_NETWORK = "/aai-network/"; - - private static final String AAI_BUSINESS = "/aai-business/"; - - private static final String AAI_SEARCH = "/aai-search/"; - - public static final String AAI_VNF_ADDR = AAI_NETWORK + AAI_API_VERSION + "/generic-vnfs/generic-vnf"; - - public static final String AAI_TP_UPDATE = AAI_NETWORK + AAI_API_VERSION + AAI_PNF_URL_SUF; - - public static final String AAI_LINK_QUERY = AAI_NETWORK + AAI_API_VERSION + AAI_PNF_URL_SUF; - - public static final String AAI_LINK_UPDATE = AAI_NETWORK + AAI_API_VERSION + "/network/logical-links/logical-link/{linkName}"; - - public static final String AAI_TP_ADDR = AAI_NETWORK + AAI_API_VERSION + "/pnfs/pnf/{node-Id}/p-interfaces/p-interface/{tp-id}"; - - public static final String AAI_VPN_ADDR = AAI_NETWORK + AAI_API_VERSION + AAI_PNF_URL_SUF; - - public static final String AAI_CONN_ADDR = AAI_NETWORK + AAI_API_VERSION + "/network/vpn-bindings/vpn-binding/{vpnId}"; - - public static final String AAI_SERVICE_INSTANCE_ADDR_4_CCVPN = AAI_NETWORK + AAI_API_VERSION + "/network/connectivities/connectivity/{connectivityId}"; - - public static final String AAI_SERVICE_INSTANCES_ADDR_4_CCVPN = AAI_BUSINESS + AAI_API_VERSION + "/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}"; - - public static final String AAI_VM_ADDR = AAI_SEARCH + AAI_API_VERSION + "/nodes-query?search-node-type=vserver&filter="; + public static final String AAI_PNF_ID = AAI_PREF + "/network/pnfs?pnf-id={pnfId}"; - public static final String AAI_SITE_RESOURCES_QUERY = AAI_MSB_PREF + AAI_NETWORK + AAI_API_VERSION + - "/site-resources"; + public static final String AAI_SITE_VNF_QUERY = AAI_PREF + + "/network/generic-vnfs/generic-vnf/{vnfId}"; - public static final String AAI_SITE_VNF_QUERY = AAI_MSB_PREF + AAI_NETWORK + AAI_API_VERSION + - "/generic-vnfs/generic-vnf/{vnfId}"; + public static final String AAI_SITE_RESOURCES_QUERY = AAI_PREF + AAI_API_VERSION + + "/network/site-resources"; } } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/entity/RelationshipList.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/entity/RelationshipList.java index faf5297..6e03fb5 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/entity/RelationshipList.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/entity/RelationshipList.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,11 @@ package org.onap.holmes.common.aai.entity; -import java.util.List; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Setter @Getter public class RelationshipList { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java index 47aeb0d..a6825b2 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@ package org.onap.holmes.common.api.entity;
import com.google.gson.annotations.SerializedName;
-import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java index f3e2562..f012a3b 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationResult.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +15,14 @@ */
package org.onap.holmes.common.api.entity;
-import java.io.Serializable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.onap.holmes.common.api.stat.Alarm;
+import java.io.Serializable;
+
@Setter
@Getter
@NoArgsConstructor
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java index 14a3f07..6361c20 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,12 @@ package org.onap.holmes.common.api.entity;
import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
import java.util.Date;
import java.util.Properties;
-import lombok.Getter;
-import lombok.Setter;
-
@Getter
@Setter
public class CorrelationRule implements Cloneable {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java index 4bfb3cf..bfaec3c 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceEntity.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,10 @@ package org.onap.holmes.common.api.entity; -import lombok.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.util.List; diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java index a8fc04d..08ccddf 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.onap.holmes.common.api.entity;
import lombok.AllArgsConstructor;
-import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java index 98e5506..22f5de9 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceNode4Query.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,10 @@ */ package org.onap.holmes.common.api.entity; -import lombok.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; @Getter @Setter diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java index eba7544..508164e 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/ServiceRegisterEntity.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +16,14 @@ package org.onap.holmes.common.api.entity;
-import java.util.ArrayList;
-import java.util.List;
import lombok.AllArgsConstructor;
-import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import java.util.ArrayList;
+import java.util.List;
+
@NoArgsConstructor
@AllArgsConstructor
@Setter
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java index b07a558..8b15d5f 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/AlarmAdditionalField.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,11 @@ package org.onap.holmes.common.api.stat; -import java.io.Serializable; import lombok.Getter; import lombok.Setter; +import java.io.Serializable; + @Setter @Getter public class AlarmAdditionalField implements Serializable { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java index 09daf54..da378a9 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,13 @@ package org.onap.holmes.common.api.stat; +import lombok.Getter; +import lombok.Setter; + import java.io.Serializable; -import java.util.Map; import java.util.HashMap; +import java.util.Map; import java.util.TimeZone; -import lombok.Getter; -import lombok.Setter; @Getter @Setter diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java index 191d897..df3a7df 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java @@ -18,6 +18,7 @@ package org.onap.holmes.common.config; import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import org.apache.commons.lang3.StringUtils;
import org.onap.holmes.common.constant.AlarmConst;
import org.onap.holmes.common.utils.JerseyClient;
import org.slf4j.Logger;
@@ -35,8 +36,14 @@ public class MicroServiceConfig { final static public String MSB_ADDR = "MSB_ADDR";
final static public String MSB_IAG_SERVICE_HOST = "MSB_IAG_SERVICE_HOST";
final static public String MSB_IAG_SERVICE_PORT = "MSB_IAG_SERVICE_PORT";
-
- final static public String AAI_HOSTNAME = "aai.onap";
+ final static public String BASE_URL = "BASE_URL";
+ final static public String PRE_ADDR = "PRE_ADDR";
+ final static public String POST_ADDR = "POST_ADDR";
+ final static public String AAI_ADDR = "AAI_BASEADDR";
+ final static public String PROTOCOL_HTTP = "http";
+ final static public String PROTOCOL_HTTPS = "https";
+ final static public int PLAIN_PORT = 80;
+ final static public int TLS_PORT = 443;
final static public Logger log = LoggerFactory.getLogger(MicroServiceConfig.class);
@@ -88,7 +95,15 @@ public class MicroServiceConfig { }
public static String getAaiAddr() {
- return AlarmConst.HTTPS + AAI_HOSTNAME + ":8443";
+ boolean tlsEnabled = Boolean.valueOf(getEnv("ENABLE_ENCRYPT"));
+
+ return String.format("%s://%s%s%s.%s:%d",
+ tlsEnabled ? PROTOCOL_HTTPS : PROTOCOL_HTTP,
+ nullToEmptyString(getEnv(PRE_ADDR)),
+ nullToEmptyString(getEnv(AAI_ADDR)),
+ nullToEmptyString(getEnv(POST_ADDR)),
+ nullToEmptyString(getEnv(BASE_URL)),
+ tlsEnabled ? TLS_PORT : PLAIN_PORT);
}
public static String[] getMsbIpAndPort() {
@@ -118,4 +133,8 @@ public class MicroServiceConfig { return new String[]{ip, port};
}
+ private static String nullToEmptyString(String input) {
+ return input == null ? StringUtils.EMPTY : input;
+ }
+
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/entity/DcaeConfigurations.java b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/entity/DcaeConfigurations.java index 4b90dd7..04b2d0b 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/entity/DcaeConfigurations.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/entity/DcaeConfigurations.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +16,7 @@ package org.onap.holmes.common.dcae.entity;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
public class DcaeConfigurations extends HashMap<String, Object>{
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java index ee041e0..3cf18b7 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java @@ -1,5 +1,5 @@ /*
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +15,13 @@ */
package org.onap.holmes.common.dmaap;
+import jakarta.ws.rs.client.Entity;
import lombok.Getter;
import lombok.Setter;
import org.onap.holmes.common.dmaap.entity.PolicyMsg;
import org.onap.holmes.common.utils.JerseyClient;
import org.springframework.stereotype.Service;
-import jakarta.ws.rs.client.Entity;
import java.util.concurrent.TimeUnit;
@Getter
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java index 6c3189c..d8d4678 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java @@ -1,5 +1,5 @@ /*
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,12 @@ package org.onap.holmes.common.dmaap.entity;
import com.google.gson.annotations.SerializedName;
-import java.util.HashMap;
-import java.util.Map;
import lombok.Getter;
import lombok.Setter;
+import java.util.HashMap;
+import java.util.Map;
+
@Getter
@Setter
public class PolicyMsg {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java index e9755e8..fb39f43 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017-2022 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ import org.jdbi.v3.core.mapper.RowMapper; import org.jdbi.v3.core.statement.StatementContext;
import org.onap.holmes.common.api.entity.AlarmInfo;
-
import java.sql.ResultSet;
import java.sql.SQLException;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java index 5c2c12c..cf49b84 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/LanguageUtil.java @@ -1,5 +1,5 @@ /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2023 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,11 @@ */
package org.onap.holmes.common.utils;
-import java.util.Locale;
-import javax.servlet.http.HttpServletRequest;
import org.onap.holmes.common.constant.AlarmConst;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Locale;
+
public class LanguageUtil {
private LanguageUtil() {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/Md5Util.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/Md5Util.java index c630239..c39d371 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/Md5Util.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/Md5Util.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.onap.holmes.common.utils; import com.google.common.hash.HashCode; import com.google.common.hash.HashFunction; import com.google.common.hash.Hashing; + import java.nio.charset.Charset; public class Md5Util { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/MsbRegister.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/MsbRegister.java index 21136a8..78ac59b 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/MsbRegister.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/MsbRegister.java @@ -1,5 +1,5 @@ /** - * Copyright 2017-2022 ZTE Corporation. + * Copyright 2017-2023 ZTE Corporation. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.onap.holmes.common.utils; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.holmes.common.config.MicroServiceConfig; @@ -26,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.core.MediaType; import java.util.concurrent.TimeUnit; import static org.onap.holmes.common.utils.JerseyClient.PROTOCOL_HTTP; diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/RestExceptionHandler.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/RestExceptionHandler.java index e32efaf..c04ffc4 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/RestExceptionHandler.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/RestExceptionHandler.java @@ -1,5 +1,5 @@ /** - * Copyright 2021 - 2022 ZTE Corporation. + * Copyright 2021 - 2023 ZTE Corporation. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,12 @@ package org.onap.holmes.common.utils; +import jakarta.ws.rs.WebApplicationException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; -import jakarta.ws.rs.WebApplicationException; - @RestControllerAdvice public class RestExceptionHandler { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/AddHeadersHttpServletRequestWrapper.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/AddHeadersHttpServletRequestWrapper.java index d61797b..bfe67d1 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/AddHeadersHttpServletRequestWrapper.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/AddHeadersHttpServletRequestWrapper.java @@ -1,5 +1,5 @@ /** - * Copyright 2018 ZTE Corporation. + * Copyright 2018-2023 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ */ package org.onap.holmes.common.utils.transactionid; -import java.util.HashMap; -import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; +import java.util.HashMap; +import java.util.Map; public class AddHeadersHttpServletRequestWrapper extends HttpServletRequestWrapper { final private Map<String, String> additionalHeaders = new HashMap<>(); diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/TransactionIdFilter.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/TransactionIdFilter.java index 725084a..3451b85 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/TransactionIdFilter.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/transactionid/TransactionIdFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2018-2021 ZTE Corporation. + * Copyright 2018-2022 ZTE Corporation. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,6 @@ import java.util.UUID; public class TransactionIdFilter implements Filter { public static final Marker INVOKE_SYNCHRONOUS; - public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY"); - public static final Marker EXIT = MarkerFactory.getMarker("EXIT"); - private static final String DEFAULT_REQUEST_ID = UUID.randomUUID().toString(); static { @@ -57,7 +54,6 @@ public class TransactionIdFilter implements Filter { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; AddHeadersHttpServletRequestWrapper requestWithTransactionId = new AddHeadersHttpServletRequestWrapper( httpServletRequest); - log.warn(ENTRY, "Entering."); String requestID = ensureTransactionIdIsPresent(requestWithTransactionId); HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; @@ -76,11 +72,9 @@ public class TransactionIdFilter implements Filter { MDC.put("RequestID", requestID); MDC.put("InvocationID", invocationID); - log.warn(INVOKE_SYNCHRONOUS, "Invoking synchronously ... "); try { filterChain.doFilter(requestWithTransactionId, httpServletResponse); } finally { - log.debug(EXIT, "Exiting."); MDC.remove("RequestID"); MDC.remove("InvocationID"); } @@ -97,7 +91,6 @@ public class TransactionIdFilter implements Filter { if (StringUtils.isBlank(requestId)) { requestId = TransactionIdUtils.getUUID(); - log.info(INVOKE_SYNCHRONOUS, "This warning has a 'MY_MARKER' annotation."); log.info("Request ID ({} header) not exist. It was generated: {}", TransactionIdUtils.REQUEST_ID_HEADER, requestId); request.addHeader(TransactionIdUtils.REQUEST_ID_HEADER, requestId); |