<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- Copyright 2017-2022 ZTE Corporation. Licensed under the Apache License, Version\r
+<!-- Copyright 2017-2023 ZTE Corporation. Licensed under the Apache License, Version\r
2.0 (the "License"); you may not use this file except in compliance with\r
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\r
Unless required by applicable law or agreed to in writing, software distributed\r
<parent>\r
<groupId>org.onap.holmes.common</groupId>\r
<artifactId>holmes-common-parent</artifactId>\r
- <version>1.4.4-SNAPSHOT</version>\r
+ <version>1.4.5-SNAPSHOT</version>\r
</parent>\r
\r
<name>holmes-common-service</name>\r
<groupId>javax.servlet</groupId>\r
<artifactId>javax.servlet-api</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>org.springframework</groupId>\r
- <artifactId>spring-web</artifactId>\r
- <version>5.3.13</version>\r
- </dependency>\r
<dependency>\r
<groupId>jakarta.ws.rs</groupId>\r
<artifactId>jakarta.ws.rs-api</artifactId>\r
* ============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.
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;
}
return null;
}
-
- public static String getHostAddr() {
- return MicroServiceConfig.getMsbServerAddrWithHttpPrefix();
- }
}
/**
- * 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
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;
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");
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,
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");
}
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) {
}
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));
}
}
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;
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) {
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");
}
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/(.+)" +
/**
- * 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
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;
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;
}
- 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";
}
}
/**
- * 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.
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 {
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
package org.onap.holmes.common.api.entity;\r
\r
import com.google.gson.annotations.SerializedName;\r
-import lombok.Data;\r
import lombok.Getter;\r
import lombok.NoArgsConstructor;\r
import lombok.Setter;\r
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
package org.onap.holmes.common.api.entity;\r
\r
-import java.io.Serializable;\r
import lombok.Getter;\r
import lombok.NoArgsConstructor;\r
import lombok.Setter;\r
import lombok.ToString;\r
import org.onap.holmes.common.api.stat.Alarm;\r
\r
+import java.io.Serializable;\r
+\r
@Setter\r
@Getter\r
@NoArgsConstructor\r
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
* <p>\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
package org.onap.holmes.common.api.entity;\r
\r
import com.google.gson.annotations.SerializedName;\r
+import lombok.Getter;\r
+import lombok.Setter;\r
\r
import java.util.Date;\r
import java.util.Properties;\r
\r
-import lombok.Getter;\r
-import lombok.Setter;\r
-\r
@Getter\r
@Setter\r
public class CorrelationRule implements Cloneable {\r
/**
- * 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.
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;
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
package org.onap.holmes.common.api.entity;\r
\r
import lombok.AllArgsConstructor;\r
-import lombok.Data;\r
import lombok.Getter;\r
import lombok.NoArgsConstructor;\r
import lombok.Setter;\r
/**
- * 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.
*/
package org.onap.holmes.common.api.entity;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@Getter
@Setter
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
package org.onap.holmes.common.api.entity;\r
\r
-import java.util.ArrayList;\r
-import java.util.List;\r
import lombok.AllArgsConstructor;\r
-import lombok.Data;\r
import lombok.Getter;\r
import lombok.NoArgsConstructor;\r
import lombok.Setter;\r
\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
@NoArgsConstructor\r
@AllArgsConstructor\r
@Setter\r
/**
- * 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.
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 {
/*
- * 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.
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
import com.google.gson.JsonArray;\r
import com.google.gson.JsonObject;\r
import com.google.gson.JsonParser;\r
+import org.apache.commons.lang3.StringUtils;\r
import org.onap.holmes.common.constant.AlarmConst;\r
import org.onap.holmes.common.utils.JerseyClient;\r
import org.slf4j.Logger;\r
final static public String MSB_ADDR = "MSB_ADDR";\r
final static public String MSB_IAG_SERVICE_HOST = "MSB_IAG_SERVICE_HOST";\r
final static public String MSB_IAG_SERVICE_PORT = "MSB_IAG_SERVICE_PORT";\r
-\r
- final static public String AAI_HOSTNAME = "aai.onap";\r
+ final static public String BASE_URL = "BASE_URL";\r
+ final static public String PRE_ADDR = "PRE_ADDR";\r
+ final static public String POST_ADDR = "POST_ADDR";\r
+ final static public String AAI_ADDR = "AAI_BASEADDR";\r
+ final static public String PROTOCOL_HTTP = "http";\r
+ final static public String PROTOCOL_HTTPS = "https";\r
+ final static public int PLAIN_PORT = 80;\r
+ final static public int TLS_PORT = 443;\r
\r
final static public Logger log = LoggerFactory.getLogger(MicroServiceConfig.class);\r
\r
}\r
\r
public static String getAaiAddr() {\r
- return AlarmConst.HTTPS + AAI_HOSTNAME + ":8443";\r
+ boolean tlsEnabled = Boolean.valueOf(getEnv("ENABLE_ENCRYPT"));\r
+\r
+ return String.format("%s://%s%s%s.%s:%d",\r
+ tlsEnabled ? PROTOCOL_HTTPS : PROTOCOL_HTTP,\r
+ nullToEmptyString(getEnv(PRE_ADDR)),\r
+ nullToEmptyString(getEnv(AAI_ADDR)),\r
+ nullToEmptyString(getEnv(POST_ADDR)),\r
+ nullToEmptyString(getEnv(BASE_URL)),\r
+ tlsEnabled ? TLS_PORT : PLAIN_PORT);\r
}\r
\r
public static String[] getMsbIpAndPort() {\r
return new String[]{ip, port};\r
}\r
\r
+ private static String nullToEmptyString(String input) {\r
+ return input == null ? StringUtils.EMPTY : input;\r
+ }\r
+\r
}\r
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
package org.onap.holmes.common.dcae.entity;\r
\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
+import java.util.*;\r
\r
public class DcaeConfigurations extends HashMap<String, Object>{\r
\r
/*\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
package org.onap.holmes.common.dmaap;\r
\r
+import jakarta.ws.rs.client.Entity;\r
import lombok.Getter;\r
import lombok.Setter;\r
import org.onap.holmes.common.dmaap.entity.PolicyMsg;\r
import org.onap.holmes.common.utils.JerseyClient;\r
import org.springframework.stereotype.Service;\r
\r
-import jakarta.ws.rs.client.Entity;\r
import java.util.concurrent.TimeUnit;\r
\r
@Getter\r
/*\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
package org.onap.holmes.common.dmaap.entity;\r
\r
import com.google.gson.annotations.SerializedName;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
import lombok.Getter;\r
import lombok.Setter;\r
\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
@Getter\r
@Setter\r
public class PolicyMsg {\r
/**\r
- * Copyright 2017-2022 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
import org.jdbi.v3.core.statement.StatementContext;\r
import org.onap.holmes.common.api.entity.AlarmInfo;\r
\r
-\r
import java.sql.ResultSet;\r
import java.sql.SQLException;\r
\r
/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2023 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
package org.onap.holmes.common.utils;\r
\r
-import java.util.Locale;\r
-import javax.servlet.http.HttpServletRequest;\r
import org.onap.holmes.common.constant.AlarmConst;\r
\r
+import javax.servlet.http.HttpServletRequest;\r
+import java.util.Locale;\r
+\r
public class LanguageUtil {\r
\r
private LanguageUtil() {\r
/*
- * 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.
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 {
/**
- * 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.
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;
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;
/**
- * 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.
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 {
/**
- * 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.
*/
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<>();
/**
- * 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.
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 {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
AddHeadersHttpServletRequestWrapper requestWithTransactionId = new AddHeadersHttpServletRequestWrapper(
httpServletRequest);
- log.warn(ENTRY, "Entering.");
String requestID = ensureTransactionIdIsPresent(requestWithTransactionId);
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
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");
}
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);
/**
- * 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
private static JsonObject data;
- private static final String AAI_ADDR = "https://aai.onap:8443/aai/v19/";
+ private static final String AAI_ADDR = "https://aai.onap:443/aai/v19/";
@BeforeClass
public static void beforeClass() {
System.setProperty(MSB_ADDR, "127.0.0.1:80");
System.setProperty("ENABLE_ENCRYPT", "true");
+ System.setProperty(MicroServiceConfig.AAI_ADDR, "aai");
+ System.setProperty(MicroServiceConfig.BASE_URL, "onap");
File file = new File(AaiQueryMdonsTest.class.getClassLoader().getResource("./aai-mdons.json").getFile());
BufferedReader reader = null;
@Test
public void testAaiConfig_get_static_fields() {
- String aaiVnfAddr = "/aai/v11/network/generic-vnfs/generic-vnf";
- String aaiVmAddr = "/aai/v11/search/nodes-query?search-node-type=vserver&filter=";
+ String aaiVnfAddr = "/aai/v19/network/generic-vnfs/generic-vnf";
+ String aaiVmAddr = "/aai/v19/search/nodes-query?search-node-type=vserver&filter=";
String xTransactionId = "9999";
String xFromAppId = "jimmy-postman";
assertThat(aaiVnfAddr, equalTo(AaiConfig.AaiConsts.AAI_VNF_ADDR));
<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- Copyright 2017-2022 ZTE Corporation. Licensed under the Apache License, Version\r
+<!-- Copyright 2017-2023 ZTE Corporation. Licensed under the Apache License, Version\r
2.0 (the "License"); you may not use this file except in compliance with\r
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\r
Unless required by applicable law or agreed to in writing, software distributed\r
<artifactId>holmes-common-parent</artifactId>\r
<packaging>pom</packaging>\r
\r
- <version>1.4.4-SNAPSHOT</version>\r
+ <version>1.4.5-SNAPSHOT</version>\r
<name>holmes-common</name>\r
<modules>\r
<module>holmes-actions</module>\r