summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_vrf/tests/common/sanity.yaml
blob: a39883cab8fc942dbacc0e9bb1607d7f74b4037a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
- debug: msg="START connection={{ ansible_connection }} nxos_vrf sanity test"
- debug: msg="Using provider={{ connection.transport }}"
  when: ansible_connection == "local"

- set_fact: intname1="{{ nxos_int1 }}"
- set_fact: intname2="{{ nxos_int2 }}"

- set_fact: rdnd="1:2"
  when: (platform is not match("N35|N7K")) and ((imagetag != 'I2'))

- set_fact: rdd="default"
  when: (platform is not match("N35|N7K")) and ((imagetag != 'I2'))

- set_fact: vnind="5000"
  when: platform is not match("N35|N7K|N3L")

- set_fact: vnid="default"
  when: platform is not match("N35|N7K|N3L")

- name: "Enable feature BGP"
  nxos_feature:
    feature: bgp
    provider: "{{ connection }}"
    state: enabled
  ignore_errors: yes

- name: "Setup: Enable nv overlay evpn"
  nxos_config:
    commands:
      - nv overlay evpn
    provider: "{{ connection }}"
  ignore_errors: yes
  when: platform is match("N5K|N6K")

- block:
  - name: Ensure ntc VRF exists on switch
    nxos_vrf: &configure
      vrf: ntc
      admin_state: down
      description: testing
      vni: "{{vnind|default(omit)}}"
      rd: "{{rdnd|default(omit)}}"
      interfaces:
        - "{{ intname1 }}"
        - "{{ intname2 }}"
      provider: "{{ connection }}"
    register: result

  - assert: &true
      that:
        - "result.changed == true"

  - name: "Conf Idempotence"
    nxos_vrf: *configure
    register: result

  - assert: &false
      that:
        - "result.changed == false"

  - pause:
      seconds: 30

  - name: Remove config
    nxos_vrf: &remconf
      vrf: ntc
      admin_state: up
      vni: "{{vnid|default(omit)}}"
      rd: "{{rdd|default(omit)}}"
      interfaces: default
      provider: "{{ connection }}"
    register: result

  - assert: *true

  - name: "Conf Idempotence"
    nxos_vrf: *remconf
    register: result

  - assert: *false

  - name: Ensure ntc VRF does not exist on switch
    nxos_vrf: &remove
      vrf: ntc
      provider: "{{ connection }}"
      state: absent
    register: result

  - assert: *true

  - pause:
      seconds: 30

  - name: "Remove Idempotence"
    nxos_vrf: *remove
    register: result

  - assert: *false

  always:
  - name: "Setup: Disable nv overlay evpn"
    nxos_config:
      commands:
        - no nv overlay evpn
      provider: "{{ connection }}"
    ignore_errors: yes
    when: platform is match("N5K|N6K")

  - name: "Disable feature BGP"
    nxos_feature:
      feature: bgp
      provider: "{{ connection }}"
      state: disabled
    ignore_errors: yes

  - debug: msg="END connection={{ ansible_connection }} nxos_vrf sanity test"