diff options
113 files changed, 6989 insertions, 251 deletions
diff --git a/appc-config/appc-config-params/features/src/main/resources/features.xml b/appc-config/appc-config-params/features/src/main/resources/features.xml index d02b8400c..88f410019 100644 --- a/appc-config/appc-config-params/features/src/main/resources/features.xml +++ b/appc-config/appc-config-params/features/src/main/resources/features.xml @@ -5,19 +5,21 @@ ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + 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 + 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. + 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. - ECOMP is a trademark and service mark of AT&T Intellectual Property. + ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> diff --git a/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml b/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml index 706fab4f4..f1adf9c5e 100644 --- a/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml +++ b/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml @@ -1,9 +1,11 @@ <!-- ============LICENSE_START======================================================= - ONAP : APP-C + ONAP : APPC ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -15,6 +17,8 @@ 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. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= ECOMP is a trademark and service mark of AT&T Intellectual Property. --> diff --git a/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml index f7e0c9586..a8f949d38 100644 --- a/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -1,9 +1,11 @@ <!-- ============LICENSE_START======================================================= - ONAP : APP-C + ONAP : APPC ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -15,6 +17,8 @@ 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. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= ECOMP is a trademark and service mark of AT&T Intellectual Property. --> diff --git a/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh b/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh index d3d2ea6e7..0d25deb4c 100644 --- a/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh +++ b/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh @@ -1,9 +1,11 @@ ### # ============LICENSE_START======================================================= -# ONAP : APP-C +# ONAP : APPC # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -15,6 +17,8 @@ # 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. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= # ECOMP is a trademark and service mark of AT&T Intellectual Property. ### diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java index f248159de..dd4515cca 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java index 4b541982c..65b93d738 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java index 6a03eddb3..aaa457645 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java index 0fd1b92c8..d33fd9589 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java index c1cf0e19a..0589afcc3 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java index 9e394e465..5277699e1 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java index a19c2b927..714d01c6e 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java index c646d9bd6..8498b6375 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java index b4c688075..cb4f1e0f7 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java index 65da0c4f6..9ec80c9a4 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java index 754676c26..e3dd5dc41 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java index e4ce87976..e788fbf88 100644 --- a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java +++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties b/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties index 525fcf9ba..d6f041f1c 100644 --- a/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties +++ b/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties @@ -4,19 +4,21 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java index 81f4a6685..1f982b8e6 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java index 5a8930fa7..0a7a267ee 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java index 8fe8dc73a..d11b14d4f 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java index 51c458cff..f828297b0 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java index 438884350..d7d90540c 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java index 654b4c1b3..3abd84138 100644 --- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java +++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java @@ -4,19 +4,21 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * 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 + * 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. + * 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. * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ECOMP is a trademark and service mark of AT&T Intellectual Property. * ============LICENSE_END========================================================= */ diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml index 7c8b31d52..910d15fcb 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml @@ -4,18 +4,20 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml index 7c8b31d52..910d15fcb 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml @@ -4,18 +4,20 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml index 7c8b31d52..910d15fcb 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml @@ -4,18 +4,20 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml index 7c8b31d52..910d15fcb 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml @@ -4,18 +4,20 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml index d379c4730..7c4137c88 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml @@ -4,19 +4,21 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml index 092575329..bb9593ab2 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml @@ -4,19 +4,21 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml index 6c1214206..dbd0a5881 100644 --- a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml +++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml @@ -4,19 +4,21 @@ # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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 +# 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. +# 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. # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ECOMP is a trademark and service mark of AT&T Intellectual Property. # ============LICENSE_END========================================================= ### diff --git a/appc-inbound/.gitignore b/appc-inbound/.gitignore new file mode 100755 index 000000000..4b38b789e --- /dev/null +++ b/appc-inbound/.gitignore @@ -0,0 +1,32 @@ +# Target dirs in all projects
+**/target/*
+
+# Added for Intellij IDEA IDE
+**/.idea/*
+*.iml
+
+# Generated models and features
+**/bin/*
+
+# MANIFEST.MF is updated on every clean install
+**/src/main/resources/META-INF/
+**/pom.xml.versionsBackup
+pom.xml.versionsBackup
+
+.project
+
+*.prefs
+.classpath
+**/.classpath
+/target/
+logs/
+debug-logs/
+/.settings/
+**/*.iml
+/.idea/
+
+
+# MANIFEST.MF is updated on every clean install
+**/src/main/resources/META-INF/
+**/src/main/yang-gen-sal
+**/src/main/yang-gen-config
diff --git a/appc-inbound/appc-artifact-handler/.gitignore b/appc-inbound/appc-artifact-handler/.gitignore new file mode 100755 index 000000000..ab7c300b8 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/.gitignore @@ -0,0 +1,32 @@ +# Target dirs in all projects +**/target/* + +# Added for Intellij IDEA IDE +**/.idea/* +*.iml + +# Generated models and features +**/bin/* + +# MANIFEST.MF is updated on every clean install +**/src/main/resources/META-INF/ +**/pom.xml.versionsBackup +pom.xml.versionsBackup + +.project + +*.prefs +.classpath +**/.classpath +/target/ +logs/ +debug-logs/ +/.settings/ +**/*.iml +/.idea/ + + +# MANIFEST.MF is updated on every clean install +**/src/main/resources/META-INF/ +**/src/main/yang-gen-sal +**/src/main/yang-gen-config diff --git a/appc-inbound/appc-artifact-handler/features/.gitignore b/appc-inbound/appc-artifact-handler/features/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/features/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-artifact-handler/features/pom.xml b/appc-inbound/appc-artifact-handler/features/pom.xml new file mode 100755 index 000000000..ab4f624ea --- /dev/null +++ b/appc-inbound/appc-artifact-handler/features/pom.xml @@ -0,0 +1,99 @@ +<?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> + <artifactId>appc-artifact-handler</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-artifact-handler-features</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-artifact-handler-model</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-artifact-handler-provider</artifactId> + <classifier>config</classifier> + <type>xml</type> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>features-mdsal</artifactId> + <classifier>features</classifier> + <type>xml</type> + <scope>runtime</scope> + </dependency> + <!-- dependency for opendaylight-karaf-empty for use by testing --> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>opendaylight-karaf-empty</artifactId> + <type>zip</type> + </dependency> + + <dependency> + <!-- Required for launching the feature tests --> + <groupId>org.opendaylight.odlparent</groupId> + <artifactId>features-test</artifactId> + <scope>test</scope> + <version>${odl.commons.opendaylight.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>features-yangtools</artifactId> + <classifier>features</classifier> + <type>xml</type> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>filter</id> + <goals> + <goal>resources</goal> + </goals> + <phase>generate-resources</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/${features.file}</file> + <type>xml</type> + <classifier>features</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml b/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml new file mode 100644 index 000000000..f742dfcb0 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/features/src/main/resources/features.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + + +<features name="app-cntrl-artifact-handler-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> + + + <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.version}/xml/features</repository> + + <feature name='app-cntrl-artifact-handler' description="Application Controller Artifact Handler" + version='${project.version}'> + <!-- Most applications will have a dependency on the ODL MD-SAL Broker --> + <feature version="${broker-mdsal.version">odl-mdsal-broker</feature> + <feature version='${sdnctl.sli.version}'>sdnc-sli</feature> + <bundle>wrap:mvn:com.att.eelf/eelf-core/${eelf.version}</bundle> + <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle> + <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle> + <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle> + <bundle>wrap:mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${jackson.version}</bundle> + <bundle>wrap:mvn:org.yaml/snakeyaml/${snakeyaml.version}</bundle> + <bundle>wrap:mvn:org.openecomp.appc/appc-yang-generator/${project.version}</bundle> + <bundle>wrap:mvn:org.openecomp.sdc.common/openecomp-tosca-datatype/${tosca.datatype.version}</bundle> + <bundle>mvn:org.openecomp.appc/appc-config-params-provider/${project.version}</bundle> + <bundle>mvn:org.openecomp.appc/appc-artifact-handler-model/${project.version}</bundle> + <bundle>mvn:org.openecomp.appc/appc-artifact-handler-provider/${project.version}</bundle> + <configfile finalname="etc/opendaylight/karaf/200-artifact-handler-provider.xml">mvn:org.openecomp.appc/appc-artifact-handler-provider/${project.version}/xml/config</configfile> + </feature> + +</features> diff --git a/appc-inbound/appc-artifact-handler/installer/.gitignore b/appc-inbound/appc-artifact-handler/installer/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-artifact-handler/installer/pom.xml b/appc-inbound/appc-artifact-handler/installer/pom.xml new file mode 100755 index 000000000..9af28bf6a --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/pom.xml @@ -0,0 +1,132 @@ +<?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> + <artifactId>appc-artifact-handler</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-artifact-handler-installer</artifactId> + <name>appc-artifact-handler-installer</name> + <packaging>pom</packaging> + + <properties> + <application.name>appc-artifact-handler</application.name> + <features.boot>appc-artifact-handler</features.boot> + <features.repositories>mvn:org.openecomp.appc/appc-artifact-handler-features/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-artifact-handler-features</artifactId> + <classifier>features</classifier> + <type>xml</type> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-artifact-handler-provider</artifactId> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>false</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>true</attach> + <finalName>${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <excludeGroupIds>org.opendaylight</excludeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals> + <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/appc-inbound/appc-artifact-handler/installer/resources/scripts/install-feature.sh b/appc-inbound/appc-artifact-handler/installer/resources/scripts/install-feature.sh new file mode 100755 index 000000000..c5a39bf9a --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/resources/scripts/install-feature.sh @@ -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========================================================= +### + +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -n -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_installer_zip.xml b/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..e54eede04 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,62 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..fc99e918e --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,50 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/appc-inbound/appc-artifact-handler/installer/src/main/resources/scripts/install-feature.sh b/appc-inbound/appc-artifact-handler/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..05b4ae373 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,43 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -n -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/appc-inbound/appc-artifact-handler/model/.gitignore b/appc-inbound/appc-artifact-handler/model/.gitignore new file mode 100755 index 000000000..0f44a0f25 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.classpath diff --git a/appc-inbound/appc-artifact-handler/model/pom.xml b/appc-inbound/appc-artifact-handler/model/pom.xml new file mode 100755 index 000000000..7b9402d8f --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/pom.xml @@ -0,0 +1,158 @@ +<?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> + <artifactId>appc-artifact-handler</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-artifact-handler-model</artifactId> + <packaging>bundle</packaging> + + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <!-- <version>${odl.yangtools.version}</version> --> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <configuration> + <executable>python</executable> + <arguments> + <argument>scripts/python/yang2props.py</argument> + <argument>src/main/yang/artifact-handler.yang</argument> + <argument>target/artifact-handler.properties</argument> + </arguments> + </configuration> + <id>generation</id> + <phase>generate-resources</phase> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/artifact-handler.properties</file> + <type>properties</type> + <classifier>artifact-handler</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </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> + org.codehaus.mojo + </groupId> + <artifactId> + exec-maven-plugin + </artifactId> + <versionRange> + [1.2.1,) + </versionRange> + <goals> + <goal>exec</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> + </dependencies> +</project> diff --git a/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py b/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py new file mode 100755 index 000000000..559d31b8b --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/scripts/python/yang2props.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import re +import sys + + +# Convert word from foo-bar to FooBar +# words begining with a digit will be converted to _digit +def to_enum(s): + if s[0].isdigit(): + s = "_" + s + else: + s = s[0].upper() + s[1:] + return re.sub(r'(?!^)-([a-zA-Z])', lambda m: m.group(1).upper(), s) + +leaf = "" +val = "" +li = [] + +if len(sys.argv) < 3: + print 'yang2props.py <input yang> <output properties>' + sys.exit(2) + +with open(sys.argv[1], "r") as ins: + for line in ins: + # if we see a leaf save the name for later + if "leaf " in line: + match = re.search(r'leaf (\S+)', line) + if match: + leaf = match.group(1) + + # if we see enum convert the value to enum format and see if it changed + # if the value is different write a property entry + if "enum " in line: + match = re.search(r'enum "(\S+)";', line) + if match: + val = match.group(1) + enum = to_enum(val) + + # see if converting to enum changed the string + if val != enum: + property = "yang."+leaf+"."+enum+"="+val + if property not in li: + li.append( property) + + +# Open output file +fo = open(sys.argv[2], "wb") +fo.write("# yang conversion properties \n") +fo.write("# used to convert Enum back to the original yang value \n") +fo.write("\n".join(li)) +fo.write("\n") + +# Close opend file +fo.close() + + diff --git a/appc-inbound/appc-artifact-handler/model/src/main/.gitignore b/appc-inbound/appc-artifact-handler/model/src/main/.gitignore new file mode 100755 index 000000000..380e77fc2 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/src/main/.gitignore @@ -0,0 +1 @@ +/yang-gen-sal/ diff --git a/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang new file mode 100644 index 000000000..1839fbd67 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/model/src/main/yang/artifact-handler.yang @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +module artifact-handler { + yang-version 1; + + namespace "org.openecomp.appc:artifacthandler"; + prefix artifacthandler; + + import ietf-inet-types { prefix "ietf"; revision-date "2010-09-24"; } + organization "AT&T, Inc."; + + description + "Defines APPC interface to push reference data and templates."; + + revision "2017-03-21" { + description + "Initial draft"; + } + + grouping configuration-document-information { + uses request-information; + uses document-parameters; + } + + grouping request-information { + container request-information { + leaf request-id { + type string; + } + leaf request-action { + type enumeration { + enum "StoreAsdcDocumentRequest"; + } + } + leaf request-sub-action { + type enumeration { + enum "STOREDOCUMENT"; + } + } + leaf source { + type string; + } + } + } + grouping document-parameters { + container document-parameters { + leaf service-uuid { + type string; + mandatory true; + } + leaf distribution-id { + type string; + } + leaf service-name { + type string; + } + leaf service-description { + type string; + } + leaf service-artifacts { + type string; + } + leaf resource-uuid { + type string; + } + leaf resource-instance-name { + type string; + } + leaf resource-name { + type string; + } + leaf resource-version { + type string; + } + leaf resource-type { + type string; + } + leaf artifact-uuid { + type string; + } + leaf artifact-name { + type string; + } + leaf artifact-type { + type string; + } + leaf artifact-version { + type string; + } + leaf artifact-description { + type string; + } + leaf artifact-contents { + type string; + } + } + } + rpc uploadartifact { + description "upload the artifact into APPC"; + input { + uses configuration-document-information; + } + output { + container config-document-response { + leaf request-id { + type string; + } + leaf status { + type string; + } + leaf error-reason { + type string; + } + } + } + } +} diff --git a/appc-inbound/appc-artifact-handler/pom.xml b/appc-inbound/appc-artifact-handler/pom.xml new file mode 100755 index 000000000..ffa735255 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/pom.xml @@ -0,0 +1,49 @@ +<?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/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-inbound</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <artifactId>appc-artifact-handler</artifactId>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-artifact-handler-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-artifact-handler-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-artifact-handler-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-artifact-handler-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <modules>
+ <module>model</module>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/appc-inbound/appc-artifact-handler/provider/.gitignore b/appc-inbound/appc-artifact-handler/provider/.gitignore new file mode 100755 index 000000000..0f44a0f25 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/.gitignore @@ -0,0 +1,2 @@ +/target/ +/.classpath diff --git a/appc-inbound/appc-artifact-handler/provider/pom.xml b/appc-inbound/appc-artifact-handler/provider/pom.xml new file mode 100755 index 000000000..90d34a320 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/pom.xml @@ -0,0 +1,184 @@ +<?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> + <artifactId>appc-artifact-handler</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-artifact-handler-provider</artifactId> + <packaging>bundle</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.openecomp.appc.artifact.handler</Bundle-SymbolicName> + <Bundle-Activator>org.openecomp.appc.artifact.handler.AsdcArtifactHandlerActivator</Bundle-Activator> + <Export-Package>org.openecomp.appc.artifact.handler,org.opendaylight.controller.config.yang.config.artifact-handler_provider.impl</Export-Package> + <Import-Package>*</Import-Package> + <DynamicImport-Package>*</DynamicImport-Package> + </instructions> + <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <executions> + <execution> + <id>config</id> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass> + <outputBaseDir>${jmxGeneratorPath}</outputBaseDir> + <additionalConfiguration> + <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1> + </additionalConfiguration> + </generator> + <generator> + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>yang-jmx-generator-plugin</artifactId> + <version>${odl.yang.jmx.generator.version}</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/initial/artifact-handler-provider.xml</file> + <type>xml</type> + <classifier>config</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-artifact-handler-model</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>config-api</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-yang-generator</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-config</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + </dependency> + + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-config-params-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <artifactId>sal-test-model</artifactId> + <groupId>org.opendaylight.controller</groupId> + <scope>test</scope> + </dependency> + <dependency> + <artifactId>sal-rest-connector</artifactId> + <groupId>org.opendaylight.netconf</groupId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <version>${odl.mdsal.version}</version> + <classifier>tests</classifier> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.adaptors</groupId> + <artifactId>sql-resource-provider</artifactId> + <version>${openecomp.sdnc.sql-resource.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/.gitignore b/appc-inbound/appc-artifact-handler/provider/src/main/.gitignore new file mode 100755 index 000000000..f49bcf5ee --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/.gitignore @@ -0,0 +1,2 @@ +/yang-gen-config/ +/yang-gen-sal/ diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModule.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModule.java new file mode 100644 index 000000000..a35ba6821 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModule.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.opendaylight.yang.gen.v1.org.openecomp.appc.artifact.handler.provider.impl.rev170321; + +import org.openecomp.appc.artifact.handler.ArtifactHandlerProvider; + +public class ArtifactHandlerProviderModule extends org.opendaylight.yang.gen.v1.org.openecomp.appc.artifact.handler.provider.impl.rev170321.AbstractArtifactHandlerProviderModule { + public ArtifactHandlerProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public ArtifactHandlerProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.appc.artifact.handler.provider.impl.rev170321.ArtifactHandlerProviderModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + final ArtifactHandlerProvider provider = new ArtifactHandlerProvider(getDataBrokerDependency() + , getNotificationServiceDependency() + , getRpcRegistryDependency()); + + return new AutoCloseable() { + + @Override + public void close() throws Exception { + provider.close(); + } + }; + } + + +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModuleFactory.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModuleFactory.java new file mode 100644 index 000000000..171eada9b --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/artifact/handler/provider/impl/rev170321/ArtifactHandlerProviderModuleFactory.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +/* +* Generated file +* +* Generated from: yang module name: artifact-handler-provider-impl yang module local name: artifact-handler-provider-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Wed Aug 09 09:36:59 EDT 2017 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.org.openecomp.appc.artifact.handler.provider.impl.rev170321; +public class ArtifactHandlerProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.appc.artifact.handler.provider.impl.rev170321.AbstractArtifactHandlerProviderModuleFactory { + +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java new file mode 100644 index 000000000..233984f55 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java @@ -0,0 +1,213 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler; + +import java.util.HashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.ArtifactHandlerService; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.UploadartifactInput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.UploadartifactInputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.UploadartifactOutput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.UploadartifactOutputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.uploadartifact.output.ConfigDocumentResponseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.Services; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServicesBuilder; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; +import org.openecomp.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; +import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; + + + +public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerService, DataChangeListener { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerProvider.class); + private final String appName = "ArtifactsHandler"; + private final ExecutorService executor; + protected DataBroker dataBroker; + protected NotificationProviderService notificationService; + protected RpcProviderRegistry rpcRegistry; + private ListenerRegistration<DataChangeListener> dclServices; + + protected BindingAwareBroker.RpcRegistration<ArtifactHandlerService> rpcRegistration; + + public ArtifactHandlerProvider(DataBroker dataBroker2, + NotificationProviderService notificationProviderService, + RpcProviderRegistry rpcProviderRegistry) { + this.log.info("Creating provider for " + appName); + executor = Executors.newFixedThreadPool(10); + dataBroker = dataBroker2; + notificationService = notificationProviderService; + rpcRegistry = rpcProviderRegistry; + initialize(); + + } + + public void initialize() { + log.info("Initializing provider for " + appName); + // Create the top level containers + createContainers(); + try { + ArtifactHandlerProviderUtil.loadProperties(); + } catch (Exception e) { + log.error("Caught Exception while trying to load properties file"); + } + // Listener for changes to Services tree + + rpcRegistration = rpcRegistry.addRpcImplementation( + ArtifactHandlerService.class, this); + + log.info("Initialization complete for " + appName); + } + private void createContainers() { + final WriteTransaction t = dataBroker.newReadWriteTransaction(); + // Create the Services container + t.merge(LogicalDatastoreType.CONFIGURATION,InstanceIdentifier.create(Services.class),new ServicesBuilder().build()); + t.merge(LogicalDatastoreType.OPERATIONAL,InstanceIdentifier.create(Services.class),new ServicesBuilder().build()); + + try { + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); + checkedFuture.get(); + log.info("Create Containers succeeded!: "); + + } catch (InterruptedException | ExecutionException e) { + log.error("Create Containers Failed: " + e); + e.printStackTrace(); + } + } + + + @Override + public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> arg0) { + // TODO Auto-generated method stub + + } + + + + @Override + public void close() throws Exception { + + log.info("Closing provider for " + appName); + if(this.executor != null){ + executor.shutdown(); + } + if(this.rpcRegistration != null){ + rpcRegistration.close(); + } + log.info("Successfully closed provider for " + appName); + + } + + private RpcResult<UploadartifactOutput> buildResponse1( + String svcRequestId, + String topic, + String code, + String message, + String finalInd) { + + UploadartifactOutputBuilder responseBuilder = new UploadartifactOutputBuilder(); + ConfigDocumentResponseBuilder configResponseBuilder=new ConfigDocumentResponseBuilder(); + configResponseBuilder.setRequestId(svcRequestId); + configResponseBuilder.setStatus(code); + configResponseBuilder.setErrorReason(message); + RpcResult<UploadartifactOutput> rpcResult = RpcResultBuilder.<UploadartifactOutput> status(true) + .withResult(responseBuilder.build()).build(); + return rpcResult; + } + + @Override + public Future<RpcResult<UploadartifactOutput>> uploadartifact(UploadartifactInput input) { + + if (input == null || input.getDocumentParameters() == null || input.getDocumentParameters().getArtifactContents() == null ) { + RpcResult<UploadartifactOutput> rpcResult = + buildResponse1("N/A", "N/A", "INVALID_INPUT", "Invalid input, null or empty document information" , "Y"); + return Futures.immediateFuture(rpcResult); + } + UploadartifactInputBuilder inputBuilder = new UploadartifactInputBuilder(input); + ConfigDocumentResponseBuilder configResponseBuilder = new ConfigDocumentResponseBuilder(); + UploadartifactOutputBuilder responseBuilder = new UploadartifactOutputBuilder(); + log.info("Received input = " + input ); + ArtifactHandlerProviderUtil designUtil = new ArtifactHandlerProviderUtil(input); + configResponseBuilder.setRequestId(input.getRequestInformation().getRequestId()); + try{ + + if(input.getRequestInformation().getSource() !=null){ + if(input.getRequestInformation().getSource().equalsIgnoreCase(AsdcArtifactHandlerConstants.DESIGN_TOOL)){ + designUtil.processTemplate(designUtil.createDummyRequestData()); + configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_OK.toString()); + } + else + { + designUtil.processTemplate(designUtil.createRequestData()); + configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_OK.toString()); + } + } + else + { + throw new Exception("No Tempalte data found"); + } + + + } + catch (Exception e) { + + configResponseBuilder.setErrorReason(e.getMessage()); + configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_ERROR.toString()); + log.error("Caught exception looking for Artifact Handler", e); + log.info("Caught exception looking for Artifact Handler: "); + } + + responseBuilder.setConfigDocumentResponse(configResponseBuilder.build()); + RpcResult<UploadartifactOutput> rpcResult = RpcResultBuilder.<UploadartifactOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + + } +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java new file mode 100644 index 000000000..4c8e1358f --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler; + +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; + +import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; +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 AsdcArtifactHandlerActivator implements BundleActivator { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(AsdcArtifactHandlerActivator.class); + private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); + + @Override + public void start(BundleContext ctx) throws Exception { + ArtifactHandlerNode artifactHandlerNode = new ArtifactHandlerNode(); + log.info("Registering service-- " + artifactHandlerNode.getClass().getName()); + registrations.add(ctx.registerService(artifactHandlerNode.getClass().getName(), artifactHandlerNode, null)); + + } + + @Override + public void stop(BundleContext arg0) throws Exception { + for (ServiceRegistration registration : registrations) { + registration.unregister(); + registration = null; + } + } +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java new file mode 100644 index 000000000..4984ebf43 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java @@ -0,0 +1,462 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.dbservices; + +import java.sql.SQLException; +import java.util.HashMap; + +import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +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 DBService { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DBService.class); + private SvcLogicResource serviceLogic; + private static DBService dgGeneralDBService = null; + public static DBService initialise() { + if (dgGeneralDBService == null) { + dgGeneralDBService = new DBService(); + } + return dgGeneralDBService; + } + private DBService() { + if (serviceLogic == null) { + serviceLogic = new SqlResource(); + } + } + + public String getInternalVersionNumber(SvcLogicContext ctx, String artifactName, String prefix) throws SvcLogicException { + String fn = "DBService.getInternalVersionNumber"; + QueryStatus status = null; + String artifactInternalVersion = null; + if (serviceLogic != null && ctx != null) { + String key = "select max(internal_version) as maximum from ASDC_ARTIFACTS WHERE ARTIFACT_NAME = '" + artifactName + "'"; + log.info("Getting internal Versoin :" + key); + status = serviceLogic.query("SQL", false, null, key, prefix, null, ctx); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - getting internal Artifact Number"); + artifactInternalVersion = ctx.getAttribute("maximum"); + log.info("Internal Version received as : " + artifactInternalVersion); + log.info("Internal Version received as1 : " + ctx.getAttribute("max(internal_version)")); + log.info("Internal Version received as1 : " + ctx.getAttribute("max")); + log.info("Internal Version received as1 : " + ctx.getAttribute("internal_version")); + log.info("Internal Version received as1 : " + ctx.getAttributeKeySet().toString()); + } + return artifactInternalVersion; + } + public String getArtifactID(SvcLogicContext ctx, String artifactName) throws SvcLogicException { + String fn = "DBService.getArtifactID"; + QueryStatus status = null; + String artifactID = null; + if (serviceLogic != null && ctx != null) { + String key = "select max(ASDC_ARTIFACTS_ID) as id from ASDC_ARTIFACTS WHERE ARTIFACT_NAME = '" + artifactName + "'"; + log.info("Getting Artifact ID String :" + key); + status = serviceLogic.query("SQL", false, null, key, null, null, ctx); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error - getting Artifact ID from database"); + artifactID = ctx.getAttribute("id"); + log.info("ASDC_ARTIFACTS_ID received as : " + ctx.getAttribute("id")); + } + return artifactID; + } + public QueryStatus saveArtifacts(SvcLogicContext ctx, int intversion) throws SvcLogicException { + String fn = "DBService.saveArtifacts"; + QueryStatus status = null; + if (serviceLogic != null && ctx != null) { + String key = "INSERT INTO ASDC_ARTIFACTS " + + "SET SERVICE_UUID = $service-uuid , " + + " DISTRIBUTION_ID = $distribution-id ," + + " SERVICE_NAME = $service-name ," + + " SERVICE_DESCRIPTION = $service-description ," + + " RESOURCE_UUID = $resource-uuid ," + + " RESOURCE_INSTANCE_NAME = $resource-instance-name ," + + " RESOURCE_NAME = $resource-name ," + + " RESOURCE_VERSION = $resource-version ," + + " RESOURCE_TYPE = $resource-type ," + + " ARTIFACT_UUID = $artifact-uuid ," + + " ARTIFACT_TYPE = $artifact-type ," + + " ARTIFACT_VERSION = $artifact-version ," + + " ARTIFACT_DESCRIPTION = $artifact-description ," + + " INTERNAL_VERSION = " + intversion + "," + + " ARTIFACT_NAME = $artifact-name ," + + " ARTIFACT_CONTENT = $artifact-contents " ; + + status = serviceLogic.save("SQL", false, false, key, null, null, ctx); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing storing Artifact: " +ctx.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + } + return status; + + } + public QueryStatus logData(SvcLogicContext ctx, String prefix) throws SvcLogicException { + String fn = "DBService.saveReferenceData"; + QueryStatus status = null; + if (serviceLogic != null && ctx != null) { + String key = "INSERT INTO CONFIG_TRANSACTION_LOG " + " SET request_id = $request-id , " + + " message_type = $log-message-type , " + + " message = $log-message ;"; + status = serviceLogic.save("SQL", false, false, key, null, prefix, ctx); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error while loging data"); + + } + return status; + } + + public void processConfigureActionDg(SvcLogicContext context, boolean isUpdate) { + String fn = "DBService.processConfigureActionDg"; + log.info("Update Parameter for ASDC Reference " + isUpdate ); + String key = ""; + QueryStatus status = null; + if(isUpdate); + + } + + public void processAsdcReferences(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { + String fn = "DBService.processAsdcReferences"; + String key = ""; + QueryStatus status = null; + + if (isUpdate && AsdcArtifactHandlerConstants.FILE_CATEGORY.equals(AsdcArtifactHandlerConstants.CAPABILITY)) { + key = "update " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + " set ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + + " where VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + " and ACTION = null"; + } + else if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + " set ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + + " where VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION ; + + else { + if (AsdcArtifactHandlerConstants.FILE_CATEGORY.equals(AsdcArtifactHandlerConstants.CAPABILITY)) { + key = "insert into " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + + " set VNFC_TYPE = null " + + " , FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , ACTION = null " + + " , ARTIFACT_TYPE = null " + + " , ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME ; + } + else { + key = "insert into " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + + " set VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " , FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " , ARTIFACT_TYPE = $" + AsdcArtifactHandlerConstants.ARTIFACT_TYPE + + " , ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME ; + } + } + if (serviceLogic != null && context != null) { + log.info("Insert Key: " + key); + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing asdc_reference table "); + } + } + + public boolean isArtifactUpdateRequired(SvcLogicContext context, String db) throws SvcLogicException, SQLException { + String fn = "DBService.isArtifactUpdateRequired"; + log.info("Checking if Update required for this data" ); + + log.info("db" + db); + log.info("ACTION=" + context.getAttribute(AsdcArtifactHandlerConstants.ACTION)); + log.info("VNFC_TYPE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE)); + log.info("VNFC_INSTANCE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); + log.info("VM_INSTANCE=" + context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + log.info("VNF_TYPE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNF_TYPE)); + String whereClause = ""; + + QueryStatus status = null; + /* if(context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && + context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) + whereClause = " where artifact_name = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + + " and vnf_type = 'DummyVnf' "; + else*/ + whereClause = " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE; + + if (db !=null && db.equals(AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE) && + context.getAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY).equals(AsdcArtifactHandlerConstants.CAPABILITY) && + context.getAttribute(AsdcArtifactHandlerConstants.ACTION) ==null) { + whereClause = whereClause + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY ; + } + + else if(db !=null && db.equals(AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)) { + whereClause = whereClause + " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION; + } + + else if(db.equals(AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)) { + whereClause = " where PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL; + } + else if(db.equals(AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)) { + whereClause = whereClause + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION; + } + else if(db.equals(AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE)){ + int vm_instance = -1 ; + if(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE) !=null) + vm_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + int vnfc_instance = -1 ; + if(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) + vnfc_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); + whereClause = whereClause + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " and VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE + + " and VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE ; + + } + if (serviceLogic != null && context != null) { + String key = "select COUNT(*) from " + db + whereClause ; + log.info("SELECT String : " + key); + status = serviceLogic.query("SQL", false, null, key, null, null, context); + if(status.toString().equals("FAILURE")){ + throw new SvcLogicException("Error while reading data from " + db ); + } + String count = context.getAttribute("COUNT(*)"); + log.info("Number of row Returned : " + count + ": " + status + ":"); + if(count !=null && Integer.parseInt(count) > 0){ + context.setAttribute(count, null); + return true; + } + else + return false; + } + return false; + } + + public void processDeviceInterfaceProtocol(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { + String fn = "DBService.processDeviceInterfaceProtocol"; + log.info("Starting DB operation for Device Interface Protocol " + isUpdate ); + String key = ""; + QueryStatus status = null; + if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL + + " set PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL + + " , DG_RPC = 'getDeviceRunningConfig' " + + " , MODULE = 'APPC' " + + " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + else + key = "insert into " + AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL+ + " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL + + " , DG_RPC = 'getDeviceRunningConfig' " + + " , MODULE = 'APPC' " ; + + if (serviceLogic != null && context != null) { + + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing DEVICE_INTERFACE_PROTOCOL table "); + } + + } + + public void processDeviceAuthentication(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { + String fn = "DBService.processDeviceAuthentication"; + log.info(fn + "Starting DB operation for Device Authentication " + isUpdate ); + String key = ""; + QueryStatus status = null; + if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION + + " set USER_NAME = $" + AsdcArtifactHandlerConstants.USER_NAME + + " , PASSWORD = 'dummy' " + + " , PORT_NUMBER = $" + AsdcArtifactHandlerConstants.PORT_NUMBER + + " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + else + key = "insert into " + AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION+ + " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , USER_NAME = $" + AsdcArtifactHandlerConstants.USER_NAME + + " , PASSWORD = 'dummy' " + + " , PORT_NUMBER = $" + AsdcArtifactHandlerConstants.PORT_NUMBER; + + if (serviceLogic != null && context != null) { + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing DEVICE_AUTHENTICATION table "); + } + } + + public void processVnfcReference(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { + String fn = "DBService.processVnfcReference"; + log.info(fn + "Starting DB operation for Vnfc Reference " + isUpdate ); + String key = ""; + int vm_instance = -1 ; + if(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE) !=null) + vm_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + int vnfc_instance = -1 ; + if(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) + vnfc_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); + QueryStatus status = null; + if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE + + " set VM_INSTANCE = " + vm_instance + + " , VNFC_INSTANCE = " + vnfc_instance + + " , VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " , VNFC_FUNCTION_CODE = $" + AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + + " , GROUP_NOTATION_TYPE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + + " , GROUP_NOTATION_VALUE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE + + " , IPADDRESS_V4_OAM_VIP = $" + AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + + " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " and VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE + + " and VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE ; + else + key = "insert into " + AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE+ + " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " , VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE + + " , VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE + + " , VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + + " , VNFC_FUNCTION_CODE = $" + AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + + " , GROUP_NOTATION_TYPE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + + " , IPADDRESS_V4_OAM_VIP = $" + AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + + " , GROUP_NOTATION_VALUE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE ; + + if (serviceLogic != null && context != null) { + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing VNFC_REFERENCE table "); + } + } + + public void processDownloadDgReference(SvcLogicContext context, boolean isUpdate) throws SvcLogicException, SQLException { + String fn = "DBService.processDownloadDgReference"; + log.info(fn + "Starting DB operation for Download DG Reference " + isUpdate ); + String key = ""; + QueryStatus status = null; + + if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE + + " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " where PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL ; + else + key = "insert into " + AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE+ + " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " , PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL ; + + if (serviceLogic != null && context != null) + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing DOWNLOAD_DG_REFERENCE table "); + } + public void processConfigActionDg(SvcLogicContext context, boolean isUpdate) throws SvcLogicException + { + String fn = "DBService.processConfigActionDg"; + log.info(fn + "Starting DB operation for Config DG Action " + isUpdate ); + String key = ""; + QueryStatus status = null; + + if(context.getAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) != null && + context.getAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ + if(isUpdate) + key = "update " + AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG + + " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " where ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " and VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + else + key = "insert into " + AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG+ + " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + + " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + + if (serviceLogic != null && context != null) + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing Configure DG Action table "); + } + else + log.info("No Update required for Config DG Action"); + + } + + public String getModelDataInformationbyArtifactName(String artifact_name) throws SvcLogicException + { + String fn = "DBService.getVnfData"; + String key = ""; + SvcLogicContext con = new SvcLogicContext(); + HashMap<String, String> modelData = new HashMap<String, String>(); + QueryStatus status = null; + key = "select VNF_TYPE, VNFC_TYPE, ACTION, FILE_CATEGORY, ARTIFACT_TYPE from ASDC_REFERENCE where ARTIFACT_NAME = " + artifact_name ; + + if (serviceLogic != null && con != null) { + log.info(fn + "select Key: " + key); + status = serviceLogic.query("SQL", false, null, key, null, null, con); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing is ArtifactUpdateRequiredforPD table "); + + } + + log.info(fn + "Vnf_received :" + con.getAttribute("VNF_TYPE")); + + return con.getAttribute("VNF_TYPE"); + + } + public void updateYangContents(SvcLogicContext context, String artifactId, String yangContents) throws SvcLogicException { + String fn = "DBService.updateYangContents"; + log.info(fn + "Starting DB operation for updateYangContents"); + String key = ""; + QueryStatus status = null; + + key = "update ASDC_ARTIFACTS " + + " set ARTIFACT_CONTENT = '" + yangContents + "'" + + " where ASDC_ARTIFACTS_ID = " + artifactId ; + + if (serviceLogic != null && context != null) + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing Configure DG Action table "); + + } + + + public void insertProtocolReference(SvcLogicContext context, String vnfType, String protocol, String action, String action_level, + String template) throws SvcLogicException { + String fn = "DBService.insertProtocolReference"; + log.info(fn + "Starting DB operation for insertProtocolReference"); + String key = ""; + QueryStatus status = null; + + key = "insert into PROTOCOL_REFERENCE (ACTION, VNF_TYPE, PROTOCOL, UPDATED_DATE, TEMPLATE, ACTION_LEVEL)" + + " values (" + + "'"+action +"', '"+ vnfType+"', '"+protocol+"', now(),'"+template+"', '"+action_level+"')"; + + if (serviceLogic != null && context != null) + status = serviceLogic.save("SQL", false, false, key, null, null, context); + if(status.toString().equals("FAILURE")) + throw new SvcLogicException("Error While processing insertProtocolReference "); + + } +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java new file mode 100644 index 000000000..e4cefad48 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java @@ -0,0 +1,450 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.node; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.appc.artifact.handler.dbservices.DBService; +import org.openecomp.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; +import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +import org.openecomp.appc.yang.YANGGenerator; +import org.openecomp.appc.yang.impl.YANGGeneratorFactory; +import org.openecomp.sdnc.config.params.transformer.tosca.ArtifactProcessorImpl; +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; + + + +public class ArtifactHandlerNode implements SvcLogicJavaPlugin { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerNode.class); + public void processArtifact(Map<String, String> inParams, SvcLogicContext ctx) throws Exception + { + String responsePrefix = inParams.get("response_prefix"); + try{ + if(inParams != null && !inParams.isEmpty() && inParams.get("postData") !=null ){ + log.info("Received request for process Artifact with params: " + inParams.toString()); + String postData = inParams.get("postData"); + JSONObject input = new JSONObject(postData).getJSONObject("input"); + responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; + storeUpdateAsdcArtifacts(input); + } + } + catch(Exception e){ + e.printStackTrace(); + throw e; + } + } + + private boolean storeUpdateAsdcArtifacts(JSONObject postDataJson) throws Exception { + log.info("Starting processing of ASDC Artifacs into Handler with Data : " + postDataJson.toString()); + try{ + JSONObject request_information = (JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.REQUEST_INFORMATION); + JSONObject document_information =(JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS); + String artifact_name = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME); + if(artifact_name !=null){ + updateStoreArtifacts(request_information, document_information ); + if(artifact_name.toLowerCase().startsWith(AsdcArtifactHandlerConstants.REFERENCE)) + return storeReferenceData(request_information, document_information ); + else if (artifact_name.toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) + return createDataForPD(request_information, document_information ); + + } + else + throw new Exception("Missing Artifact Name for Request : " + request_information.getString(AsdcArtifactHandlerConstants.REQUETS_ID)); + } + catch(Exception e){ + e.printStackTrace(); + throw new Exception("Error while processing Request ID : " + ((JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.REQUEST_INFORMATION)).getString(AsdcArtifactHandlerConstants.REQUETS_ID) + e.getMessage()); + } + return false; + + } + private boolean createDataForPD(JSONObject request_information, JSONObject document_information) throws Exception { + + String fn = "ArtifactHandlerNode.createReferenceDataForPD"; + String artifact_name = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME); + log.info(fn + "Received PD File Name: " + artifact_name + " and suffix lenght " + AsdcArtifactHandlerConstants.PD.length()); + try { + + String suffix = artifact_name.substring(AsdcArtifactHandlerConstants.PD.length()); + createArtifactRecords(request_information, document_information, suffix); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("Error while createing PD data records " + e.getMessage()); + } + return true; + } + + private void createArtifactRecords(JSONObject request_information, JSONObject document_information, String suffix) throws Exception { + + log.info("Creating Tosca Records and storing into ASDC Artifacs"); + String [] docs = {"Tosca", "Yang"}; + ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); + String PDFileContents = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS); + + //Tosca generation + OutputStream toscaStream = new ByteArrayOutputStream(); + String toscaContents = null; + ArtifactProcessorImpl toscaGenerator = new ArtifactProcessorImpl(); + toscaGenerator.generateArtifact(PDFileContents,toscaStream); + if(toscaStream != null) + toscaContents = toscaStream.toString(); + log.info("Generated Tosca File : " + toscaContents); + + //Yang generation + //String yangContents = "Dummay Yang, Yang contents will be available after IST Integration"; + + String yangContents = "YANG generation is in Progress"; + String yangName = null; + + for(String doc : docs){ + document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, doc.concat("Type")); + document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, doc.concat("Model")); + if(doc.equals("Tosca")) + document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(toscaContents)); + else if (doc.equals("Yang")) + document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(yangContents)); + document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, doc.concat(suffix)); + yangName = doc.concat(suffix); + updateStoreArtifacts(request_information, document_information); + } + + String artifactId = getArtifactID(yangName); + OutputStream yangStream = new ByteArrayOutputStream(); + YANGGenerator yangGenerator = YANGGeneratorFactory.getYANGGenerator(); + yangGenerator.generateYANG(artifactId , toscaContents, yangStream); + if(yangStream != null) + yangContents = yangStream.toString(); + + if(yangContents !=null ){ + updateYangContents(artifactId, ahpUtil.escapeSql(yangContents)); + } + + } + + private void updateYangContents(String artifactId, String yangContents) throws SvcLogicException { + SvcLogicContext context = new SvcLogicContext(); + DBService dbservice = DBService.initialise(); + dbservice.updateYangContents(context, artifactId, yangContents); + } + + private String getArtifactID(String yangName) throws SvcLogicException { + SvcLogicContext context = new SvcLogicContext(); + DBService dbservice = DBService.initialise(); + return dbservice.getArtifactID(context, yangName); + } + + private boolean updateStoreArtifacts(JSONObject request_information, JSONObject document_information ) throws Exception { + log.info("UpdateStoreArtifactsStarted storing of ASDC Artifacs "); + + SvcLogicContext context = new SvcLogicContext(); + DBService dbservice = DBService.initialise(); + ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); + int intversion = 0; + context.setAttribute("artifact_name",document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + String internal_version = dbservice.getInternalVersionNumber(context, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME), null); + log.info("Internal Version number received from Database : " + internal_version); + if(internal_version != null){ + intversion = Integer.parseInt(internal_version); + intversion++ ; + } + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(AsdcArtifactHandlerConstants.DISTRIBUTION_ID)); + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_NAME)); + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_TYPE)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS,ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS))); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + dbservice.saveArtifacts(context, intversion); + return true; + + } + + public boolean storeReferenceData(JSONObject request_information, JSONObject document_information) throws Exception { + log.info("Started storing of ASDC Artifacs into Handler" ); + try{ + boolean updateRequired = false; + boolean pdFile = false; + String suffix = null; + String categorySuffix = null; + DBService dbservice = DBService.initialise(); + ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); + String contentString = ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS)) ; + String artifactName=ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + String capabilityArtifactName=StringUtils.replace(artifactName,AsdcArtifactHandlerConstants.ARTIFACT_NAME_REFERENCE,AsdcArtifactHandlerConstants.ARTIFACT_NAME_CAPABILITY); + JSONObject capabilities = new JSONObject(); + JSONArray vnfActionList = new JSONArray(); + JSONArray vfModuleActionList = new JSONArray(); + JSONArray vnfcActionList = new JSONArray(); + JSONArray vmActionList = new JSONArray(); + String vnfType=null; + JSONObject contentObject = new JSONObject(contentString); + JSONArray contentArray= contentObject.getJSONArray("reference_data"); + for(int a=0; a<contentArray.length() ; a++){ + + JSONObject content = (JSONObject) contentArray.get(a); + log.info("contentString =" + content.toString()); + JSONObject scope = content.getJSONObject("scope"); + log.info("scope :" + scope); + SvcLogicContext context = new SvcLogicContext(); + vnfType=scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE); + context.setAttribute(AsdcArtifactHandlerConstants.VNF_TYPE, scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE)); + context.setAttribute(AsdcArtifactHandlerConstants.ACTION, content.getString(AsdcArtifactHandlerConstants.ACTION)); + String actionLevel=content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL); + context.setAttribute(AsdcArtifactHandlerConstants.ACTION_LEVEL, content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL)); + if ((null != actionLevel) && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VNFC)) { + vnfcActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + } + if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VF_MODULE)) { + vfModuleActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + } + if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VNF)) { + vnfActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + } + if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VM)) { + vmActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + } + if(scope.has(AsdcArtifactHandlerConstants.VNFC_TYPE) && !scope.isNull(AsdcArtifactHandlerConstants.VNFC_TYPE) ) + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, scope.getString(AsdcArtifactHandlerConstants.VNFC_TYPE)); + else + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE,null); + if (content.has(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)) + context.setAttribute(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL, content.getString(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)); + if (content.has(AsdcArtifactHandlerConstants.USER_NAME)) + context.setAttribute(AsdcArtifactHandlerConstants.USER_NAME, content.getString(AsdcArtifactHandlerConstants.USER_NAME)); + if (content.has(AsdcArtifactHandlerConstants.PORT_NUMBER)) + context.setAttribute(AsdcArtifactHandlerConstants.PORT_NUMBER, content.getString(AsdcArtifactHandlerConstants.PORT_NUMBER)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, ""); + if(content.has("artifact-list") && content.get("artifact-list") instanceof JSONArray){ + JSONArray artifactLists = (JSONArray)content.get("artifact-list"); + for(int i=0;i<artifactLists.length();i++){ + JSONObject artifact=(JSONObject)artifactLists.get(i); + log.info("artifact is " + artifact); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE)); + + if(artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && + artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) + { + suffix = artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME).substring(AsdcArtifactHandlerConstants.PD.length()); + categorySuffix = artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE).substring(AsdcArtifactHandlerConstants.PD.length()); + pdFile = true; + } + + dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + + cleanArtifactInstanceData(context); + } + + if(pdFile) + { + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, "Tosca".concat(suffix)); + context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.TOSCA_MODEL); + dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, "Yang".concat(suffix)); + context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.PARAMETER_YANG); + dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + } + } + if (content.getString(AsdcArtifactHandlerConstants.ACTION).equals("Configure")) { + if(content.has(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) && content.getString(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ + context.setAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE, content.getString(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE)); + dbservice.processDownloadDgReference(context, dbservice.isArtifactUpdateRequired(context,AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)); + } + + dbservice.processConfigActionDg(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)); + dbservice.processDeviceInterfaceProtocol(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL)); + dbservice.processDeviceAuthentication(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION)); + + } + + + populateProtocolReference(dbservice, content); + + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); + + if( content.has(AsdcArtifactHandlerConstants.VM) && content.get(AsdcArtifactHandlerConstants.VM) instanceof JSONArray){ + JSONArray vmList = (JSONArray)content.get(AsdcArtifactHandlerConstants.VM); + for(int i=0;i<vmList.length();i++){ + JSONObject vmInstance=(JSONObject)vmList.get(i); + context.setAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE, String.valueOf(vmInstance.getInt(AsdcArtifactHandlerConstants.VM_INSTANCE))); + log.info("VALUE = " + context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + if(vmInstance.get(AsdcArtifactHandlerConstants.VNFC) instanceof JSONArray){ + JSONArray vnfcInstanceList = (JSONArray)vmInstance.get(AsdcArtifactHandlerConstants.VNFC); + for(int k=0;k<vnfcInstanceList.length();k++){ + JSONObject vnfcInstance = (JSONObject)vnfcInstanceList.get(k); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE, String.valueOf(vnfcInstance.getInt(AsdcArtifactHandlerConstants.VNFC_INSTANCE))); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, vnfcInstance.getString(AsdcArtifactHandlerConstants.VNFC_TYPE)); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, vnfcInstance.getString(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE)); + if(vnfcInstance.has(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)) + context.setAttribute(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, vnfcInstance.getString(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)); + if(vnfcInstance.has(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)) + context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, vnfcInstance.getString(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)); + if(vnfcInstance.has(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE)) + context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE, vnfcInstance.getString(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE)); + dbservice.processVnfcReference(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE)); + cleanVnfcInstance(context); + } + context.setAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE,null); + } + } + } + + + } + capabilities.put("vnf",vnfActionList ); + capabilities.put("vf-module", vfModuleActionList); + capabilities.put("vnfc", vnfcActionList); + capabilities.put("vm", vmActionList); + processAndStoreCapablitiesArtifact(dbservice, document_information, capabilities,capabilityArtifactName,vnfType ); + + } + catch(Exception e) + { + e.printStackTrace(); + throw new Exception("Error While Storing : " + e.getMessage()); + } + + return true; + } + + + + + + private void cleanArtifactInstanceData(SvcLogicContext context) + { + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, null); + context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, null); + } + + private void cleanVnfcInstance(SvcLogicContext context) { + + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE, null); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, null); + context.setAttribute(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, null); + context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, null); + context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE, null); + + } + + private void processAndStoreCapablitiesArtifact (DBService dbservice , JSONObject document_information, + JSONObject capabilities, String capabilityArtifactName, String vnfType) throws Exception { + log.info("Begin-->processAndStoreCapablitiesArtifact "); + + try { + + JSONObject newCapabilitiesObject=new JSONObject(); + newCapabilitiesObject.put("capabilities", capabilities); + SvcLogicContext context = new SvcLogicContext(); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME,capabilityArtifactName); + context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.CAPABILITY); + context.setAttribute(AsdcArtifactHandlerConstants.ACTION, null); + context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, null); + context.setAttribute(AsdcArtifactHandlerConstants.VNF_TYPE,vnfType); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS,newCapabilitiesObject.toString()); + dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + int intversion = 0; + + String internal_version = dbservice.getInternalVersionNumber(context, context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME), null); + log.info("Internal Version number received from Database : " + internal_version); + if(internal_version != null){ + intversion = Integer.parseInt(internal_version); + intversion++ ; + } + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(AsdcArtifactHandlerConstants.DISTRIBUTION_ID)); + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_NAME)); + context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN)); + context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_TYPE)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_UUID)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); + context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); + + + dbservice.saveArtifacts(context, intversion); + return ; + } + catch (Exception e) { + log.error("Error saving capabilities artifact to DB: "+ e.toString()); + throw e; + } + finally { + log.info("End-->processAndStoreCapablitiesArtifact "); + } + + } + + + private void populateProtocolReference(DBService dbservice, JSONObject content) throws Exception{ + log.info("Begin-->populateProtocolReference "); + try { + SvcLogicContext context = new SvcLogicContext(); + JSONObject scope = content.getJSONObject("scope"); + String vnfType=null,protocol=null,action=null,actionLevel=null,template=null; + if(scope.has(AsdcArtifactHandlerConstants.VNF_TYPE) && !scope.isNull(AsdcArtifactHandlerConstants.VNF_TYPE)) + vnfType=scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE); + if (content.has(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)) + protocol=content.getString(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL); + if (content.has(AsdcArtifactHandlerConstants.ACTION)) + action= content.getString(AsdcArtifactHandlerConstants.ACTION); + if (content.has(AsdcArtifactHandlerConstants.ACTION_LEVEL)) + actionLevel=content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL); + if (content.has(AsdcArtifactHandlerConstants.TEMPLATE) && !content.isNull(AsdcArtifactHandlerConstants.TEMPLATE)) + template=content.getString(AsdcArtifactHandlerConstants.TEMPLATE); + dbservice.insertProtocolReference(context, vnfType,protocol,action,actionLevel,template); + } + catch (Exception e) { + log.error("Error inserting record into protocolReference: "+e.toString()); + throw e; + } + finally { + log.info("End-->populateProtocolReference "); + } + } + + } diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java new file mode 100644 index 000000000..91b6e88b0 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java @@ -0,0 +1,184 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.utils; + +import java.io.IOException; +import java.security.SecureRandom; +import java.util.HashMap; + +import org.apache.commons.lang3.StringUtils; +import org.json.JSONException; +import org.json.JSONObject; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.artifacthandler.rev170321.UploadartifactInput; +import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; +import org.openecomp.sdnc.sli.SvcLogicContext; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class ArtifactHandlerProviderUtil { + + public UploadartifactInput templateData ; + SvcLogicContext context = null; + private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerProviderUtil.class); + public static void loadProperties() { + // TODO Auto-generated method stub + + } + public enum DistributionStatusEnum { + DOWNLOAD_OK, + DOWNLOAD_ERROR, + ALREADY_DOWNLOADED, + DEPLOY_OK, + DEPLOY_ERROR, + ALREADY_DEPLOYED; + } + + public ArtifactHandlerProviderUtil(){}; + + public ArtifactHandlerProviderUtil(UploadartifactInput input) { + this.templateData = input; + log.info("templateData " + this.templateData); + } + + public void processTemplate(String requestInfo) throws Exception { + if(context == null) + context = new SvcLogicContext(); + + ArtifactHandlerNode node = new ArtifactHandlerNode(); + try { + + HashMap<String, String> processdata = new HashMap<String, String>(); + processdata.put("postData", requestInfo); + log.info("Post data = " + requestInfo); + node.processArtifact(processdata, context); + } catch (Exception e) { + // TODO Auto-generated catch block + log.error("Error: " + e.getMessage()); + e.printStackTrace(); + throw e; + } + + } + public String createDummyRequestData() throws JSONException, IOException{ + + + JSONObject info = new JSONObject(this.templateData); + log.info("INFO = " + info); + String artifact_name = templateData.getDocumentParameters().getArtifactName(); + String artifact_version = templateData.getDocumentParameters().getArtifactVersion(); + + JSONObject json = new JSONObject(); + JSONObject requestInfo = new JSONObject(); + String random = getRandom(); + + requestInfo.put(AsdcArtifactHandlerConstants.REQUETS_ID, "TLRID-" + random); + requestInfo.put(AsdcArtifactHandlerConstants.REQUEST_ACTION, "StoreAsdcDocumentRequest"); + requestInfo.put(AsdcArtifactHandlerConstants.SOURCE, "TemplateLoader"); + + JSONObject docParams = new JSONObject(); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_UUID, "TLSUUID" + templateData.getRequestInformation().getRequestId()); + docParams.put(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, "TLDID" + random); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_NAME, "TLServiceName"); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "Template Loader Test"); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_ARTIFACTS, "[]"); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_UUID, "TLRUID" + random); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "TLRIName"); + docParams.put(AsdcArtifactHandlerConstants.REOURCE_NAME, "TLResourceName"); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, "TLResourceVersion"); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_TYPE, "TLResourceType"); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_UUID, "TLAUUID" + random); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, "APPC-CONFIG"); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, "AsdcTestDescription"); + // String data = IOUtils.toString(TestartifactHandlerNode.class.getClassLoader().getResourceAsStream("template_msrp_msc_a_template.json"), "utf-8"); + // String data = IOUtils.toString(TemplateProcessor.class.getClassLoader().getResourceAsStream("referenceData.json"), "utf-8"); + + // this.templateData = this.templateData.substring(this.templateData.indexOf("}") + 1); + docParams.put("artifact-contents", templateData.getDocumentParameters().getArtifactContents()); + + json.put(AsdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); + json.put(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); + System.out.println("Final data =" + this.templateData); + return String.format("{\"input\": %s}", json.toString()); + } + + private String getRandom() { + SecureRandom random = new SecureRandom(); + int num = random.nextInt(100000); + String formatted = String.format("%05d", num); + return formatted; + } + + public String escapeSql(String str) { + if (str == null) { + return null; + } + String searchList[] = new String[]{"'","\\"}; + String replacementList[] = new String[]{ "''","\\\\"}; + return StringUtils.replaceEach(str,searchList, replacementList); + } + public String createRequestData() throws JSONException, IOException{ + + + JSONObject info = new JSONObject(this.templateData); + log.info("INFO = " + info); + + JSONObject json = new JSONObject(); + JSONObject requestInfo = new JSONObject(); + String random = getRandom(); + + requestInfo.put(AsdcArtifactHandlerConstants.REQUETS_ID, templateData.getRequestInformation().getRequestId()); + requestInfo.put(AsdcArtifactHandlerConstants.REQUEST_ACTION, "StoreAsdcDocumentRequest"); + requestInfo.put(AsdcArtifactHandlerConstants.SOURCE, templateData.getRequestInformation().getSource()); + + JSONObject docParams = new JSONObject(); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_UUID, templateData.getDocumentParameters().getResourceUuid()); + docParams.put(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, templateData.getDocumentParameters().getDistributionId()); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_NAME, templateData.getDocumentParameters().getServiceName()); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, templateData.getDocumentParameters().getServiceDescription()); + docParams.put(AsdcArtifactHandlerConstants.SERVICE_ARTIFACTS, templateData.getDocumentParameters().getServiceArtifacts()); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_UUID, templateData.getDocumentParameters().getResourceUuid()); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, templateData.getDocumentParameters().getResourceInstanceName()); + docParams.put(AsdcArtifactHandlerConstants.REOURCE_NAME, templateData.getDocumentParameters().getResourceName()); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, templateData.getDocumentParameters().getResourceVersion()); + docParams.put(AsdcArtifactHandlerConstants.RESOURCE_TYPE, templateData.getDocumentParameters().getResourceType()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_UUID, templateData.getDocumentParameters().getArtifactUuid()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, templateData.getDocumentParameters().getArtifactType()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); + docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, templateData.getDocumentParameters().getArtifactDescription()); + + docParams.put("artifact-contents", templateData.getDocumentParameters().getArtifactContents()); + + json.put(AsdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); + json.put(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); + System.out.println("Final data =" + this.templateData); + return String.format("{\"input\": %s}", json.toString()); + } + + +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java new file mode 100644 index 000000000..cfcb250ee --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.utils; + +public class AsdcArtifactHandlerConstants { + + public static final String DOCUMENT_PARAMETERS = "document-parameters"; + public static final String SERVICE_UUID = "service-uuid"; + public static final String DISTRIBUTION_ID = "distribution-id"; + public static final String REQUETS_ID = "request-id"; + public static final String REQUEST_ACTION = "request-action"; + public static final String SOURCE = "source"; + public static final String SERVICE_NAME = "service-name"; + public static final String SERVICE_DESCRIPTION ="service-description"; + public static final String SERVICE_ARTIFACTS = "service-artifacts"; + public static final String RESOURCE_UUID ="resource-uuid"; + public static final String RESOURCE_INSTANCE_NAME = "resource-instance-name"; + public static final String REOURCE_NAME = "resource-name"; + public static final String RESOURCE_VERSOIN ="resource-version"; + public static final String RESOURCE_TYPE= "resource-type"; + public static final String ARTIFACT_UUID ="artifact-uuid"; + public static final String ARTIFACT_NAME = "artifact-name"; + public static final String ARTIFACT_TYPE = "artifact-type"; + public static final String ARTIFACT_VERSOIN = "artifact-version"; + public static final String ARTIFACT_DESRIPTION = "artifact-description"; + public static final String ARTIFACT_CONTENTS = "artifact-contents"; + public static final String REQUEST_INFORMATION = "request-information"; + public static final String INTERNAL_VERSION = "internal-versoin"; + public static final String FILE_CATEGORY = "file-category"; + public static final String VNF_TYPE = "vnf-type"; + public static final String ACTION = "action"; + public static final String ACTION_LEVEL = "action-level"; + 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 VNFC_FUNCTION_CODE = "vnfc-function-code"; + public static final String GROUP_NOTATION = "group-notation"; + public static final String IPADDRESS_V4_OAM_VIP = "ipaddress-v4-oam-vip"; + public static final String GROUP_NOTATION_TYPE = "group-notation-type"; + public static final String GROUP_NOTATION_VALUE = "group-notation-value"; + 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 DB_DOWNLOAD_DG_REFERENCE = "DOWNLOAD_DG_REFERENCE"; + public static final String DB_ASDC_REFERENCE = "ASDC_REFERENCE"; + public static final String DB_DEVICE_INTERFACE_PROTOCOL = "DEVICE_INTERFACE_PROTOCOL"; + public static final String DB_DEVICE_AUTHENTICATION = "DEVICE_AUTHENTICATION"; + public static final String DB_VNFC_REFERENCE = "VNFC_REFERENCE"; + public static final String DB_CONFIG_ACTION_DG = "CONFIGURE_ACTION_DG"; + public static final String PD = "pd"; + public static final String PARAMETER_YANG = "parameter_yang"; + public static final String TOSCA_MODEL = "tosca_model"; + public static final String DESIGN_TOOL = "Design-tool"; + public static final String ACTION_LEVEL_VNFC = "VNFC"; + public static final String ACTION_LEVEL_VF_MODULE ="VF-MODULE"; + public static final String ACTION_LEVEL_VNF = "VNF"; + public static final String ACTION_LEVEL_VM = "VM"; + public static final String CAPABILITY = "capability"; + public static final String TEMPLATE = "template"; + public static final String ARTIFACT_NAME_REFERENCE = "reference"; + public static final String ARTIFACT_NAME_CAPABILITY = "capability"; +} + diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/EscapeUtils.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/EscapeUtils.java new file mode 100644 index 000000000..a5a338198 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/EscapeUtils.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.utils; + +import org.apache.commons.lang3.StringUtils; + +public class EscapeUtils { + + public EscapeUtils() { + // TODO Auto-generated constructor stub + } + + 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-inbound/appc-artifact-handler/provider/src/main/resources/initial/artifact-handler-provider.xml b/appc-inbound/appc-artifact-handler/provider/src/main/resources/initial/artifact-handler-provider.xml new file mode 100644 index 000000000..658cb3fd6 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/resources/initial/artifact-handler-provider.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- vi: set et smarttab sw=4 tabstop=4: --> +<snapshot> + <configuration> + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <module> + + <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file + The prefix: inside type should match the prefix of the yang file. --> + <type xmlns:prefix="org:openecomp:appc:artifact:handler:provider:impl"> + prefix:artifact-handler-provider-impl + </type> + <name>artifact-handler-provider-impl</name> + + <!-- The following sections contain bindings to services defined in the + *-provider-impl yang file. For example the rpc-registry is required + because we have a dependency (or augmentation) named "rpc-registry" + and which binds to the md-sa-binding-registry. If you remove those + dependencies from the yang file then you can remove them from here. --> + <rpc-registry> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type> + <name>binding-rpc-broker</name> + </rpc-registry> + + <data-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>binding-data-broker</name> + </data-broker> + + <notification-service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding"> + binding:binding-notification-service + </type> + <name>binding-notification-broker</name> + </notification-service> + </module> + + </modules> + </data> + + </configuration> + + <!-- Required capabilities are basically a listing of all modules that need to be imported before + our service can be resolved. Capabilities for dependencies defined above are implied which is + why we do not have define a required capability for the data broker, for example. --> + <required-capabilities> + <capability>org:openecomp:appc:artifact:handler:provider:impl?module=artifact-handler-provider-impl&revision=2017-03-21</capability> + </required-capabilities> + +</snapshot> diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/yang/artifact-handler-provider-impl.yang b/appc-inbound/appc-artifact-handler/provider/src/main/yang/artifact-handler-provider-impl.yang new file mode 100644 index 000000000..01eeb3919 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/yang/artifact-handler-provider-impl.yang @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +module artifact-handler-provider-impl { + + yang-version 1; + namespace "org:openecomp:appc:artifact:handler:provider:impl"; + prefix "artifact-handler-provider-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } + + description + "This module contains the base YANG definitions for + artifact-handler-provider impl implementation."; + + revision "2017-03-21" { + description + "Initial revision."; + } + + // This is the definition of the service implementation as a module identity. + identity artifact-handler-provider-impl { + base config:module-type; + + // Specifies the prefix for generated java classes. + config:java-name-prefix ArtifactHandlerProvider; + } + + // Augments the 'configuration' choice node under modules/module. + // We consume the three main services, RPCs, DataStore, and Notifications + augment "/config:modules/config:module/config:configuration" { + case artifact-handler-provider-impl { + when "/config:modules/config:module/config:type = 'artifact-handler-provider-impl'"; + + container rpc-registry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-rpc-registry; + } + } + } + + container notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-notification-service; + } + } + } + + container data-broker { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity mdsal:binding-async-data-broker; + } + } + } + } + } +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/openecomp/appc/artifact/handler/node/TestArtifactHandlerNode.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/openecomp/appc/artifact/handler/node/TestArtifactHandlerNode.java new file mode 100644 index 000000000..6687c790b --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/openecomp/appc/artifact/handler/node/TestArtifactHandlerNode.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler.node; + +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.Enumeration; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.json.JSONObject; + +public class TestArtifactHandlerNode { + + //Onap Migration +} diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/resources/svclogic.properties b/appc-inbound/appc-artifact-handler/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..ae595f73b --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/resources/svclogic.properties @@ -0,0 +1,37 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============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-inbound/appc-artifact-handler/provider/src/test/resources/templates/general_template b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/general_template new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/general_template diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/pd_template b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/pd_template new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/pd_template diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/reference_template b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/reference_template new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/reference_template diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/template_Asdc b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/template_Asdc new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/test/resources/templates/template_Asdc diff --git a/appc-inbound/appc-design-services/.gitignore b/appc-inbound/appc-design-services/.gitignore new file mode 100755 index 000000000..b18c07c65 --- /dev/null +++ b/appc-inbound/appc-design-services/.gitignore @@ -0,0 +1,23 @@ +# Target dirs in all projects
+**/target/*
+
+# Generated models and features
+**/bin/*
+
+# MANIFEST.MF is updated on every clean install
+**/src/main/resources/META-INF/
+**/src/main/yang-gen-sal
+**/src/main/yang-gen-config
+
+
+.project
+
+*.prefs
+.classpath
+**/.classpath
+/target/
+logs/
+debug-logs/
+/.settings/
+**/*.iml
+/.idea/
diff --git a/appc-inbound/appc-design-services/features/.gitignore b/appc-inbound/appc-design-services/features/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-design-services/features/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-design-services/features/pom.xml b/appc-inbound/appc-design-services/features/pom.xml new file mode 100755 index 000000000..e1e2375d5 --- /dev/null +++ b/appc-inbound/appc-design-services/features/pom.xml @@ -0,0 +1,85 @@ +<?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> + <artifactId>appc-design-services</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-design-services-features</artifactId> + + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-model</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-provider</artifactId> + </dependency> + + <!-- dependency for opendaylight-karaf-empty for use by testing --> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>opendaylight-karaf-empty</artifactId> + <type>zip</type> + </dependency> + + <dependency> + <!-- Required for launching the feature tests--> + <groupId>org.opendaylight.odlparent</groupId> + <artifactId>features-test</artifactId> + <scope>test</scope> + <version>${odl.commons.opendaylight.version}</version> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>filter</id> + <goals> + <goal>resources</goal> + </goals> + <phase>generate-resources</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/${features.file}</file> + <type>xml</type> + <classifier>features</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/appc-inbound/appc-design-services/features/src/main/resources/features.xml b/appc-inbound/appc-design-services/features/src/main/resources/features.xml new file mode 100644 index 000000000..d3cf5d20a --- /dev/null +++ b/appc-inbound/appc-design-services/features/src/main/resources/features.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + + +<features name="appc-design-services-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> + + <repository>mvn:org.opendaylight.yangtools/features-yangtools/${odl.yangtools.version}/xml/features</repository> + <repository>mvn:org.opendaylight.controller/features-mdsal/${odl.controller.mdsal.version}/xml/features</repository> + <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/${mdsal.model.version}/xml/features</repository> + <repository>mvn:org.opendaylight.netconf/features-restconf/${odl.controller.mdsal.version}/xml/features</repository> + + <feature name='appc-design-services' description="Application Controller LCM API Bypass" + version='${project.version}'> + + <feature version='${mdsal.model.version}'>odl-mdsal-models</feature> + <bundle>mvn:org.openecomp.appc/appc-design-services-model/${project.version}</bundle> + + <!-- Most applications will have a dependency on the ODL MD-SAL Broker --> + <feature version='${broker-mdsal.version}'>odl-mdsal-broker</feature> + <feature version='${sdnctl.sli.version}'>sdnc-sli</feature> + <bundle>mvn:org.openecomp.appc/appc-design-services.provider/${project.version}</bundle> + <bundle>wrap:mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.3.0</bundle> + + <feature version='${broker-mdsal.version}'>odl-restconf</feature> + + </feature> + +</features> diff --git a/appc-inbound/appc-design-services/installer/.gitignore b/appc-inbound/appc-design-services/installer/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-design-services/installer/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-design-services/installer/pom.xml b/appc-inbound/appc-design-services/installer/pom.xml new file mode 100755 index 000000000..d0595f1fe --- /dev/null +++ b/appc-inbound/appc-design-services/installer/pom.xml @@ -0,0 +1,134 @@ +<?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> + <artifactId>appc-design-services</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-design-services-installer</artifactId> + <name>appc-design-services-installer</name> + <packaging>pom</packaging> + + <properties> + <application.name>appc-design-services</application.name> + <features.boot>appc-design-services</features.boot> + <features.repositories>mvn:org.openecomp.appc/appc-design-services-features/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-features</artifactId> + <version>${project.version}</version> + <classifier>features</classifier> + <type>xml</type> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-provider</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>false</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <appendAssemblyId>false</appendAssemblyId> + <attach>true</attach> + <finalName>${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <excludeGroupIds>org.opendaylight</excludeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals> + <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/appc-inbound/appc-design-services/installer/resources/scripts/install-feature.sh b/appc-inbound/appc-design-services/installer/resources/scripts/install-feature.sh new file mode 100755 index 000000000..c5a39bf9a --- /dev/null +++ b/appc-inbound/appc-design-services/installer/resources/scripts/install-feature.sh @@ -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========================================================= +### + +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -n -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/appc-inbound/appc-design-services/installer/src/assembly/assemble_installer_zip.xml b/appc-inbound/appc-design-services/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..e54eede04 --- /dev/null +++ b/appc-inbound/appc-design-services/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,62 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/appc-inbound/appc-design-services/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-inbound/appc-design-services/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..fc99e918e --- /dev/null +++ b/appc-inbound/appc-design-services/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,50 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>controller</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/appc-inbound/appc-design-services/installer/src/main/resources/scripts/install-feature.sh b/appc-inbound/appc-design-services/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..05b4ae373 --- /dev/null +++ b/appc-inbound/appc-design-services/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,43 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -n -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/appc-inbound/appc-design-services/model/.gitignore b/appc-inbound/appc-design-services/model/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-design-services/model/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-design-services/model/pom.xml b/appc-inbound/appc-design-services/model/pom.xml new file mode 100755 index 000000000..ef7b83e55 --- /dev/null +++ b/appc-inbound/appc-design-services/model/pom.xml @@ -0,0 +1,155 @@ +<?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> + <artifactId>appc-design-services</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-design-services-model</artifactId> + <packaging>bundle</packaging> + + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <configuration> + <executable>python</executable> + <arguments> + <argument>scripts/python/yang2props.py</argument> + <argument>src/main/yang/appc-design-services.yang</argument> + <argument>target/appc-design-services.properties</argument> + </arguments> + </configuration> + <id>generation</id> + <phase>generate-resources</phase> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/appc-design-services.properties</file> + <type>properties</type> + <classifier>appc-design-services</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </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> + org.codehaus.mojo + </groupId> + <artifactId> + exec-maven-plugin + </artifactId> + <versionRange> + [1.2.1,) + </versionRange> + <goals> + <goal>exec</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + </dependency> + </dependencies> +</project> diff --git a/appc-inbound/appc-design-services/model/scripts/python/yang2props.py b/appc-inbound/appc-design-services/model/scripts/python/yang2props.py new file mode 100755 index 000000000..559d31b8b --- /dev/null +++ b/appc-inbound/appc-design-services/model/scripts/python/yang2props.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import re +import sys + + +# Convert word from foo-bar to FooBar +# words begining with a digit will be converted to _digit +def to_enum(s): + if s[0].isdigit(): + s = "_" + s + else: + s = s[0].upper() + s[1:] + return re.sub(r'(?!^)-([a-zA-Z])', lambda m: m.group(1).upper(), s) + +leaf = "" +val = "" +li = [] + +if len(sys.argv) < 3: + print 'yang2props.py <input yang> <output properties>' + sys.exit(2) + +with open(sys.argv[1], "r") as ins: + for line in ins: + # if we see a leaf save the name for later + if "leaf " in line: + match = re.search(r'leaf (\S+)', line) + if match: + leaf = match.group(1) + + # if we see enum convert the value to enum format and see if it changed + # if the value is different write a property entry + if "enum " in line: + match = re.search(r'enum "(\S+)";', line) + if match: + val = match.group(1) + enum = to_enum(val) + + # see if converting to enum changed the string + if val != enum: + property = "yang."+leaf+"."+enum+"="+val + if property not in li: + li.append( property) + + +# Open output file +fo = open(sys.argv[2], "wb") +fo.write("# yang conversion properties \n") +fo.write("# used to convert Enum back to the original yang value \n") +fo.write("\n".join(li)) +fo.write("\n") + +# Close opend file +fo.close() + + diff --git a/appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang b/appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang new file mode 100644 index 000000000..b43ce0fad --- /dev/null +++ b/appc-inbound/appc-design-services/model/src/main/yang/appc-design-services.yang @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +/* + * Yang model for the Application Controller (APP-C) component of ECOMP + * + * + *The main purpose of this model to provide an interface bewteen APPC Runtime and APPC design time environment + * to communicate. + * + * + * + * +*/ + +module design-services { + + yang-version 1; + namespace "org:openecomp:appc"; + prefix design-services; + organization "AT&T. Copyright (C) 2015. All rights reserved."; + + description + "Defines the services and request/response requirements for the APP-C Design and RunTime."; + + /* + * Note, the revision changes the package name of the generated java code. Do not + * change the revision unless you also update all references to the bindings. + */ + revision "2017-06-27" { + description + "APP-C Design interface version 1.1.0"; + } + + grouping design-request { + container design-request { + leaf request-id { + type string; + description "The request ID "; + mandatory true; + } + leaf action { + type string; + description "The Action Name"; + mandatory true; + } + leaf payload { + type string; + description "The Payload"; + } + leaf data-type { + description "Data type for validation"; + type string; + + } + } + } + + + grouping data { + description "The Generic Data response which includes data from run Time for Design time environment"; + container data { + description "The Data from run Time for Design time environment"; + leaf block { + description "Response message"; + type string; + } + leaf requestId { + description "Response message reqesut ID"; + type string; + mandatory true; + } + } + + } + grouping status { + description "The specific response codes are to be aligned with APPC/ECOMP messaging Systems"; + container status { + description "The specific response codes are to be aligned with ASDC reference doc (main table removed to avoid duplication and digression from main table). See ASDC and ECOMP Distribution Consumer Interface Agreement"; + leaf code { + description "Response code"; + type string; + mandatory true; + } + leaf message { + description "Response message"; + type string; + } + } + } + + rpc dbservice { + description "Runs a given task if it exists."; + input { + uses design-request; + } + output { + uses data ; + uses status; + } + } + rpc validator { + description "Runs a given task if it exists."; + + input { + uses design-request; + } + output { + uses status; + } + } + rpc xinterfaceservice { + description "Runs a given task if it exists."; + input { + uses design-request; + } + output { + uses data ; + uses status; + + } + } +} diff --git a/appc-inbound/appc-design-services/pom.xml b/appc-inbound/appc-design-services/pom.xml new file mode 100755 index 000000000..268a97845 --- /dev/null +++ b/appc-inbound/appc-design-services/pom.xml @@ -0,0 +1,53 @@ +<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-inbound</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <packaging>pom</packaging> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services</artifactId> + + <dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-features</artifactId> + <classifier>features</classifier> + <type>xml</type> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-provider</artifactId> + <version>${project.version}</version> + <classifier>config</classifier> + <type>xml</type> + </dependency> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + + <modules> + <module>model</module> + <module>features</module> + <module>provider</module> + <module>installer</module> + </modules> +</project> diff --git a/appc-inbound/appc-design-services/provider/.gitignore b/appc-inbound/appc-design-services/provider/.gitignore new file mode 100755 index 000000000..b83d22266 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-inbound/appc-design-services/provider/pom.xml b/appc-inbound/appc-design-services/provider/pom.xml new file mode 100755 index 000000000..52878d833 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/pom.xml @@ -0,0 +1,128 @@ +<?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> + <artifactId>appc-design-services</artifactId> + <groupId>org.openecomp.appc</groupId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>appc-design-services-provider</artifactId> + <packaging>bundle</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package>org.openecomp.appc.design.services</Export-Package> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-design-services-model</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>config-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-config</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + </dependency> + <dependency> + <artifactId>sal-test-model</artifactId> + <groupId>org.opendaylight.controller</groupId> + <scope>test</scope> + </dependency> + <dependency> + <artifactId>sal-rest-connector</artifactId> + <groupId>org.opendaylight.netconf</groupId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.adaptors</groupId> + <artifactId>sql-resource-provider</artifactId> + <version>${openecomp.sdnc.sql-resource.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.17</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.openecomp.sdnc.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + <version>2.3.0</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + </dependencies> +</project> diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/ArtifactInfo.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/ArtifactInfo.java new file mode 100644 index 000000000..41c02eac9 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/ArtifactInfo.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ArtifactInfo { + + @JsonProperty("artifact-content") + String artifact_content; + + public String getArtifact_content() { + return artifact_content; + } + + public void setArtifact_content(String artifact_content) { + this.artifact_content = artifact_content; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignInfo.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignInfo.java new file mode 100644 index 000000000..96e429f02 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignInfo.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class DesignInfo{ + + @JsonProperty("vnf-type") + String vnf_type; + + @JsonProperty("vnfc-type") + String vnfc_type; + + @JsonProperty("protocol") + String protocol; + + @JsonProperty("incart") + String inCart; + + @JsonProperty("action") + String action; + + @JsonProperty("artifact-name") + String artifact_name; + + + @JsonProperty("artifact-type") + String artifact_type; + + public String getArtifact_type() { + return artifact_type; + } + + public void setArtifact_type(String artifact_type) { + this.artifact_type = artifact_type; + } + + public String getArtifact_name() { + return artifact_name; + } + + public void setArtifact_name(String artifact_name) { + this.artifact_name = artifact_name; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getVnf_type() { + return vnf_type; + } + + public void setVnf_type(String vnf_type) { + this.vnf_type = vnf_type; + } + + public String getVnfc_type() { + return vnfc_type; + } + + public void setVnfc_type(String vnfc_type) { + this.vnfc_type = vnfc_type; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getInCart() { + return inCart; + } + + public void setInCart(String inCart) { + this.inCart = inCart; + } + + @Override + public String toString() { + return "DesignInfo [vnf_type=" + vnf_type + ", vnfc_type=" + vnfc_type + ", protocol=" + protocol + ", inCart=" + + inCart + "]"; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignRequest.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignRequest.java new file mode 100644 index 000000000..3c980b44f --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignRequest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.data; + +import java.io.File; +import java.net.URL; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.sql.rowset.CachedRowSet; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import org.openecomp.appc.design.services.util.DesignServiceConstants; +import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager; +import org.openecomp.sdnc.sli.resource.dblib.DbLibService; + +public class DesignRequest{ + + + @JsonProperty("userID") + String userId ; + + @JsonProperty("vnf-type") + String vnf_type; + + @JsonProperty("vnfc-type") + String vnfc_type; + + @JsonProperty("protocol") + String protocol; + + @JsonProperty("action") + String action; + + @JsonProperty("artifact-name") + String artifact_name; + + @JsonProperty("artifact-contents") + String artifact_contents ; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getVnf_type() { + return vnf_type; + } + + public void setVnf_type(String vnf_type) { + this.vnf_type = vnf_type; + } + + public String getVnfc_type() { + return vnfc_type; + } + + public void setVnfc_type(String vnfc_type) { + this.vnfc_type = vnfc_type; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getArtifact_name() { + return artifact_name; + } + + public void setArtifact_name(String artifact_name) { + this.artifact_name = artifact_name; + } + + public String getArtifact_contents() { + return artifact_contents; + } + + public void setArtifact_contents(String artifact_contents) { + this.artifact_contents = artifact_contents; + } + + @Override + public String toString() { + return "DesignRequest [userId=" + userId + ", vnf_type=" + vnf_type + ", vnfc_type=" + vnfc_type + ", protocol=" + + protocol + ", action=" + action + ", artifact_name=" + artifact_name + ", artifact_contents=" + + artifact_contents + "]"; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignResponse.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignResponse.java new file mode 100644 index 000000000..65fac2554 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/DesignResponse.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.data; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class DesignResponse{ + + + @JsonProperty("userID") + String userId ; + + @JsonProperty("designInfo") + List<DesignInfo> designInfoList; + + @JsonProperty("statusInfo") + List<StatusInfo> statusInfoList; + + @JsonProperty("artifactInfo") + List<ArtifactInfo> artifactInfo; + + + public List<ArtifactInfo> getArtifactInfo() { + return artifactInfo; + } + + public void setArtifactInfo(List<ArtifactInfo> artifactInfo) { + this.artifactInfo = artifactInfo; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public List<DesignInfo> getDesignInfoList() { + return designInfoList; + } + + public void setDesignInfoList(List<DesignInfo> designInfoList) { + this.designInfoList = designInfoList; + } + + public List<StatusInfo> getStatusInfoList() { + return statusInfoList; + } + + public void setStatusInfoList(List<StatusInfo> statusInfoList) { + this.statusInfoList = statusInfoList; + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/StatusInfo.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/StatusInfo.java new file mode 100644 index 000000000..32a3e79e5 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/data/StatusInfo.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class StatusInfo{ + + @JsonProperty("vnf-type") + String vnf_type; + + @JsonProperty("vnfc-type") + String vnfc_type; + + @JsonProperty("action") + String action; + + @JsonProperty("artifact-status") + String artifact_status; + + @JsonProperty("action-status") + String action_status; + + public String getVnf_type() { + return vnf_type; + } + + public void setVnf_type(String vnf_type) { + this.vnf_type = vnf_type; + } + + public String getVnfc_type() { + return vnfc_type; + } + + public void setVnfc_type(String vnfc_type) { + this.vnfc_type = vnfc_type; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getArtifact_status() { + return artifact_status; + } + + public void setArtifact_status(String artifact_status) { + this.artifact_status = artifact_status; + } + + public String getAction_status() { + return action_status; + } + + public void setAction_status(String action_status) { + this.action_status = action_status; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbResponseProcessor.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbResponseProcessor.java new file mode 100644 index 000000000..b6f6510a7 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbResponseProcessor.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.dbervices; + +import org.openecomp.appc.design.services.util.DesignServiceConstants; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class DbResponseProcessor { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DbResponseProcessor.class); + public String parseResponse(String dbresposne, String action) throws Exception { + + log.info("Starting Parsing the response for action : " + action + "\n data " + dbresposne ); + String response ; + switch (action) { + case DesignServiceConstants.GETDESIGNS: + response = getDesignsResponse(dbresposne); + break; + case DesignServiceConstants.ADDINCART: + response = getAddInCartResponse(dbresposne); + break ; + case DesignServiceConstants.GETARTIFACTREFERENCE: + response= getArtifactReferenceResponse(dbresposne); + break; + case DesignServiceConstants.GETARTIFACT: + response= getArtifactResponse(dbresposne); + break; + case DesignServiceConstants.GETGUIREFERENCE: + response= getGuiReferenceResponse(dbresposne); + break; + case DesignServiceConstants.GETSTATUS: + response= getStatusResponse(dbresposne); + break; + case DesignServiceConstants.UPLOADARTIFACT: + response= getsetStatusResponse(dbresposne); + break; + case DesignServiceConstants.SETPROTOCOLREFERENCE: + response= getsetStatusResponse(dbresposne); + break; + case DesignServiceConstants.SETINCART: + response= getsetStatusResponse(dbresposne); + break; + default: + log.error("Action " + action + " Not Supported by response Parser"); + throw new Exception(" Action " + action + " not found while processing request "); + + } + return response; + + } + + private String getArtifactResponse(String dbresposne) { + // TODO Auto-generated method stub + return dbresposne; + } + + private String getsetStatusResponse(String dbresposne) { + // TODO Auto-generated method stub + return null; + } + + private String getStatusResponse(String dbresposne) { + log.info("Returning reposne from Response Parser " + dbresposne); + return dbresposne; + } + + private String getGuiReferenceResponse(String dbresposne) { + // TODO Auto-generated method stub + return null; + } + + private String getArtifactReferenceResponse(String dbresposne) { + // TODO Auto-generated method stub + return null; + } + + private String getAddInCartResponse(String dbresposne) { + // TODO Auto-generated method stub + return null; + } + + private String getDesignsResponse(String dbresposne) { + return dbresposne; + + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbService.java new file mode 100644 index 000000000..3c5ac740b --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DbService.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.dbervices; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.UUID; + +import org.openecomp.sdnc.sli.provider.SvcLogicService; +import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager; +import org.openecomp.sdnc.sli.resource.dblib.DbLibService; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DbService { + + private static final Logger Log = LoggerFactory.getLogger(DbService.class); + private static final String DBLIB_SERVICE = "org.openecomp.sdnc.sli.resource.dblib.DBResourceManager"; + DbLibService dblibSvc = null; + String errorMsg = null; + + public DbService() throws Exception { + DbLibService dblibSvc = null; + Log.info("Initializing DbService service"); + try + { + dblibSvc = getDbLibService(); + if (dblibSvc == null) { + Log.error("Got Exception While getting DB Connection"); + throw new Exception("Got Exception While getting DB Connection"); + } + this.dblibSvc = dblibSvc; + } + catch (Exception e) { + Log.error(e.getMessage()); + throw e; + } + } + + private static DbLibService getDbLibService() { + + DbLibService dblibSvc = null; + BundleContext bctx = null; + ServiceReference sref = null; + + Bundle bundle = FrameworkUtil.getBundle(SvcLogicService.class); + + if (bundle != null) { + bctx = bundle.getBundleContext(); + } + + if (bctx != null) { + Log.debug("Getting bundle Context"); + sref = bctx.getServiceReference(DBLIB_SERVICE); + } + + if (sref == null) { + Log.warn("Could not find service reference for DBLib service"); + + } else { + dblibSvc = (DbLibService) bctx.getService(sref); + if (dblibSvc == null) { + Log.warn("DBLIB_SERVICE is null"); + } + } + if (dblibSvc == null) { + try { + dblibSvc = DBResourceManager.create(System.getProperties()); + } catch (Exception e) { + Log.error("Caught exception trying to create db service", e); + } + + if (dblibSvc == null) { + Log.warn("Could not create new DBResourceManager"); + } + } + return (dblibSvc); + } + + public ResultSet getDBData(String query) throws Exception { + ResultSet resultSet; + StringBuilder sqlBuilder = new StringBuilder(query); + Log.info("Query: " + sqlBuilder.toString()); + try { + resultSet = dblibSvc.getData(sqlBuilder.toString(), null, null); + } catch (Exception e) { + Log.error("SQL query "+sqlBuilder+" :: " + e.getMessage()); + throw e; + } + return resultSet; + } + + public ResultSet getDBData(String query, ArrayList<String> paramList) throws Exception { + ResultSet resultSet; + StringBuilder sqlBuilder = new StringBuilder(query); + Log.info("Query :" + sqlBuilder.toString()); + try { + resultSet = dblibSvc.getData(sqlBuilder.toString(), paramList, null); + } catch (Exception expObj) { + Log.error("query "+sqlBuilder+" :: " + expObj.getMessage()); + throw expObj; + } + return resultSet; + } + + public boolean updateDBData(String query, ArrayList<String> paramList) throws Exception { + boolean update; + StringBuilder sqlBuilder = new StringBuilder(query); + Log.info("Query :" + sqlBuilder.toString()); + try { + update = dblibSvc.writeData(sqlBuilder.toString(), paramList, null); + } catch (Exception expObj) { + Log.error("query "+sqlBuilder+" :: " + expObj.getMessage()); + throw expObj; + } + return update; + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DesignDBService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DesignDBService.java new file mode 100644 index 000000000..ba126aff2 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/DesignDBService.java @@ -0,0 +1,645 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.dbervices; + +import java.io.IOException; +import java.security.SecureRandom; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.openecomp.appc.design.data.ArtifactInfo; +import org.openecomp.appc.design.data.DesignInfo; +import org.openecomp.appc.design.data.DesignResponse; +import org.openecomp.appc.design.data.StatusInfo; +import org.openecomp.appc.design.services.util.ArtifactHandlerClient; +import org.openecomp.appc.design.services.util.DesignServiceConstants; +import org.openecomp.sdnc.sli.SvcLogicResource; +import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager; +import org.openecomp.sdnc.sli.resource.sql.SqlResource; +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; +import com.fasterxml.jackson.databind.node.ObjectNode; + +public class DesignDBService { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DesignDBService.class); + private SvcLogicResource serviceLogic; + private static DesignDBService dgGeneralDBService = null; + private static DBResourceManager jdbcDataSource; + + DbService dbservice = null; + private static Properties props; + public static DesignDBService initialise() { + if (dgGeneralDBService == null) { + dgGeneralDBService = new DesignDBService(); + } + return dgGeneralDBService; + } + private DesignDBService() { + if (serviceLogic == null) { + serviceLogic = new SqlResource(); + } + } + + public String execute(String action, String payload, String requestID) throws Exception { + + log.info("Received execute request for action : " + action + " with Payload : "+ payload ); + RequestValidator.validate(action, payload); + String response = null; + dbservice = new DbService(); + switch (action) { + case DesignServiceConstants.GETDESIGNS: + response = getDesigns(payload,requestID ); + break; + case DesignServiceConstants.ADDINCART: + response= setInCart(payload, requestID); + break ; + case DesignServiceConstants.GETARTIFACTREFERENCE: + response= getArtifactReference(payload, requestID); + break; + case DesignServiceConstants.GETARTIFACT: + response= getArtifact(payload, requestID); + break; + case DesignServiceConstants.GETGUIREFERENCE: + response= getGuiReference(payload, requestID); + break; + case DesignServiceConstants.GETSTATUS: + response= getStatus(payload, requestID); + break; + case DesignServiceConstants.SETSTATUS: + response= setStatus(payload, requestID); + break; + case DesignServiceConstants.UPLOADARTIFACT: + response= uploadArtifact(payload, requestID); + break; + case DesignServiceConstants.SETPROTOCOLREFERENCE: + response= setProtocolReference(payload, requestID); + break; + default: + throw new Exception(" Action " + action + " not found while processing request "); + + } + return response; + } + + private String setInCart(String payload, String requestID) throws Exception { + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get(DesignServiceConstants.INCART).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + + String queryString = "UPDATE DT_ARTIFACT_TRACKING SET INCART= ? WHERE ASDC_REFERENCE_ID IN " + + " (SELECT ASDC_REFERENCE_ID FROM ASDC_REFERENCE_ID WHERE VNF_TYPE = ? " ; + + if(payloadObject.get(DesignServiceConstants.VNF_TYPE) != null &&! payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) { + queryString = queryString + " AND VNFC_TYPE = ? ) AND USER = ? " ; + argList.add(payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue()); + } + else{ + queryString = queryString + " ) AND USER = ? " ; + } + + argList.add(payloadObject.get(DesignServiceConstants.USER_ID).textValue()); + + log.info("Query String :" + queryString); + boolean data = dbservice.updateDBData(queryString, argList); + + if(!data) + throw new Exception("Error while updating ProtocolReference"); + + return "{\"update\" : \"success\" } "; + + } + private String setProtocolReference(String payload, String requestID) throws Exception { + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + + argList.add(payloadObject.get(DesignServiceConstants.ACTION).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.ACTION_LEVEL).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.PROTOCOL).textValue()); + + String queryString = " DELETE FROM PROTOCOL_REFERENCE WHERE ACTION = ? AND ACTION_LEVEL AND VNF_TYPE= ? AND PROTOCOL = ? " ; + + log.info("Delete Query String :" + queryString); + boolean data = dbservice.updateDBData(queryString, argList); + + log.info("Record Deleted"); + + if((payloadObject.get(DesignServiceConstants.TEMPLATE) != null && !payloadObject.get(DesignServiceConstants.TEMPLATE).textValue().isEmpty())) + argList.add(payloadObject.get(DesignServiceConstants.TEMPLATE).textValue()); + else + argList.add("NO"); + + String insertString = "INSERT INTO PROTOCOL_REFERENCE VALUES (?,?,?,?,?,SYSDATE()) "; + + if(payloadObject.get(DesignServiceConstants.VNFC_TYPE) != null && ! payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue().isEmpty()){ + queryString = queryString + " AND VNFC_TYPE = ? )" ; + } + else{ + queryString = queryString + " ) "; + } + log.info("Query String :" + queryString); + data = dbservice.updateDBData(queryString, argList); + + if(!data) + throw new Exception("Error while updating ProtocolReference"); + + return "{\"update\" : \"success\" } "; + } + private String uploadArtifact(String payload, String requestID) throws Exception { + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + log.info("Got upload Aritfact with Payload : " + payloadObject.asText()); + try{ + ArtifactHandlerClient ac = new ArtifactHandlerClient(); + String requestString = ac.createArtifactData(payload, requestID); + ac.execute(requestString, "POST"); + int asdc_artifact_id = getASDCArtifactIDbyRequestID(requestID); + int asdc_reference_id = getASDCReferenceID(payload); + createArtifactTrackingRecord(payload, requestID,asdc_artifact_id, asdc_reference_id ); + String status = getDataFromActionStatus(payload, "STATUS"); + if(status == null || status.isEmpty()) + setActionStatus(payload, "Not Tested"); + linkstatusRelationShip(asdc_artifact_id,asdc_reference_id, payload); + + } + catch(Exception e){ + e.printStackTrace(); + throw e; + } + return "{\"update\" : \"success\" } "; + + } + + private void linkstatusRelationShip(int asdc_artifact_id, int asdc_reference_id, String payload) throws Exception { + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(String.valueOf(asdc_artifact_id)); + argList.add(String.valueOf(asdc_reference_id)); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.ACTION).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.USER_ID).textValue()); + + String queryString = "INSERT INTO DT_STATUS_RELATIONSHIP (DT_ARTIFACT_TRACKING_ID,DT_ACTION_STATUS_ID) VALUES " + + "(( SELECT DT_ARTIFACT_TRACKING_ID FROM DT_ARTIFACT_TRACKING WHERE ASDC_ARTIFACTS_ID = ? AND ASDC_REFERENCE_ID = ? ) , " + + "( SELECT DT_ACTION_STATUS_ID FROM DT_ACTION_STATUS WHERE VNF_TYPE = ? AND ACTION = ? AND USER = ? " ; + + if(payloadObject.get(DesignServiceConstants.VNFC_TYPE) != null && ! payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue().isEmpty()){ + queryString = queryString + " AND VNFC_TYPE = ? ) )" ; + } + else{ + queryString = queryString + " ) ) "; + } + log.info("Query String :" + queryString); + boolean data = dbservice.updateDBData(queryString, argList); + + if(!data) + throw new Exception("Error while updating RealtionShip table"); + + } + private int getASDCReferenceID(String payload) throws Exception { + + String vnfc_type = null; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + + argList.add(payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.ARTIFACT_NAME).textValue()); + + String queryString = " SELECT ASDC_REFERENCE_ID FROM ASDC_REFERENCE WHERE VNF_TYPE = ? " + + " AND ARTIFACT_TYPE = ? AND ARTIFACT_NAME = ? " ; + + if(payloadObject.get(DesignServiceConstants.ACTION) != null && !payloadObject.get(DesignServiceConstants.ACTION).textValue().isEmpty()){ + argList.add(payloadObject.get(DesignServiceConstants.ACTION).textValue()); + queryString = queryString + " AND ACTION = ? "; + } + if(payloadObject.get(DesignServiceConstants.VNFC_TYPE) !=null && !payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue().isEmpty()){ + argList.add(payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue()); + queryString = queryString + " AND VNFC_TYPE = ? "; + + } + + log.info("Query String :" + queryString); + ResultSet data = dbservice.getDBData(queryString, argList); + int asdc_reference_id = 0; + while(data.next()) { + asdc_reference_id = data.getInt("ASDC_REFERENCE_ID"); + } + log.info("Got asdc_reference_id = " + asdc_reference_id ); + return asdc_reference_id; + + } + + private String getDataFromActionStatus(String payload, String dataValue) throws Exception { + String status = null ; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.ACTION).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.USER_ID).textValue()); + String queryString = " SELECT " + dataValue + " FROM DT_ACTION_STATUS WHERE VNF_TYPE = ? AND ACTION = ? AND USER = ? "; + if(payloadObject.get(DesignServiceConstants.VNFC_TYPE) !=null && !payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue().isEmpty()){ + argList.add(payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue()); + queryString = queryString + " AND VNFC_TYPE = ? "; + } + log.info("Query String :" + queryString); + ResultSet data = dbservice.getDBData(queryString, argList); + while(data.next()) { + status = data.getString("STATUS"); + } + log.info("DT_ACTION_STATUS Status = " + status ); + return status; + } + + private boolean setActionStatus(String payload, String status) throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get(DesignServiceConstants.ACTION).textValue()); + argList.add(payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue()); + + + String insertQuery = " INSERT INTO DT_ACTION_STATUS (ACTION, VNF_TYPE, VNFC_TYPE, USER, TECHNOLOGY, UPDATED_DATE, STATUS) VALUES (?,?,?,?,?,sysdate() , ?); "; + if(payloadObject.get(DesignServiceConstants.VNFC_TYPE) !=null && !payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue().isEmpty()){ + argList.add(payloadObject.get(DesignServiceConstants.VNFC_TYPE).textValue()); + } + else{ + argList.add(null); + } + argList.add(payloadObject.get(DesignServiceConstants.USER_ID).textValue()); + if(payloadObject.get(DesignServiceConstants.TECHNOLOGY) !=null && !payloadObject.get(DesignServiceConstants.TECHNOLOGY).textValue().isEmpty()){ + argList.add(payloadObject.get(DesignServiceConstants.TECHNOLOGY).textValue()); + } + else{ + argList.add(null); + } + argList.add(status); + + boolean updateStatus = dbservice.updateDBData(insertQuery, argList); + if(!updateStatus) + throw new Exception("Error while updating Action Status"); + return updateStatus; + } + + private void createArtifactTrackingRecord(String payload, String requestID, int asdc_artifact_id, int asdc_reference_id) throws Exception { + String vnfc_type = null; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + + ArrayList<String> argList = new ArrayList<>(); + argList.add(String.valueOf(asdc_artifact_id)); + argList.add(String.valueOf(asdc_reference_id)); + argList.add(payloadObject.get(DesignServiceConstants.USER_ID).textValue()); + if (payloadObject.get(DesignServiceConstants.TECHNOLOGY) != null &&! payloadObject.get(DesignServiceConstants.TECHNOLOGY).textValue().isEmpty()) + argList.add(payloadObject.get(DesignServiceConstants.TECHNOLOGY).textValue()); + else + argList.add(""); + + if (payloadObject.get(DesignServiceConstants.PROTOCOL) != null &&! payloadObject.get(DesignServiceConstants.PROTOCOL).textValue().isEmpty()) + argList.add(payloadObject.get(DesignServiceConstants.PROTOCOL).textValue()); + else + argList.add(""); + + + String queryString = "INSERT INTO DT_ARTIFACT_TRACKING (ASDC_ARTIFACTS_ID, ASDC_REFERENCE_ID, USER, TECHNOLOGY, CREATION_DATE, UPDATED_DATE, ARTIFACT_STATUS, PROTOCOL, IN_CART) VALUES (? , ? , ?, ?, sysdate() , sysdate(), 'Created', ? ,'N' )" ; + + log.info("Query String :" + queryString); + boolean data = dbservice.updateDBData(queryString, argList); + if(!data) + throw new Exception("Error Updating DT_ARTIFACT_TRACKING "); + + + } + + private int getASDCArtifactIDbyRequestID(String requestID) throws Exception { + log.info("Starting getArtifactIDbyRequestID DB Operation"); + int artifact_id = 0; + try{ + ArrayList<String> argList = new ArrayList<>(); + argList.add("TLSUUID" + requestID); + String queryString = " SELECT ASDC_ARTIFACTS_ID FROM ASDC_ARTIFACTS where SERVICE_UUID = ? "; + log.info("Query String :" + queryString); + ResultSet data = dbservice.getDBData(queryString, argList); + while(data.next()){ + artifact_id = data.getInt("ASDC_ARTIFACTS_ID"); + } + } + catch(Exception e){ + e.printStackTrace(); + throw e; + } + log.info("Got ASDC_ARTIFACTS_ID As :" + artifact_id); + return artifact_id; + } + + + private String getArtifact(String payload, String requestID) throws Exception { + String fn = "DBService.getStatus "; + log.info("Starting getArtifact DB Operation"); + try{ + String vnfc_type = null; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get("artifact-name").textValue()); + argList.add(payloadObject.get("artifact-type").textValue()); + + String queryString = "SELECT INTERNAL_VERSION, ARTIFACT_CONTENT FROM ASDC_ARTIFACTS where " + + " ARTIFACT_NAME = ? AND ARTIFACT_TYPE = ? " ; + + log.info("Query String :" + queryString); + ResultSet data = dbservice.getDBData(queryString, argList); + String artifact_content = null; + int hightestVerion = 0 ; + while(data.next()) { + int version = data.getInt("INTERNAL_VERSION"); + if(hightestVerion < version) + artifact_content = data.getString("ARTIFACT_CONTENT"); + } + + if(artifact_content == null || artifact_content.isEmpty()) + throw new Exception("Sorry !!! I dont have any artifact Named : " + payloadObject.get("artifact-name").textValue()); + DesignResponse designResponse = new DesignResponse(); + designResponse.setUserId(payloadObject.get("userID").textValue()); + List<ArtifactInfo> artifactInfoList = new ArrayList<ArtifactInfo>(); + ArtifactInfo artifactInfo = new ArtifactInfo(); + artifactInfo.setArtifact_content(artifact_content); + artifactInfoList.add(artifactInfo); + designResponse.setArtifactInfo(artifactInfoList); + + ObjectMapper mapper = new ObjectMapper(); + String jsonString = mapper.writeValueAsString(designResponse); + log.info("Info : " + jsonString); + return jsonString; + } + catch(SQLException e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + catch(Exception e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + + } + private String setStatus(String payload, String requestID) throws Exception { + String fn = "DBService.getStatus "; + log.info("Starting getStatus DB Operation"); + try{ + String vnfc_type = null; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + + + ArrayList<String> argList = new ArrayList<>(); + argList.add(payloadObject.get("artifact_status").textValue()); + argList.add(payloadObject.get("action_status").textValue()); + + argList.add(payloadObject.get("userID").textValue()); + argList.add(payloadObject.get("vnf-type").textValue()); + + String queryString = " UPDATE DT_ARTIFACT_TRACKING DAT, DT_STATUS_RELATIONSHIP DSR SET DAT.ARTIFACT_STATUS = ? , DAS.DT_ACTION_STATUS = ? " + + " where DAT.USER = DAS.USER and DSR.DT_ARTIFACT_TRACKING_ID = DAT.DT_ARTIFACT_TRACKING_ID " + + " and DSR.DT_ACTION_STATUS_ID = DAS.DT_ACTION_STATUS_ID and DAT.USER = ? " + + " and DAS.VNF_TYPE = ? " ; + + if(payloadObject.get("vnfc-type") !=null && !payloadObject.get("vnfc-type").textValue().isEmpty()){ + argList.add(payloadObject.get("vnfc-type").textValue()); + queryString = queryString + " and DAS.VNFC_TYPE = ? "; + } + + log.info("Query String :" + queryString); + + DesignResponse designResponse = new DesignResponse(); + designResponse.setUserId(payloadObject.get("userID").textValue()); + List<StatusInfo> statusInfoList = new ArrayList<StatusInfo>(); + boolean update = dbservice.updateDBData(queryString, argList); + if(!update) + throw new Exception("Sorry .....Something went wrong while updating the Status"); + + ObjectMapper mapper = new ObjectMapper(); + String jsonString = mapper.writeValueAsString(designResponse); + log.info("Info : " + jsonString); + return jsonString; + } + catch(SQLException e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + catch(Exception e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + } + private String getStatus(String payload, String requestID) throws Exception { + String fn = "DBService.getStatus "; + log.info("Starting getStatus DB Operation"); + try{ + String vnfc_type = null; + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + String UserID = payloadObject.get("userID").textValue(); + String vnf_type = payloadObject.get("vnf-type").textValue(); + if(payloadObject.get("vnfc-type") != null ) + vnfc_type = payloadObject.get("vnfc-type").textValue(); + ArrayList<String> argList = new ArrayList<>(); + + argList.add(UserID); + argList.add(vnf_type); + + String queryString = "SELECT DAS.VNF_TYPE, DAS.VNFC_TYPE, DAS.STATUS, DAS.ACTION, DAT.ARTIFACT_STATUS " + + "from DT_ACTION_STATUS DAS , DT_ARTIFACT_TRACKING DAT, DT_STATUS_RELATIONSHIP DSR " + + " where DAT.USER = DAS.USER and DSR.DT_ARTIFACT_TRACKING_ID = DAT.DT_ARTIFACT_TRACKING_ID " + + " and DSR.DT_ACTION_STATUS_ID = DAS.DT_ACTION_STATUS_ID and DAT.USER = ? " + + " and DAS.VNF_TYPE = ? " ; + + if(vnfc_type !=null && ! vnfc_type.isEmpty()){ + argList.add(vnfc_type); + queryString = queryString + " and DAS.VNFC_TYPE = ? "; + } + + log.info("Query String :" + queryString); + + DesignResponse designResponse = new DesignResponse(); + designResponse.setUserId(UserID); + List<StatusInfo> statusInfoList = new ArrayList<StatusInfo>(); + ResultSet data = dbservice.getDBData(queryString, argList); + while(data.next()) { + StatusInfo statusInfo = new StatusInfo(); + statusInfo.setAction(data.getString("ACTION")); + statusInfo.setAction_status(data.getString("STATUS")); + statusInfo.setArtifact_status(data.getString("ARTIFACT_STATUS")); + statusInfo.setVnf_type(data.getString("VNF_TYPE")); + statusInfo.setVnfc_type(data.getString("VNFC_TYPE")); + statusInfoList.add(statusInfo); + } + + if(statusInfoList.size() < 1) + throw new Exception("OOPS !!!! No VNF information available for VNF-TYPE : " + vnf_type + " for User : " + UserID); + designResponse.setStatusInfoList(statusInfoList); + ObjectMapper mapper = new ObjectMapper(); + String jsonString = mapper.writeValueAsString(designResponse); + log.info("Info : " + jsonString); + return jsonString; + } + catch(SQLException e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + catch(Exception e) + { + log.error("Error while DB operation : " + e.getMessage()); + e.printStackTrace(); + throw e; + } + } + private String getGuiReference(String payload, String requestID) { + // TODO Auto-generated method stub + return null; + } + private String getArtifactReference(String payload, String requestID) { + // TODO Auto-generated method stub + return null; + } + private String getAddInCart(String payload, String requestID) { + // TODO Auto-generated method stub + return null; + } + + // private String getDesigns(String payload, String requestID) throws SQLException, JsonProcessingException, IOException, SvcLogicException { + // + // String fn = "DBService.getDesigns "; + // QueryStatus status = null; + // ObjectMapper objectMapper = new ObjectMapper(); + // JsonNode jnode = objectMapper.readTree(payload); + // String UserId = jnode.get("userID").textValue(); + // SvcLogicContext localContext = new SvcLogicContext(); + // localContext.setAttribute("requestID", requestID); + // localContext.setAttribute("userID", UserId); + // if (serviceLogic != null && localContext != null) { + // String queryString = "SELECT AR.VNF_TYPE, AR.VNFC_TYPE, DAT.PROTOCOL, DAT.IN_CART from " + + // DesignServiceConstants.DB_DT_ARTIFACT_TRACKING + " DAT , " + DesignServiceConstants.DB_ASDC_REFERENCE + + // " AR where DAT.ASDC_REFERENCE_ID= AR.ASDC_REFERENCE_ID and DAT.USER = $userID" ; + // + // log.info(fn + "Query String : " + queryString); + // try { + // status = serviceLogic.query("SQL", true, null, queryString, null, null, localContext); + // } catch (SvcLogicException e1) { + // // TODO Auto-generated catch block + // e1.printStackTrace(); + // } + // + // if(status.toString().equals("FAILURE")) + // throw new SvcLogicException("Error - while getting FlowReferenceData "); + // + // Properties props = localContext.toProperties(); + // log.info("SvcLogicContext contains the following : " + props.toString()); + // for (Enumeration e = props.propertyNames(); e.hasMoreElements() ; ) { + // String propName = (String) e.nextElement(); + // log.info(propName+" = "+props.getProperty(propName)); + // + // } + // } + // return requestID; + // + // } + + private String getDesigns(String payload, String requestID) throws Exception { + + String fn = "DBService.getDesigns "; + log.info("Starting getDesgins DB Operation"); + + + try{ + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + String UserID = payloadObject.get("userID").textValue(); + ArrayList<String> argList = new ArrayList<>(); + argList.add(UserID); + + String queryString = "SELECT AR.VNF_TYPE, AR.VNFC_TYPE, DAT.PROTOCOL, DAT.IN_CART, AR.ACTION, AR.ARTIFACT_NAME, AR.ARTIFACT_TYPE from " + + DesignServiceConstants.DB_DT_ARTIFACT_TRACKING + " DAT , " + DesignServiceConstants.DB_ASDC_REFERENCE + + " AR where DAT.ASDC_REFERENCE_ID= AR.ASDC_REFERENCE_ID and DAT.USER = ? "; + + DesignResponse designResponse = new DesignResponse(); + designResponse.setUserId(UserID); + List<DesignInfo> designInfoList = new ArrayList<DesignInfo>(); + ResultSet data = dbservice.getDBData(queryString, argList); + while(data.next()) { + DesignInfo designInfo = new DesignInfo(); + designInfo.setInCart(data.getString("IN_CART")); + designInfo.setProtocol(data.getString("PROTOCOL")); + designInfo.setVnf_type(data.getString("VNF_TYPE")); + designInfo.setVnfc_type(data.getString("VNFC_TYPE")); + designInfo.setAction(data.getString("ACTION")); + designInfo.setArtifact_type(data.getString("ARTIFACT_TYPE")); + designInfo.setArtifact_name(data.getString("ARTIFACT_NAME")); + designInfoList.add(designInfo); + } + if(designInfoList.size() < 1) + throw new Exception(" Welcome to CDT, Looks like you dont have Design Yet... Lets create some...."); + designResponse.setDesignInfoList(designInfoList); + ObjectMapper mapper = new ObjectMapper(); + String jsonString = mapper.writeValueAsString(designResponse); + log.info("Info : " + jsonString); + return jsonString; + } + catch(Exception e) + { + e.printStackTrace(); + throw e; + } + } + +} + + diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/RequestValidator.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/RequestValidator.java new file mode 100644 index 000000000..0a9dd670a --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/dbervices/RequestValidator.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.dbervices; + +import org.openecomp.appc.design.services.util.ArtifactHandlerClient; +import org.openecomp.appc.design.services.util.DesignServiceConstants; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class RequestValidator { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(RequestValidator.class); + public static void validate(String action, String payload) throws Exception { + log.info("payload" + payload); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + log.info("payloadObject" + payloadObject.get(DesignServiceConstants.ARTIFACT_CONTENTS)); + + String errorString = null; + switch (action) { + case DesignServiceConstants.GETDESIGNS: + if(payloadObject.get(DesignServiceConstants.USER_ID) == null || payloadObject.get(DesignServiceConstants.USER_ID).textValue().isEmpty()) + errorString = DesignServiceConstants.USER_ID; + break; + case DesignServiceConstants.GETARTIFACT: + if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_TYPE; + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_NAME) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_NAME).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_NAME; + break; + case DesignServiceConstants.GETSTATUS: + if(payloadObject.get(DesignServiceConstants.USER_ID) == null || payloadObject.get(DesignServiceConstants.USER_ID).textValue().isEmpty()) + errorString = DesignServiceConstants.USER_ID; + else if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + break; + case DesignServiceConstants.SETSTATUS: + if(payloadObject.get(DesignServiceConstants.USER_ID) == null || payloadObject.get(DesignServiceConstants.USER_ID).textValue().isEmpty()) + errorString = DesignServiceConstants.USER_ID; + else if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + else if(payloadObject.get(DesignServiceConstants.ACTION) == null || payloadObject.get(DesignServiceConstants.ACTION).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION; + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_TYPE; + else if(payloadObject.get(DesignServiceConstants.STATUS) == null || payloadObject.get(DesignServiceConstants.STATUS).textValue().isEmpty()) + errorString = DesignServiceConstants.STATUS; + break; + case DesignServiceConstants.UPLOADARTIFACT: + if(payloadObject.get(DesignServiceConstants.ARTIFACT_NAME) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_NAME).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_NAME; + else if(! payloadObject.get(DesignServiceConstants.ARTIFACT_NAME).textValue().contains("reference")){ + if(payloadObject.get(DesignServiceConstants.ACTION) == null || payloadObject.get(DesignServiceConstants.ACTION).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION; + } + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_VERSOIN) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_VERSOIN).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_VERSOIN; + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_CONTENTS) == null) + errorString = DesignServiceConstants.ARTIFACT_CONTENTS; + else if(payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE) == null || payloadObject.get(DesignServiceConstants.ARTIFACT_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.ARTIFACT_TYPE; + + else if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + + + break; + case DesignServiceConstants.SETPROTOCOLREFERENCE: + if(payloadObject.get(DesignServiceConstants.ACTION) == null || payloadObject.get(DesignServiceConstants.ACTION).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION; + else if(payloadObject.get(DesignServiceConstants.ACTION_LEVEL) == null || payloadObject.get(DesignServiceConstants.ACTION_LEVEL).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION_LEVEL; + else if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + else if(payloadObject.get(DesignServiceConstants.PROTOCOL) == null || payloadObject.get(DesignServiceConstants.PROTOCOL).textValue().isEmpty()) + errorString = DesignServiceConstants.PROTOCOL; + + case DesignServiceConstants.SETINCART: + if(payloadObject.get(DesignServiceConstants.ACTION) == null || payloadObject.get(DesignServiceConstants.ACTION).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION; + else if(payloadObject.get(DesignServiceConstants.ACTION_LEVEL) == null || payloadObject.get(DesignServiceConstants.ACTION_LEVEL).textValue().isEmpty()) + errorString = DesignServiceConstants.ACTION_LEVEL; + else if(payloadObject.get(DesignServiceConstants.VNF_TYPE) == null || payloadObject.get(DesignServiceConstants.VNF_TYPE).textValue().isEmpty()) + errorString = DesignServiceConstants.VNF_TYPE; + else if(payloadObject.get(DesignServiceConstants.PROTOCOL) == null || payloadObject.get(DesignServiceConstants.PROTOCOL).textValue().isEmpty()) + errorString = DesignServiceConstants.PROTOCOL; + break; + default: + throw new Exception(" Action " + action + " not found while processing request "); + + } + if(errorString != null) + throw new Exception(" Missing input parameter :-" + errorString + " -:"); + + } + +} + + diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/propertyServices/PropertyUpdateService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/propertyServices/PropertyUpdateService.java new file mode 100644 index 000000000..79746ebc1 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/propertyServices/PropertyUpdateService.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.propertyServices; + +public class PropertyUpdateService { + + // to set the properties this placeholder will be used. +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/DesignServiceProvider.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/DesignServiceProvider.java new file mode 100644 index 000000000..641041979 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/DesignServiceProvider.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services; + +import java.util.concurrent.Future; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DesignServicesService; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.openecomp.appc.design.services.impl.DesignServicesImpl; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class DesignServiceProvider{ + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DesignServiceProvider.class); + + private final DataBroker dataBroker; + private final RpcProviderRegistry rpcProviderRegistry; + private RpcRegistration <DesignServicesService> serviceRegistration; + + + public DesignServiceProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry) { + this.dataBroker = dataBroker; + this.rpcProviderRegistry = rpcProviderRegistry; + } + + /** + * Method called when the blueprint container is created. + */ + public void init() { + // initialize data broker + this.serviceRegistration = this.rpcProviderRegistry.addRpcImplementation(DesignServicesService.class, new DesignServicesImpl()); + log.info("DesignServicesImpl Session Initiated"); + } + + /** + * Method called when the blueprint container is destroyed. + */ + public void close() { + if(this.serviceRegistration != null){ + this.serviceRegistration.close(); + } + log.info("DesignServicesImpl Closed"); + } + + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/impl/DesignServicesImpl.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/impl/DesignServicesImpl.java new file mode 100644 index 000000000..e800b8704 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/impl/DesignServicesImpl.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services.impl; + +import java.util.concurrent.Future; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DbserviceInput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DbserviceOutput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DbserviceOutputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DesignServicesService; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.ValidatorInput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.ValidatorOutput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.ValidatorOutputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.XinterfaceserviceInput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.XinterfaceserviceOutput; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.XinterfaceserviceOutputBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.data.DataBuilder; +import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.status.StatusBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.openecomp.appc.design.dbervices.DbResponseProcessor; +import org.openecomp.appc.design.dbervices.DesignDBService; +import org.openecomp.appc.design.services.util.DesignServiceConstants; +import org.openecomp.appc.design.validator.ValidatorResponseProcessor; +import org.openecomp.appc.design.validator.ValidatorService; +import org.openecomp.appc.design.xinterface.XInterfaceService; +import org.openecomp.appc.design.xinterface.XResponseProcessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.Futures; + +public class DesignServicesImpl implements DesignServicesService { + + private static final Logger log = LoggerFactory.getLogger(DesignServicesImpl.class); + + @Override + public Future<RpcResult<DbserviceOutput>> dbservice(DbserviceInput input) { + + log.info("Received Request: " + input.getDesignRequest().getRequestId() + " Action : " + + input.getDesignRequest().getAction() + " with Payload :" + input.getDesignRequest().getPayload()); + + + DbserviceOutputBuilder outputBuilder = new DbserviceOutputBuilder(); + DataBuilder databuilder = new DataBuilder(); + StatusBuilder statusBuilder = new StatusBuilder(); + + try{ + DesignDBService dbservices = DesignDBService.initialise(); + DbResponseProcessor responseProcessor = new DbResponseProcessor(); + String response = responseProcessor.parseResponse(dbservices.execute(input.getDesignRequest().getAction(), input.getDesignRequest().getPayload(), input.getDesignRequest().getRequestId()), input.getDesignRequest().getAction()); + log.info("Response in for Design Service : " + response); + databuilder.setBlock(response); + databuilder.setRequestId(input.getDesignRequest().getRequestId()); + statusBuilder.setCode("400"); + statusBuilder.setMessage("success"); + } + catch(Exception e){ + log.error("Error" + e.getMessage()); + e.printStackTrace(); + statusBuilder.setCode("401"); + statusBuilder.setMessage(e.getMessage()); + } + + outputBuilder.setData(databuilder.build()); + outputBuilder.setStatus(statusBuilder.build()); + + RpcResult<DbserviceOutput> result = RpcResultBuilder.<DbserviceOutput>status(true).withResult(outputBuilder.build()).build(); + return Futures.immediateFuture(result); + } + + @Override + public Future<RpcResult<XinterfaceserviceOutput>> xinterfaceservice(XinterfaceserviceInput input) { + log.info("Received Request: " + input.getDesignRequest().getRequestId() + " Action : " + + input.getDesignRequest().getAction() + " with Payload :" + input.getDesignRequest().getPayload()); + XinterfaceserviceOutputBuilder outputBuilder = new XinterfaceserviceOutputBuilder(); + DataBuilder databuilder = new DataBuilder(); + StatusBuilder statusBuilder = new StatusBuilder(); + try { + + XInterfaceService xInterfaceService = new XInterfaceService(); + XResponseProcessor responseProcessor = new XResponseProcessor(); + String response = responseProcessor.parseResponse(xInterfaceService.execute(input.getDesignRequest().getAction(), input.getDesignRequest().getPayload()), input.getDesignRequest().getAction()); + databuilder.setBlock(response); + databuilder.setRequestId(input.getDesignRequest().getRequestId()); + statusBuilder.setCode("400"); + statusBuilder.setMessage("success"); + } catch (Exception e) { + e.printStackTrace(); + statusBuilder.setCode("401"); + statusBuilder.setMessage(e.getMessage()); + } + outputBuilder.setData(databuilder.build()); + outputBuilder.setStatus(statusBuilder.build()); + + RpcResult<XinterfaceserviceOutput> result = RpcResultBuilder.<XinterfaceserviceOutput>status(true).withResult(outputBuilder.build()).build(); + return Futures.immediateFuture(result); + } + + @Override + public Future<RpcResult<ValidatorOutput>> validator(ValidatorInput input) { + log.info("Received Request: " + input.getDesignRequest().getRequestId() + " Action : " + + input.getDesignRequest().getAction() + " with Payload :" + input.getDesignRequest().getPayload() + " and Data Type = " + input.getDesignRequest().getDataType()); + ValidatorOutputBuilder outputBuilder = new ValidatorOutputBuilder(); + StatusBuilder statusBuilder = new StatusBuilder(); + + + try { + if(input.getDesignRequest().getDataType() == null || input.getDesignRequest().getDataType().isEmpty()) + throw new Exception ("Data Type required for validate Serivce"); + if(input.getDesignRequest().getAction()== null || input.getDesignRequest().getAction().isEmpty()) + throw new Exception ("Action required for validate Serivce"); + + + if(! input.getDesignRequest().getDataType().equals(DesignServiceConstants.DATA_TYPE_JSON) && + ! input.getDesignRequest().getDataType().equals(DesignServiceConstants.DATA_TYPE_YAML) && + ! input.getDesignRequest().getDataType().equals(DesignServiceConstants.DATA_TYPE_XML) && + ! input.getDesignRequest().getDataType().equals(DesignServiceConstants.DATA_TYPE_VELOCITY)) + throw new Exception ("Request Data format " + input.getDesignRequest().getDataType() + + " is not supported by validate Service : Supported data types are : XML, YAML, VELOCITY, JSON "); + + ValidatorService validatorService = new ValidatorService(); + ValidatorResponseProcessor responseProcessor = new ValidatorResponseProcessor(); + String response = validatorService.execute(input.getDesignRequest().getAction(), input.getDesignRequest().getPayload(), input.getDesignRequest().getDataType()); + statusBuilder.setCode("400"); + statusBuilder.setMessage(response); + } catch (Exception e) { + e.printStackTrace(); + statusBuilder.setCode("401"); + statusBuilder.setMessage(e.getMessage()); + } + + outputBuilder.setStatus(statusBuilder.build()); + + RpcResult<ValidatorOutput> result = RpcResultBuilder.<ValidatorOutput>status(true).withResult(outputBuilder.build()).build(); + return Futures.immediateFuture(result); + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/ArtifactHandlerClient.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/ArtifactHandlerClient.java new file mode 100644 index 000000000..6254728ee --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/ArtifactHandlerClient.java @@ -0,0 +1,187 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.Charset; +import java.security.SecureRandom; +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.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; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + + +public class ArtifactHandlerClient { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(ArtifactHandlerClient.class); + private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR"; + Properties props = new Properties(); + public ArtifactHandlerClient() 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 + "/" + DesignServiceConstants.DESIGN_SERVICE_PROPERTIES; + 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); + } + } + } + + public String createArtifactData(String payload, String requestID) throws JsonProcessingException, IOException { + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode payloadObject = objectMapper.readTree(payload); + + ObjectNode json = objectMapper.createObjectNode(); + + String artifact_name = payloadObject.get(DesignServiceConstants.ARTIFACT_NAME).textValue(); + String artifact_version = payloadObject.get(DesignServiceConstants.ARTIFACT_VERSOIN).textValue(); + String artifact_contents = payloadObject.get(DesignServiceConstants.ARTIFACT_CONTENTS).textValue(); + + ObjectNode requestInfo = objectMapper.createObjectNode(); + + requestInfo.put(DesignServiceConstants.REQUETS_ID, requestID); + requestInfo.put(DesignServiceConstants.REQUEST_ACTION, "StoreAsdcDocumentRequest"); + requestInfo.put(DesignServiceConstants.SOURCE, DesignServiceConstants.DESIGN_TOOL); + + String random = getRandom(); + + ObjectNode docParams = objectMapper.createObjectNode(); + + docParams.put(DesignServiceConstants.ARTIFACT_VERSOIN, artifact_version); + docParams.put(DesignServiceConstants.ARTIFACT_NAME, artifact_name); + docParams.put(DesignServiceConstants.ARTIFACT_CONTENTS, artifact_contents); + + + json.put(DesignServiceConstants.REQUEST_INFORMATION, requestInfo); + json.put(DesignServiceConstants.DOCUMENT_PARAMETERS, docParams); + log.info("Final data =" + json.toString()); + return String.format("{\"input\": %s}", json.toString()); + } + + public HashMap<String, String> execute(String payload, String rpc) throws Exception{ + log.info("Configuring Rest Operation for Payload " + payload + " RPC : " + rpc ); + 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(props.getProperty("appc.upload.user"), props.getProperty("appc.upload.pass"))); + webResource = client.resource(new URI(props.getProperty("appc.upload.provider.url"))); + webResource.setProperty("Content-Type", "application/json;charset=UTF-8"); + + log.info("Starting Rest Operation....."); + if(HttpMethod.GET.equalsIgnoreCase(rpc)){ + clientResponse = webResource.accept(responseDataType).get(ClientResponse.class); + }else if(HttpMethod.POST.equalsIgnoreCase(rpc)){ + clientResponse = webResource.type(requestDataType).post(ClientResponse.class, payload); + }else if(HttpMethod.PUT.equalsIgnoreCase(rpc)){ + clientResponse = webResource.type(requestDataType).put(ClientResponse.class,payload); + }else if(HttpMethod.DELETE.equalsIgnoreCase(rpc)){ + clientResponse = webResource.delete(ClientResponse.class); + } + + if(!(clientResponse.getStatus() == 200)) + throw new Exception("HTTP error code : " + clientResponse.getStatus()); + + + log.info("Completed Rest Operation....."); + + }catch (Exception e) { + e.printStackTrace(); + log.debug("failed in RESTCONT Action with 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 String getRandom() { + SecureRandom random = new SecureRandom(); + int num = random.nextInt(100000); + String formatted = String.format("%05d", num); + return formatted; + } + + private HostnameVerifier getHostnameVerifier() { + return new HostnameVerifier() { + @Override + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }; + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/DesignServiceConstants.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/DesignServiceConstants.java new file mode 100644 index 000000000..702d1d1fa --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/DesignServiceConstants.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services.util; + +public class DesignServiceConstants { + + 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_YAML = "YAML"; + public static String DATA_TYPE_VELOCITY = "VELOCITY"; + public static String DATA_TYPE_SQL = "SQL"; + + public static final String GETDESIGNS = "getDesigns"; + public static final String UPLOADARTIFACTS = "uploadArtifacts"; + public static final String VALIDATETEMPLATE = "validateTemplate"; + public static final String GETSTATUS = "getStatus"; + public static final String SETSTATUS = "setStatus"; + public static final String GETGUIREFERENCE = "getGUIReference"; + public static final String GETARTIFACTREFERENCE = "getArtifactReference"; + public static final String GETAAIDATA = "getAAIData"; + public static final String GETINSTARDATA = "getInstarData"; + public static final String PUBLISHARTIFACTS = "publishdArtifacts"; + public static final String ADDINCART = "addInCart"; + + public static final String SUCCESS = "success"; + 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 DOCUMENT_PARAMETERS = "document-parameters"; + public static final String SERVICE_UUID = "service-uuid"; + public static final String DISTRIBUTION_ID = "distribution-id"; + + public static final String SERVICE_NAME = "service-name"; + public static final String SERVICE_DESCRIPTION ="service-description"; + public static final String SERVICE_ARTIFACTS = "service-artifacts"; + public static final String RESOURCE_UUID ="resource-uuid"; + public static final String RESOURCE_INSTANCE_NAME = "resource-instance-name"; + public static final String REOURCE_NAME = "resource-name"; + public static final String RESOURCE_VERSOIN ="resource-version"; + public static final String RESOURCE_TYPE= "resource-type"; + public static final String ARTIFACT_UUID ="artifact-uuid"; + public static final String ARTIFACT_NAME = "artifact-name"; + + public static final String ARTIFACT_VERSOIN = "artifact-version"; + public static final String ARTIFACT_DESRIPTION = "artifact-description"; + public static final String ARTIFACT_CONTENTS = "artifact-contents"; + public static final String REQUEST_INFORMATION = "request-information"; + public static final String INTERNAL_VERSION = "internal-versoin"; + + + + public static final String DB_DT_ARTIFACT_TRACKING = "DT_ARTIFACT_TRACKING"; + public static final String DB_ASDC_REFERENCE = "ASDC_REFERENCE"; + public static final String SCHEMA_SDNCTL = "SDNCTL"; + public static final String GETARTIFACT = "getArtifact"; + public static final String USER_ID = "userID"; + public static final String ARTIFACT_TYPE = "artifact-type"; + public static final String STATUS = "status"; + public static final String UPLOADARTIFACT = "uploadArtifact"; + public static final String REQUETS_ID = "request-id"; + public static final String REQUEST_ACTION = "request-action"; + public static final String SOURCE = "source"; + public static final String DESIGN_SERVICE_PROPERTIES = "designService.properties"; + public static final String DESIGN_TOOL = "Design-tool"; + public static final String TECHNOLOGY = "technology"; + public static final String PROTOCOL = "protocol"; + public static final String SETPROTOCOLREFERENCE = "setProtocolReference"; + public static final String ACTION_LEVEL = "action-level"; + public static final String TEMPLATE = "template"; + public static final String SETINCART = "setInCart"; + public static final String INCART = "inCart"; + public static final String STOREPASSWORD = "storeProperty"; + } diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/EscapeUtils.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/EscapeUtils.java new file mode 100644 index 000000000..ae0f7f77b --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/EscapeUtils.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services.util; + +import org.apache.commons.lang3.StringUtils; + +public class EscapeUtils { + + public EscapeUtils() { + // TODO Auto-generated constructor stub + } + + 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-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/SecureRestClientTrustManager.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/SecureRestClientTrustManager.java new file mode 100644 index 000000000..69014b5e4 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/services/util/SecureRestClientTrustManager.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.services.util; + +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-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorResponseProcessor.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorResponseProcessor.java new file mode 100644 index 000000000..1af4a97a0 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorResponseProcessor.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.validator; + +import org.openecomp.appc.design.services.impl.DesignServicesImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ValidatorResponseProcessor { + + private static final Logger log = LoggerFactory.getLogger(ValidatorResponseProcessor.class); + public String parseResponse(Object execute, String action) { + return null; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorService.java new file mode 100644 index 000000000..2ab327530 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/validator/ValidatorService.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.validator; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringWriter; +import java.nio.charset.StandardCharsets; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.validation.Validator; + +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.exception.MethodInvocationException; +import org.apache.velocity.exception.ParseErrorException; +import org.apache.velocity.exception.ResourceNotFoundException; +import org.apache.velocity.runtime.resource.loader.StringResourceLoader; +import org.apache.velocity.runtime.resource.util.StringResourceRepository; +import org.openecomp.appc.design.services.util.DesignServiceConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml; +import com.fasterxml.jackson.dataformat.yaml.snakeyaml.introspector.BeanAccess; + +public class ValidatorService { + + private static final Logger log = LoggerFactory.getLogger(ValidatorService.class); + public String execute(String action, String payload, String dataType) throws Exception { + + String validateResponse = null; + log.info("Received validation for action= " + action + "Data :" + payload + " dataType = " + dataType); + if(dataType.equals(DesignServiceConstants.DATA_TYPE_XML)) + validateResponse = validateXML(payload); + else if(dataType.equals(DesignServiceConstants.DATA_TYPE_JSON)) + validateResponse = validateJOSN(payload); + else if(dataType.equals(DesignServiceConstants.DATA_TYPE_VELOCITY)) + validateResponse = validateVelocity(payload); + else if(dataType.equals(DesignServiceConstants.DATA_TYPE_YAML)) + validateResponse = validateYAML(payload); + + return validateResponse; + + } + + private String validateYAML(String payload) throws Exception { + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try{ + InputStream is = new ByteArrayInputStream(payload.getBytes()); + + Reader in = new InputStreamReader(is); + Yaml yaml = new Yaml(); + yaml.setBeanAccess(BeanAccess.FIELD); + yaml.load(in); + return DesignServiceConstants.SUCCESS; + } + catch(Exception e){ + log.error("Not a Valid YAML Format "); + throw e; + } + + } + + private String validateVelocity(String payload) { + + try{ + VelocityEngine engine = new VelocityEngine(); + engine.setProperty(Velocity.RESOURCE_LOADER, "string"); + engine.addProperty("string.resource.loader.class", StringResourceLoader.class.getName()); + engine.addProperty("string.resource.loader.repository.static", "false"); + engine.init(); + StringResourceRepository repo = (StringResourceRepository) engine.getApplicationAttribute(StringResourceLoader.REPOSITORY_NAME_DEFAULT); + repo.putStringResource("TestTemplate", payload); + //Template t = ve.getTemplate(payload); + Template t = engine.getTemplate("TestTemplate"); + + return DesignServiceConstants.SUCCESS; + } + catch(ResourceNotFoundException e ){ + log.error("Not a Valid Velocity Template "); + throw e; + } + catch(ParseErrorException pe){ + log.error("Not a Valid Velocity Template "); + throw pe; + } + catch(MethodInvocationException mi){ + log.error("Not a Valid Velocity Template "); + throw mi; + } + } + + private String validateJOSN(String payload) throws Exception { + + try{ + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.readTree(payload); + return DesignServiceConstants.SUCCESS; + } catch(JsonProcessingException e){ + log.error("Not a Valid JOSN file "); + throw e; + } + + } + + private String validateXML(String payload) throws IOException, SAXException, ParserConfigurationException { + + try{ + + DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = dBF.newDocumentBuilder(); + InputSource is = new InputSource(payload); + builder.parse(new InputSource(new ByteArrayInputStream(payload.getBytes("utf-8")))); + return DesignServiceConstants.SUCCESS; + + } catch(ParserConfigurationException e){ + log.info("Error While parsing Payload : " + e.getMessage()); + throw e; + } + catch(SAXException se){ + log.info("Error While parsing Payload : " + se.getMessage()); + throw se; + } + catch(IOException io){ + log.info("Error While parsing Payload : " + io.getMessage()); + throw io; + } + } +} + diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XInterfaceService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XInterfaceService.java new file mode 100644 index 000000000..16a4b40da --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XInterfaceService.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.xinterface; + +import java.io.File; +import java.io.IOException; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; + +public class XInterfaceService { + + + public String execute(String action, String payload) throws IOException { + //Remove this once hte interfaces are up and running + File targetFile = new File("/tmp/" + action + "-response.txt" ); + String interfaceResponse = Files.toString(targetFile, Charsets.UTF_8); + return interfaceResponse; + } + +} diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XResponseProcessor.java b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XResponseProcessor.java new file mode 100644 index 000000000..33e8438f0 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/openecomp/appc/design/xinterface/XResponseProcessor.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.xinterface; + +import java.io.File; +import java.io.IOException; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; + +public class XResponseProcessor { + + public String parseResponse(Object execute, String action) { + return null; + } +} diff --git a/appc-inbound/appc-design-services/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/appc-inbound/appc-design-services/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml new file mode 100644 index 000000000..c207e8d3a --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<!-- vi: set et smarttab sw=4 tabstop=4: --> +<!-- Copyright ? 2016 AT&T and others. All rights reserved. --> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" /> + + <bean id="provider" class="org.openecomp.appc.design.services.DesignServiceProvider" + init-method="init" destroy-method="close"> + <argument ref="dataBroker" /> + <argument ref="rpcRegistry" /> + </bean> +</blueprint> diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java new file mode 100644 index 000000000..81a620afa --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.validator; + +import java.io.File; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.appc.design.dbervices.DesignDBService; +import org.openecomp.appc.design.services.util.DesignServiceConstants; +import org.openecomp.appc.design.services.util.EscapeUtils; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import junit.framework.Assert; + +public class TestDBService { + +//Onap Migration +} diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java new file mode 100644 index 000000000..1757c3c94 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.design.validator; + +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.design.services.util.DesignServiceConstants; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import junit.framework.Assert; + +public class TestValidatorService { + +//Onap Migration + +} diff --git a/appc-inbound/appc-design-services/provider/src/test/resources/Info.out.xml b/appc-inbound/appc-design-services/provider/src/test/resources/Info.out.xml new file mode 100644 index 000000000..76ebf3631 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/resources/Info.out.xml @@ -0,0 +1,23 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> diff --git a/appc-inbound/appc-design-services/provider/src/test/resources/designService.properties b/appc-inbound/appc-design-services/provider/src/test/resources/designService.properties new file mode 100644 index 000000000..34e2b15d3 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/resources/designService.properties @@ -0,0 +1,27 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + +appc.upload.user= +appc.upload.pass= +appc.upload.provider.url= diff --git a/appc-inbound/appc-design-services/provider/src/test/resources/svclogic.properties b/appc-inbound/appc-design-services/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..ae595f73b --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/resources/svclogic.properties @@ -0,0 +1,37 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============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-inbound/appc-design-services/provider/src/test/resources/transactionModel.json b/appc-inbound/appc-design-services/provider/src/test/resources/transactionModel.json new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/resources/transactionModel.json diff --git a/appc-inbound/pom.xml b/appc-inbound/pom.xml new file mode 100755 index 000000000..6c4add1b4 --- /dev/null +++ b/appc-inbound/pom.xml @@ -0,0 +1,22 @@ +<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</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-inbound</artifactId>
+ <packaging>pom</packaging>
+ <name>Application Controller Inbound</name>
+ <description>Application Controller Inbound</description>
+
+ <properties>
+ <openecomp.sdnc.sql-resource.version>1.1.2</openecomp.sdnc.sql-resource.version>
+ </properties>
+ <modules>
+ <module>appc-artifact-handler</module>
+ <module>appc-design-services</module>
+ </modules>
+
+</project>
@@ -51,7 +51,7 @@ <sdnctl.sli.version>1.1.2-SNAPSHOT</sdnctl.sli.version> <sdnctl.dblib.version>1.1.2-SNAPSHOT</sdnctl.dblib.version> <sdnctl.aai.service.version>1.1.2-SNAPSHOT</sdnctl.aai.service.version> - <openecomp.sdnc.sql-resource.version>1.1.2-SNAPSHOT</openecomp.sdnc.sql-resource.version> + <openecomp.sdnc.sql-resource.version>1.1.2-SNAPSHOT</openecomp.sdnc.sql-resource.version> <cdp.pal.version>1.1.7-oss</cdp.pal.version> <dmaap.client.version>0.2.12</dmaap.client.version> @@ -70,7 +70,7 @@ <logback.version>1.1.1</logback.version> <toscalib.version>1.1.0</toscalib.version> <sdc-client.version>1.1.13-SNAPSHOT</sdc-client.version> - <jackson.yml.version>2.3.2</jackson.yml.version> + <jackson.yml.version>2.3.2</jackson.yml.version> <!-- SONAR --> <sonar.language>java</sonar.language> @@ -639,6 +639,7 @@ <module>appc-oam</module> <module>appc-config</module> <module>appc-outbound</module> + <module>appc-inbound</module> </modules> </profile> <profile> |