neutron/neutron/services/loadbalancer/drivers/radware/workflows/openstack_l2_l3/workflow/workflow.xml

167 lines
8.8 KiB
XML

<?xml version="1.0" ?>
<workflow createAction="init" deleteAction="teardown_l2_l3" name="openstack_l2_l3" xmlns="http://www.radware.com/vdirect">
<description>Workflow to setup L2 and L3 for Alteon VA, Single or HA Pair, in Hot Standbye [2013-07-25 11:50:20.285000]</description>
<persist>
<!-- Declare the persistent parameters of the workflow -->
<parameters>
<parameter name="service" prompt="ADC service" type="adcService"/>
<parameter defaultValue="HA-Network" name="ha_network_name" prompt="HA Network Name" type="string"/>
<!-- Data Info-->
<parameter defaultValue="1" max="2" min="1" name="data_port" prompt="Data Port" type="int"/>
<parameter name="data_ip_address" prompt="Data IP Address" type="ip"/>
<parameter name="data_ip_mask" prompt="Data IP Mask" type="ip"/>
<parameter name="gateway" prompt="Default Gateway IP Address" type="ip"/>
<!-- HA Info -->
<parameter defaultValue="2" max="2" min="1" name="ha_port" prompt="HA Port" type="int"/>
<parameter name="ha_ip_address_1" prompt="HA IP Address for Primary ADC" type="ip"/>
<parameter name="ha_ip_address_2" prompt="HA IP Address for Secondary ADC" type="ip"/>
<parameter name="ha_vrrp_ip_address" prompt="HA VRRP IP Address" type="ip"/>
<parameter name="ha_ip_mask" prompt="Data IP Mask" type="ip"/>
<parameter max="1024" min="2" name="ha_group_vr_id" prompt="HA Group VR ID (1 is allocated to the interface VR)" type="int"/>
<parameter defaultValue="save" name="apply_type" prompt="Device apply type" type="string" values="none,apply,save"/>
<!-- Calculated -->
<parameter name="ha_enabled" type="bool"/>
<parameter name="ha_network" type="network"/>
<parameter name="ha_vrrp_pool" type="vrrpPool"/>
<parameter name="data_interface_id_1" type="int"/>
<parameter name="data_interface_id_2" type="int"/>
<parameter name="gateway_id_1" type="int"/>
<parameter name="gateway_id_2" type="int"/>
<parameter name="ha_interface_id_1" type="int"/>
<parameter name="ha_interface_id_2" type="int"/>
<parameter name="data_vlan_1" type="int"/>
<parameter name="data_vlan_2" type="int"/>
<parameter name="ha_vlan_1" type="int"/>
<parameter name="ha_vlan_2" type="int"/>
</parameters>
</persist>
<!-- Declare the states used by this workflow -->
<states>
<state name="initialized"/>
<state name="applied"/>
<state name="removed"/>
</states>
<!-- Declare the workflow actions -->
<actions>
<action fromState="none" name="init" toState="initialized">
<inputs>
<parameters>
<parameter name="service"/>
<parameter name="ha_network_name"/>
</parameters>
</inputs>
<sequence>
<log message="This may take time... making sure that the service is provisioned."/>
<script file="wait_for_service.groovy" name="wait_for_service"/>
<log message="Service is provisioned."/>
<set saveAs="$ha_enabled" value="$service.request.ha"/>
</sequence>
<sequence if="$ha_enabled">
<set saveAs="$ha_network" value="${service.containerResourcePool.getNetwork($ha_network_name)}"/>
<error if="$workflow.isNull($ha_network)" message="Requested to allocate HA IPs while HA Network $ha_network_name not found!"/>
</sequence>
<sequence>
<log message="Read HA and Data IP addresses from the instances"/>
<script file="read_ips_data_from_service.groovy" name="read_ips_data_from_service"/>
<!-- out: data_ip_address, data_ip_mask, gateway, ha_ip_address_1, ha_ip_address_2, ha_vrrp_ip_address, ha_ip_mask-->
</sequence>
<sequence if="$ha_enabled &amp;&amp; $workflow.isNotNull($ha_network)">
<set saveAs="$ha_vrrp_pool" value="${ha_network.getVrrpPool()}"/>
<error if="$workflow.isNull($ha_vrrp_pool)" message="Requested to allocate HA VRRP while VRRP Pool not found in HA network $ha_network_name!"/>
<acquireResource comment="HA VR for service $service.id" owner="$service.id" pool="$ha_vrrp_pool" saveAs="$ha_group_vr_id"/>
</sequence>
<onError>
<autoReleaseResource/>
</onError>
</action>
<!-- setup l2 and l3 on the two devices -->
<action fromState="initialized" name="setup_l2_l3" toState="applied">
<devices>
<device device="$service.primary" name="adc1"/>
<device device="$service.secondary" if="$ha_enabled" name="adc2"/>
</devices>
<sequence>
<error if="$workflow.isNull($ha_ip_address_1)" message="HA IP address for primary ADC is not set!"/>
<error if="$ha_enabled &amp;&amp; $workflow.isNull($ha_ip_address_2)" message="HA IP address for secondary ADC is not set!"/>
<error if="$ha_enabled &amp;&amp; $workflow.isNull($ha_vrrp_ip_address)" message="HA VRRP IP address is not set!"/>
<error if="$workflow.isNull($ha_ip_mask)" message="HA IP mask is not set!"/>
<error if="$workflow.isNull($ha_group_vr_id)" message="HA group VR id is not set!"/>
<error if="$workflow.isNull($data_ip_address)" message="Data IP address is not set!"/>
<error if="$workflow.isNull($data_ip_mask)" message="Data IP mask is not set!"/>
<error if="$workflow.isNull($gateway)" message="Gateway IP address is not set!"/>
<log message="Start 'setup l2 l3 adc1' step."/>
<configuration file="setup_l2_l3.vm" name="setup_l2_l3_adc1">
<parameterMapping>
<map from="$adc1" to="$adc"/>
<map from="$ha_ip_address_1" to="$ha_ip_address"/>
<!-- Outputs -->
<map from="$data_interface_id_1" to="$data_interface_id"/>
<map from="$gateway_id_1" to="$gateway_id"/>
<map from="$ha_interface_id_1" to="$ha_interface_id"/>
<map from="$data_vlan_1" to="$data_vlan"/>
<map from="$ha_vlan_1" to="$ha_vlan"/>
</parameterMapping>
</configuration>
<log message="Completed 'setup l2 l3 adc1' step."/>
<log if="$ha_enabled" message="Start 'setup l2 l3 adc2' step."/>
<configuration if="$ha_enabled" file="setup_l2_l3.vm" name="setup_l2_l3_adc2">
<parameterMapping>
<map from="$adc2" to="$adc"/>
<map from="$ha_ip_address_2" to="$ha_ip_address"/>
<!-- Outputs -->
<map from="$data_interface_id_2" to="$data_interface_id"/>
<map from="$gateway_id_2" to="$gateway_id"/>
<map from="$ha_interface_id_2" to="$ha_interface_id"/>
<map from="$data_vlan_2" to="$data_vlan"/>
<map from="$ha_vlan_2" to="$ha_vlan"/>
</parameterMapping>
</configuration>
<log if="$ha_enabled" message="Completed 'setup l2 l3 adc2' step."/>
<commit apply="$apply_type != 'none'" save="$apply_type == 'save'"/>
</sequence>
<onError>
<autoRevert/>
</onError>
</action>
<action name="teardown_l2_l3" toState="removed">
<!-- Called when workflow is destroyed. A placeholder for 'setup' operations -->
<devices>
<device device="$service.primary" name="adc1"/>
<device device="$service.secondary" if="$ha_enabled" name="adc2"/>
</devices>
<sequence ifState="applied">
<log message="Start 'teardown l2 l3 adc1' step."/>
<configuration file="teardown_l2_l3.vm" name="teardown_l2_l3_adc1">
<parameterMapping>
<map from="$adc1" to="$adc"/>
<map from="$data_interface_id_1" to="$data_interface_id"/>
<map from="$gateway_id_1" to="$gateway_id"/>
<map from="$ha_interface_id_1" to="$ha_interface_id"/>
</parameterMapping>
</configuration>
<log message="Completed teardown l2 l3 adc1' step."/>
<log if="$ha_enabled" message="Start 'teardown l2 l3 adc2' step."/>
<configuration if="$ha_enabled" file="teardown_l2_l3.vm" name="teardown_l2_l3_adc2">
<parameterMapping>
<map from="$adc2" to="$adc"/>
<map from="$data_interface_id_2" to="$data_interface_id"/>
<map from="$gateway_id_2" to="$gateway_id"/>
<map from="$ha_interface_id_2" to="$ha_interface_id"/>
</parameterMapping>
</configuration>
<log if="$ha_enabled" message="Completed teardown l2 l3 adc2' step."/>
<commit apply="$apply_type != 'none'" save="$apply_type == 'save'"/>
</sequence>
<sequence if="$ha_enabled">
<releaseResource pool="$ha_vrrp_pool" resource="$ha_group_vr_id"/>
<set saveAs="$ha_enabled" value="false"/>
</sequence>
<onError>
<autoRevert/>
<!-- The resource is released as the next step will be to delete the ADC service itself so it is better to have the resource back to its pool -->
<releaseResource if="$ha_enabled" pool="$ha_vrrp_pool" resource="$ha_group_vr_id"/>
</onError>
</action>
</actions>
</workflow>