name: Global teardown
testcases:
- name: get_login_token
  steps:
  - type: get_login_token

- name: bulk_delete_roles
  steps:
  - type: http
    method: POST
    url: '{{.pfserver_webadmin_url}}/api/v1/config/roles/bulk_delete'
    ignore_verify_ssl: true
    body: >-
      {
        "items": [
          "{{.eap_peap.roles.ad_user.id}}",
          "{{.eap_peap.roles.ad_machine.id}}",
          "{{.mac_auth.roles.headless_device.id}}",
          "{{.wired_dot1x_eap_tls_manual.roles.dot1x_eap_tls.id}}",
          "{{.wired_dot1x_eap_tls_scep.roles.dot1x_eap_tls.id}}",
          "{{.inline_l2_and_radius.roles.first}}",
          "{{.inline_l2_and_radius.roles.second}}"
        ]
      }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

- name: delete_access_level
  steps:
  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/admin_role/{{.access_level_user_and_node.id}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200
  
- name: delete_switches
  steps:
  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/switch/{{.cumulus_switch.id2}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/switch/{{.cumulus_switch.id3}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

- name: delete_switch_group
  steps:
  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/switch_group/{{.cumulus_switch_group.id}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

- name: delete_wireless_switch
  steps:
  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/switch/{{.wireless_switch.id2}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

- name: delete_wireless_switch_group
  steps:
  - type: http
    method: DELETE
    url: '{{.pfserver_webadmin_url}}/api/v1/config/switch_group/{{.wireless_switch_group.id}}'
    ignore_verify_ssl: true
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200


