summaryrefslogtreecommitdiff
path: root/test/integration/targets/junos_netconf/tests/cli/changeport.yaml
blob: 3c9496fd099ef9773e1b33693dedb733a7abac55 (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
---
- debug: msg="START netconf/changeport.yaml"


- name: Setup
  junos_netconf:
    state: present
  register: result


###################################
- name: Change port
  junos_netconf:
    state: present
    netconf_port: 8022
  register: result

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

- name: idempotent tests
  junos_netconf:
    state: present
    netconf_port: 8022
  register: result

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

- name: Ensure we can communicate over 8022
  junos_command:
    rpcs:
    - get-software-information
    provider: "{{ netconf }}"
    port: 8022

# This protects against the port override above not being honoured and a bug setting the port
- name: Ensure we can NOT communicate over default port
  junos_command:
    rpcs: get-software-information
    provider: "{{ netconf }}"
  register: result
  ignore_errors: true

- assert:
    that:
      - "result.failed == true"
      - "'unable to open shell' in result.msg"

- name: Set back netconf to default port
  junos_netconf:
    state: present
  register: result

- name: Ensure we can communicate over netconf
  junos_command:
    rpcs:
    - get-software-information
    provider: "{{ netconf }}"

- debug: msg="END netconf/changeport.yaml"