* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
+ * Copyright (C) 2017 Amdocs
* ================================================================================
* Modifications Copyright (C) 2018 Ericsson
- * =============================================================================
+ * ================================================================================
+ *
* 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=========================================================
*/
-package org.onap.appc.instar.node;
+
+package org.onap.appc.system.node;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.onap.appc.instar.interfaceImpl.InstarRestClientImpl;
import org.onap.appc.instar.interfaceImpl.InterfaceIpAddressImpl;
import org.onap.appc.instar.interfaces.RestClientInterface;
-import org.onap.appc.instar.interfaces.RuleHandlerInterface;
+import org.onap.appc.system.interfaces.RuleHandlerInterface;
import org.onap.appc.instar.utils.InstarClientConstant;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
import org.onap.sdnc.config.params.data.Parameter;
-public class InstarClientNode implements SvcLogicJavaPlugin {
+public class SourceSystemNode implements SvcLogicJavaPlugin {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarClientNode.class);
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(SourceSystemNode.class);
public void getInstarInfo(Map<String, String> inParams, SvcLogicContext ctx)
RuleHandlerInterface handler;
log.info("Processing rule Type : " + params.getRuleType());
if (params.getRuleType().equals(InstarClientConstant.INTERFACE_IP_ADDRESS)) {
- handler = createHandler(params, ctx);
+ handler = createHandler(params, ctx);
} else {
throw new SvcLogicException("No Rule Defined to process :" + params.getRuleType());
}
private static String[] getKeys(String keyString) {
log.error("Received Key String as :" + keyString);
+
String key = keyString
.replace("[", "")
.replace("]", "")
.replace("\"", "");
+
if (key.contains(",")) {
return key.split(",");
} else {
input.putAll(inParams);
RestClientInterface rcINterface = createRestClientInterface(input);
String response = rcINterface.sendRequest(inParams.get("operationName"));
+
responsePrefix = StringUtils.isNotBlank(responsePrefix) ? responsePrefix + "." : "";
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
InstarClientConstant.OUTPUT_STATUS_SUCCESS);
ctx.setAttribute(responsePrefix + InstarClientConstant.INSTAR_KEY_VALUES, response);
+
} catch (Exception e) {
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
InstarClientConstant.OUTPUT_STATUS_FAILURE);
}
}
+
protected RuleHandlerInterface createHandler(Parameter params, SvcLogicContext ctx) {
return new InterfaceIpAddressImpl(params, ctx);
}
protected RestClientInterface createRestClientInterface(Map<String, String> input) {
return new InstarRestClientImpl(input);
}
+
}