name: Delete configuration in PacketFence
testcases:
- name: get_login_token
  steps:
  - type: get_login_token

- name: configure_inlinel2_as_other
  steps:
  - type: http
    method: PATCH
    url: '{{.pfserver_webadmin_url}}/api/v1/config/interface/inlinel2'
    ignore_verify_ssl: true
    body: >-
     {
       "id": "inlinel2",
       "isClone": false,
       "isNew": false,
       "type": "none",
     }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

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

- name: deconfigure_snat_interface_for_passthroughs
  steps:
  - type: http
    method: PATCH
    url: '{{.pfserver_webadmin_url}}/api/v1/config/base/network'
    ignore_verify_ssl: true
    body: >-
      {
        "interfaceSNAT":""
      }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200
      - result.bodyjson.message ShouldEqual "Settings updated"

- name: deconfigure_snat_interface_for_inline
  steps:
  - type: http
    method: PATCH
    url: '{{.pfserver_webadmin_url}}/api/v1/config/base/inline'
    ignore_verify_ssl: true
    body: >-
     {
       "id": "inline",
       "interfaceSNAT": ""
     }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200

- name: restart_iptables
  steps:
  - type: perl_iptables_restart 

- name: restart_pfdns_service
  steps:
  - type: pf_api_service_restart_async
    service: "pfdns"

- name: restart_pfdhcp_service
  steps:
  - type: pf_api_service_restart_async
    service: "pfdhcp"

- name: restart_haproxy-portal_service
  steps:
  - type: pf_api_service_restart_async
    service: "haproxy-portal"

- name: restart_keepalived_service
  steps:
  - type: pf_api_service_restart_async
    service: "keepalived"

- name: restart_pfdhcplistener_service
  steps:
  - type: pf_api_service_restart_async
    service: "pfdhcplistener"

- name: restart_pfacct_service
  steps:
  - type: pf_api_service_restart_async
    service: "pfacct"
