metadata:
 name: host_public_nic_failure_scenarios port 0
 description: scenarios triggered by host nic fail on physical port 0
definitions:
 entities:
  - entity:
     category: ALARM
     type: zabbix
     rawtext: Public interface down on {HOST.NAME}
     template_id: zabbix_alarm
  - entity:
     category: ALARM
     type: vitrage
     name: VM network problem 0
     template_id: instance_alarm
  - entity:
     category: RESOURCE
     type: nova.instance
     template_id: instance
  - entity:
     category: RESOURCE
     type: neutron.port
     template_id: port
  - entity:
     category: ALARM
     type: vitrage
     name: PORT network problem 0
     template_id: port_alarm
  - entity:
     category: RESOURCE
     type: nova.host
     template_id: host
 relationships:
  - relationship:
     source: zabbix_alarm
     relationship_type: on
     target: host
     template_id : public_nic_fail_on_host
  - relationship:
     source: host
     relationship_type: contains
     target: instance
     template_id : host_contains_instance
  - relationship:
     source: instance_alarm
     relationship_type: on
     target: instance
     template_id : alarm_on_instance
  - relationship:
     source: port_alarm
     relationship_type: on
     target: port
     template_id : alarm_on_port
  - relationship:
     source: port
     relationship_type: attached
     target: instance
     template_id : port_attached_to_instance
scenarios:
 - scenario:
    condition: host_contains_instance and alarm_on_instance and port_attached_to_instance
    actions:
     - action:
        action_type: raise_alarm
        action_target:
         target: port
        properties:
         alarm_name: PORT network problem 0
         severity: critical
     - action:
        action_type: set_state
        action_target:
         target: port
        properties:
         state: SUBOPTIMAL
 - scenario:
    condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port
    actions:
     - action:
        action_type: add_causal_relationship
        action_target:
         source: instance_alarm
         target: port_alarm

