diff options
15 files changed, 324 insertions, 151 deletions
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-one_consumer.properties b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-one_consumer.properties index c92e987c2..d607137d6 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-one_consumer.properties +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-one_consumer.properties @@ -1,34 +1,34 @@ -#consumer.properties file created on the fly for topic:JunitTopicOne on:1542997120536
-#Fri Nov 23 13:18:40 EST 2018
-AFT_DME2_EP_CONN_TIMEOUT=15000
-MethodType=GET
-password=admin
-routeOffer=MR1
-DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties
-Longitude=-100.000000
-username=admin
-Version=1.0
-group=junit-client
-timeout=15000
-SubContextPath=/
-authDate=2016-02-18T13\:57\:37-0800
-filter=none
-authKey=01234567890abcde\:01234567890abcdefghijklmn
-Environment=TEST
-host=192.168.10.10
-Protocol=http
-Partner=BOT_R
-contenttype=application/json
-id=junit-consumer-one
-Latitude=50.000000
-ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events
-AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
-AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
-topic=JunitTopicOne
-TransportType=HTTPNOAUTH
-AFT_ENVIRONMENT=AFTUAT
-limit=1000
-AFT_DME2_EP_READ_TIMEOUT_MS=50000
-sessionstickinessrequired=NO
-AFT_DME2_REQ_TRACE_ON=true
-AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+#consumer.properties - This file is generated automatically for topic:JunitTopicOne on:1549243025739 +#Sun Feb 03 20:17:05 EST 2019 +AFT_DME2_EP_CONN_TIMEOUT=15000 +MethodType=GET +password=admin +routeOffer=MR1 +DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties +Longitude=-100.000000 +username=admin +Version=1.0 +group=junit-client +timeout=15000 +SubContextPath=/ +authDate=2016-02-18T13\:57\:37-0800 +filter=none +authKey=01234567890abcde\:01234567890abcdefghijklmn +Environment=TEST +host=192.168.10.10 +Protocol=http +Partner=BOT_R +contenttype=application/json +id=junit-consumer-one +Latitude=50.000000 +ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +topic=JunitTopicOne +TransportType=HTTPNOAUTH +AFT_ENVIRONMENT=AFTUAT +limit=1000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +AFT_DME2_REQ_TRACE_ON=true +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-two_consumer.properties b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-two_consumer.properties index d36ad03f3..0cc25b3e1 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-two_consumer.properties +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-consumer-two_consumer.properties @@ -1,30 +1,30 @@ -#consumer.properties file created on the fly for topic:JunitTopicOne on:1542997120526
-#Fri Nov 23 13:18:40 EST 2018
-AFT_DME2_EP_CONN_TIMEOUT=15000
-MethodType=GET
-routeOffer=MR1
-DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties
-Longitude=-100.000000
-Version=1.0
-group=junit-client
-timeout=15000
-SubContextPath=/
-filter=none
-Environment=TEST
-host=192.168.10.10
-Protocol=http
-Partner=BOT_R
-contenttype=application/json
-Latitude=50.000000
-id=junit-consumer-two
-ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events
-AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
-AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
-topic=JunitTopicOne
-TransportType=HTTPAAF
-AFT_ENVIRONMENT=AFTUAT
-limit=1000
-AFT_DME2_EP_READ_TIMEOUT_MS=50000
-sessionstickinessrequired=NO
-AFT_DME2_REQ_TRACE_ON=true
-AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+#consumer.properties - This file is generated automatically for topic:JunitTopicOne on:1549243025689 +#Sun Feb 03 20:17:05 EST 2019 +AFT_DME2_EP_CONN_TIMEOUT=15000 +MethodType=GET +routeOffer=MR1 +DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties +Longitude=-100.000000 +Version=1.0 +group=junit-client +timeout=15000 +SubContextPath=/ +filter=none +Environment=TEST +host=192.168.10.10 +Protocol=http +Partner=BOT_R +contenttype=application/json +Latitude=50.000000 +id=junit-consumer-two +ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +topic=JunitTopicOne +TransportType=HTTPAAF +AFT_ENVIRONMENT=AFTUAT +limit=1000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +AFT_DME2_REQ_TRACE_ON=true +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-producer-one_producer.properties b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-producer-one_producer.properties index 055e8ccd6..ca04b2820 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-producer-one_producer.properties +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/JunitTopicOne_junit-producer-one_producer.properties @@ -1,35 +1,35 @@ -#producer.properties file created on the fly for topic:JunitTopicOne on:1542997120515
-#Fri Nov 23 13:18:40 EST 2018
-AFT_DME2_EP_CONN_TIMEOUT=15000
-MethodType=POST
-password=admin
-DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties
-Longitude=-100.000000
-username=admin
-partition=2
-Version=1.0
-maxBatchSize=100
-group=junit-client
-SubContextPath=/
-authDate=2016-07-20T11\:30\:56-0700
-filter=none
-authKey=01234567890abcde\:01234567890abcdefghijklmn
-Environment=TEST
-host=192.168.10.10
-Protocol=http
-Partner=BOT_R
-contenttype=application/json
-id=junit-producer-one
-Latitude=50.000000
-ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events
-AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
-AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
-topic=JunitTopicOne
-TransportType=HTTPNOAUTH
-AFT_ENVIRONMENT=AFTUAT
-AFT_DME2_EP_READ_TIMEOUT_MS=50000
-sessionstickinessrequired=NO
-AFT_DME2_REQ_TRACE_ON=true
-AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
-MessageSentThreadOccurance=50
-maxAgeMs=250
+#producer.properties - This file is generated automatically for topic:JunitTopicOne on:1549243025647 +#Sun Feb 03 20:17:05 EST 2019 +AFT_DME2_EP_CONN_TIMEOUT=15000 +MethodType=POST +password=admin +DME2preferredRouterFilePath=JunitTopicOnepreferredRoute.properties +Longitude=-100.000000 +username=admin +partition=2 +Version=1.0 +maxBatchSize=100 +group=junit-client +SubContextPath=/ +authDate=2016-07-20T11\:30\:56-0700 +filter=none +authKey=01234567890abcde\:01234567890abcdefghijklmn +Environment=TEST +host=192.168.10.10 +Protocol=http +Partner=BOT_R +contenttype=application/json +id=junit-producer-one +Latitude=50.000000 +ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.openecomp.org/events +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +topic=JunitTopicOne +TransportType=HTTPNOAUTH +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +AFT_DME2_REQ_TRACE_ON=true +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +MessageSentThreadOccurance=50 +maxAgeMs=250 diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapConsumerImpl.java index 94b06b52e..e2a20ee45 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapConsumerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapConsumerImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java index 3a986c31e..a9af8c702 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java @@ -2,22 +2,22 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= * 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. - * + * * ============LICENSE_END========================================================= */ @@ -68,7 +68,7 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer @Override public boolean post(String partition, String data) { - LOG.debug("Entering HttpDmaapProducerImpl::: post "); + LOG.debug("Entering HttpDmaapProducerImpl::: post "); long sent = 0; try { HttpPost request = postReq(null); @@ -102,7 +102,7 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer successful = true; } else { - LOG.debug("HttpDmaapProducerImpl::: did not receive 200 for sendRequest"); + LOG.debug("HttpDmaapProducerImpl::: did not receive 200 for sendRequest"); } response.close(); } catch (Exception sendEx) { @@ -131,4 +131,5 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer return String.format("%d.%d.%s%s", prt.length(), msg.length(), prt, msg); } + } diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java index ca551c6af..686bb071f 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapConsumerImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ================================================================================ @@ -11,15 +11,15 @@ * 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. - * + * * ============LICENSE_END========================================================= */ @@ -235,4 +235,5 @@ public class DmaapConsumerImpl implements Consumer { public boolean isHttps() { return useHttps; } + } diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java index 445f91960..ee4061c94 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java @@ -2,16 +2,16 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= * 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. @@ -140,7 +140,7 @@ public class DmaapProducerImpl implements Producer { @Override public boolean post(String partition, String data) { - LOG.debug("In DmaapProducerImpl.post()"); + LOG.debug("In DmaapProducerImpl.post()"); boolean success = true; Properties properties = configuration.getProperties(); if (properties != null && properties.getProperty("metric.enabled") != null) { @@ -219,4 +219,5 @@ public class DmaapProducerImpl implements Producer { public boolean isHttps() { return useHttps; } + } diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/utils/DmaapUtil.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/utils/DmaapUtil.java index 7e5f15898..af20ac7c6 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/utils/DmaapUtil.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/utils/DmaapUtil.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -59,7 +59,7 @@ public class DmaapUtil { props.setProperty("preferredRouteKey", fileName); topicPreferredRouteFileName = topic + "preferredRoute.properties"; props.store(new FileOutputStream(topicPreferredRouteFileName), - "preferredRoute.properties file created on the fly for topic:" + topic + " on:" + "preferredRoute.properties -This file is generated automatically for topic:" + topic + " on:" + System.currentTimeMillis()); } return topicPreferredRouteFileName; @@ -99,7 +99,7 @@ public class DmaapUtil { : DELIMITER + topicConsumerPropFileName; defaultProps.store(new FileOutputStream(topicConsumerPropFileName), defaultProfFileName - + " file created on the fly for topic:" + topic + " on:" + System.currentTimeMillis()); + + " - This file is generated automatically for topic:" + topic + " on:" + System.currentTimeMillis()); return topicConsumerPropFileName; } diff --git a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Consumer.java b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Consumer.java index cac044f4e..542797ed2 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Consumer.java +++ b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Consumer.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -65,6 +65,26 @@ public interface Consumer { default void useHttps(boolean yes) {} /** + * Sets Blacklist time for a server with response problem in seconds + */ + default void setResponseProblemBlacklistTime(String duration) {} + + /** + * Sets Blacklist time for a server with server problem in seconds + */ + default void setServerProblemBlacklistTime(String duration) {} + + /** + * Sets Blacklist time for a server with DNS problem in seconds + */ + default void setDnsIssueBlacklistTime(String duration) {} + + /** + * Sets Blacklist time for a server with IO Exception problem in seconds + */ + default void setIOExceptionBlacklistTime(String duration) {} + + /** * Closes the dmaap client https connection. */ default void close() {} diff --git a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Producer.java b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Producer.java index d7ca519c0..8536d8257 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Producer.java +++ b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-api/src/main/java/org/onap/appc/adapter/message/Producer.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -46,6 +46,27 @@ public interface Producer { default void useHttps(boolean yes) {} /** + * Sets Blacklist time for a server with response problem in seconds + */ + default void setResponseProblemBlacklistTime(String duration) { } + + /** + * Sets Blacklist time for a server with server problem in seconds + */ + default void setServerProblemBlacklistTime(String duration) {} + + /** + * Sets Blacklist time for a server with DNS problem in seconds + */ + default void setDnsIssueBlacklistTime(String duration) {} + + /** + * Sets Blacklist time for a server with IO Exception problem in seconds + */ + default void setIOExceptionBlacklistTime(String duration) {} + + + /** * Closes the dmaap client https connection. */ default void close() {} diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/EventHandler.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/EventHandler.java index 20d4a6ad4..c2b7c4bbf 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/EventHandler.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/EventHandler.java @@ -2,22 +2,22 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= * 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. - * + * * ============LICENSE_END========================================================= */ @@ -36,14 +36,14 @@ public interface EventHandler { /** * Gets a list of messages as Strings on the read topic. - * + * * @return A list of String messages. Never returns null. */ public List<String> getIncomingEvents(); /** * Gets a list of messages as String on the read topic. - * + * * @param limit * The maximum amount of entries to return * @return A list of String messages. Never returns null. @@ -72,7 +72,7 @@ public interface EventHandler { /** * Posts the String message to the write topic(s). - * + * * @param event * The String to post. */ @@ -96,7 +96,7 @@ public interface EventHandler { /** * Set the client/group id used to read messages - * + * * @param clientId * The new clientId to use */ @@ -109,7 +109,7 @@ public interface EventHandler { /** * Set the client/group name used to read messages. - * + * * @param clientName * The new clientName to use */ @@ -122,7 +122,7 @@ public interface EventHandler { /** * Set the name of the topic to read from. - * + * * @param topic * The new topic to read from */ @@ -135,7 +135,7 @@ public interface EventHandler { /** * Set the name of the topic to write to - * + * * @param topic * The new topic to write to */ @@ -143,7 +143,7 @@ public interface EventHandler { /** * Adds a DMaaP host to the host pool - * + * * @param host * The host to add to the pool in <host>:<port> format */ @@ -151,7 +151,7 @@ public interface EventHandler { /** * Remove the host name from the pool if it exists - * + * * @param host * The host to add to the pool in <host>:<port> format */ @@ -159,7 +159,7 @@ public interface EventHandler { /** * Get all of the hosts in the DMaaP pool - * + * * @return A collection of host in <host>:<port> format */ public Collection<String> getPool(); @@ -170,15 +170,36 @@ public interface EventHandler { public void clearCredentials(); /** + * Sets Blacklist time for a server with response problem in seconds + */ + void setResponseProblemBlacklistTime(String duration); + + /** + * Sets Blacklist time for a server with server problem in seconds + */ + void setServerProblemBlacklistTime(String duration); + + /** + * Sets Blacklist time for a server with DNS problem in seconds + */ + void setDnsIssueBlacklistTime(String duration); + + /** + * Sets Blacklist time for a server with IO Exception problem in seconds + */ + void setIOExceptionBlacklistTime(String duration); + /** * Set the api credentials and make future requests as an authenticated user - * + * * @param access * The access portion of the credentials (either user name or api key) * @param secret * The secret portion of the credentials (either password or api secret) */ + + public void setCredentials(String access, String secret); - + /** * Close consumer/producer DMaaP clients */ diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/ListenerProperties.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/ListenerProperties.java index 107b0f67e..74ead9485 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/ListenerProperties.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/ListenerProperties.java @@ -2,22 +2,22 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= * 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. - * + * * ============LICENSE_END========================================================= */ @@ -89,7 +89,7 @@ public class ListenerProperties { /** * Returns a property matching a given KEYS - * + * * @param key * The KEYS object who's value to return. * @return The value of the property or null if none exists @@ -100,7 +100,7 @@ public class ListenerProperties { /** * Returns a property matching a given string. - * + * * @param key * The key who's value to return. * @return The value of the property or null if none exists @@ -111,7 +111,7 @@ public class ListenerProperties { /** * Returns a property matching a given KEYS - * + * * @param key * The KEYS object who's value to return. * @param defaultValue @@ -124,7 +124,7 @@ public class ListenerProperties { /** * Returns a property matching a given string. - * + * * @param key * The key who's value to return. * @param defaultValue @@ -218,6 +218,27 @@ public class ListenerProperties { TOPIC_READ_TIMEOUT("topic.read.timeout"), /** + * Blacklist time for a server with response problem in seconds + */ + + PROBLEM_WITH_RESPONSE_BLACKLIST_TIME("topic.responseProblem.blacklistTime"), + /** + * Blacklist time for a server with server problem in seconds + */ + + PROBLEM_SERVERSIDE_ERROR_BLACKLIST_TIME("topic.serverError.blacklistTime"), + /** + * Blacklist time for a server with DNS problem in seconds + */ + + PROBLEM_DNS_BLACKLIST_TIME("topic.dnsIssue.blacklistTime"), + /** + * Blacklist time for a server with IO Exception problem in seconds + */ + + PROBLEM_IO_EXCEPTION_BLACKLIST_TIME("topic.ioException.blacklistTime"), + + /** * The name of the client to use. Should be unique to the application. */ CLIENT_NAME("client.name"), diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/impl/EventHandlerImpl.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/impl/EventHandlerImpl.java index 3019aaf33..74193c2b8 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/impl/EventHandlerImpl.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/impl/EventHandlerImpl.java @@ -2,22 +2,22 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= * 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. - * + * * ============LICENSE_END========================================================= */ @@ -100,6 +100,27 @@ public class EventHandlerImpl implements EventHandler { */ private String filter_json; + + /* + * Blacklist time for a server with response problem in seconds + */ + private String responseProblemBlacklistTime; + + /* + * Blacklist time for a server with server problem in seconds + */ + private String serverProblemBlacklistTime; + + /* + * Blacklist time for a server with DNS problem in seconds + */ + private String dnsIssueBlacklistTime; + + /* + * Blacklist time for a server with IO Exception problem in seconds + */ + private String ioExceptionBlacklistTime; + private MessageService messageService; private Consumer reader = null; @@ -115,6 +136,10 @@ public class EventHandlerImpl implements EventHandler { clientId = props.getProperty(ListenerProperties.KEYS.CLIENT_ID, "0"); apiKey = props.getProperty(ListenerProperties.KEYS.AUTH_USER_KEY); apiSecret = props.getProperty(ListenerProperties.KEYS.AUTH_SECRET_KEY); + responseProblemBlacklistTime = props.getProperty(ListenerProperties.KEYS.PROBLEM_WITH_RESPONSE_BLACKLIST_TIME); + serverProblemBlacklistTime = props.getProperty(ListenerProperties.KEYS.PROBLEM_SERVERSIDE_ERROR_BLACKLIST_TIME); + dnsIssueBlacklistTime = props.getProperty(ListenerProperties.KEYS.PROBLEM_DNS_BLACKLIST_TIME); + ioExceptionBlacklistTime = props.getProperty(ListenerProperties.KEYS.PROBLEM_IO_EXCEPTION_BLACKLIST_TIME); filter_json = props.getProperty(ListenerProperties.KEYS.TOPIC_READ_FILTER); @@ -218,6 +243,26 @@ public class EventHandlerImpl implements EventHandler { try { out = ((MessageAdapterFactory) ctx.getService(svcRef)) .createConsumer(pool, readTopic, clientName, clientId, filter_json, apiKey, apiSecret); + + if (out != null && responseProblemBlacklistTime != null && responseProblemBlacklistTime.length() > 0) + { + out.setResponseProblemBlacklistTime(responseProblemBlacklistTime); + } + + if (out != null && serverProblemBlacklistTime != null && serverProblemBlacklistTime.length() > 0) + { + out.setServerProblemBlacklistTime(serverProblemBlacklistTime); + } + + if (out != null && dnsIssueBlacklistTime != null && dnsIssueBlacklistTime.length() > 0) + { + out.setDnsIssueBlacklistTime(dnsIssueBlacklistTime); + } + + if (out != null && ioExceptionBlacklistTime != null && ioExceptionBlacklistTime.length() > 0) + { + out.setIOExceptionBlacklistTime(ioExceptionBlacklistTime); + } } catch (Exception e) { //TODO:create eelf message LOG.error("EvenHandlerImp.getConsumer calling MessageAdapterFactor.createConsumer", e); @@ -250,6 +295,25 @@ public class EventHandlerImpl implements EventHandler { if (svcRef != null) { out = ((MessageAdapterFactory) ctx.getService(svcRef)) .createProducer(pool, writeTopics, apiKey, apiSecret); + if (out != null && responseProblemBlacklistTime != null && responseProblemBlacklistTime.length() > 0) + { + out.setResponseProblemBlacklistTime(responseProblemBlacklistTime); + } + + if (out != null && serverProblemBlacklistTime != null && serverProblemBlacklistTime.length() > 0) + { + out.setServerProblemBlacklistTime(serverProblemBlacklistTime); + } + + if (out != null && dnsIssueBlacklistTime != null && dnsIssueBlacklistTime.length() > 0) + { + out.setDnsIssueBlacklistTime(dnsIssueBlacklistTime); + } + + if (out != null && ioExceptionBlacklistTime != null && ioExceptionBlacklistTime.length() > 0) + { + out.setIOExceptionBlacklistTime(ioExceptionBlacklistTime); + } if (out != null) { for (String url : pool) { if (url.contains("3905") || url.contains("https")) { @@ -331,6 +395,26 @@ public class EventHandlerImpl implements EventHandler { } @Override + public void setResponseProblemBlacklistTime(String duration){ + this.responseProblemBlacklistTime = duration; + } + + @Override + public void setServerProblemBlacklistTime(String duration){ + this.serverProblemBlacklistTime = duration; + } + + @Override + public void setDnsIssueBlacklistTime(String duration){ + this.dnsIssueBlacklistTime = duration; + } + + @Override + public void setIOExceptionBlacklistTime(String duration){ + this.ioExceptionBlacklistTime = duration; + } + + @Override public void clearCredentials() { apiKey = null; apiSecret = null; diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/ListenerPropertiesTest.java b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/ListenerPropertiesTest.java index 088553e76..c83555c50 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/ListenerPropertiesTest.java +++ b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/ListenerPropertiesTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -121,7 +121,7 @@ public class ListenerPropertiesTest { @Test public void testKeys() { // Hardcode count so tests must be updated when values are added - assertEquals(15, ListenerProperties.KEYS.values().length); + assertEquals(19, ListenerProperties.KEYS.values().length); Properties tmp = new Properties(); try { diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties index bacbe53f3..c729c7b0a 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties +++ b/appc-event-listener/appc-event-listener-bundle/src/test/resources/org/onap/appc/default.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP : APPC # ================================================================================ -# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Copyright (C) 2017 Amdocs # ============================================================================= @@ -58,7 +58,10 @@ appc.ClosedLoop.threads.queuesize.max=1000 appc.ClosedLoop.threads.poolsize.min=1 appc.ClosedLoop.threads.poolsize.max=2 appc.ClosedLoop.provider.url=https://admin:password@localhost:8443/restconf/operations/appc-provider:topology-operation - +appc.ClosedLoop.topic.responseProblem.blacklistTime=60 +appc.ClosedLoop.topic.serverError.blacklistTime=60 +appc.ClosedLoop.topic.dnsIssue.blacklistTime=60 +appc.ClosedLoop.topic.ioException.blacklistTime=60 |