---
- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection }}"

# Add minimal testcase to check args are passed correctly to
# implementation module and module run is successful.

- name: setup - remove vrf
  net_vrf:
    name: test-1
    state: absent
    provider: "{{ netconf }}"

- name: Configure vrf and its parameter using platform agnostic vrf module
  net_vrf:
    name: test-1
    description: test-vrf-1
    interfaces:
          - ge-0/0/6
          - ge-0/0/5
    rd: 3.3.3.3:10
    target: target:65513:111
    state: present
    provider: "{{ netconf }}"
  register: result

- assert:
    that:
      - "result.changed == true"
      - result.diff.prepared is search("\+ *test-1")
      - result.diff.prepared is search("\+ *description test-vrf-1")
      - result.diff.prepared is search("\+ *instance-type vrf")
      - result.diff.prepared is search("\+ *interface ge-0/0/5.0")
      - result.diff.prepared is search("\+ *interface ge-0/0/6.0")
      - result.diff.prepared is search("\+ *route-distinguisher 3.3.3.3:10")
      - result.diff.prepared is search("\+ *vrf-target target:65513:111")

- name: teardown - remove vrf
  net_vrf:
    name: test-1
    state: absent
    provider: "{{ netconf }}"

- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection }}"
