diff options
4 files changed, 320 insertions, 0 deletions
diff --git a/platform-logic/appc/src/main/xml/APPC_method_Generic_Restart_2.0.1.xml b/platform-logic/appc/src/main/xml/APPC_method_Generic_Restart_2.0.1.xml new file mode 100644 index 0000000..19c88f9 --- /dev/null +++ b/platform-logic/appc/src/main/xml/APPC_method_Generic_Restart_2.0.1.xml @@ -0,0 +1,246 @@ +<!-- + ============LICENSE_START======================================================= + APPC + ================================================================================ + 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========================================================= + ECOMP is a trademark and service mark of AT&T Intellectual Property. +--> + +<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='APPC' version='2.0.1'><method rpc='Generic_Restart' mode='sync'> +<execute plugin='org.openecomp.appc.dg.common.JsonDgUtil' method='flatAndAddToContext' > +<parameter name="payload" value="`$input.payload`" /><outcome value='success'> +<execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='getVnfHierarchy'> +<parameter name="resourceKey" value="`$input.action-identifiers.vnf-id`" /><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="Exception in getting VNF Hierachy" /> + +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='success'> +<switch test='`$getVnfHierarchy_result`'> +<outcome value='SUCCESS'> +<switch test='`$VNF.VMCount`'> +<outcome value='0'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="VM Count is 0" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='Other'> +<block atomic='true'> +<for index="i" start="0" end="`$VNF.VMCount`" ><block atomic='true'> +<execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='postResource'> +<parameter name="resourceType" value="vnfc" /> +<parameter name="prefix" value="vnfc" /> +<parameter name="resourceKey" value='vnfc-name = $VNF.VM[$i].VNFC' /> +<parameter name="attributeName" value="orchestration-status" /> +<parameter name="attributeValue" value="Restarting" /> +<outcome value='success'> +<switch test='`$postResource_result`'> +<outcome value='NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'VNFC not found in AAI : ' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='SUCCESS'> +<execute plugin='org.openecomp.appc.adapter.iaas.ProviderAdapter' method='restartServer'> +<parameter name="org.openecomp.appc.provider.name" value="OpenStack"/> +<parameter name="org.openecomp.appc.instance.url" value="`$VNF.VM[$i].URL`" /> +<parameter name="org.openecomp.appc.identity.url" value="`$AICIdentity`" /> + +<outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in restart for:' + $VNF.VM[$i].URL`" /><outcome value='success'> +</outcome></execute><execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='postResource'> +<parameter name="resourceType" value="vnfc" /> +<parameter name="prefix" value="vnfc" /> +<parameter name="resourceKey" value='vnfc-name = $VNF.VM[$i].VNFC' /> +<parameter name="attributeName" value="orchestration-status" /> +<parameter name="attributeValue" value="Error" /> +<outcome value='success'> +<switch test='`$postResource_result`'> +<outcome value='SUCCESS'> +<return status='failure'> +</return></outcome><outcome value='NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'VNFC not found in AAI : ' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value='Exception in AAI Update for vnfc $VNF.VM[$i].VNFC' /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in updating AAI for' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></execute></block></outcome><outcome value='success'> +<switch test='`$RESTART_STATUS`'> +<outcome value='ERROR'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Stop : Error occoured while restarting the server:' + $VNF.VM[$i].URL`" /><outcome value='success'> +</outcome></execute><execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='postResource'> +<parameter name="resourceType" value="vnfc" /> +<parameter name="prefix" value="vnfc" /> +<parameter name="resourceKey" value='vnfc-name = $VNF.VM[$i].VNFC' /> +<parameter name="attributeName" value="orchestration-status" /> +<parameter name="attributeValue" value="Error" /> +<outcome value='success'> +<switch test='`$postResource_result`'> +<outcome value='SUCCESS'> +<return status='failure'> +</return></outcome><outcome value='NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'VNFC not found in AAI : ' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value='Exception in AAI Update for vnfc $VNF.VM[$i].VNFC' /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in updating AAI for' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></execute></block></outcome><outcome value='CONTEXT_NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Stop : Context not found:' + $VNF.VM[$i].URL`" /><outcome value='success'> +</outcome></execute><execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='postResource'> +<parameter name="resourceType" value="vnfc" /> +<parameter name="prefix" value="vnfc" /> +<parameter name="resourceKey" value='vnfc-name = $VNF.VM[$i].VNFC' /> +<parameter name="attributeName" value="orchestration-status" /> +<parameter name="attributeValue" value="Error" /> +<outcome value='success'> +<switch test='`$postResource_result`'> +<outcome value='SUCCESS'> +<return status='failure'> +</return></outcome><outcome value='NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'VNFC not found in AAI : ' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value='Exception in AAI Update for vnfc $VNF.VM[$i].VNFC' /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in updating AAI for' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></execute></block></outcome><outcome value='SUCCESS'> +<execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='reportSuccess' > +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Restart event executed successfully for ' + $VNF.VM[$i].URL`" /> +<outcome value='failure'> +</outcome><outcome value='success'> +<execute plugin='org.openecomp.appc.dg.util.ExecuteNodeAction' method='postResource'> +<parameter name="resourceType" value="vnfc" /> +<parameter name="prefix" value="vnfc" /> +<parameter name="resourceKey" value='vnfc-name = $VNF.VM[$i].VNFC' /> +<parameter name="attributeName" value="orchestration-status" /> +<parameter name="attributeValue" value="Restarted" /> +<outcome value='success'> +<switch test='`$postResource_result`'> +<outcome value='NOT_FOUND'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'VNFC not found in AAI : ' + $VNF.VM[$i].VNFC`" /><outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome><outcome value='SUCCESS'> +</outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Exception in AAI Update for vnfc' + $VNF.VM[$i].VNFC`" /><outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in updating AAI for' + $VNF.VM[$i].VNFC`" /><outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></execute></outcome></execute></outcome></switch></outcome></execute></outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Exception in AAI Update for vnfc ' + $VNF.VM[$i].VNFC`" /> + +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="`'Failure in updating AAI for' + $VNF.VM[$i].VNFC`" /> +<outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></execute></block></for><return status='success'> +</return></block></outcome></switch></outcome><outcome value='FAILURE'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="Failure in getting VNF Hierachy" /><outcome value='success'> +</outcome></execute><return status='failure'> +</return></block></outcome></switch></outcome></execute></outcome><outcome value='failure'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="Failure in flattening payload Json" /><outcome value='success'> +</outcome></execute><return status='failure'> +<parameter name="output.status.message" value="Failure in flattening payload Json" /></return></block></outcome><outcome value='not-found'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.DCAEReporterPlugin' method='report' > +<parameter name="apiVer" value="1.01"/> +<parameter name="eventId" value="`$input.action-identifiers.vnf-id`" /> +<parameter name="output.status.message" value="Failure in loading Json flattening plugin" /><outcome value='success'> +</outcome></execute><return status='failure'> +<parameter name="output.status.message" value="Failure in loading Json flattening plugin" /></return></block></outcome></execute></method></service-logic> diff --git a/platform-logic/appc/src/main/xml/APPC_method_legacy_operation_2.0.0.xml b/platform-logic/appc/src/main/xml/APPC_method_legacy_operation_2.0.0.xml new file mode 100644 index 0000000..f24c454 --- /dev/null +++ b/platform-logic/appc/src/main/xml/APPC_method_legacy_operation_2.0.0.xml @@ -0,0 +1,36 @@ +<!-- + ============LICENSE_START======================================================= + APPC + ================================================================================ + 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========================================================= + ECOMP is a trademark and service mark of AT&T Intellectual Property. +--> + +<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='Appc-API' version='2.0.0.0'><method rpc='legacy_operation' mode='sync'> +<block atomic='true'><execute plugin='org.openecomp.appc.dg.common.LegacyUtil' method='prepareRequest' > +</execute><call module='APPC' rpc='topology-operation-all' version='2.0.0' mode='sync' > +<outcome value='failure'> +<execute plugin='org.openecomp.appc.dg.common.LegacyUtil' method='convertNegativeResponse' > +<outcome value='success'> +<return status='failure'> +<parameter name='SvcLogic.status.code' value='`$error-code`' /> +<parameter name='org.openecomp.appc.dg.error' value='`$error-message`' /> +<parameter name='dg.status.message.param.errorMsg' value='`$error-message`' /> +</return></outcome></execute></outcome><outcome value='success'> +<execute plugin='org.openecomp.appc.dg.common.LegacyUtil' method='convertPositiveResponse' > +<outcome value='success'> +</outcome></execute></outcome></call><return status='success'> +</return></block></method></service-logic> diff --git a/platform-logic/installer/src/main/scripts/VNF_DG_MAPPING.sql b/platform-logic/installer/src/main/scripts/VNF_DG_MAPPING.sql new file mode 100644 index 0000000..764e694 --- /dev/null +++ b/platform-logic/installer/src/main/scripts/VNF_DG_MAPPING.sql @@ -0,0 +1,30 @@ +-- +-- Table structure for table `VNF_DG_MAPPING` +-- + +USE sdnctl; +DROP TABLE IF EXISTS `VNF_DG_MAPPING`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `VNF_DG_MAPPING` ( + `action` varchar(50) NOT NULL, + `api_version` varchar(50) DEFAULT NULL, + `vnf_type` varchar(50) DEFAULT NULL, + `vnf_version` varchar(50) DEFAULT NULL, + `dg_name` varchar(50) NOT NULL, + `dg_version` varchar(50) DEFAULT NULL, + `dg_module` varchar(50) NOT NULL, + UNIQUE KEY `INPUT_CONSTRAINT` (`action`,`api_version`,`vnf_type`,`vnf_version`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `VNF_DG_MAPPING` +-- + +LOCK TABLES `VNF_DG_MAPPING` WRITE; +/*!40000 ALTER TABLE `VNF_DG_MAPPING` DISABLE KEYS */; +INSERT INTO `VNF_DG_MAPPING` VALUES ('Restart','2.01','','','legacy_operation','2.0.0','APPC'), ('Restart','2.00','','','Restart_VNF','2.0.1','APPC'); + +/*!40000 ALTER TABLE `VNF_DG_MAPPING` ENABLE KEYS */; +UNLOCK TABLES; diff --git a/platform-logic/installer/src/main/scripts/install.sh b/platform-logic/installer/src/main/scripts/install.sh index ddf3933..9711b70 100644 --- a/platform-logic/installer/src/main/scripts/install.sh +++ b/platform-logic/installer/src/main/scripts/install.sh @@ -46,3 +46,11 @@ do done < <(cat $graphlist) done +MYSQL_USER=${MYSQL_USER:-sdnctl} +MYSQL_PWD=${MYSQL_PWD:-gamma} +MYSQL_DB=${MYSQL_DB:-sdnctl} +MYSQL_HOST=${MYSQL_HOST:-dbhost} + +mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host=${MYSQL_HOST} ${MYSQL_DB} <<-END +SOURCE VNF_DG_MAPPING.sql +END |