---

# MLAG State Tests

- name: Gather mlag status
  eos_command:
    commands: "show mlag detail | json"
  register: mlag_state
  tags:
    - mlag

- name: Validate mlag status
  delegate_to: localhost
  assert:
    that:
      - mlag_state.stdout[0].state | arista.avd.default('Not configured') == 'active'
      - mlag_state.stdout[0].negStatus | arista.avd.default('Not configured') == 'connected'
    fail_msg: "State: {{ mlag_state.stdout[0].state | arista.avd.default('Not configured') | replace('\"','')  }} - Negotiation_status: {{ mlag_state.stdout[0].negStatus | arista.avd.default('Not configured') | replace('\"','')  }}"
    quiet: true
  ignore_errors: "{{ eos_validate_state_validation_mode_loose }}"
  register: mlag_state_results
  tags:
    - mlag
