diff options
author | Enbo Wang <wangenbo@huawei.com> | 2019-03-27 09:23:09 +0000 |
---|---|---|
committer | Enbo Wang <wangenbo@huawei.com> | 2019-03-27 09:47:22 +0000 |
commit | d0b8fc583393c79655d44511ad3d1628fdc1914c (patch) | |
tree | 7b2c03bdab996a908ea97fc27279d3be4b561d63 /platform-logic/lcm/src/main/xml | |
parent | 0b444df21c00b225a1e1c86da506aa5a2131f58b (diff) |
Add a DG for PNF software rollback action
Add a DG for LCM:rollback action to support PNF software rollback.
Change-Id: Id82e1dc20a0792713fb079ea302f7d71e2949fc8
Issue-ID: SDNC-670
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Former-commit-id: 90cd373ebe1409b523b6fd64a436199a66d2bd97
Diffstat (limited to 'platform-logic/lcm/src/main/xml')
-rw-r--r-- | platform-logic/lcm/src/main/xml/LCM_rollback.xml | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/platform-logic/lcm/src/main/xml/LCM_rollback.xml b/platform-logic/lcm/src/main/xml/LCM_rollback.xml new file mode 100644 index 00000000..bb540b6d --- /dev/null +++ b/platform-logic/lcm/src/main/xml/LCM_rollback.xml @@ -0,0 +1,340 @@ +<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='LCM' version='${project.version}'>
+ <method rpc='rollback' mode='sync'>
+ <block atomic='true'>
+ <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
+ <parameter name='fileName' value='%SDNC_CONFIG_DIR%/lcm-dg.properties' />
+ <parameter name='contextPrefix' value='prop' />
+ </execute>
+ <set>
+ <parameter name='status.code' value='200' />
+ <parameter name='status.message' value='unexpected return from DG' />
+ <parameter name='quote' value="'" />
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='jsonStringToCtx'>
+ <parameter name='source' value='rollback-input.payload' />
+ <parameter name='outputPath' value='payloadJson' />
+ <parameter name='isEscaped' value='true' />
+ </execute>
+ <switch test='`$payloadJson.pnf-flag`'>
+ <outcome value='true'>
+ <set>
+ <parameter name='nodelist' value="`'[' + $quote + $payloadJson.ipaddress-v4-oam + $quote + ']'`"/>
+ <parameter name='playbookname' value='`$prop.lcm.pnf.rollback.playbookname`'/>
+ </set>
+ </outcome>
+ <outcome value='Other'>
+ <block>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='Currently only support PNF.' />
+ </return>
+ </block>
+ </outcome>
+ </switch>
+ <switch test='`$playbookname`'>
+ <outcome value=''>
+ <set>
+ <parameter name='nodelist' value="`$prop.ansible.nodelist`"/>
+ <parameter name='playbookname' value='`$prop.lcm.rollback.playbookname`'/>
+ </set>
+ </outcome>
+ </switch>
+ <switch test='`$nodelist`'>
+ <outcome value=''>
+ <set>
+ <parameter name='nodelist' value="`$prop.ansible.nodelist`"/>
+ </set>
+ </outcome>
+ <outcome value="['']">
+ <set>
+ <parameter name='nodelist' value="`$prop.ansible.nodelist`"/>
+ </set>
+ </outcome>
+ </switch>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='`$playbookname`'/>
+ <parameter name="field2" value='`$nodelist`'/>
+ </record>
+ <execute plugin='org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter' method='reqExec' >
+ <parameter name='AgentUrl' value='`$prop.ansible.agenturl`'/>
+ <parameter name='User' value='`$prop.ansible.user`'/>
+ <parameter name='Password' value='`$prop.ansible.password`'/>
+ <parameter name='LocalParameters' value='`$prop.ansible.lcm.localparameters`'/>
+ <parameter name='EnvParameters' value='`$rollback-input.payload`'/>
+ <parameter name='NodeList' value="`$nodelist`"/>
+ <parameter name='Timeout' value='`$prop.ansible.timeout`'/>
+ <parameter name='Version' value='`$prop.ansible.version`'/>
+ <parameter name='Id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='PlaybookName' value='`$playbookname`'/>
+ <outcome value='not-found'>
+ <block>
+ <set>
+ <parameter name='org.onap.appc.adapter.ansible.result.code' value='401'/>
+ <parameter name='org.onap.appc.adapter.ansible.message' value='Ansible Adapter was not found'/>
+ </set>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`' />
+ </return>
+ </block>
+ </block>
+ </outcome>
+ <outcome value='failure'>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`' />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='Other'>
+ <switch test="`$org.onap.appc.adapter.ansible.result.code`">
+ <outcome value='101'>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`' />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='500'>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`' />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='100'>
+ <execute plugin='org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter' method='reqExecResult' >
+ <parameter name='AgentUrl' value='`$prop.ansible.agenturl`'/>
+ <parameter name='User' value='`$prop.ansible.user`'/>
+ <parameter name='Password' value='`$prop.ansible.password`'/>
+ <parameter name='Id' value='`$org.onap.appc.adapter.ansible.Id`'/>
+ <parameter name='PlaybookName' value='`$playbookname`'/>
+ <outcome value='failure'>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='failure'>
+ <parameter name='status.code' value='401' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`' />
+ </return>
+ </block>
+ </outcome>
+ <outcome value='success'>
+ <block>
+ <set>
+ <parameter name='lcm-dmaap.version' value='`$prop.lcm.dmaap.version`'/>
+ <parameter name='lcm-dmaap.correlation-id' value="`$rollback-input.common-header.request-id + '-' + $rollback-input.common-header.sub-request-id`"/>
+ <parameter name='lcm-dmaap.partition' value='`$prop.lcm.dmaap.partition`'/>
+ <parameter name='lcm-dmaap.rpc-name' value='rollback'/>
+ <parameter name='lcm-dmaap.type' value='`$prop.lcm.dmaap.type`'/>
+ <parameter name='lcm-dmaap.timestamp' value='`$rollback-input.common-header.timestamp`'/>
+ <parameter name='lcm-dmaap.api-ver' value='`$rollback-input.common-header.api-ver`'/>
+ <parameter name='lcm-dmaap.originator-id' value='`$rollback-input.common-header.originator-id`'/>
+ <parameter name='lcm-dmaap.request-id' value='`$rollback-input.common-header.request-id`'/>
+ <parameter name='lcm-dmaap.sub-request-id' value='`$rollback-input.common-header.sub-request-id`'/>
+ <parameter name='lcm-dmaap.flags.mode' value='`$rollback-input.common-header.flags.mode`'/>
+ <parameter name='lcm-dmaap.flags.force' value='`$rollback-input.common-header.flags.force`'/>
+ <parameter name='lcm-dmaap.flags.ttl' value='`$rollback-input.common-header.flags.ttl`'/>
+ <parameter name='lcm-dmaap.status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='lcm-dmaap.status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </set>
+ <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
+ <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.lcm.dmaap.publish.templatefile`" />
+ <parameter name='restapiUrl' value='`$prop.lcm.dmaap.url`' />
+ <parameter name='restapiUser' value='`$prop.lcm.dmaap.user`' />
+ <parameter name='restapiPassword' value='`$prop.lcm.dmaap.password`' />
+ <parameter name='format' value='json' />
+ <parameter name='httpMethod' value='POST' />
+ <parameter name='contentType' value='application/json' />
+ <parameter name="responsePrefix" value="lcm" />
+ <outcome value='failure'>
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log"/>
+ <parameter name="field1" value='Failed to Publish to DMaap'/>
+ </record>
+ </outcome>
+ </execute>
+ <return status='success'>
+ <parameter name='status.code' value='`$org.onap.appc.adapter.ansible.result.code`' />
+ <parameter name='status.message' value='`$org.onap.appc.adapter.ansible.message`'/>
+ </return>
+ </block>
+ </outcome>
+ </execute>
+ </outcome>
+ </switch>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic>
\ No newline at end of file |