diff options
author | Skip Wonnell <kw5258@att.com> | 2017-08-15 17:26:38 -0500 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-17 06:15:50 +0000 |
commit | 9296b7674ea71cb86fe2ea99e80d9d055267ae5b (patch) | |
tree | 399a89d854d3e9474d498173d483abfd08cce051 /appc-config/appc-flow-controller/provider | |
parent | 86011b92947fdb0805623a25c893cd59128ec40e (diff) |
Initial commit for appc-flow-controller bundle
This bundle contains the APPC orchestration control
for the directed graph for model driven transactions
Issue-ID: APPC-73
Change-Id: Ia812fe14b2d6aa46c3acd5b2bfab0c004507c628
Signed-off-by: Skip Wonnell <kw5258@att.com>
Diffstat (limited to 'appc-config/appc-flow-controller/provider')
46 files changed, 5407 insertions, 0 deletions
diff --git a/appc-config/appc-flow-controller/provider/.gitignore b/appc-config/appc-flow-controller/provider/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-config/appc-flow-controller/provider/pom.xml b/appc-config/appc-flow-controller/provider/pom.xml new file mode 100644 index 000000000..e76d42dae --- /dev/null +++ b/appc-config/appc-flow-controller/provider/pom.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-config-flow-controller</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-config-flow-controller-provider</artifactId> + <packaging>bundle</packaging> + <name>Flow Executor - Provider</name> + <url>http://maven.apache.org</url> + + <dependencies> + <dependency> + <groupId>equinoxSDK381</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${equinox.osgi.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + </dependency> + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.adaptors</groupId> + <artifactId>sql-resource-provider</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.17</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${bundle.plugin.version}</version> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.openecomp.appc.flow.controller</Bundle-SymbolicName> + <Bundle-Activator>org.openecomp.appc.flow.controller.FlowControllerActivator</Bundle-Activator> + <Export-Package>org.openecomp.appc.flow.controller</Export-Package> + <Import-Package>*</Import-Package> + <DynamicImport-Package>*</DynamicImport-Package> + </instructions> + <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation> + </configuration> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + com.brocade.developer + </groupId> + <artifactId> + providermodule-plugin + </artifactId> + <versionRange> + [1.2.0.100-SNAPSHOT,) + </versionRange> + <goals> + <goal>process</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/FlowControllerActivator.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/FlowControllerActivator.java new file mode 100644 index 000000000..e7e80b731 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/FlowControllerActivator.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller; + +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; + +import org.openecomp.appc.flow.controller.node.FlowControlNode; +import org.openecomp.appc.flow.controller.node.JsonParsingNode; +import org.openecomp.appc.flow.controller.node.RestServiceNode; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class FlowControllerActivator implements BundleActivator{ + + private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); + + + private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControllerActivator.class); + + @Override + public void start(BundleContext ctx) throws Exception + { + + try { + + FlowControlNode flowExecutorNode = new FlowControlNode(); + log.debug("Registering service "+ flowExecutorNode.getClass().getName()); + registrations.add(ctx.registerService(flowExecutorNode.getClass().getName(), flowExecutorNode, null)); + log.debug("Registering service sccessful for "+ flowExecutorNode.getClass().getName()); + + RestServiceNode restServiceNode = new RestServiceNode(); + log.debug("Registering service "+ restServiceNode.getClass().getName()); + registrations.add(ctx.registerService(restServiceNode.getClass().getName(), restServiceNode, null)); + log.debug("Registering service sccessful for "+ restServiceNode.getClass().getName()); + + JsonParsingNode jsonParsingNode = new JsonParsingNode(); + log.debug("Registering service "+ jsonParsingNode.getClass().getName()); + registrations.add(ctx.registerService(jsonParsingNode.getClass().getName(), jsonParsingNode, null)); + log.debug("Registering service sccessful for "+ jsonParsingNode.getClass().getName()); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + @Override + public void stop(BundleContext arg0) throws Exception + { + for (ServiceRegistration registration: registrations) + { + registration.unregister(); + registration = null; + } + + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java new file mode 100644 index 000000000..58877348f --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.ResponseHandlerImpl; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.appc.flow.controller.data.Response; +import org.openecomp.appc.flow.controller.data.ResponseAction; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +public class DefaultResponseHandler { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DefaultResponseHandler.class); + + public ResponseAction handlerResponse(Transaction transaction){ + + log.info("Transaction Input params " + transaction.toString()); + ResponseAction responseAction = new ResponseAction(); + if(transaction.getResponses() != null && !transaction.getResponses().isEmpty()){ + for(Response response : transaction.getResponses()){ + if(response.getResponseCode() != null && response.getResponseCode().equals(transaction.getStatusCode())){ + responseAction = response.getResponseAction(); + break; + } + + } + + } + return responseAction ; + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ActionIdentifier.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ActionIdentifier.java new file mode 100644 index 000000000..422bb1152 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ActionIdentifier.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ActionIdentifier { + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((vnfId == null) ? 0 : vnfId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ActionIdentifier other = (ActionIdentifier) obj; + if (vnfId == null) { + if (other.vnfId != null) + return false; + } else if (!vnfId.equals(other.vnfId)) + return false; + return true; + } + + @JsonProperty("vnf-id") + private String vnfId ; + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + @Override + public String toString() { + return "ActionIdentifier [vnfId=" + vnfId + "]"; + } + + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Parameters.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Parameters.java new file mode 100644 index 000000000..fe3ae8ff0 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Parameters.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Parameters { + + + @JsonProperty("name") + private String paramName ; + + @JsonProperty("value") + private String paramValue ; + + + public String getParamValue() { + return paramValue; + } + public void setParamValue(String paramValue) { + this.paramValue = paramValue; + } + public String getParamName() { + return paramName; + } + public void setParamName(String paramName) { + this.paramName = paramName; + } + @Override + public String toString() { + return "Parameters [paramName=" + paramName + ", paramValue=" + paramValue + "]"; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((paramName == null) ? 0 : paramName.hashCode()); + result = prime * result + ((paramValue == null) ? 0 : paramValue.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Parameters other = (Parameters) obj; + if (paramName == null) { + if (other.paramName != null) + return false; + } else if (!paramName.equals(other.paramName)) + return false; + if (paramValue == null) { + if (other.paramValue != null) + return false; + } else if (!paramValue.equals(other.paramValue)) + return false; + return true; + } + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PreCheck.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PreCheck.java new file mode 100644 index 000000000..9ee3d615a --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PreCheck.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class PreCheck { + + + @JsonProperty("precheck-operator") + private String precheckOperator; + + public String getPrecheckOperator() { + return precheckOperator; + } + + public void setPrecheckOperator(String precheckOperator) { + this.precheckOperator = precheckOperator; + } + + @JsonProperty("precheck-options") + private List<PrecheckOption> precheckOptions; + + public List<PrecheckOption> getPrecheckOptions() { + return precheckOptions; + } + + public void setPrecheckOptions(List<PrecheckOption> precheckOptions) { + this.precheckOptions = precheckOptions; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((precheckOperator == null) ? 0 : precheckOperator.hashCode()); + result = prime * result + ((precheckOptions == null) ? 0 : precheckOptions.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PreCheck other = (PreCheck) obj; + if (precheckOperator == null) { + if (other.precheckOperator != null) + return false; + } else if (!precheckOperator.equals(other.precheckOperator)) + return false; + if (precheckOptions == null) { + if (other.precheckOptions != null) + return false; + } else if (!precheckOptions.equals(other.precheckOptions)) + return false; + return true; + } + + @Override + public String toString() { + return "PreCheck [precheckOperator=" + precheckOperator + ", precheckOptions=" + precheckOptions + "]"; + } + + + + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PrecheckOption.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PrecheckOption.java new file mode 100644 index 000000000..efa19025a --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/PrecheckOption.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class PrecheckOption { + + + @JsonProperty("pre-transaction-id") + private int pTransactionID ; + + @JsonProperty("param-name") + private String paramName ; + + + @JsonProperty("param-value") + private String paramValue ; + + @JsonProperty("rule") + private String rule ; + + public int getpTransactionID() { + return pTransactionID; + } + + public void setpTransactionID(int pTransactionID) { + this.pTransactionID = pTransactionID; + } + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public String getParamValue() { + return paramValue; + } + + public void setParamValue(String paramValue) { + this.paramValue = paramValue; + } + + + + @Override + public String toString() { + return "PrecheckOption [pTransactionID=" + pTransactionID + ", paramName=" + paramName + ", paramValue=" + + paramValue + ", rule=" + rule + "]"; + } + + + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PrecheckOption other = (PrecheckOption) obj; + if (pTransactionID != other.pTransactionID) + return false; + if (paramName == null) { + if (other.paramName != null) + return false; + } else if (!paramName.equals(other.paramName)) + return false; + if (paramValue == null) { + if (other.paramValue != null) + return false; + } else if (!paramValue.equals(other.paramValue)) + return false; + if (rule != other.rule) + return false; + return true; + } + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Response.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Response.java new file mode 100644 index 000000000..fb20edb6b --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Response.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Response { + + @JsonProperty("response-code") + private String responseCode; + + @JsonProperty("response-message") + private String responseMessage; + + @JsonProperty("response-action") + private ResponseAction responseAction; + + private String responseActionHanlder; + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + + public String getResponseActionHanlder() { + return responseActionHanlder; + } + + public void setResponseActionHanlder(String responseActionHanlder) { + this.responseActionHanlder = responseActionHanlder; + } + + public ResponseAction getResponseAction() { + return responseAction; + } + + public void setResponseAction(ResponseAction responseAction) { + this.responseAction = responseAction; + } + + @Override + public String toString() { + return "Response [responseCode=" + responseCode + ", responseMessage=" + responseMessage + ", responseAction=" + + responseAction + ", responseActionHanlder=" + responseActionHanlder + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ResponseAction.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ResponseAction.java new file mode 100644 index 000000000..84497de35 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/ResponseAction.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ResponseAction { + + @JsonProperty("wait") + private String wait; + + @JsonProperty("retry") + private String retry; + + @JsonProperty("jump") + private String jump; + + @JsonProperty("ignore") + private boolean ignore; + + @JsonProperty("stop") + private boolean stop; + + @JsonProperty("intermediate-message") + private boolean intermediateMessage; + + public String getWait() { + return wait; + } + + public void setWait(String wait) { + this.wait = wait; + } + + public String getRetry() { + return retry; + } + + public void setRetry(String retry) { + this.retry = retry; + } + + public String getJump() { + return jump; + } + + public void setJump(String jump) { + this.jump = jump; + } + + public boolean isIgnore() { + return ignore; + } + + public void setIgnore(boolean ignore) { + this.ignore = ignore; + } + + public boolean isStop() { + return stop; + } + + public void setStop(boolean stop) { + this.stop = stop; + } + + + + @Override + public String toString() { + return "ResponseAction [wait=" + wait + ", retry=" + retry + ", jump=" + jump + ", ignore=" + ignore + ", stop=" + + stop + ", intermediateMessage=" + intermediateMessage + "]"; + } + + public boolean isIntermediateMessage() { + return intermediateMessage; + } + + public void setIntermediateMessage(boolean intermediateMessage) { + this.intermediateMessage = intermediateMessage; + } + + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transaction.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transaction.java new file mode 100644 index 000000000..8f26e80ff --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transaction.java @@ -0,0 +1,365 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class Transaction { + + @JsonProperty("transaction-id") + private int transactionId ; + + @JsonProperty("action") + private String action ; + + @JsonProperty("action-level") + private String actionLevel ; + + @JsonProperty("action-identifier") + private ActionIdentifier actionIdentifier ; + + @JsonProperty("parameters") + private List<Parameters> parameters ; + + private String executionType; + + private String uId; + + private String statusCode; + + private String pswd; + + private String executionEndPoint; + + private String executionModule; + + private String executionRPC; + + @JsonProperty("state") + private String state; + + @JsonProperty("precheck") + private PreCheck precheck; + + @JsonProperty("payload") + private String payload ; + + @JsonProperty("responses") + private List<Response> responses ; + + + private String status = "PENDING"; + + public String getuId() { + return uId; + } + + public void setuId(String uId) { + this.uId = uId; + } + + public String getPswd() { + return pswd; + } + + public void setPswd(String pswd) { + this.pswd = pswd; + } + + public String getExecutionEndPoint() { + return executionEndPoint; + } + + public void setExecutionEndPoint(String executionEndPoint) { + this.executionEndPoint = executionEndPoint; + } + + + public String getExecutionType() { + return executionType; + } + + public void setExecutionType(String executionType) { + this.executionType = executionType; + } + + public String getExecutionModule() { + return executionModule; + } + + + public void setExecutionModule(String executionModule) { + this.executionModule = executionModule; + } + + + public String getExecutionRPC() { + return executionRPC; + } + + + public void setExecutionRPC(String executionRPC) { + this.executionRPC = executionRPC; + } + + + public List<Parameters> getParameters() { + return parameters; + } + + + public void setParameters(List<Parameters> parameters) { + this.parameters = parameters; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public PreCheck getPrecheck() { + return precheck; + } + + public void setPrecheck(PreCheck precheck) { + this.precheck = precheck; + } + + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + public List<Response> getResponses() { + return responses; + } + + + public void setResponses(List<Response> responses) { + this.responses = responses; + } + + public int getTransactionId() { + return transactionId; + } + + + public void setTransactionId(int transactionId) { + this.transactionId = transactionId; + } + + + public String getAction() { + return action; + } + + + public void setAction(String action) { + this.action = action; + } + + + public String getActionLevel() { + return actionLevel; + } + + + public void setActionLevel(String actionLevel) { + this.actionLevel = actionLevel; + } + + + + public String getPayload() { + return payload; + } + + + public void setPayload(String payload) { + this.payload = payload; + } + + + public ActionIdentifier getActionIdentifier() { + return actionIdentifier; + } + + + public void setActionIdentifier(ActionIdentifier actionIdentifier) { + this.actionIdentifier = actionIdentifier; + } + + public String getStatusCode() { + return statusCode; + } + + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + + @Override + public String toString() { + return "Transaction [transactionId=" + transactionId + ", action=" + action + ", actionLevel=" + actionLevel + + ", actionIdentifier=" + actionIdentifier + ", parameters=" + parameters + ", executionType=" + + executionType + ", uId=" + uId + ", statusCode=" + statusCode + ", pswd=" + pswd + + ", executionEndPoint=" + executionEndPoint + ", executionModule=" + executionModule + + ", executionRPC=" + executionRPC + ", state=" + state + ", precheck=" + precheck + ", payload=" + + payload + ", responses=" + responses + ", status=" + status + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((action == null) ? 0 : action.hashCode()); + result = prime * result + ((actionIdentifier == null) ? 0 : actionIdentifier.hashCode()); + result = prime * result + ((actionLevel == null) ? 0 : actionLevel.hashCode()); + result = prime * result + ((executionEndPoint == null) ? 0 : executionEndPoint.hashCode()); + result = prime * result + ((executionModule == null) ? 0 : executionModule.hashCode()); + result = prime * result + ((executionRPC == null) ? 0 : executionRPC.hashCode()); + result = prime * result + ((executionType == null) ? 0 : executionType.hashCode()); + result = prime * result + ((parameters == null) ? 0 : parameters.hashCode()); + result = prime * result + ((payload == null) ? 0 : payload.hashCode()); + result = prime * result + ((precheck == null) ? 0 : precheck.hashCode()); + result = prime * result + ((pswd == null) ? 0 : pswd.hashCode()); + result = prime * result + ((responses == null) ? 0 : responses.hashCode()); + result = prime * result + ((state == null) ? 0 : state.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((statusCode == null) ? 0 : statusCode.hashCode()); + result = prime * result + transactionId; + result = prime * result + ((uId == null) ? 0 : uId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Transaction other = (Transaction) obj; + if (action == null) { + if (other.action != null) + return false; + } else if (!action.equals(other.action)) + return false; + if (actionIdentifier == null) { + if (other.actionIdentifier != null) + return false; + } else if (!actionIdentifier.equals(other.actionIdentifier)) + return false; + if (actionLevel == null) { + if (other.actionLevel != null) + return false; + } else if (!actionLevel.equals(other.actionLevel)) + return false; + if (executionEndPoint == null) { + if (other.executionEndPoint != null) + return false; + } else if (!executionEndPoint.equals(other.executionEndPoint)) + return false; + if (executionModule == null) { + if (other.executionModule != null) + return false; + } else if (!executionModule.equals(other.executionModule)) + return false; + if (executionRPC == null) { + if (other.executionRPC != null) + return false; + } else if (!executionRPC.equals(other.executionRPC)) + return false; + if (executionType == null) { + if (other.executionType != null) + return false; + } else if (!executionType.equals(other.executionType)) + return false; + if (parameters == null) { + if (other.parameters != null) + return false; + } else if (!parameters.equals(other.parameters)) + return false; + if (payload == null) { + if (other.payload != null) + return false; + } else if (!payload.equals(other.payload)) + return false; + if (precheck == null) { + if (other.precheck != null) + return false; + } else if (!precheck.equals(other.precheck)) + return false; + if (pswd == null) { + if (other.pswd != null) + return false; + } else if (!pswd.equals(other.pswd)) + return false; + if (responses == null) { + if (other.responses != null) + return false; + } else if (!responses.equals(other.responses)) + return false; + if (state == null) { + if (other.state != null) + return false; + } else if (!state.equals(other.state)) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + if (statusCode == null) { + if (other.statusCode != null) + return false; + } else if (!statusCode.equals(other.statusCode)) + return false; + if (transactionId != other.transactionId) + return false; + if (uId == null) { + if (other.uId != null) + return false; + } else if (!uId.equals(other.uId)) + return false; + return true; + } + + +} + + + diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transactions.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transactions.java new file mode 100644 index 000000000..736b7f3b7 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/data/Transactions.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.data; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Transactions { + + + @JsonProperty("transactions") + private List<Transaction> transactions ; + + public List<Transaction> getTransactions() { + return transactions; + } + + public void setTransactions(List<Transaction> transactions) { + this.transactions = transactions; + } + + @Override + public String toString() { + return "Transactions [transactions=" + transactions + "]"; + } + + +} + + + diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/dbervices/FlowControlDBService.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/dbervices/FlowControlDBService.java new file mode 100644 index 000000000..c3ea6ede8 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/dbervices/FlowControlDBService.java @@ -0,0 +1,220 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.dbervices; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.utils.EscapeUtils; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicResource; +import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.sli.resource.sql.SqlResource; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class FlowControlDBService { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlDBService.class); + private SvcLogicResource serviceLogic; + private static FlowControlDBService dgGeneralDBService = null; + public static FlowControlDBService initialise() { + if (dgGeneralDBService == null) { + dgGeneralDBService = new FlowControlDBService(); + } + return dgGeneralDBService; + } + private FlowControlDBService() { + if (serviceLogic == null) { + serviceLogic = new SqlResource(); + } + } + + public void getFlowReferenceData(SvcLogicContext ctx, Map<String, String> inParams, SvcLogicContext localContext) throws SvcLogicException { + + String fn = "DBService.getflowModelInfo"; + // log.debug("Testing " + ctx.getAttribute(FlowExecutorConstants.VNF_TYPE) + " and " + ctx.getAttribute(FlowExecutorConstants.ACTION_LEVEL)); + String whereClause = " where ACTION = $" +FlowControllerConstants.REQUEST_ACTION ; + + if(ctx.getAttribute(FlowControllerConstants.VNF_TYPE) !=null) + whereClause = whereClause.concat(" and VNF_TYPE = $" + FlowControllerConstants.VNF_TYPE); + + if(ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL) !=null) + whereClause = whereClause.concat(" and ACTION_LEVEL = $" + FlowControllerConstants.ACTION_LEVEL); + + QueryStatus status = null; + if (serviceLogic != null && localContext != null) { + String key = "select SEQUENCE_TYPE, CATEGORY, GENERATION_NODE, EXECUTION_NODE from " + FlowControllerConstants.DB_MULTISTEP_FLOW_REFERENCE + + whereClause ; + log.debug(fn + "Query String : " + key); + status = serviceLogic.query("SQL", false, null, key, null, null, localContext); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting FlowReferenceData "); + } + } + public String getEndPointByAction(String action) { + // TODO Auto-generated method stub + return null; + } + public String getDesignTimeFlowModel(SvcLogicContext localContext) throws SvcLogicException { + String fn = "DBService.getDesignTimeFlowModel "; + QueryStatus status = null; + if (serviceLogic != null && localContext != null) { + String queryString = "select max(internal_version) as maxInternalVersion, artifact_name as artifactName from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name in (select artifact_name from " + FlowControllerConstants.DB_ASDC_REFERENCE + + " where vnf_type= $" + FlowControllerConstants.VNF_TYPE + + " and vnfc_type = $" + FlowControllerConstants.VNFC_TYPE + + " and action = $" + FlowControllerConstants.REQUEST_ACTION + + " and file_category = $" + FlowControllerConstants.CATEGORY + " )" ; + + + log.debug(fn + "Query String : " + queryString); + status = serviceLogic.query("SQL", false, null, queryString, null, null, localContext); + + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting FlowReferenceData "); + + String queryString1 = "select artifact_content from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name = $artifactName and internal_version = $maxInternalVersion "; + + log.debug(fn + "Query String : " + queryString1); + status = serviceLogic.query("SQL", false, null, queryString1, null, null, localContext); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting FlowReferenceData "); + } + + return localContext.getAttribute("artifact-content"); + } + public QueryStatus loadSequenceIntoDB(SvcLogicContext localContext) throws SvcLogicException { + String fn = "DBService.saveArtifacts"; + localContext.setAttribute(FlowControllerConstants.ARTIFACT_CONTENT_ESCAPED, EscapeUtils.escapeSql(localContext.getAttribute(FlowControllerConstants.ARTIFACT_CONTENT))); + log.debug("ESCAPED sequence for DB : " + localContext.getAttribute(FlowControllerConstants.ARTIFACT_CONTENT_ESCAPED)); + + for (Object key : localContext.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = localContext.getAttribute(parmName); + log.debug(" loadSequenceIntoDB " + parmName + "=" + parmValue); + + } + + + QueryStatus status = null; + if (serviceLogic != null && localContext != null) { + String queryString = "INSERT INTO " + FlowControllerConstants.DB_REQUEST_ARTIFACTS + + " set request_id = $" + FlowControllerConstants.REQUEST_ID + + " , action = $" + FlowControllerConstants.REQUEST_ACTION + + " , action_level = $" + FlowControllerConstants.ACTION_LEVEL + + " , vnf_type = $" + FlowControllerConstants.VNF_TYPE + + " , category = $" + FlowControllerConstants.CATEGORY + + " , artifact_content = $" + FlowControllerConstants.ARTIFACT_CONTENT_ESCAPED + + " , updated_date = sysdate() "; + + status = serviceLogic.save("SQL", false, false, queryString, null, null, localContext); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing storing Artifact: " +localContext.getAttribute(FlowControllerConstants.ARTIFACT_NAME)); + } + return status; + + } + public void populateModuleAndRPC(Transaction transaction, String vnf_type) throws SvcLogicException { + String fn = "FlowControlDBService.populateModuleAndRPC "; + QueryStatus status = null; + SvcLogicContext context = new SvcLogicContext(); + if (serviceLogic != null && context != null) { + String key = "select execution_type, execution_module, execution_rpc from " + FlowControllerConstants.DB_PROCESS_FLOW_REFERENCE + + " where action = '" + transaction.getAction() + "'" + + " and action_level = '" + transaction.getActionLevel() + "'" + + " and protocol in ( select protocol from " + FlowControllerConstants.DB_PROTOCOL_REFERENCE + + " where action = '" + transaction.getAction() + "'" ; + if(vnf_type !=null && !vnf_type.isEmpty()) + key = key + " and vnf_type ='" + vnf_type + "' )" ; + else + key = key + " ) " ; + log.debug(fn + "Query String : " + key); + status = serviceLogic.query("SQL", false, null, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting FlowReferenceData "); + + transaction.setExecutionModule(context.getAttribute(FlowControllerConstants.EXECUTTION_MODULE)); + transaction.setExecutionRPC(context.getAttribute(FlowControllerConstants.EXECUTION_RPC)); + transaction.setExecutionType(context.getAttribute(FlowControllerConstants.EXECUTION_TYPE)); + } + + } + + public String getDependencyInfo(SvcLogicContext localContext) throws SvcLogicException { + String fn = "DBService.getDependencyInfo "; + QueryStatus status = null; + if (serviceLogic != null && localContext != null) { + String queryString = "select max(internal_version) as maxInternalVersion, artifact_name as artifactName from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name in (select artifact_name from " + FlowControllerConstants.DB_ASDC_REFERENCE + + " where vnf_type= $" + FlowControllerConstants.VNF_TYPE + + " and file_category = '" + FlowControllerConstants.DEPENDENCYMODEL +"' )" ; + + log.debug(fn + "Query String : " + queryString); + status = serviceLogic.query("SQL", false, null, queryString, null, null, localContext); + + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting dependencydata "); + + String queryString1 = "select artifact_content from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name = $artifactName and internal_version = $maxInternalVersion "; + + log.debug(fn + "Query String : " + queryString1); + status = serviceLogic.query("SQL", false, null, queryString1, null, null, localContext); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting dependencyData "); + } + + return localContext.getAttribute("artifact-content"); + } + + public String getCapabilitiesData(SvcLogicContext localContext) throws SvcLogicException { + String fn = "DBService.getCapabilitiesData "; + QueryStatus status = null; + if (serviceLogic != null && localContext != null) { + String queryString = "select max(internal_version) as maxInternalVersion, artifact_name as artifactName from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name in (select artifact_name from " + FlowControllerConstants.DB_ASDC_REFERENCE + + " where vnf_type= $" + FlowControllerConstants.VNF_TYPE + + " and file_category = '" + FlowControllerConstants.CAPABILITY +"' )" ; + + log.info(fn + "Query String : " + queryString); + status = serviceLogic.query("SQL", false, null, queryString, null, null, localContext); + + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting capabilitiesData "); + + String queryString1 = "select artifact_content from " + FlowControllerConstants.DB_ASDC_ARTIFACTS + + " where artifact_name = $artifactName and internal_version = $maxInternalVersion "; + + log.debug(fn + "Query String : " + queryString1); + status = serviceLogic.query("SQL", false, null, queryString1, null, null, localContext); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - while getting capabilitiesData "); + } + + return localContext.getAttribute("artifact-content"); + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/GraphExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/GraphExecutor.java new file mode 100644 index 000000000..9c8a37c0a --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/GraphExecutor.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.executorImpl; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Properties; + +import org.openecomp.appc.flow.controller.data.Parameters; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.interfaces.FlowExecutorInterface; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicGraph; +import org.openecomp.sdnc.sli.provider.SvcLogicService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +public class GraphExecutor implements FlowExecutorInterface { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(GraphExecutor.class); + + private SvcLogicService svcLogic = null; + + public GraphExecutor() { + BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class) + .getBundleContext(); + + ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME); + if (sref != null) { + svcLogic = (SvcLogicService) bctx.getService(sref); + + + } else { + log.warn("Cannot find service reference for " + + SvcLogicService.NAME); + } + log.debug("Graph Executor Initialized successfully"); + } + + public boolean hasGraph(String module, String rpc, String version, + String mode) throws SvcLogicException { + return (svcLogic.hasGraph(module, rpc, version, mode)); + } + + public Properties executeGraph(String module, String rpc, String version, + String mode, Properties parms) throws SvcLogicException { + log.debug("Parameters passed to SLI"); + +// for (Object key : parms.keySet()) { +// String parmName = (String) key; +// String parmValue = parms.getProperty(parmName); +// +// log.debug(parmName + " = " + parmValue); +// } + + Properties respProps = svcLogic.execute(module, rpc, version, mode,parms); + if (log.isDebugEnabled()) { + log.debug("Parameters returned by SLI"); + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + log.debug(parmName + " = " + parmValue); + } + } + if ("failure" + .equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + return (respProps); + } + return (respProps); +} + +@Override +public HashMap<String, String> execute(Transaction transaction, SvcLogicContext ctx) throws Exception { + + String fn = "GraphExecutor.execute "; + log.debug(fn + "About to execute graph : " + transaction.getExecutionRPC()) ; + + Properties parms = new Properties(); + for (Object key : ctx.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + parms.put(parmName, parmValue); + log.info(fn + "Setting Key= " + parmName + "and Value = " + parmValue); + + } + Properties returnParams = executeGraph(transaction.getExecutionModule(),transaction.getExecutionRPC(), null, "sync", parms); + + //log.debug("Return Params executing DG :" + returnParams.toString()); + + log.debug("Returned Params from DG Module: " + transaction.getExecutionModule() + "and DG NAME: " + transaction.getExecutionRPC() + + returnParams.toString()); + + Enumeration e = returnParams.propertyNames(); + + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + log.info("NEW KEY = " + key + " -- " + returnParams.getProperty(key)); + + ctx.setAttribute(key, returnParams.getProperty(key)); + } + + + //Get the correct code from the SVC Logic and set it in transaction +// transaction.setStatusCode(returnParams.getProperty("SvcLogic.code")); + + if (FlowControllerConstants.FAILURE + .equalsIgnoreCase(returnParams.getProperty("SvcLogic.status"))) { + transaction.setStatus(FlowControllerConstants.FAILURE); + ctx.setAttribute(ctx.getAttribute(FlowControllerConstants.RESPONSE_PREFIX) + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(ctx.getAttribute(FlowControllerConstants.RESPONSE_PREFIX) + FlowControllerConstants.OUTPUT_STATUS_MESSAGE, returnParams.getProperty("error-message")); + transaction.setStatusCode("401"); + transaction.setState((ctx.getAttribute(transaction.getExecutionModule() + "." + transaction.getExecutionRPC() + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE)) !=null ? + ctx.getAttribute(transaction.getExecutionModule() + "." + transaction.getExecutionRPC() + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE): null); + //Get error code from above instead setting here ...its for testing purpose + + + } + else if(FlowControllerConstants.SUCCESS + .equalsIgnoreCase(returnParams.getProperty("SvcLogic.status"))) { + transaction.setStatus(FlowControllerConstants.SUCCESS); + transaction.setStatusCode("400"); + ctx.setAttribute(ctx.getAttribute(FlowControllerConstants.RESPONSE_PREFIX) + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_SUCCESS); + transaction.setState((ctx.getAttribute(transaction.getExecutionModule() + "." + transaction.getExecutionRPC() + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE)) !=null ? + ctx.getAttribute(transaction.getExecutionModule() + "." + transaction.getExecutionRPC() + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE): null); + //Get error code from above instead setting here ...its for testing purpose + } + else { + transaction.setStatus(FlowControllerConstants.OTHERS); + ctx.setAttribute(ctx.getAttribute(FlowControllerConstants.RESPONSE_PREFIX) + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE); + transaction.setStatusCode("401"); + ctx.setAttribute(ctx.getAttribute(FlowControllerConstants.RESPONSE_PREFIX) + FlowControllerConstants.OUTPUT_STATUS_MESSAGE, returnParams.getProperty("error-message")); + } + + return null; + //Change null to required value if required in upper level +} +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/NodeExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/NodeExecutor.java new file mode 100644 index 000000000..54c627ef7 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/NodeExecutor.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.executorImpl; + +import java.util.HashMap; +import java.util.Properties; + +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.interfaces.FlowExecutorInterface; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.provider.SvcLogicService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +public class NodeExecutor implements FlowExecutorInterface { + + private static final EELFLogger LOG = EELFManager.getInstance().getLogger(NodeExecutor.class); + + @Override + public HashMap<String, String> execute(Transaction transaction, SvcLogicContext ctx) { + return null; + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/RestExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/RestExecutor.java new file mode 100644 index 000000000..ff1ba6195 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/RestExecutor.java @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.executorImpl; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.io.IOUtils; +import org.openecomp.appc.flow.controller.data.Response; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.interfaces.FlowExecutorInterface; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.DefaultClientConfig; +import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +public class RestExecutor implements FlowExecutorInterface { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(RestExecutor.class); + private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR"; + Properties props = new Properties(); + public RestExecutor() throws Exception { + String propDir = System.getenv(SDNC_CONFIG_DIR_VAR); + if (propDir == null) + throw new Exception(" Cannot find Property file -" + SDNC_CONFIG_DIR_VAR); + String propFile = propDir + FlowControllerConstants.APPC_FLOW_CONTROLLER; + InputStream propStream = new FileInputStream(propFile); + try{ + props.load(propStream); + } + catch (Exception e){ + throw new Exception("Could not load properties file " + propFile, e); + } + finally{ + try{ + propStream.close(); + } + catch (Exception e){ + log.warn("Could not close FileInputStream", e); + } + } + } + @Override + public HashMap<String, String> execute(Transaction transaction, SvcLogicContext ctx) throws Exception{ + log.info("Configuring Rest Operation....." + transaction.toString()); + Response response = new Response(); + HashMap<String, String> outputMessage = new HashMap<String, String>(); + Client client = null; + WebResource webResource = null; + ClientResponse clientResponse = null; + String responseDataType=MediaType.APPLICATION_JSON; + String requestDataType=MediaType.APPLICATION_JSON; + + + try{ + DefaultClientConfig defaultClientConfig = new DefaultClientConfig(); + System.setProperty("jsse.enableSNIExtension", "false"); + SSLContext sslContext = null; + SecureRestClientTrustManager secureRestClientTrustManager = new SecureRestClientTrustManager(); + sslContext = SSLContext.getInstance("SSL"); + sslContext.init(null, new javax.net.ssl.TrustManager[] { secureRestClientTrustManager }, null); + defaultClientConfig.getProperties().put( + com.sun.jersey.client.urlconnection.HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, + new com.sun.jersey.client.urlconnection.HTTPSProperties(getHostnameVerifier(), sslContext)); + client = Client.create(defaultClientConfig); + client.addFilter(new HTTPBasicAuthFilter(transaction.getuId(), transaction.getPswd())); + webResource = client.resource(new URI(transaction.getExecutionEndPoint())); + webResource.setProperty("Content-Type", "application/json;charset=UTF-8"); + + log.info("Starting Rest Operation....."); + if(HttpMethod.GET.equalsIgnoreCase(transaction.getExecutionRPC())){ + clientResponse = webResource.accept(responseDataType).get(ClientResponse.class); + }else if(HttpMethod.POST.equalsIgnoreCase(transaction.getExecutionRPC())){ + clientResponse = webResource.type(requestDataType).post(ClientResponse.class, transaction.getPayload()); + }else if(HttpMethod.PUT.equalsIgnoreCase(transaction.getExecutionRPC())){ + clientResponse = webResource.type(requestDataType).put(ClientResponse.class,transaction.getPayload()); + }else if(HttpMethod.DELETE.equalsIgnoreCase(transaction.getExecutionRPC())){ + clientResponse = webResource.delete(ClientResponse.class); + } + + if(clientResponse.getStatus() == 200){ + response.setResponseCode(String.valueOf(clientResponse.getStatus())); + ArrayList<Response> responses = new ArrayList<Response>(); + responses.add(response); + transaction.setResponses(responses); + outputMessage.put("restResponse", clientResponse.getEntity(String.class)); + } + else{ + throw new Exception("Can not determine the state of : " + transaction.getActionLevel() + " HTTP error code : " + + clientResponse.getStatus()); + + } + + log.info("Completed Rest Operation....."); + + }catch (Exception e) { + e.printStackTrace(); + log.debug("failed in RESTCONT Action ("+transaction.getExecutionRPC()+") for the resource " + transaction.getExecutionEndPoint() + ", falut message :"+e.getMessage()); + throw new Exception("Error While Sending Rest Request" + e.getMessage()); + } + finally { + // clean up. + webResource = null; + if(client != null){ + client.destroy(); + client = null; + } + } + + return outputMessage; + } + +private HostnameVerifier getHostnameVerifier() { + return new HostnameVerifier() { + @Override + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }; +} + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/SecureRestClientTrustManager.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/SecureRestClientTrustManager.java new file mode 100644 index 000000000..3cf2d6e63 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/executorImpl/SecureRestClientTrustManager.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.executorImpl; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.X509TrustManager; + + +public class SecureRestClientTrustManager implements X509TrustManager { + + @Override + public void checkClientTrusted(X509Certificate[] arg0, String arg1) + throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] arg0, String arg1) + throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + + public boolean isClientTrusted(X509Certificate[] arg0) { + return true; + } + + public boolean isServerTrusted(X509Certificate[] arg0) { + return true; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ActionIdentifier.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ActionIdentifier.java new file mode 100644 index 000000000..f16477c05 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ActionIdentifier.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="vnf-id" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="vserver-id" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="vnfc-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfId", + "vserverId", + "vnfcName" +}) +@XmlRootElement(name = "action-identifier") +public class ActionIdentifier { + + @XmlElement(name = "vnf-id", required = true) + @JsonProperty("vnf-id") + protected String vnfId; + @XmlElement(name = "vserver-id", required = true) + @JsonProperty("vserver-id") + protected String vserverId; + @XmlElement(name = "vnfc-name", required = true) + @JsonProperty("vnfc-name") + protected String vnfcName; + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the vserverId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVserverId() { + return vserverId; + } + + /** + * Sets the value of the vserverId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVserverId(String value) { + this.vserverId = value; + } + + /** + * Gets the value of the vnfcName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfcName() { + return vnfcName; + } + + /** + * Sets the value of the vnfcName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfcName(String value) { + this.vnfcName = value; + } + + @Override + public String toString() { + return "ActionIdentifier [vnfId=" + vnfId + ", vserverId=" + vserverId + + ", vnfcName=" + vnfcName + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Capabilities.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Capabilities.java new file mode 100644 index 000000000..058d291f8 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Capabilities.java @@ -0,0 +1,190 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlList; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnf", + "vfModule", + "vm", + "vnfc" +}) +@XmlRootElement(name = "capabilities") +public class Capabilities { + + @XmlList + @XmlElement(required = true) + protected List<String> vnf; + @XmlList + @XmlElement(name = "vf-module", required = true) + @JsonProperty("vf-module") + protected List<String> vfModule; + @XmlList + @XmlElement(required = true) + protected List<String> vm; + @XmlList + @XmlElement(required = true) + protected List<String> vnfc; + + /** + * Gets the value of the vnf property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vnf property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVnf().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List<String> getVnf() { + if (vnf == null) { + vnf = new ArrayList<String>(); + } + return this.vnf; + } + + /** + * Gets the value of the vfModule property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vfModule property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVfModule().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List<String> getVfModule() { + if (vfModule == null) { + vfModule = new ArrayList<String>(); + } + return this.vfModule; + } + + /** + * Gets the value of the vm property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vm property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVm().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List<String> getVm() { + if (vm == null) { + vm = new ArrayList<String>(); + } + return this.vm; + } + + /** + * Gets the value of the vnfc property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vnfc property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVnfc().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List<String> getVnfc() { + if (vnfc == null) { + vnfc = new ArrayList<String>(); + } + return this.vnfc; + } + + @Override + public String toString() { + return "Capabilities [vnf=" + vnf + ", vfModule=" + vfModule + ", vm=" + + vm + ", vnfc=" + vnfc + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/DependencyInfo.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/DependencyInfo.java new file mode 100644 index 000000000..0bc01867b --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/DependencyInfo.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfcs" +}) +@XmlRootElement(name = "dependency-info") +@JsonIgnoreProperties(ignoreUnknown = true) +public class DependencyInfo { + + protected List<Vnfcs> vnfcs; + + /** + * Gets the value of the vnfcs property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vnfcs property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVnfcs().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Vnfcs } + * + * + */ + public List<Vnfcs> getVnfcs() { + if (vnfcs == null) { + vnfcs = new ArrayList<Vnfcs>(); + } + return this.vnfcs; + } + + @Override + public String toString() { + return "DependencyInfo [vnfcs=" + vnfcs + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Input.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Input.java new file mode 100644 index 000000000..43564a4be --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Input.java @@ -0,0 +1,199 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + + +@XmlAccessorType(XmlAccessType.FIELD) +@JsonRootName(value="input") +@XmlType(name = "input", propOrder = { + "requestInfo", + "inventoryInfo", + "dependencyInfo", + "tunableParameters", + "capabilities" +}) +@JsonPropertyOrder({"requestInfo", + "inventoryInfo", + "dependencyInfo", + "tunableParameters", + "capabilities" }) +public class Input { + + @XmlElement(name = "request-info") + @JsonProperty("request-info") + protected RequestInfo requestInfo; + @XmlElement(name = "inventory-info") + @JsonProperty("inventory-info") + protected InventoryInfo inventoryInfo; + @XmlElement(name = "dependency-info") + @JsonProperty("dependency-info") + protected DependencyInfo dependencyInfo; + @XmlElement(name = "tunable-parameters") + @JsonProperty("tunable-parameters") + protected TunableParameters tunableParameters; + protected Capabilities capabilities; + + /** + * Gets the value of the requestInfo property. + * + * @return + * possible object is + * {@link RequestInfo } + * + */ + public RequestInfo getRequestInfo() { + return requestInfo; + } + + /** + * Sets the value of the requestInfo property. + * + * @param value + * allowed object is + * {@link RequestInfo } + * + */ + public void setRequestInfo(RequestInfo value) { + this.requestInfo = value; + } + + /** + * Gets the value of the inventoryInfo property. + * + * @return + * possible object is + * {@link InventoryInfo } + * + */ + public InventoryInfo getInventoryInfo() { + return inventoryInfo; + } + + /** + * Sets the value of the inventoryInfo property. + * + * @param value + * allowed object is + * {@link InventoryInfo } + * + */ + public void setInventoryInfo(InventoryInfo value) { + this.inventoryInfo = value; + } + + /** + * Gets the value of the dependencyInfo property. + * + * @return + * possible object is + * {@link DependencyInfo } + * + */ + public DependencyInfo getDependencyInfo() { + return dependencyInfo; + } + + /** + * Sets the value of the dependencyInfo property. + * + * @param value + * allowed object is + * {@link DependencyInfo } + * + */ + public void setDependencyInfo(DependencyInfo value) { + this.dependencyInfo = value; + } + + /** + * Gets the value of the tunableParameters property. + * + * @return + * possible object is + * {@link TunableParameters } + * + */ + public TunableParameters getTunableParameters() { + return tunableParameters; + } + + /** + * Sets the value of the tunableParameters property. + * + * @param value + * allowed object is + * {@link TunableParameters } + * + */ + public void setTunableParameters(TunableParameters value) { + this.tunableParameters = value; + } + + /** + * Gets the value of the capabilities property. + * + * @return + * possible object is + * {@link Capabilities } + * + */ + public Capabilities getCapabilities() { + return capabilities; + } + + /** + * Sets the value of the capabilities property. + * + * @param value + * allowed object is + * {@link Capabilities } + * + */ + public void setCapabilities(Capabilities value) { + this.capabilities = value; + } + + @Override + public String toString() { + return "Input [requestInfo=" + requestInfo + ", inventoryInfo=" + + inventoryInfo + ", dependencyInfo=" + dependencyInfo + + ", tunableParameters=" + tunableParameters + + ", capabilities=" + capabilities + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/InventoryInfo.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/InventoryInfo.java new file mode 100644 index 000000000..12f086ff7 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/InventoryInfo.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfInfo" +}) +@XmlRootElement(name = "inventory-info") +public class InventoryInfo { + + @XmlElement(name = "vnf-info", required = true) + @JsonProperty("vnf-info") + protected VnfInfo vnfInfo; + + /** + * Gets the value of the vnfInfo property. + * + * @return + * possible object is + * {@link VnfInfo } + * + */ + public VnfInfo getVnfInfo() { + return vnfInfo; + } + + /** + * Sets the value of the vnfInfo property. + * + * @param value + * allowed object is + * {@link VnfInfo } + * + */ + public void setVnfInfo(VnfInfo value) { + this.vnfInfo = value; + } + + @Override + public String toString() { + return "InventoryInfo [vnfInfo=" + vnfInfo + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ObjectFactory.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ObjectFactory.java new file mode 100644 index 000000000..80cb3bff0 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/ObjectFactory.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.appc.flow.controller.interfaceData package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.appc.flow.controller.interfaceData + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Capabilities } + * + */ + public Capabilities createCapabilities() { + return new Capabilities(); + } + + /** + * Create an instance of {@link RequestInfo } + * + */ + public RequestInfo createRequestInfo() { + return new RequestInfo(); + } + + /** + * Create an instance of {@link ActionIdentifier } + * + */ + public ActionIdentifier createActionIdentifier() { + return new ActionIdentifier(); + } + + /** + * Create an instance of {@link DependencyInfo } + * + */ + public DependencyInfo createDependencyInfo() { + return new DependencyInfo(); + } + + /** + * Create an instance of {@link Vnfcs } + * + */ + public Vnfcs createVnfcs() { + return new Vnfcs(); + } + + /** + * Create an instance of {@link Vm } + * + */ + public Vm createVm() { + return new Vm(); + } + + /** + * Create an instance of {@link Vnfcslist } + * + */ + public Vnfcslist createVnfcslist() { + return new Vnfcslist(); + } + + /** + * Create an instance of {@link TunableParameters } + * + */ + public TunableParameters createTunableParameters() { + return new TunableParameters(); + } + + /** + * Create an instance of {@link VnfInfo } + * + */ + public VnfInfo createVnfInfo() { + return new VnfInfo(); + } + + /** + * Create an instance of {@link InventoryInfo } + * + */ + public InventoryInfo createInventoryInfo() { + return new InventoryInfo(); + } + + /** + * Create an instance of {@link Input } + * + */ + public Input createInput() { + return new Input(); + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/RequestInfo.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/RequestInfo.java new file mode 100644 index 000000000..0a0607794 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/RequestInfo.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "action", + "actionLevel", + "actionIdentifier", + "payload" +}) +@XmlRootElement(name = "request-info") +public class RequestInfo { + + @XmlElement(required = true) + protected String action; + @XmlElement(name = "action-level", required = true) + @JsonProperty("action-level") + protected String actionLevel; + @XmlElement(name = "action-identifier", required = true) + @JsonProperty("action-identifier") + protected ActionIdentifier actionIdentifier; + @XmlElement(required = true) + protected String payload; + + /** + * Gets the value of the action property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAction() { + return action; + } + + /** + * Sets the value of the action property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAction(String value) { + this.action = value; + } + + /** + * Gets the value of the actionLevel property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActionLevel() { + return actionLevel; + } + + /** + * Sets the value of the actionLevel property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActionLevel(String value) { + this.actionLevel = value; + } + + /** + * Gets the value of the actionIdentifier property. + * + * @return + * possible object is + * {@link ActionIdentifier } + * + */ + public ActionIdentifier getActionIdentifier() { + return actionIdentifier; + } + + /** + * Sets the value of the actionIdentifier property. + * + * @param value + * allowed object is + * {@link ActionIdentifier } + * + */ + public void setActionIdentifier(ActionIdentifier value) { + this.actionIdentifier = value; + } + + /** + * Gets the value of the payload property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPayload() { + return payload; + } + + /** + * Sets the value of the payload property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPayload(String value) { + this.payload = value; + } + + @Override + public String toString() { + return "RequestInfo [action=" + action + ", actionLevel=" + actionLevel + + ", actionIdentifier=" + actionIdentifier + ", payload=" + + payload + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/TunableParameters.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/TunableParameters.java new file mode 100644 index 000000000..b0bb0e06a --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/TunableParameters.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="strategy" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="wait-time" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="retry-count" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "strategy", + "waitTime", + "retryCount" +}) +@XmlRootElement(name = "tunable-parameters") +public class TunableParameters { + + @XmlElement(required = true) + protected String strategy; + @XmlElement(name = "wait-time", required = true) + protected String waitTime; + @XmlElement(name = "retry-count", required = true) + protected String retryCount; + + /** + * Gets the value of the strategy property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStrategy() { + return strategy; + } + + /** + * Sets the value of the strategy property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStrategy(String value) { + this.strategy = value; + } + + /** + * Gets the value of the waitTime property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWaitTime() { + return waitTime; + } + + /** + * Sets the value of the waitTime property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWaitTime(String value) { + this.waitTime = value; + } + + /** + * Gets the value of the retryCount property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRetryCount() { + return retryCount; + } + + /** + * Sets the value of the retryCount property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRetryCount(String value) { + this.retryCount = value; + } + + @Override + public String toString() { + return "TunableParameters [strategy=" + strategy + ", waitTime=" + + waitTime + ", retryCount=" + retryCount + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vm.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vm.java new file mode 100644 index 000000000..750719e30 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vm.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vserverId", + "vnfc" +}) +@XmlRootElement(name = "vm") +public class Vm { + + @XmlElement(name = "vserver-id", required = true) + @JsonProperty("vserver-id") + protected String vserverId; + @XmlElement(required = true) + @JsonProperty("vnfc") + protected Vnfcslist vnfc; + + /** + * Gets the value of the vserverId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVserverId() { + return vserverId; + } + + /** + * Sets the value of the vserverId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVserverId(String value) { + this.vserverId = value; + } + + /** + * Gets the value of the vnfc property. + * + * @return + * possible object is + * {@link Vnfcslist } + * + */ + public Vnfcslist getVnfc() { + return vnfc; + } + + /** + * Sets the value of the vnfc property. + * + * @param value + * allowed object is + * {@link Vnfcslist } + * + */ + public void setVnfc(Vnfcslist value) { + this.vnfc = value; + } + + @Override + public String toString() { + return "Vm [vserverId=" + vserverId + ", vnfc=" + vnfc + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/VnfInfo.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/VnfInfo.java new file mode 100644 index 000000000..08ce862b7 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/VnfInfo.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfId", + "vnfName", + "vnfType", + "vm" +}) +@XmlRootElement(name = "vnf-info") +public class VnfInfo { + + @XmlElement(name = "vnf-id", required = true) + @JsonProperty("vnf-id") + protected String vnfId; + @XmlElement(name = "vnf-name", required = true) + @JsonProperty("vnf-name") + protected String vnfName; + @XmlElement(name = "vnf-type", required = true) + @JsonProperty("vnf-type") + protected String vnfType; + @JsonProperty("vm") + protected List<Vm> vm; + + /** + * Gets the value of the vnfId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfId() { + return vnfId; + } + + /** + * Sets the value of the vnfId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfId(String value) { + this.vnfId = value; + } + + /** + * Gets the value of the vnfName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfName() { + return vnfName; + } + + /** + * Sets the value of the vnfName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfName(String value) { + this.vnfName = value; + } + + /** + * Gets the value of the vnfType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfType() { + return vnfType; + } + + /** + * Sets the value of the vnfType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfType(String value) { + this.vnfType = value; + } + + /** + * Gets the value of the vm property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the vm property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVm().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Vm } + * + * + */ + public List<Vm> getVm() { + if (vm == null) { + vm = new ArrayList<Vm>(); + } + return this.vm; + } + + @Override + public String toString() { + return "VnfInfo [vnfId=" + vnfId + ", vnfName=" + vnfName + + ", vnfType=" + vnfType + ", vm=" + vm + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcs.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcs.java new file mode 100644 index 000000000..a3cab0231 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcs.java @@ -0,0 +1,176 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlList; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "vnfcType", + "mandatory", + "resilience", + "parents" +}) +@XmlRootElement(name = "vnfcs") +@JsonRootName(value="vnfcs") +public class Vnfcs { + + @XmlElement(name = "vnfc-type", required = true) + @JsonProperty("vnfc-type") + protected String vnfcType; + @XmlElement(required = true) + @JsonProperty("mandatory") + protected String mandatory; + @XmlElement(required = true) + @JsonProperty("resilience") + protected String resilience; + @XmlList + @XmlElement(required = true) + @JsonProperty("parents") + protected List<String> parents; + + /** + * Gets the value of the vnfcType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfcType() { + return vnfcType; + } + + /** + * Sets the value of the vnfcType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfcType(String value) { + this.vnfcType = value; + } + + /** + * Gets the value of the mandatory property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMandatory() { + return mandatory; + } + + /** + * Sets the value of the mandatory property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMandatory(String value) { + this.mandatory = value; + } + + /** + * Gets the value of the resilience property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResilience() { + return resilience; + } + + /** + * Sets the value of the resilience property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResilience(String value) { + this.resilience = value; + } + + /** + * Gets the value of the parents property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the parents property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getParents().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List<String> getParents() { + if (parents == null) { + parents = new ArrayList<String>(); + } + return this.parents; + } + + @Override + public String toString() { + return "Vnfcs [vnfcType=" + vnfcType + ", mandatory=" + mandatory + + ", resilience=" + resilience + ", parents=" + parents + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcslist.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcslist.java new file mode 100644 index 000000000..70692f3f6 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnfcslist.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * <p>Java class for vnfcslist complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="vnfcslist"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="vnfc-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="vnfc-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "vnfcslist", propOrder = { + "vnfcType", + "vnfcName" +}) +public class Vnfcslist { + + @XmlElement(name = "vnfc-type", required = true) + @JsonProperty("vnfc-type") + protected String vnfcType; + @XmlElement(name = "vnfc-name", required = true) + @JsonProperty("vnfc-name") + protected String vnfcName; + + /** + * Gets the value of the vnfcType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfcType() { + return vnfcType; + } + + /** + * Sets the value of the vnfcType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfcType(String value) { + this.vnfcType = value; + } + + /** + * Gets the value of the vnfcName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVnfcName() { + return vnfcName; + } + + /** + * Sets the value of the vnfcName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVnfcName(String value) { + this.vnfcName = value; + } + + @Override + public String toString() { + return "Vnfcslist [vnfcType=" + vnfcType + ", vnfcName=" + vnfcName + + "]"; + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnflist.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnflist.java new file mode 100644 index 000000000..208970cfc --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/Vnflist.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.03 at 03:13:44 PM EDT +// + + +package org.openecomp.appc.flow.controller.interfaceData; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for vnflist. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * <p> + * <pre> + * <simpleType name="vnflist"> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="Restart"/> + * <enumeration value="Rebuild"/> + * <enumeration value="Migrate"/> + * <enumeration value="Evacuate"/> + * <enumeration value="Snapshot"/> + * <enumeration value="Rollback"/> + * <enumeration value="Sync"/> + * <enumeration value="Audit"/> + * <enumeration value="Start"/> + * <enumeration value="Stop"/> + * <enumeration value="Terminate"/> + * <enumeration value="SoftwareUpload"/> + * <enumeration value="HealthCheck"/> + * <enumeration value="LiveUpgrade"/> + * <enumeration value="ModifyConfig"/> + * <enumeration value="Lock"/> + * <enumeration value="Unlock"/> + * <enumeration value="Test"/> + * <enumeration value="CheckLock"/> + * <enumeration value="Configure"/> + * <enumeration value="ConfigModify"/> + * <enumeration value="ConfigScaleOut"/> + * <enumeration value="ConfigRestore"/> + * <enumeration value="ConfigBackup"/> + * <enumeration value="ConfigBackupDelete"/> + * <enumeration value="ConfigExport"/> + * </restriction> + * </simpleType> + * </pre> + * + */ +@XmlType(name = "vnflist") +@XmlEnum +public enum Vnflist { + + @XmlEnumValue("Restart") + RESTART("Restart"), + @XmlEnumValue("Rebuild") + REBUILD("Rebuild"), + @XmlEnumValue("Migrate") + MIGRATE("Migrate"), + @XmlEnumValue("Evacuate") + EVACUATE("Evacuate"), + @XmlEnumValue("Snapshot") + SNAPSHOT("Snapshot"), + @XmlEnumValue("Rollback") + ROLLBACK("Rollback"), + @XmlEnumValue("Sync") + SYNC("Sync"), + @XmlEnumValue("Audit") + AUDIT("Audit"), + @XmlEnumValue("Start") + START("Start"), + @XmlEnumValue("Stop") + STOP("Stop"), + @XmlEnumValue("Terminate") + TERMINATE("Terminate"), + @XmlEnumValue("SoftwareUpload") + SOFTWARE_UPLOAD("SoftwareUpload"), + @XmlEnumValue("HealthCheck") + HEALTH_CHECK("HealthCheck"), + @XmlEnumValue("LiveUpgrade") + LIVE_UPGRADE("LiveUpgrade"), + @XmlEnumValue("ModifyConfig") + MODIFY_CONFIG("ModifyConfig"), + @XmlEnumValue("Lock") + LOCK("Lock"), + @XmlEnumValue("Unlock") + UNLOCK("Unlock"), + @XmlEnumValue("Test") + TEST("Test"), + @XmlEnumValue("CheckLock") + CHECK_LOCK("CheckLock"), + @XmlEnumValue("Configure") + CONFIGURE("Configure"), + @XmlEnumValue("ConfigModify") + CONFIG_MODIFY("ConfigModify"), + @XmlEnumValue("ConfigScaleOut") + CONFIG_SCALE_OUT("ConfigScaleOut"), + @XmlEnumValue("ConfigRestore") + CONFIG_RESTORE("ConfigRestore"), + @XmlEnumValue("ConfigBackup") + CONFIG_BACKUP("ConfigBackup"), + @XmlEnumValue("ConfigBackupDelete") + CONFIG_BACKUP_DELETE("ConfigBackupDelete"), + @XmlEnumValue("ConfigExport") + CONFIG_EXPORT("ConfigExport"); + private final String value; + + Vnflist(String v) { + value = v; + } + + public String value() { + return value; + } + + public static Vnflist fromValue(String v) { + for (Vnflist c: Vnflist.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/package-info.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/package-info.java new file mode 100644 index 000000000..825c7f8ce --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaceData/package-info.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2017.07.31 at 10:30:39 AM EDT +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http:org.openecomp.appc/sequence/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.openecomp.appc.flow.controller.interfaceData; diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaces/FlowExecutorInterface.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaces/FlowExecutorInterface.java new file mode 100644 index 000000000..690191015 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/interfaces/FlowExecutorInterface.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.interfaces; + +import java.util.HashMap; + +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public interface FlowExecutorInterface { + + public HashMap<String, String> execute(Transaction transaction, SvcLogicContext ctx) throws Exception; + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowControlNode.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowControlNode.java new file mode 100644 index 000000000..6a125af22 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowControlNode.java @@ -0,0 +1,562 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.node; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.openecomp.appc.flow.controller.ResponseHandlerImpl.DefaultResponseHandler; +import org.openecomp.appc.flow.controller.data.PrecheckOption; +import org.openecomp.appc.flow.controller.data.ResponseAction; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.data.Transactions; +import org.openecomp.appc.flow.controller.dbervices.FlowControlDBService; +import org.openecomp.appc.flow.controller.executorImpl.GraphExecutor; +import org.openecomp.appc.flow.controller.executorImpl.NodeExecutor; +import org.openecomp.appc.flow.controller.executorImpl.RestExecutor; +import org.openecomp.appc.flow.controller.interfaceData.ActionIdentifier; +import org.openecomp.appc.flow.controller.interfaceData.Capabilities; +import org.openecomp.appc.flow.controller.interfaceData.DependencyInfo; +import org.openecomp.appc.flow.controller.interfaceData.Input; +import org.openecomp.appc.flow.controller.interfaceData.InventoryInfo; +import org.openecomp.appc.flow.controller.interfaceData.RequestInfo; +import org.openecomp.appc.flow.controller.interfaceData.Vm; +import org.openecomp.appc.flow.controller.interfaceData.VnfInfo; +import org.openecomp.appc.flow.controller.interfaceData.Vnfcs; +import org.openecomp.appc.flow.controller.interfaceData.Vnfcslist; +import org.openecomp.appc.flow.controller.interfaces.FlowExecutorInterface; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class FlowControlNode implements SvcLogicJavaPlugin{ + + + private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlNode.class); + private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR"; + + public void processFlow(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + log.debug("Received processParamKeys call with params : " + inParams); + String responsePrefix = inParams.get(FlowControllerConstants.INPUT_PARAM_RESPONSE_PRIFIX); + try + { + responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; + FlowControlDBService dbservice = FlowControlDBService.initialise(); + SvcLogicContext localContext = new SvcLogicContext(); + localContext.setAttribute(FlowControllerConstants.REQUEST_ID, ctx.getAttribute(FlowControllerConstants.REQUEST_ID)); + localContext.setAttribute(FlowControllerConstants.VNF_TYPE, ctx.getAttribute(FlowControllerConstants.VNF_TYPE)); + localContext.setAttribute(FlowControllerConstants.REQUEST_ACTION, ctx.getAttribute(FlowControllerConstants.REQUEST_ACTION)); + localContext.setAttribute(FlowControllerConstants.ACTION_LEVEL, ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL)); + localContext.setAttribute(FlowControllerConstants.RESPONSE_PREFIX, responsePrefix); + ctx.setAttribute(FlowControllerConstants.RESPONSE_PREFIX, responsePrefix); + dbservice.getFlowReferenceData(ctx, inParams, localContext); + + for (Object key : localContext.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + log.debug("processFlow " + parmName + "=" + parmValue); + + } + processFlowSequence(inParams, ctx, localContext); + if(!ctx.getAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS).equals(FlowControllerConstants.OUTPUT_STATUS_SUCCESS)) + throw new SvcLogicException(ctx.getAttribute(responsePrefix + FlowControllerConstants.OUTPUT_STATUS_MESSAGE)); + + } catch (Exception e) { + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + e.printStackTrace(); + throw new SvcLogicException(e.getMessage()); + } + } + + private void processFlowSequence( Map<String, String> inParams, SvcLogicContext ctx, SvcLogicContext localContext) throws Exception + { + String fn = "FlowExecutorNode.processflowSequence"; + log.debug(fn + "Received model for flow : " + localContext.toString()); + FlowControlDBService dbservice = FlowControlDBService.initialise(); + String flowSequnce =null; + for (Object key : localContext.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + log.debug(parmName + "=" + parmValue); + + } + if(localContext != null && localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) !=null){ + + if(localContext.getAttribute(FlowControllerConstants.GENERATION_NODE) != null){ + GraphExecutor transactionExecutor = new GraphExecutor(); + Boolean generatorExists = transactionExecutor.hasGraph("APPC_COMMOM", localContext.getAttribute(FlowControllerConstants.GENERATION_NODE), null, "sync"); + if(generatorExists){ + flowSequnce = transactionExecutor.executeGraph("APPC_COMMOM", localContext.getAttribute(FlowControllerConstants.GENERATION_NODE), + null, "sync", null).getProperty(FlowControllerConstants.FLOW_SEQUENCE); + } + else + throw new Exception("Can not find Custom defined Flow Generator for " + localContext.getAttribute(FlowControllerConstants.GENERATION_NODE)); + } + else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.DESINGTIME)){ + localContext.setAttribute(FlowControllerConstants.VNFC_TYPE, ctx.getAttribute(FlowControllerConstants.VNFC_TYPE)); + flowSequnce = dbservice.getDesignTimeFlowModel(localContext); + if(flowSequnce == null) + throw new Exception("Flow Sequence is not found User Desinged VNF " + ctx.getAttribute(FlowControllerConstants.VNF_TYPE)); + } + else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.RUNTIME)){ + + Transaction transaction = new Transaction(); + String input = collectInputParams(ctx,transaction); + log.info("collectInputParamsData" + input ); + + RestExecutor restExe = new RestExecutor(); + HashMap<String,String>flowSeq= restExe.execute(transaction, localContext); + flowSequnce=flowSeq.get("restResponse"); + + if(flowSequnce == null) + throw new Exception("Failed to get the Flow Sequece runtime for VNF type" + ctx.getAttribute(FlowControllerConstants.VNF_TYPE)); + + } + else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.EXTERNAL)){ + //String input = collectInputParams(localContext); + // flowSequnce = ""; //get it from the External interface calling the Rest End point - TBD + if(flowSequnce == null) + throw new Exception("Flow Sequence not found for " + ctx.getAttribute(FlowControllerConstants.VNF_TYPE)); + } + else + { + //No other type of model supported...in Future can get flowModel from other generators which will be included here + throw new Exception("No information found for sequence Owner Design-Time Vs Run-Time" ); + } + } + else{ + FlowGenerator flowGenerator = new FlowGenerator(); + Transactions trans = flowGenerator.createSingleStepModel(inParams,ctx); + ObjectMapper mapper = new ObjectMapper(); + flowSequnce = mapper.writeValueAsString(trans); + log.debug("Single step Flow Sequence : " + flowSequnce); + + } + log.debug("Received Flow Sequence : " + flowSequnce); + + HashMap<Integer, Transaction> transactionMap = createTransactionMap(flowSequnce, localContext); + exeuteAllTransaction(transactionMap, ctx); + log.info("Executed all the transacstion successfully"); + + } + + private void exeuteAllTransaction(HashMap<Integer, Transaction> transactionMap, SvcLogicContext ctx) throws Exception { + + String fn = "FlowExecutorNode.exeuteAllTransaction "; + int retry = 0; + FlowExecutorInterface flowExecutor = null; + for (int key = 1; key <= transactionMap.size() ; key++ ) + { + log.debug(fn + "Starting transactions ID " + key + " :)=" + retry); + Transaction transaction = transactionMap.get(key); + if(!preProcessor(transactionMap, transaction)){ + log.info("Skipping Transaction ID " + transaction.getTransactionId()); + continue; + } + if(transaction.getExecutionType() != null){ + switch (transaction.getExecutionType()){ + case FlowControllerConstants.GRAPH : + flowExecutor = new GraphExecutor(); + break; + case FlowControllerConstants.NODE : + flowExecutor = new NodeExecutor(); + break; + case FlowControllerConstants.REST : + flowExecutor = new RestExecutor(); + break; + default : + throw new Exception("No Executor found for transaction ID" + transaction.getTransactionId()); + } + flowExecutor.execute(transaction, ctx); + ResponseAction responseAction= handleResponse(transaction); + + if(responseAction.getWait() != null && Integer.parseInt(responseAction.getWait()) > 0){ + log.debug(fn + "Going to Sleep .... " + responseAction.getWait()); + Thread.sleep(Integer.parseInt(responseAction.getWait())*1000); + } + + if(responseAction.isIntermediateMessage()){ + log.debug(fn + "Sending Intermediate Message back .... "); + sendIntermediateMessage(); + } + if(responseAction.getRetry() != null && Integer.parseInt(responseAction.getRetry()) > retry ){ + log.debug(fn + "Ooppss!!! We will retry again ....... "); + key--; + retry++; + log.debug(fn + "key =" + key + "retry =" + retry); + + } + if(responseAction.isIgnore()){ + log.debug(fn + "Ignoring this Error and moving ahead ....... "); + continue; + } + if(responseAction.isStop()){ + log.debug(fn + "Need to Stop ....... "); + break; + } + if(responseAction.getJump() != null && Integer.parseInt(responseAction.getJump()) > 0 ){ + key = Integer.parseInt(responseAction.getJump()); + key --; + } + log.debug(fn + "key =" + key + "retry =" + retry); + + } + else{ + throw new Exception("Don't know how to execute transaction ID " + transaction.getTransactionId()); + } + } + + } + private void sendIntermediateMessage() { + // TODO Auto-generated method stub + + } + + private ResponseAction handleResponse(Transaction transaction) { + log.info("Handling Response for transaction Id " + transaction.getTransactionId()); + DefaultResponseHandler defaultHandler = new DefaultResponseHandler(); + return defaultHandler.handlerResponse(transaction); + } + + private boolean preProcessor(HashMap<Integer, Transaction> transactionMap, Transaction transaction) throws IOException { + + log.debug("Starting Preprocessing Logic "); + boolean runthisStep = false; + try{ + if(transaction.getPrecheck() != null && transaction.getPrecheck().getPrecheckOptions() != null + && !transaction.getPrecheck().getPrecheckOptions().isEmpty()){ + List<PrecheckOption> precheckOptions = transaction.getPrecheck().getPrecheckOptions(); + for(PrecheckOption precheck : precheckOptions){ + Transaction trans = transactionMap.get(precheck.getpTransactionID()); + ObjectMapper mapper = new ObjectMapper(); + log.info("Mapper= " + mapper.writeValueAsString(trans)); + HashMap<Object, Object> trmap = mapper.readValue(mapper.writeValueAsString(trans), HashMap.class); + if(trmap.get(precheck.getParamName()) != null && + ((String) trmap.get(precheck.getParamName())).equalsIgnoreCase(precheck.getParamValue())) + runthisStep = true; + else + runthisStep = false; + + if(transaction.getPrecheck().getPrecheckOperator() != null && + transaction.getPrecheck().getPrecheckOperator().equalsIgnoreCase("any") && runthisStep) + break; + } + } + + else{ + log.debug("No Pre check defined for transaction ID " + transaction.getTransactionId()); + runthisStep = true; + + } + } + catch(Exception e) + { + e.printStackTrace(); + throw e; + } + log.debug("Returing process current Transaction = " + runthisStep); + + return runthisStep ; + } + + private HashMap<Integer, Transaction> createTransactionMap(String flowSequnce, SvcLogicContext localContext) throws SvcLogicException, JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + Transactions transactions = mapper.readValue(flowSequnce,Transactions.class); + HashMap<Integer, Transaction> transMap = new HashMap<Integer, Transaction>(); + for(Transaction transaction : transactions.getTransactions()){ + compileFlowDependencies(transaction, localContext); + //loadTransactionIntoStatus(transactions, ctx); //parse the Transactions Object and create records in process_flow_status table + transMap.put(transaction.getTransactionId(), transaction); + } + return transMap; + } + + private void compileFlowDependencies(Transaction transaction, SvcLogicContext localContext) throws SvcLogicException, JsonParseException, JsonMappingException, IOException { + + String fn = "FlowExecutorNode.compileFlowDependencies"; + FlowControlDBService dbservice = FlowControlDBService.initialise(); + dbservice.populateModuleAndRPC(transaction, localContext.getAttribute(FlowControllerConstants.VNF_TYPE)); + ObjectMapper mapper = new ObjectMapper(); + log.debug("Indivisual Transaction Details :" + transaction.toString()); + if((localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) == null) || + ( localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) != null && + ! localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE).equalsIgnoreCase(FlowControllerConstants.DESINGTIME))){ + localContext.setAttribute("artifact-content", mapper.writeValueAsString(transaction)); + dbservice.loadSequenceIntoDB(localContext); + } + //get a field in transction class as transactionhandle interface and register the Handler here for each trnactions + } + + private String collectInputParams(SvcLogicContext ctx, Transaction transaction) throws Exception { + + String fn = "FlowExecuteNode.collectInputParams"; + Properties prop = loadProperties(); + log.info("Loaded Properties " + prop.toString()); + + String vnfId = ctx.getAttribute(FlowControllerConstants.VNF_ID); + log.debug(fn + "vnfId :" + vnfId); + + if (StringUtils.isBlank(vnfId)) { + throw new Exception("VnfId is missing"); + } + + ActionIdentifier actionIdentifier = new ActionIdentifier(); + actionIdentifier.setVnfId(vnfId); + actionIdentifier.setVserverId(ctx.getAttribute(FlowControllerConstants.VSERVER_ID)); + actionIdentifier.setVnfcName(ctx.getAttribute(FlowControllerConstants.VNFC_NAME)); + + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setAction(ctx.getAttribute(FlowControllerConstants.ACTION)); + requestInfo.setActionLevel(ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL)); + requestInfo.setPayload(ctx.getAttribute(FlowControllerConstants.PAYLOAD)); + requestInfo.setActionIdentifier(actionIdentifier); + + InventoryInfo inventoryInfo = getInventoryInfo(ctx,vnfId); + DependencyInfo dependencyInfo = getDependencyInfo(ctx); + Capabilities capabilites = getCapabilitesData(ctx); + + Input input = new Input(); + input.setRequestInfo(requestInfo); + input.setInventoryInfo(inventoryInfo); + input.setDependencyInfo(dependencyInfo); + input.setCapabilities(capabilites); + //input.setTunableParameters(null); + + + log.info(fn + "Input parameters:" + input.toString()); + + String inputData = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE,true); + inputData = mapper.writeValueAsString(input); + log.info("InputDataJson:"+inputData); + + } catch (Exception e) { + e.printStackTrace(); + } + + String resourceUri = prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_URL); + log.info(fn + "resourceUri= " + resourceUri); + + transaction.setPayload(inputData); + transaction.setExecutionRPC("POST"); + transaction.setuId(prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_UID)); + transaction.setPswd(prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_PWD)); + transaction.setExecutionEndPoint(resourceUri); + + return inputData; + + } + + private DependencyInfo getDependencyInfo(SvcLogicContext ctx) throws Exception { + + String fn = "FlowExecutorNode.getDependencyInfo"; + DependencyInfo dependencyInfo = new DependencyInfo(); + FlowControlDBService dbservice = FlowControlDBService.initialise(); + String dependencyData = dbservice.getDependencyInfo(ctx); + log.info(fn + "dependencyDataInput:" + dependencyData); + + if (dependencyData != null) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + JsonNode dependencyInfoData = mapper.readTree(dependencyData).get("dependencyInfo"); + JsonNode vnfcData = mapper.readTree(dependencyInfoData.toString()).get("vnfcs"); + List<Vnfcs> vnfclist = Arrays.asList(mapper.readValue(vnfcData.toString(), Vnfcs[].class)); + dependencyInfo.getVnfcs().addAll(vnfclist); + + log.info("Dependency Output:"+ dependencyInfo.toString()); + } + + return dependencyInfo; + + } + + private Capabilities getCapabilitesData(SvcLogicContext ctx)throws Exception { + + String fn = "FlowExecutorNode.getCapabilitesData"; + Capabilities capabilities = new Capabilities(); + FlowControlDBService dbservice = FlowControlDBService.initialise(); + String capabilitiesData = dbservice.getCapabilitiesData(ctx); + log.info(fn + "capabilitiesDataInput:" + capabilitiesData); + + if (capabilitiesData != null) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false); + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + JsonNode capabilitiesNode = mapper.readValue(capabilitiesData,JsonNode.class); + log.info("capabilitiesNode:" + capabilitiesNode.toString()); + + JsonNode vnfs = capabilitiesNode.findValue(FlowControllerConstants.VNF); + List<String> vnfsList = new ArrayList<String>(); + if (vnfs != null) { + for (int i = 0; i < vnfs.size(); i++) { + + String vnf = vnfs.get(i).asText(); + vnfsList.add(vnf); + } + } + + JsonNode vfModules = capabilitiesNode.findValue(FlowControllerConstants.VF_MODULE); + List<String> vfModulesList = new ArrayList<String>(); + if (vfModules != null) { + for (int i = 0; i < vfModules.size(); i++) { + + String vfModule = vfModules.get(i).asText(); + vfModulesList.add(vfModule); + } + } + + JsonNode vnfcs = capabilitiesNode.findValue(FlowControllerConstants.VNFC); + List<String> vnfcsList = new ArrayList<String>(); + if (vnfcs != null) { + for (int i = 0; i < vnfcs.size(); i++) { + + String vnfc1 = vnfcs.get(i).asText(); + vnfcsList.add(vnfc1); + } + } + + JsonNode vms = capabilitiesNode.findValue(FlowControllerConstants.VM); + + List<String> vmList = new ArrayList<String>(); + if (vms != null) { + for (int i = 0; i < vms.size(); i++) { + + String vm1 = vms.get(i).asText(); + vmList.add(vm1); + } + } + + capabilities.getVnfc().addAll(vnfcsList); + capabilities.getVnf().addAll(vnfsList); + capabilities.getVfModule().addAll(vfModulesList); + capabilities.getVm().addAll(vmList); + + log.info("Capabilities Output:"+ capabilities.toString()); + + } + + return capabilities; + + } + + private InventoryInfo getInventoryInfo(SvcLogicContext ctx, String vnfId) throws Exception{ + + String fn = "FlowExecutorNode.getInventoryInfo"; + String vmcount = ctx.getAttribute("tmp.vnfInfo.vm-count"); + int vmCount = Integer.parseInt(vmcount); + log.info(fn +"vmcount:"+ vmCount); + + VnfInfo vnfInfo = new VnfInfo(); + vnfInfo.setVnfId(vnfId); + vnfInfo.setVnfName(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name")); + vnfInfo.setVnfType(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type")); + + Vm vm = new Vm(); + Vnfcslist vnfc = new Vnfcslist(); + + if (vmCount > 0) { + + for (int i = 0; i < vmCount; i++) { + + vm.setVserverId(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vserverId")); + String vnfccount = ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-count"); + int vnfcCount = Integer.parseInt(vnfccount); + + if (vnfcCount > 0) { + vnfc.setVnfcName(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-name")); + vnfc.setVnfcType(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-type")); + vm.setVnfc(vnfc); + } + vnfInfo.getVm().add(vm); + } + } + + InventoryInfo inventoryInfo = new InventoryInfo(); + inventoryInfo.setVnfInfo(vnfInfo); + + return inventoryInfo; + + } + + private String getFlowSequence() throws IOException { + + String sequenceModel = IOUtils.toString(FlowControlNode.class.getClassLoader().getResourceAsStream("sequence.json"), Charset.defaultCharset()); + + return null; + } + + +private static Properties loadProperties() throws Exception { + Properties props = new Properties(); + String propDir = System.getenv(SDNC_CONFIG_DIR_VAR); + if (propDir == null) + throw new Exception("Cannot find Property file -" + SDNC_CONFIG_DIR_VAR); + String propFile = propDir + FlowControllerConstants.APPC_FLOW_CONTROLLER; + InputStream propStream = new FileInputStream(propFile); + try + { + props.load(propStream); + } + catch (Exception e) + { + throw new Exception("Could not load properties file " + propFile, e); + } + finally + { + try + { + propStream.close(); + } + catch (Exception e) + { + log.warn("Could not close FileInputStream", e); + } + } + return props; +} + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowGenerator.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowGenerator.java new file mode 100644 index 000000000..8d81858fc --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/FlowGenerator.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.node; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.openecomp.appc.flow.controller.data.Response; +import org.openecomp.appc.flow.controller.data.ResponseAction; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.data.Transactions; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class FlowGenerator { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowGenerator.class); + + public Transactions createSingleStepModel(Map<String, String> inParams, SvcLogicContext ctx) { + + String fn = "FlowGenerator.createSingleStepModel"; + log.debug("Starting generating single Step flow" ); + + log.debug("Data in context" + ctx.getAttributeKeySet() ); + Transactions transactions = new Transactions(); + List<Transaction> transactionList = new ArrayList<Transaction>(); + Transaction singleTransaction = new Transaction(); + + singleTransaction.setTransactionId(1); + singleTransaction.setAction(ctx.getAttribute(FlowControllerConstants.REQUEST_ACTION)); + singleTransaction.setActionLevel(FlowControllerConstants.VNF); //Need to discuss how to get action level if not in request + singleTransaction.setPayload(ctx.getAttribute(FlowControllerConstants.PAYLOAD)); + singleTransaction.setActionLevel(ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL)); + + + + + List<Response> responseList = new ArrayList<Response>(); + Response response = new Response(); + + ResponseAction ra = new ResponseAction(); + ra.setStop(true); + response.setResponseAction(ra); + + responseList.add(response); + singleTransaction.setResponses(responseList); + transactionList.add(singleTransaction); + + transactions.setTransactions(transactionList); + + log.debug("Sequence String" + transactions.toString()); + + return transactions; + } + + + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/JsonParsingNode.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/JsonParsingNode.java new file mode 100644 index 000000000..b1f31285b --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/JsonParsingNode.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.node; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import org.apache.commons.lang3.StringUtils; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.executorImpl.RestExecutor; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonParsingNode implements SvcLogicJavaPlugin{ + + + private static final EELFLogger log = EELFManager.getInstance().getLogger(JsonParsingNode.class); + private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR"; + + public void parse(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + String fn = "RestServiceNode.sendRequest"; + log.info("Received processParamKeys call with params : " + inParams); + String responsePrefix = inParams.get(FlowControllerConstants.INPUT_PARAM_RESPONSE_PRIFIX); + try + { + responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; + //Remove below for Block + if(isValidJSON(inParams.get("data")) !=null){ + JsonNode jnode = isValidJSON(inParams.get("data")); + ObjectMapper mapper = new ObjectMapper(); + Map<String, Object> map = new HashMap<String, Object>(); + map = mapper.readValue(jnode.toString(), new TypeReference<Map<String, String>>(){}); + for (Entry<String, Object> entry : map.entrySet()) + { + ctx.setAttribute(responsePrefix + entry.getKey(),(String) entry.getValue()); + } + + } + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_SUCCESS); + + } catch (Exception e) { + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + e.printStackTrace(); + log.error("Error Message : " + e.getMessage()); + throw new SvcLogicException(e.getMessage()); + } + } + + public JsonNode isValidJSON(String json) throws IOException { + JsonNode output = null; + log.info("Received response from Interface " + json); + if(json ==null || json.isEmpty()) + return null; + try{ + ObjectMapper objectMapper = new ObjectMapper(); + output = objectMapper.readTree(json); + } catch(JsonProcessingException e){ + log.warn("Response received from interface is not a valid JSON block" + json); + return null; + } + + return output; + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/RestServiceNode.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/RestServiceNode.java new file mode 100644 index 000000000..246f7a4e9 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/node/RestServiceNode.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.node; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.lang3.StringUtils; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.executorImpl.RestExecutor; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class RestServiceNode implements SvcLogicJavaPlugin{ + + + private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class); + private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR"; + + public void sendRequest(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + String fn = "RestServiceNode.sendRequest"; + log.info("Received processParamKeys call with params : " + inParams); + String responsePrefix = inParams.get(FlowControllerConstants.INPUT_PARAM_RESPONSE_PRIFIX); + try + { + responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; + //Remove below for Block + for (Object key : ctx.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + log.info(fn + "Getting Key = " + parmName + "and Value = " + parmValue); + } + + send(ctx, inParams); + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_SUCCESS); + + } catch (Exception e) { + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + e.printStackTrace(); + log.error("Error Message : " + e.getMessage()); + throw new SvcLogicException(e.getMessage()); + } + } + + public void send(SvcLogicContext ctx, Map<String, String> inParams) throws Exception{ + try{ + Properties prop = loadProperties(); + log.info("Loaded Properties " + prop.toString()); + String responsePrefix = inParams.get(FlowControllerConstants.INPUT_PARAM_RESPONSE_PRIFIX); + RestExecutor restRequestExecutor = new RestExecutor(); + String resourceUri = ""; + if(ctx.getAttribute(FlowControllerConstants.INPUT_URL) != null && !(ctx.getAttribute(FlowControllerConstants.INPUT_URL).isEmpty())) + resourceUri = ctx.getAttribute(FlowControllerConstants.INPUT_URL); + else{ + resourceUri = resourceUri.concat(FlowControllerConstants.HTTP); + log.info("resourceUri= " + resourceUri ); + resourceUri = resourceUri.concat(ctx.getAttribute(FlowControllerConstants.INPUT_HOST_IP_ADDRESS)); + resourceUri = resourceUri.concat(":"); + resourceUri = resourceUri.concat(ctx.getAttribute(FlowControllerConstants.INPUT_PORT_NUMBER)); + + if(ctx.getAttribute(FlowControllerConstants.INPUT_CONTEXT) != null && !ctx.getAttribute(FlowControllerConstants.INPUT_CONTEXT).isEmpty()){ + resourceUri = resourceUri.concat("/").concat(ctx.getAttribute(FlowControllerConstants.INPUT_CONTEXT)); + log.info("resourceUri= " + resourceUri ); + } + else if(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".context")) != null ){ + log.info("resourceUri = " + resourceUri ); + resourceUri = resourceUri.concat("/").concat(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".context"))); + } + else + throw new Exception("Could Not found the context for operation " + ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION)); + + + if(ctx.getAttribute(FlowControllerConstants.INPUT_SUB_CONTEXT) != null && !ctx.getAttribute(FlowControllerConstants.INPUT_SUB_CONTEXT).isEmpty()){ + resourceUri = resourceUri.concat("/").concat(ctx.getAttribute(FlowControllerConstants.INPUT_SUB_CONTEXT)); + log.info("resourceUri" + resourceUri ); + } + else if(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".sub-context")) != null ){ + resourceUri = resourceUri.concat("/").concat(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".sub-context"))); + log.info("resourceUri" + resourceUri ); + } + } + + log.info("Rest Constructed URL : " + resourceUri); + Transaction transaction = new Transaction(); + + transaction.setExecutionEndPoint(resourceUri); + transaction.setExecutionRPC(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE)); + transaction.setAction(FlowControllerConstants.INPUT_REQUEST_ACTION); + if(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE) == null || ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE).isEmpty()) + throw new Exception("Dont know REST operation for Action " + transaction.getExecutionRPC()); + if(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION) == null || ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).isEmpty()) + throw new Exception("Dont know request-action " + transaction.getAction()); + + //This code need to get changed to get the UserID and pass from a common place. + if(transaction.getuId() == null ) + transaction.setuId(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".default-rest-user"))); + if(transaction.getPswd() == null) + transaction.setPswd(prop.getProperty(ctx.getAttribute(FlowControllerConstants.INPUT_REQUEST_ACTION).concat(".default-rest-pass"))); + + HashMap<String, String> output = restRequestExecutor.execute(transaction, ctx); + + if(output.get("restResponse") !=null && isValidJSON(output.get("restResponse")) != null) + { + ctx.setAttribute(responsePrefix + "." + FlowControllerConstants.OUTPUT_STATUS_MESSAGE , output.get("restResponse")); +// JsonNode restResponse = isValidJSON(output.get("restResponse")); +// for (String key : inParams.keySet()) { +// if(key !=null && key.startsWith("output-")){ +// log.info("Found Key = " + key); +// log.info("Found Key in Params " + inParams.get(key) + "."); +// JsonNode setValue = restResponse.findValue(inParams.get(key)); +// log.info("Found value = " + setValue); +// if(setValue !=null && setValue.textValue() !=null && !setValue.textValue().isEmpty()) +// ctx.setAttribute(responsePrefix + "." + key, setValue.textValue()); +// else +// ctx.setAttribute(responsePrefix + "." + key, null); +// } +// } + } + log.info("Response from Rest :" ); + } + catch(Exception e) + { + e.printStackTrace(); + log.error("Error Message " + e.getMessage()); + throw e; + } + } + + private Properties loadProperties() throws Exception { + Properties props = new Properties(); + String propDir = System.getenv(SDNC_CONFIG_DIR_VAR); + if (propDir == null) + throw new Exception("Cannot find Property file -" + SDNC_CONFIG_DIR_VAR); + String propFile = propDir + FlowControllerConstants.APPC_FLOW_CONTROLLER; + InputStream propStream = new FileInputStream(propFile); + try + { + props.load(propStream); + } + catch (Exception e) + { + throw new Exception("Could not load properties file " + propFile, e); + } + finally + { + try + { + propStream.close(); + } + catch (Exception e) + { + log.warn("Could not close FileInputStream", e); + } + } + // TODO Auto-generated method stub + return props; + } + + public JsonNode isValidJSON(String json) throws IOException { + JsonNode output = null; + log.info("Received response from Interface " + json); + if(json ==null || json.isEmpty()) + return null; + try{ + ObjectMapper objectMapper = new ObjectMapper(); + output = objectMapper.readTree(json); + } catch(JsonProcessingException e){ + log.warn("Response received from interface is not a valid JSON block" + json); + return null; + } + log.info("state is " + output.findValue("state")); + + return output; + } +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/EscapeUtils.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/EscapeUtils.java new file mode 100644 index 000000000..6223fea54 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/EscapeUtils.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.utils; + +import org.apache.commons.lang3.StringUtils; + +public class EscapeUtils { + + public EscapeUtils() { + } + + public static String escapeSql(String str) { + if (str == null) { + return null; + } + String searchList[] = new String[]{"'","\\", "\"" }; + String replacementList[] = new String[]{ "''","\\\\" ,"\\\""}; + return StringUtils.replaceEach(str,searchList, replacementList); + } + +} diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/FlowControllerConstants.java b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/FlowControllerConstants.java new file mode 100644 index 000000000..70500c4b1 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/openecomp/appc/flow/controller/utils/FlowControllerConstants.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.controller.utils; + +public class FlowControllerConstants { + + public static String STRING_ENCODING = "utf-8"; + public static String Y = "Y"; + public static String N = "N"; + public static String DATA_TYPE_TEXT = "TEXT"; + public static String DATA_TYPE_JSON = "JSON"; + public static String DATA_TYPE_XML = "XML"; + public static String DATA_TYPE_SQL = "SQL"; + + public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix"; + + public static String OUTPUT_PARAM_STATUS = "status"; + public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message"; + public static String OUTPUT_STATUS_SUCCESS = "success"; + public static String OUTPUT_STATUS_FAILURE = "failure"; + + public static final String DESINGTIME = "DesignTime"; + public static final String RUNTIME = "RunTime"; + public static final String APPC_FLOW_CONTROLLER = "/appc-flow-controller.properties"; + public static final String VNF_TYPE = "vnf-type"; + public static final String ACTION = "action"; + public static final String VNFC_TYPE = "vnfc-type"; + public static final String VM_INSTANCE = "vm-instance"; + public static final String VM = "vm"; + public static final String VNFC = "vnfc"; + public static final String REFERENCE = "reference"; + public static final String VNFC_INSTANCE = "vnfc-instance"; + public static final String DEVICE_PROTOCOL = "device-protocol"; + public static final String DG_RPC = "dg-rpc"; + public static final String MODULE = "module"; + public static final String USER_NAME = "user-name"; + public static final String PORT_NUMBER = "port-number"; + public static final String DOWNLOAD_DG_REFERENCE = "download-dg-reference"; + public static final String REQUEST_ACTION = "request-action"; + public static final String VNF = "vnf"; + public static final String EXTERNAL = "External"; + public static final String ACTION_LEVEL = "action-level"; + public static final String ARTIFACT_NAME = "artifact-name"; + + public static enum endPointType {DG,REST,NODE}; + public static enum flowStatus {PENDING,IN_PROCESS,COMPLETED}; + + public static final String GENERATION_NODE = "GENERATION-NODE"; + public static final String SEQUENCE_TYPE = "SEQUENCE-TYPE"; + public static final String CATEGORY = "CATEGORY"; + public static final String EXECUTION_NODE = "EXECUTION-NODE"; + + + public static final String REQUEST_ID = "reqeust-id"; + public static final String ARTIFACT_CONTENT = "artifact-content"; + public static final String ARTIFACT_CONTENT_ESCAPED = "artifact-content-escaped"; + public static final String FLOW_SEQUENCE = "flow-sequence"; + public static final String EXECUTTION_MODULE = "execution-module"; + public static final String EXECUTION_RPC = "execution-rpc"; + public static final String EXECUTION_TYPE = "execution-type"; + public static final String GRAPH = "graph"; + public static final String NODE = "node"; + public static final String REST = "rest"; + + + public static final String DB_ASDC_ARTIFACTS = "ASDC_ARTIFACTS"; + public static final String DB_ASDC_REFERENCE = "ASDC_REFERENCE"; + public static final String DB_REQUEST_ARTIFACTS = "REQUEST_ARTIFACTS"; + public static final String DB_MULTISTEP_FLOW_REFERENCE = "MULTISTEP_FLOW_REFERENCE"; + public static final String DB_PROTOCOL_REFERENCE = "PROTOCOL_REFERENCE"; + public static final String DB_PROCESS_FLOW_REFERENCE = "PROCESS_FLOW_REFERENCE"; + public static final String MOCK_HEALTHCHECK = "mock-healthcheck"; + public static final String ACTION_IDENTIFIER = "action-identifier"; + public static final String PAYLOAD = "payload"; + public static final String FAILURE = "failure"; + public static final String SUCCESS = "success"; + public static final String OTHERS = "Others"; + public static final String RESPONSE_PREFIX = "response-prefix"; + public static final String OUTPUT_STATUS_MESSAGE = "status-message"; + public static final String HEALTHY = "healthy"; + public static final String INPUT_URL = "input.url"; + public static final String INPUT_HOST_IP_ADDRESS = "host-ip-address"; + public static final String INPUT_PORT_NUMBER = "port-number"; + public static final String INPUT_CONTEXT = "context"; + public static final String INPUT_SUB_CONTEXT = "sub-context"; + public static final String INPUT_REQUEST_ACTION_TYPE = "request-action-type"; + public static final String INPUT_REQUEST_ACTION = "request-action"; + public static final String HTTP = "http://"; + + public static final String VNF_ID = "vnf-id"; + public static final String VSERVER_ID = "vserver-id"; + public static final String SEQ_GENERATOR_URL = "seq_generator_url"; + public static final String SEQ_GENERATOR_UID = "seq_generator.uid"; + public static final String SEQ_GENERATOR_PWD = "seq_generator.pwd"; + public static final String CAPABILITY ="capability"; + public static final String DEPENDENCYMODEL ="tosca_dependency_model"; + public static final String VF_MODULE ="vf-module"; + public static final String VNFC_NAME = "vnfc-name"; + } diff --git a/appc-config/appc-flow-controller/provider/src/main/resources/appc-flow-controller.properties b/appc-config/appc-flow-controller/provider/src/main/resources/appc-flow-controller.properties new file mode 100644 index 000000000..505ab8f43 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/resources/appc-flow-controller.properties @@ -0,0 +1,23 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APP-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. 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. +# 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========================================================= +### + +healthcheck.mock=false +healthcheck.default-rest-user=User +healthcheck.default-rest-pass=@#asd723%^ diff --git a/appc-config/appc-flow-controller/provider/src/main/resources/jaxby.properties b/appc-config/appc-flow-controller/provider/src/main/resources/jaxby.properties new file mode 100644 index 000000000..6671e3072 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/main/resources/jaxby.properties @@ -0,0 +1,21 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APP-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. 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. +# 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========================================================= +### + +javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java new file mode 100644 index 000000000..cdb9e2da5 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.executor.node; + +import java.io.InputStream; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.appc.flow.controller.node.FlowControlNode; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestFlowExecutorNode { + + private final Logger logger = LoggerFactory.getLogger(TestFlowExecutorNode.class); + + + //@Before + public void setUp() { + Properties props = new Properties(); + InputStream propStr = getClass().getResourceAsStream("/svclogic.properties"); + if (propStr == null) { + System.err.println("src/test/resources/svclogic.properties missing"); + } + try { + System.out.println("Got Properties"); + props.load(propStr); + propStr.close(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Could not initialize properties"); + } + // Add properties to global properties + + Enumeration propNames = props.keys(); + + while (propNames.hasMoreElements()) { + + String propName = (String) propNames.nextElement(); + System.setProperty(propName, props.getProperty(propName)); + System.out.println("propName" + propName + " Value: " + props.getProperty(propName)); + } + + + } + + + //@Test + public void testFlowExecutorNode() throws Exception { + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute(FlowControllerConstants.VNF_TYPE, "vUSP - vDBE-IPX HUB"); + ctx.setAttribute(FlowControllerConstants.REQUEST_ACTION, "Configure"); + ctx.setAttribute(FlowControllerConstants.VNFC_TYPE, "");; + ctx.setAttribute(FlowControllerConstants.REQUEST_ID,"TESTCOMMONFRMWK"); + ; + // ctx.setAttribute(FlowControllerConstants.ACTION_LEVEL,"VNF"); + HashMap inParams = new HashMap(); + + FlowControlNode fen = new FlowControlNode(); + fen.processFlow(inParams, ctx); + + System.out.println("Flow sequence" + ctx.getAttribute("transMap")); + + } +} diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java new file mode 100644 index 000000000..9f08424f9 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.executor.node; + +import java.io.InputStream; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.appc.flow.controller.node.FlowControlNode; +import org.openecomp.appc.flow.controller.node.JsonParsingNode; +import org.openecomp.appc.flow.controller.node.RestServiceNode; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestParsingNode { + +// @Before + public void setUp() { + Properties props = new Properties(); + InputStream propStr = getClass().getResourceAsStream("/svclogic.properties"); + if (propStr == null) { + System.err.println("src/test/resources/svclogic.properties missing"); + } + try { + System.out.println("Got Properties"); + props.load(propStr); + propStr.close(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Could not initialize properties"); + } + // Add properties to global properties + + Enumeration propNames = props.keys(); + + while (propNames.hasMoreElements()) { + + String propName = (String) propNames.nextElement(); + System.setProperty(propName, props.getProperty(propName)); + System.out.println("propName" + propName + " Value: " + props.getProperty(propName)); + } + + + + } + + +// @Test + public void testRestServiceNode() throws Exception { + + SvcLogicContext ctx = new SvcLogicContext(); + + + + HashMap<String, String> inParams = new HashMap<String, String>(); + JsonParsingNode rsn = new JsonParsingNode(); + inParams.put("data", "{\"identifier\": \"scope represented\",\"state\": \"healthy\",\"test\": \"passed\", \"time\": \"01-01-1000:0000\"}"); + inParams.put("responsePrefix", "APPC.healthcheck"); + rsn.parse(inParams, ctx); + + for (Object key : ctx.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + System.out.println(parmName + "=" + parmValue); + } + + + } +} diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java new file mode 100644 index 000000000..6c3b432c7 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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.openecomp.appc.flow.executor.node; + +import java.io.InputStream; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.appc.flow.controller.data.Transaction; +import org.openecomp.appc.flow.controller.executorImpl.RestExecutor; +import org.openecomp.appc.flow.controller.interfaceData.ActionIdentifier; +import org.openecomp.appc.flow.controller.interfaceData.InventoryInfo; +import org.openecomp.appc.flow.controller.interfaceData.RequestInfo; +import org.openecomp.appc.flow.controller.interfaceData.Vm; +import org.openecomp.appc.flow.controller.interfaceData.VnfInfo; +import org.openecomp.appc.flow.controller.interfaceData.Vnfcslist; +import org.openecomp.appc.flow.controller.node.FlowControlNode; +import org.openecomp.appc.flow.controller.node.RestServiceNode; +import org.openecomp.appc.flow.controller.utils.FlowControllerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestRestServiceNode { + +// @Before + public void setUp() { + Properties props = new Properties(); + InputStream propStr = getClass().getResourceAsStream("/svclogic.properties"); + if (propStr == null) { + System.err.println("src/test/resources/svclogic.properties missing"); + } + try { + System.out.println("Got Properties"); + props.load(propStr); + propStr.close(); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("Could not initialize properties"); + } + // Add properties to global properties + + Enumeration propNames = props.keys(); + + while (propNames.hasMoreElements()) { + + String propName = (String) propNames.nextElement(); + System.setProperty(propName, props.getProperty(propName)); + System.out.println("propName" + propName + " Value: " + props.getProperty(propName)); + } + + + } + + +// @Test + public void testRestServiceNode() throws Exception { + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute(FlowControllerConstants.VNF_TYPE, "vUSP - vDBE-IPX HUB"); + ctx.setAttribute(FlowControllerConstants.REQUEST_ACTION, "healthcheck"); + ctx.setAttribute(FlowControllerConstants.VNFC_TYPE, "TESTVNFC-CF"); + ctx.setAttribute(FlowControllerConstants.REQUEST_ID,"TESTCOMMONFRMWK"); + ctx.setAttribute("host-ip-address","127.0.0.1"); + ctx.setAttribute("port-number","8888"); + ctx.setAttribute("request-action-type","GET"); + ctx.setAttribute("context", "loader/restconf/operations/appc-provider-lcm:health-check"); + + HashMap<String, String> inParams = new HashMap<String, String>(); + RestServiceNode rsn = new RestServiceNode(); + inParams.put("output-state", "state"); + inParams.put("responsePrefix", "healthcheck"); + rsn.sendRequest(inParams, ctx); + + for (Object key : ctx.getAttributeKeySet()) { + String parmName = (String) key; + String parmValue = ctx.getAttribute(parmName); + System.out.println(parmName + "=" + parmValue); + } + + + } + + + //@Test + public void testInputParamsRestServiceNode() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("vnf-id", "test"); + ctx.setAttribute("tmp.vnfInfo.vm-count", "1"); + ctx.setAttribute("tmp.vnfInfo.vm[0].vnfc-count", "1"); + RestExecutor restExe = new RestExecutor(); + Transaction transaction = new Transaction(); + + FlowControlNode node = new FlowControlNode(); + //String output =node.collectInputParams(ctx, transaction); + +// Properties props = new Properties(); +// props.setProperty("SEQ_GENERATOR_URL", "test"); + //System.out.println(output); + //transaction.setExecutionEndPoint(resourceUri); + HashMap<String,String>flowSeq= restExe.execute(transaction, ctx); + String flowSequnce=flowSeq.get("restResponse"); + System.out.println(flowSequnce); + + } +} diff --git a/appc-config/appc-flow-controller/provider/src/test/resources/Info.out.xml b/appc-config/appc-flow-controller/provider/src/test/resources/Info.out.xml new file mode 100644 index 000000000..787796704 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/resources/Info.out.xml @@ -0,0 +1,19 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APP-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. 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. + 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========================================================= + --> diff --git a/appc-config/appc-flow-controller/provider/src/test/resources/svclogic.properties b/appc-config/appc-flow-controller/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..f6b424136 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/resources/svclogic.properties @@ -0,0 +1,33 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APP-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. 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. +# 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========================================================= +### + +org.openecomp.sdnc.sli.dbtype= +org.openecomp.sdnc.sli.jdbc.hosts= +org.openecomp.sdnc.sli.jdbc.url= +org.openecomp.sdnc.sli.jdbc.database= +org.openecomp.sdnc.sli.jdbc.user= +org.openecomp.sdnc.sli.jdbc.password= +org.openecomp.sdnc.sli.jdbc.connection.name= + +org.openecomp.sdnc.sli.jdbc.connection.timeout= +org.openecomp.sdnc.sli.jdbc.request.timeout= +org.openecomp.sdnc.sli.jdbc.limit.init= +org.openecomp.sdnc.sli.jdbc.limit.min= +org.openecomp.sdnc.sli.jdbc.limit.max= diff --git a/appc-config/appc-flow-controller/provider/src/test/resources/transactionModel.json b/appc-config/appc-flow-controller/provider/src/test/resources/transactionModel.json new file mode 100644 index 000000000..b21f48805 --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/resources/transactionModel.json @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * 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========================================================= + */ + +{ + "transactions": [{ + "transactionId": 1, + "action": "configure", + "action-level": "vnf", + "action-identifier": { + "vnf-id": "dbgx0001v" + }, + "payload": "This is my Payload", + "parameters": [{ + "name": "value" + }], + "precheck": { + "precheck-operator": "all", + "precheck-options": [{ + "pre-transactionID": "1", + "param-name": "state", + "param-value": "healthy", + "rule": "continue" + }, + { + "pre-transactionID": "2", + "param-name": "state", + "param-value": "healthy", + "rule": "continue" + }] + }, + "state": "healthy", + "responses": [{ + "responseActionHanlder": null, + "responseCode": "401", + "responseMessage": null, + "responseAction": { + "wait": null, + "retry": null, + "jump": null, + "ignore": true, + "stop": false, + "intermediateMessage": null + } + }] + }] +} |