* guard
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* 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.
import org.apache.commons.io.IOUtils;
import org.apache.http.entity.ContentType;
import org.json.JSONObject;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PolicyGuardXacmlHelper {
private static final Logger logger = LoggerFactory.getLogger(PolicyGuardXacmlHelper.class);
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
// Constant for the systme line separator
private static final String SYSTEM_LS = System.lineSeparator();
/**
* Call PDP.
- *
+ *
* @param xacmlReq the XACML request
* @return the response
*/
/**
* This makes an HTTP POST call to a running PDP RESTful servlet to get a decision.
- *
+ *
* @param is the InputStream
* @param authorization the Authorization
* @param clientauth the ClientAuth
/**
* Parse XACML PDP response.
- *
+ *
* @param xacmlResponse the XACML response
* @return the PolicyGuardResponse
*/
* aai
* ================================================================================
* Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* 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.
import java.util.UUID;
import org.onap.policy.aai.util.Serialization;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.rest.RestManager;
import org.onap.policy.rest.RestManager.Pair;
import org.slf4j.Logger;
private static final Logger logger = LoggerFactory.getLogger(AaiManager.class);
/** The Constant netLogger. */
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
/** The rest manager. */
// The REST manager used for processing REST calls for this AAI manager
* Copyright (C) 2018 Huawei. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Map;
import org.drools.core.WorkingMemory;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.rest.RestManager;
import org.onap.policy.rest.RestManager.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
+
public final class SdncManager implements Runnable {
private static final String SYSTEM_LS = System.lineSeparator();
private SdncRequest sdncRequest;
private WorkingMemory workingMem;
private static final Logger logger = LoggerFactory.getLogger(SdncManager.class);
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
// The REST manager used for processing REST calls for this Sdnc manager
private RestManager restManager;
-
+
/**
* Constructor.
- *
+ *
* @param wm Drools working memory
* @param request request
*/
restManager = new RestManager();
- setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"),
+ setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"),
getPeManagerEnvProperty("sdnc.password"));
}
/**
* Set the parameters.
- *
+ *
* @param baseUrl base URL
* @param name username
* @param pwd password
String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName);
if (enginePropertyValue == null) {
throw new IllegalArgumentException(
- "The value of policy engine manager environment property \""
+ "The value of policy engine manager environment property \""
+ enginePropertyName + "\" may not be null"
);
}
* so
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.drools.core.WorkingMemory;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.rest.RestManager;
import org.onap.policy.rest.RestManager.Pair;
*/
public final class SoManager {
private static final Logger logger = LoggerFactory.getLogger(SoManager.class);
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
+
private static ExecutorService executors = Executors.newCachedThreadPool();
private static final int SO_RESPONSE_ERROR = 999;
* @param request the SO request
* @return a concurrent Future for the thread that handles the request
*/
- public Future<SoResponse> asyncSoRestCall(final String requestId,
+ public Future<SoResponse> asyncSoRestCall(final String requestId,
final WorkingMemory wm,
- final String serviceInstanceId,
- final String vnfInstanceId,
+ final String serviceInstanceId,
+ final String vnfInstanceId,
final String vfModuleInstanceId, final SoRequest request) {
return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId,
vfModuleInstanceId, request));
* @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request)
* @param request the request itself
*/
- private AsyncSoRestCallThread(final String requestId,
+ private AsyncSoRestCallThread(final String requestId,
final WorkingMemory wm, final String serviceInstanceId,
- final String vnfInstanceId, final String vfModuleInstanceId,
+ final String vnfInstanceId, final String vfModuleInstanceId,
final SoRequest request) {
this.requestId = requestId;
this.wm = wm;
* ============LICENSE_START=======================================================
* Copyright (C) 2017-2018 Intel Corp, AT&T. All rights reserved.
* Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Map;
import org.drools.core.WorkingMemory;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.rest.RestManager;
import org.onap.policy.rest.RestManager.Pair;
private VfcRequest vfcRequest;
private WorkingMemory workingMem;
private static final Logger logger = LoggerFactory.getLogger(VfcManager.class);
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
// The REST manager used for processing REST calls for this VFC manager
private RestManager restManager;
/**
* Constructor.
- *
+ *
* @param wm Drools working memory
* @param request request
*/
/**
* Set the parameters.
- *
+ *
* @param baseUrl base URL
* @param name username
* @param pwd password
/**
* Protected setter for rest manager to allow mocked rest manager to be used for testing.
- *
+ *
* @param restManager the test REST manager
*/
protected void setRestManager(final RestManager restManager) {
/**
* This method reads and validates environmental properties coming from the policy engine. Null
* properties cause an {@link IllegalArgumentException} runtime exception to be thrown
- *
+ *
* @param string the name of the parameter to retrieve
* @return the property value
*/
* guard
* ================================================================================
* Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* 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.
import org.apache.commons.io.IOUtils;
import org.apache.http.entity.ContentType;
import org.json.JSONObject;
+import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.guard.PolicyGuardResponse;
import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes;
public class PolicyGuardXacmlHelperEmbedded {
private static final Logger logger = LoggerFactory.getLogger(PolicyGuardXacmlHelperEmbedded.class);
- private static final Logger netLogger =
- LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER);
+ private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger();
// Constant for the system line separator
private static final String SYSTEM_LS = System.lineSeparator();
// REST timeout, initialized from 'pdpx.timeout' property
private int timeout = 20000;
-
+
public PolicyGuardXacmlHelperEmbedded() {
init(PolicyEngine.manager.getEnvironment());
}
/**
* Call PDP.
- *
+ *
* @param xacmlReq the XACML request
* @return the response
*/
/**
* This makes an HTTP POST call to a running PDP RESTful servlet to get a decision.
- *
+ *
* @param is the InputStream
* @param authorization the Authorization
* @param clientauth the ClientAuth
/**
* Call embedded PDP.
- *
+ *
* @param xacmlReq the XACML request
* @return the response
*/
Properties props = new Properties();
//
// Get properties
- //
+ //
try ( InputStream is = new FileInputStream(propfile);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr) ) {
/**
* Parse XACML PDP response.
- *
+ *
* @param xacmlResponse the XACML response
* @return the PolicyGuardResponse
*/
// if content length is -1, response is chunked, and
// TCP connection will be dropped at the end
byte[] buf = new byte[contentLength < 0 ? 1024 : contentLength];
-
+
int offset = 0;
do {
int size = inputStream.read(buf, offset, buf.length - offset);