summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml
blob: 2dfa1ec084104c3bcbcdf1b79963d07ef4f7d024 (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
---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"

- name: setup - remove vlan used in test
  vyos.vyos.vyos_config:
    lines:
      - delete interfaces ethernet eth1 vif 100
      - delete interfaces ethernet eth0 vif 5
      - delete interfaces ethernet eth0 vif 100
      - delete interfaces ethernet eth0 vif 101
      - delete interfaces ethernet eth1 vif 201

- name: set vlan with name
  register: result
  vyos.vyos.vyos_vlan: &id001
    vlan_id: 100
    name: vlan-100
    interfaces: eth1

- assert:
    that:
      - result.changed == true
      - "'set interfaces ethernet eth1 vif 100 description vlan-100' in result.commands"

- name: set vlan with name(idempotence)
  register: result
  vyos.vyos.vyos_vlan: *id001

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

- name: set vlan with address
  register: result
  vyos.vyos.vyos_vlan: &id002
    vlan_id: 5
    address: 192.168.5.12/24
    interfaces: eth0

- assert:
    that:
      - result.changed == true
      - "'set interfaces ethernet eth0 vif 5 address 192.168.5.12/24' in result.commands"

- name: set vlan with address(idempotence)
  register: result
  vyos.vyos.vyos_vlan: *id002

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

- name: delete
  register: result
  vyos.vyos.vyos_vlan: &id003
    vlan_id: 100
    interfaces: eth1
    state: absent

- assert:
    that:
      - result.changed == true
      - "'delete interfaces ethernet eth1 vif 100' in result.commands"

- name: delete(idempotence)
  register: result
  vyos.vyos.vyos_vlan: *id003

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

- name: Create VLANs using aggregate
  register: result
  vyos.vyos.vyos_vlan: &id004
    aggregate:
      - vlan_id: 101
        name: voice
        interfaces: eth0

      - vlan_id: 201
        name: mgm
        interfaces: eth1
    state: present

- assert:
    that:
      - result.changed == true
      - "'set interfaces ethernet eth0 vif 101 description voice' in result.commands"
      - "'set interfaces ethernet eth1 vif 201 description mgm' in result.commands"

- name: Create VLANs using aggregate (idempotent)
  register: result
  vyos.vyos.vyos_vlan: *id004

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

- name: teardown
  vyos.vyos.vyos_config:
    lines:
      - delete interfaces ethernet eth1 vif 100
      - delete interfaces ethernet eth0 vif 5
      - delete interfaces ethernet eth0 vif 101
      - delete interfaces ethernet eth1 vif 201