name: Create wireless01 with the mac 02:00:00:00:01:00 (wlan1 interface) and role headless_device
testcases:
- name: get_login_token
  steps:
  - type: get_login_token

- name: get_category_id_of_role_wireless
  steps:
  - type: http
    method: POST
    url: '{{.pfserver_webadmin_url}}/api/v1/node_categories/search'
    ignore_verify_ssl: true
    body: >-
      {
        "cursor": 0,
        "fields": [
          "category_id"
        ],
        "limit": 10,
        "query": {
          "op": "and",
          "values": [
            {
              "op": "or",
              "values": [
                {
                  "field": "name",
                  "op": "equals",
                  "value": "{{.wireless_mac_auth.roles.headless_device.id}}"
                }
              ]
            }
          ]
        }
      }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200
    vars:
      category_id:
        from: result.bodyjson.items.items0.category_id

- name: create_wireless01
  steps:
  - type: http
    method: POST
    url: '{{.pfserver_webadmin_url}}/api/v1/nodes'
    ignore_verify_ssl: true
    body: >-
      {
        "category_id": "{{.get_category_id_of_role_wireless.category_id}}",
        "mac": "{{.wireless01_wlan1_mac_address}}",
        "notes": "wireless01 wlan1",
        "pid": null,
        "status": "reg",
        "unreg_date": null,
        "unregdate": null
      }
    headers:
      "Authorization": "{{.get_login_token.result.token}}"
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 201
