Site icon Karneliuk

OpenConfig. Part 2. New NETCONF modules in Ansible 2.6 (examples for Arista EOS, Cisco IOS XR and Nokia SR OS

Hello my friend,

While I’m still working on article for OpenConfig and BGP for automated and unified configuration of DC fabric, I’ve decided to show you operation of two new NETCONF modules, which are available in Ansible 2.6, which is the latest release for the time of writing.

1
2
3
4
5
No part of this blogpost could be reproduced, stored in a<br>
retrieval system, or transmitted in any form or by any<br>
means, electronic, mechanical or photocopying, recording,<br>
or otherwise, for commercial purposes without the<br>
prior permission of the author.<br>

Brief description

Frankly speaking, I planned to look at these modules later on, but my friend Nicola Arnoldi told me that there are some Red Hat videos, which explain how OpenConfig could be used in Ansible in more efficient way, so I decided to take a look on two new NETCONF modules, which are available in Asible 2.6:

In this blogpost, we’ll take a look capability of these modules to create data structure and collect variables (like IP addresses, interface names, etc) and operational data directly from the network elements.

What we are going to test?

We’ll test, how we can extract information (both configurational and operational data) in YANG data model through NETCONF and what to do further with this information.

Software version

The following infrastructure is used in my lab:

See the previous article to get details how to build the lab

Topology

As physical topology we are taking our standard one, with all network elements (Nokia (Alcatel-Lucent) VSR, Arista vEOS and Cisco IOS XRv) connected to our management host with Linux CentOS 7

For the logical topology we take the one we have created in the previous lab:

Correspondingly the initial configuration for this lab is the one we have created in the previous one with the exception of Arista EOS based leaf vEOS2, as we haven’t managed to get it configured on NETCONF using OpenConfig data model, so we have configured it manually:

Module #1. Usage of netconf_get.

As you might guess from the name of the module, it’s used to send “get” RPC requests to the network device using desired XMLNS schema via NETCONF protocol. As a transport plugin it uses “netconf” , so the vendor must be supported. Let’s check. How it works.

1.1#. netconf_get and Nokia (Alcatel-Lucent) SR OS

If we look at the list of the authors of the module , we see that one of them is working in Red Hat and another is working in Nokia. That’s why we start investigations with Nokia (Alcatel-Lucent) SR OS

Following the same approach, we did in previous lab, we’ll create the Ansible structure with roles, so that we easily copy the same scripts between per vendor folders, if they really will work without modifications:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
+--ansible<br>
+--130_lab.yml<br>
+--130_lab_bonus.yml<br>
+--group_vars<br>
|  +--arista<br>
|  |  +--arista_host.yml<br>
|  +--cisco<br>
|  |  +--cisco_host.yml<br>
|  +--nokia<br>
|     +--nokia_host.yml<br>
+--roles<br>
+--arista<br>
|  +--130_lab<br>
|     +--tasks<br>
|        +--main.yml<br>
+--cisco<br>
|  +--130_lab<br>
|     +--tasks<br>
|        +--main.yml<br>
+--nokia<br>
+--130_lab<br>
+--tasks<br>
+--main.yml<br>

The main Ansible playbook, which we use to call the rest of the docs is very similar to one we did in OpenConfig article:
1
2
3
4
5
6
7
$ cat 130_lab.yml<br>
---<br>
- hosts
: cisco<br>
connection
: netconf<br>
tags
: cisco<br>
roles:<br>
- { role
: cisco/130_lab }

1
2
3
4
5
- hosts: nokia<br>
connection
: netconf<br>
tags
: nokia<br>
roles:<br>
- { role
: nokia/130_lab }

1
<br>

1
 
1
2
3
4
5
6
- hosts: arista<br>
connection
: netconf<br>
tags
: arista<br>
roles:<br>
- { role
: arista/130_lab }<br>
...<br>

In “group_vars” we store information related to authentication and another important parameter, which is called “ansible_network_os”. When we review the documentation for ncclient module, which is used as our NETCONF transport, we see that part of the input is the code, which network operation system (NOS) is used, as appropriate hello/capabilities are used. So, for Nokia such details look like:
1
2
3
4
5
6
7
$ cat group_vars/nokia/nokia_host.yml<br>
---<br>
ansible_network_os
: sros<br>
ansible_user
: admin<br>
ansible_pass
: admin<br>
ansible_ssh_pass
: admin<br>
...<br>

Actually, we don’t have any variables or templates, as you might see from the structure, so we just create the Ansible playbook with tasks:
1
2
3
4
5
6
7
$ cat roles/nokia/130_lab/tasks/main.yml<br>
---<br>
- name
: OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET<br>
netconf_get:<br>
display
: json<br>
filter:<br>
register
: output_json

1
<br>
1
2
3
4
5
- name: OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE<br>
copy:<br>
content
: "{{ output_json.output | to_nice_json }}"<br>
dest
: /tmp/{{ inventory_hostname }}_oc_conf.json<br>
...<br>

The first task is exactly the module, we are using. In “display” key we configure, which format should output have, whereas in the “filter” we point out, what exactly we want to see in the output. The second task is used to save the output of the first task. Filter “to_nice_json” is used to split the output per line in easy readable format, whereas variable “output_json” is used to copy the content of the output from the first task to the input of the second one.

Before using Ansible playbook, I need to add “export ANSIBLE_HOST_KEY_CHECKING=False”, as somehow this parameter isn’t read properly from ansible.cfg.

Now it’s time to verify if our Ansible automation is working:

1
2
$ ansible-playbook 130_lab.yml --limit=SR6<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
2
PLAY [cisco] *************************************************************************************************************************************************<br>
skipping: no hosts matched

PLAY [nokia] *************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [SR6]

TASK [nokia/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] *****************************************************************************
ok: [SR6]

TASK [nokia/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ****************************************************************************************
changed: [SR6]

PLAY [arista] ************************************************************************************************************************************************
skipping: no hosts matched

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
SR6                        : ok=3    changed=1    unreachable=0    failed=0<br>

Looks ok. So we go to the output, what we have collected:
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
$ cat /tmp/SR6_oc_conf.json<br>
{<br>
"data": {<br>
"interfaces": {<br>
"interface": [<br>
{<br>
"config": {<br>
"enabled": "true",<br>
"name": "1/1/c1/1",<br>
"type": "ethernetCsmacd"<br>
},<br>
"ethernet": {<br>
"state": {<br>
"auto-negotiate": "false",<br>
"counters": {<br>
"in-crc-errors": "0",<br>
"in-fragment-frames": "0",<br>
"in-jabber-frames": "0",<br>
"in-mac-pause-frames": "0",<br>
"in-oversize-frames": "0",<br>
"out-mac-pause-frames": "0"<br>
},<br>
"hw-mac-address": "fa:ac:a6:16:02:02",<br>
"mac-address": "00:00:00:00:00:00",<br>
"negotiated-duplex-mode": "FULL",<br>
"negotiated-port-speed": "SPEED_10GB"<br>
}<br>
},<br>
"hold-time": {<br>
"state": {<br>
"down": "0",<br>
"up": "0"<br>
}<br>
},<br>
"name": "1/1/c1/1",<br>
"state": {<br>
"admin-status": "UP",<br>
"counters": {<br>
"carrier-transitions": "0",<br>
"in-broadcast-pkts": "0",<br>
"in-discards": "0",<br>
"in-errors": "0",<br>
"in-fcs-errors": "0",<br>
"in-multicast-pkts": "1",<br>
"in-octets": "85",<br>
"in-unicast-pkts": "0",<br>
"in-unknown-protos": "0",<br>
"out-broadcast-pkts": "4",<br>
"out-discards": "0",<br>
"out-errors": "0",<br>
"out-multicast-pkts": "4",<br>
"out-octets": "616",<br>
"out-unicast-pkts": "0"<br>
},<br>
"description": "10-Gig Ethernet",<br>
"enabled": "true",<br>
"ifindex": "1610899521",<br>
"last-change": "33400000",<br>
"mtu": "9212",<br>
"name": "1/1/c1/1",<br>
"oper-status": "UP",<br>
"type": "ethernetCsmacd"<br>
},<br>
"subinterfaces": {<br>
"subinterface": [<br>
{<br>
"config": {<br>
"enabled": "true",<br>
"index": "13"<br>
},<br>
"index": "13",<br>
"ipv4": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "10.11.33.11",<br>
"prefix-length": "24"<br>
},<br>
"ip": "10.11.33.11",<br>
"state": {<br>
"ip": "10.11.33.11",<br>
"origin": "STATIC",<br>
"prefix-length": "24"<br>
}<br>
}<br>
}<br>
},<br>
"ipv6": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "fc00::10:11:33:11",<br>
"prefix-length": "112"<br>
},<br>
"ip": "fc00::10:11:33:11",<br>
"state": {<br>
"ip": "fc00::10:11:33:11",<br>
"origin": "STATIC",<br>
"prefix-length": "112",<br>
"status": "PREFERRED"<br>
}<br>
}<br>
},<br>
"state": {<br>
"dup-addr-detect-transmits": "1"<br>
}<br>
},<br>
"state": {<br>
"admin-status": "UP",<br>
"counters": {<br>
"carrier-transitions": "0",<br>
"in-broadcast-pkts": "0",<br>
"in-fcs-errors": "0",<br>
"in-multicast-pkts": "0",<br>
"in-octets": "0",<br>
"in-unicast-pkts": "0",<br>
"last-clear": "0",<br>
"out-broadcast-pkts": "0",<br>
"out-discards": "0",<br>
"out-multicast-pkts": "2",<br>
"out-octets": "172",<br>
"out-unicast-pkts": "2"<br>
},<br>
"enabled": "true",<br>
"ifindex": "3",<br>
"index": "13",<br>
"last-change": "1532638002600000000",<br>
"name": "oc_1/1/c1/1_13"<br>
},<br>
"vlan": {<br>
"config": {<br>
"vlan-id": "13"<br>
},<br>
"state": {<br>
"vlan-id": "13"<br>
}<br>
}<br>
},<br>
{<br>
"config": {<br>
"enabled": "true",<br>
"index": "14"<br>
},<br>
"index": "14",<br>
"ipv4": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "10.11.44.11",<br>
"prefix-length": "24"<br>
},<br>
"ip": "10.11.44.11",<br>
"state": {<br>
"ip": "10.11.44.11",<br>
"origin": "STATIC",<br>
"prefix-length": "24"<br>
}<br>
}<br>
}<br>
},<br>
"ipv6": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "fc00::10:11:44:11",<br>
"prefix-length": "112"<br>
},<br>
"ip": "fc00::10:11:44:11",<br>
"state": {<br>
"ip": "fc00::10:11:44:11",<br>
"origin": "STATIC",<br>
"prefix-length": "112",<br>
"status": "PREFERRED"<br>
}<br>
}<br>
},<br>
"state": {<br>
"dup-addr-detect-transmits": "1"<br>
}<br>
},<br>
"state": {<br>
"admin-status": "UP",<br>
"counters": {<br>
"carrier-transitions": "0",<br>
"in-broadcast-pkts": "0",<br>
"in-fcs-errors": "0",<br>
"in-multicast-pkts": "0",<br>
"in-octets": "0",<br>
"in-unicast-pkts": "0",<br>
"last-clear": "0",<br>
"out-broadcast-pkts": "0",<br>
"out-discards": "0",<br>
"out-multicast-pkts": "2",<br>
"out-octets": "172",<br>
"out-unicast-pkts": "2"<br>
},<br>
"enabled": "true",<br>
"ifindex": "2",<br>
"index": "14",<br>
"last-change": "1532638002600000000",<br>
"name": "oc_1/1/c1/1_14"<br>
},<br>
"vlan": {<br>
"config": {<br>
"vlan-id": "14"<br>
},<br>
"state": {<br>
"vlan-id": "14"<br>
}<br>
}<br>
}<br>
]<br>
}<br>
},<br>
{<br>
"config": {<br>
"enabled": "true",<br>
"name": "system",<br>
"type": "softwareLoopback"<br>
},<br>
"hold-time": "",<br>
"name": "system",<br>
"state": {<br>
"counters": "",<br>
"name": "system",<br>
"type": "softwareLoopback"<br>
},<br>
"subinterfaces": {<br>
"subinterface": {<br>
"index": "0",<br>
"ipv4": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "10.0.0.11",<br>
"prefix-length": "32"<br>
},<br>
"ip": "10.0.0.11",<br>
"state": {<br>
"ip": "10.0.0.11",<br>
"origin": "STATIC",<br>
"prefix-length": "32"<br>
}<br>
}<br>
}<br>
},<br>
"ipv6": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "fc00::10:0:0:11",<br>
"prefix-length": "128"<br>
},<br>
"ip": "fc00::10:0:0:11",<br>
"state": {<br>
"ip": "fc00::10:0:0:11",<br>
"origin": "STATIC",<br>
"prefix-length": "128",<br>
"status": "PREFERRED"<br>
}<br>
}<br>
},<br>
"state": {<br>
"dup-addr-detect-transmits": "1"<br>
}<br>
},<br>
"state": {<br>
"admin-status": "UP",<br>
"counters": {<br>
"carrier-transitions": "0",<br>
"in-broadcast-pkts": "0",<br>
"in-fcs-errors": "0",<br>
"in-multicast-pkts": "0",<br>
"in-octets": "0",<br>
"in-unicast-pkts": "0",<br>
"last-clear": "0",<br>
"out-broadcast-pkts": "0",<br>
"out-discards": "0",<br>
"out-multicast-pkts": "0",<br>
"out-octets": "0",<br>
"out-unicast-pkts": "0"<br>
},<br>
"enabled": "true",<br>
"ifindex": "1",<br>
"index": "0",<br>
"last-change": "1532637970900000000",<br>
"name": "system"<br>
}<br>
}<br>
}<br>
}<br>
]<br>
}<br>
}<br>
}<br>

You might spot, that there are really a lot of information, much more we have seen previously. The reason is that we using “get” RPC request in general, not “get-config”, therefor also read-only fields are collected:

Looks amazing, isn’t it? For developers of the automation that is really great source of the information, I think.

1.2#. netconf_get and Cisco IOS XR

We just copy created task to appropriate folder in Cisco roles and that is it:

1
$ cp -R roles/nokia/130_lab roles/cisco

As we don’t modify this Ansible playbook with tasks or initial one with roles, I will only show parameters from “group_vars:”
1
2
3
4
5
6
7
$ cat group_vars/cisco/cisco_host.yml<br>
---<br>
ansible_network_os
: iosxr<br>
ansible_user
: cisco<br>
ansible_pass
: cisco<br>
ansible_ssh_pass
: cisco<br>
...<br>

Basically we are ready to get some info in this OpenConfig YANG data model through NETCONF:
1
2
ansible-playbook 130_lab.yml --limit=XR3<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
PLAY [cisco] *************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] *****************************************************************************
ok: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ****************************************************************************************
changed: [XR3]

PLAY [nokia] *************************************************************************************************************************************************
skipping: no hosts matched

PLAY [arista] ************************************************************************************************************************************************
skipping: no hosts matched

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
XR3                        : ok=3    changed=1    unreachable=0    failed=0<br>

The log of Ansible playbook execution looks nice, so we can verify the output of collected data:
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
$ cat /tmp/XR3_oc_conf.json<br>
{<br>
"rpc-reply": {<br>
"data": {<br>
"interfaces": {<br>
"interface": [<br>
{<br>
"config": {<br>
"enabled": "true",<br>
"name": "Loopback0",<br>
"type": "idx:softwareLoopback"<br>
},<br>
"name": "Loopback0",<br>
"state": {<br>
"admin-status": "UP",<br>
"description": "",<br>
"enabled": "true",<br>
"ifindex": "7",<br>
"last-change": "735",<br>
"mtu": "1500",<br>
"name": "Loopback0",<br>
"oper-status": "UP",<br>
"type": "idx:softwareLoopback"<br>
},<br>
"subinterfaces": {<br>
"subinterface": {<br>
"index": "0",<br>
"ipv4": {<br>
"address": {<br>
"config": {<br>
"ip": "10.0.0.33",<br>
"prefix-length": "32"<br>
},<br>
"ip": "10.0.0.33",<br>
"state": {<br>
"ip": "10.0.0.33",<br>
"origin": "STATIC",<br>
"prefix-length": "32"<br>
}<br>
}<br>
},<br>
"ipv6": {<br>
"address": {<br>
"config": {<br>
"ip": "fc00::10:0:0:33",<br>
"prefix-length": "128"<br>
},<br>
"ip": "fc00::10:0:0:33"<br>
}<br>
}<br>
}<br>
}<br>
},<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

I provide only beginning of the output for the sake of brevity, but you might see that output structure and vast majority of the keys are same, because we are using the same OpenConfig YANG model and the same XMLNS scheme

1.3#. netconf_get and Arista EOS

The successful operation of this “netconf_get” module for the Nokia (Alcatel-Lucent) and Cisco IOS XR gives me the feeling that for Arista EOS it also should work.

1
$ cp -R roles/nokia/130_lab roles/arista

Here are the “group_vars” for Arista:
1
2
3
4
5
6
7
8
$ cat group_vars/arista/arista_host.yml<br>
---<br>
ansible_network_os
: eos<br>
ansible_user
: aaa<br>
ansible_ssh_pass
: aaa<br>
ansible_become
: yes<br>
ansible_become_method
: enable<br>
...<br>

And we go straight to verification:
1
2
$ ansible-playbook 130_lab.yml --limit=vEOS2<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
2
PLAY [cisco] *************************************************************************************************************************************************<br>
skipping: no hosts matched

PLAY [nokia] *************************************************************************************************************************************************
skipping: no hosts matched

PLAY [arista] ************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
fatal: [vEOS2]: FAILED! => {“msg”: ” [WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.\n{\”socket_path\”: \”/home/aaa/.ansible/pc/eee96979d7\”, \”exception\”: \”Traceback (most recent call last):\\n File \\\”/usr/bin/ansible-connection\\\”, line 87, in start\\n self.connection._connect()\\n File \\\”/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.py\\\”, line 274, in _connect\\n raise AnsibleError(\\\”connection=netconf is not supported on {0}\\\”.format(network_os))\\nAnsibleError: connection=netconf is not supported on eos\\n\”, \”messages\”: [\”local domain socket does not exist, starting it\”, \”control socket path is /home/aaa/.ansible/pc/eee96979d7\”, \”\”], \”error\”: \”connection=netconf is not supported on eos\”}”}
to retry, use: –limit @/home/aaa/ansible/130_lab.retry

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
vEOS2                      : ok=0    changed=0    unreachable=0    failed=1<br>

Unfortunately, we fail. The good thing about Ansible is that it usually provides quite good debug information, so we can read from the output above that “eos” isn’t supported in case of using netconf transport plugin based on ncclient. But that’s strange and seems to be bug or the module must be updated.

But I have found workaround for it. We need to modify “group_vars” in the following way:

1
2
3
4
5
6
7
8
9
10
$ cat group_vars/arista/arista_host.yml<br>
---<br>
# ansible_network_os: eos<br>
ansible_network_os
: nexus<br>
ansible_port
: 22<br>
ansible_user
: aaa<br>
ansible_ssh_pass
: aaa<br>
ansible_become
: yes<br>
ansible_become_method
: enable<br>
...<br>

So we put the port to 22 (instead of default 830) and NOS version to Cisco Nexus. Then the playbook starts working:
1
2
$ ansible-playbook 130_lab.yml --limit=vEOS2<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
2
PLAY [cisco] *************************************************************************************************************************************************<br>
skipping: no hosts matched

PLAY [nokia] *************************************************************************************************************************************************
skipping: no hosts matched

PLAY [arista] ************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [vEOS2]

TASK [arista/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] ****************************************************************************
ok: [vEOS2]

TASK [arista/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ***************************************************************************************
changed: [vEOS2]

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
vEOS2                      : ok=3    changed=1    unreachable=0    failed=0<br>

And we are able to collect proper output:
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
118
119
120
121
$ cat /tmp/vEOS2_oc_conf.json<br>
{<br>
"data": {<br>
"interfaces": {<br>
"interface": [<br>
{<br>
"config": {<br>
"description": "",<br>
"enabled": "true",<br>
"load-interval": "300",<br>
"mtu": "0",<br>
"name": "Management1",<br>
"type": "ethernetCsmacd"<br>
},<br>
"ethernet": {<br>
"config": {<br>
"fec-encoding": {<br>
"disabled": "false",<br>
"fire-code": "false",<br>
"reed-solomon": "false"<br>
},<br>
"mac-address": "00:00:00:00:00:00",<br>
"port-speed": "SPEED_UNKNOWN",<br>
"sfp-1000base-t": "false"<br>
},<br>
"state": {<br>
"auto-negotiate": "true",<br>
"counters": {<br>
"in-crc-errors": "0",<br>
"in-fragment-frames": "0",<br>
"in-jabber-frames": "0",<br>
"in-mac-control-frames": "0",<br>
"in-mac-pause-frames": "0",<br>
"in-oversize-frames": "0",<br>
"out-mac-control-frames": "0",<br>
"out-mac-pause-frames": "0"<br>
},<br>
"duplex-mode": "FULL",<br>
"enable-flow-control": "true",<br>
"hw-mac-address": "00:50:56:31:07:7c",<br>
"mac-address": "00:50:56:31:07:7c",<br>
"negotiated-duplex-mode": "FULL",<br>
"negotiated-port-speed": "SPEED_1GB",<br>
"port-speed": "SPEED_1GB"<br>
}<br>
},<br>
"name": "Management1",<br>
"state": {<br>
"admin-status": "UP",<br>
"counters": {<br>
"in-broadcast-pkts": "0",<br>
"in-discards": "0",<br>
"in-errors": "0",<br>
"in-multicast-pkts": "0",<br>
"in-octets": "24673",<br>
"in-unicast-pkts": "194",<br>
"out-broadcast-pkts": "0",<br>
"out-discards": "0",<br>
"out-errors": "0",<br>
"out-multicast-pkts": "0",<br>
"out-octets": "26155",<br>
"out-unicast-pkts": "91"<br>
},<br>
"description": "",<br>
"enabled": "true",<br>
"ifindex": "999001",<br>
"inactive": "false",<br>
"last-change": "153277125116",<br>
"mtu": "0",<br>
"name": "Management1",<br>
"oper-status": "UP",<br>
"type": "ethernetCsmacd"<br>
},<br>
"subinterfaces": {<br>
"subinterface": {<br>
"config": {<br>
"index": "0"<br>
},<br>
"index": "0",<br>
"ipv4": {<br>
"addresses": {<br>
"address": {<br>
"config": {<br>
"ip": "192.168.44.82",<br>
"prefix-length": "24"<br>
},<br>
"ip": "192.168.44.82",<br>
"state": {<br>
"ip": "192.168.44.82",<br>
"prefix-length": "24"<br>
}<br>
}<br>
},<br>
"config": {<br>
"enabled": "false",<br>
"mtu": "1500"<br>
},<br>
"state": {<br>
"enabled": "false",<br>
"mtu": "1500"<br>
}<br>
},<br>
"ipv6": {<br>
"config": {<br>
"enabled": "false",<br>
"mtu": "1500"<br>
},<br>
"state": {<br>
"enabled": "false",<br>
"mtu": "1500"<br>
}<br>
},<br>
"state": {<br>
"index": "0"<br>
}<br>
}<br>
}<br>
},<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

Now it works as proper, and we collect both configuration and operational info using OpenConfig YANG data model through NETCONF.

So, if our goal is to collect some data, that this “netconf_get” module perfectly matches. If we want to do more, let’s go to the next one.

Module #2. Usage of netconf_rpc.

This module is written by the same author and uses the same transport netconf plugin based on ncclient. But it provides the possibility to send arbitrary RPC request and get proper response in case that network element has such capabilities.

2.1#. netconf_rpc and Cisco IOS XR

One of the useful requests, which might save a lot of time to you if proper implemented in vendor, is “get-schema”. In RFC 6022 there is some explanation, what this request is doing. In a short word, it extracts from the device content of particular supported YANG module, which can be converted in “.yang” model and read by “pyang”.

So, from Ansible prospective, we extend the playbook with tasks “main.yml” with 4 new tasks:

1
2
3
4
5
6
7
$ cat roles/cisco/130_lab/tasks/main.yml<br>
---<br>
- name
: OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET<br>
netconf_get:<br>
display
: json<br>
filter:<br>
register
: output_json

1
2
3
4
- name: OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE<br>
copy:<br>
content
: "{{ output_json.output | to_nice_json }}"<br>
dest
: /tmp/{{ inventory_hostname }}_oc_conf.json

1
<code lang="yaml">

– name: ALL SCHEMAS // FETCHING INFORMATION THROUGH GET
netconf_get:
display: json
filter:
lock: never
register: list_of_schemas

1
<code lang="yaml">

– name: ALL SCHEMAS // SAVING OUTPUT TO FILE
copy:
content: “{{ list_of_schemas.output | to_nice_json }}”
dest: /tmp/{{ inventory_hostname }}_list_of_schemas.json

1
<code lang="yaml">

– name: OPENCONFIG-INTERFACES SCHEMA // FETCHING INFORMATION THROUGH GET-SCHEMA
netconf_rpc:
rpc: get-schema
xmlns: “urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring”
content: “{‘identifier’: ‘openconfig-interfaces’}”
display: json
register: openconfig_interfaces

1
<br>

1
 
1
2
3
4
5
- name: OPENCONFIG-INTERFACES SCHEMA // SAVING OUTPUT TO FILE<br>
copy:<br>
content
: "{{ openconfig_interfaces.stdout }}"<br>
dest
: /tmp/{{ inventory_hostname }}_openconfig_interfaces.json<br>
...<br>

There are no other changes in other files.

You see here 4 new entries:

What is interesting, the content in “netconf_rpc” module could be filled in with either JSON or YAML structure, whatever you prefer more.

The information used in playbook comes from RFC 6022:

Let’s execute this playbook:

1
2
$ ansible-playbook 130_lab.yml --limit=XR3<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
PLAY [cisco] *************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] *****************************************************************************
ok: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ****************************************************************************************
changed: [XR3]

TASK [cisco/130_lab : ALL SCHEMAS // FETCHING INFORMATION THROUGH GET] ***************************************************************************************
ok: [XR3]

TASK [cisco/130_lab : ALL SCHEMAS // SAVING OUTPUT TO FILE] **************************************************************************************************
changed: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES SCHEMA // FETCHING INFORMATION THROUGH GET-SCHEMA] ***************************************************************
ok: [XR3]

TASK [cisco/130_lab : OPENCONFIG-INTERFACES SCHEMA // SAVING OUTPUT TO FILE] *********************************************************************************
changed: [XR3]

PLAY [nokia] *************************************************************************************************************************************************
skipping: no hosts matched

PLAY [arista] ************************************************************************************************************************************************
skipping: no hosts matched

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
XR3                        : ok=7    changed=3    unreachable=0    failed=0<br>

As the first two tasks were successful, I won’t review their result. That’s why we start with the list of schemas:
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
$ more XR3_list_of_schemas.json<br>
{<br>
"rpc-reply": {<br>
"data": {<br>
"netconf-state": {<br>
"schemas": {<br>
"schema": [<br>
{<br>
"format": "yang",<br>
"identifier": "Cisco-IOS-XR-aaa-lib-cfg",<br>
"location": "NETCONF",<br>
"namespace": "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-lib-cfg",<br>
"version": "2015-11-09"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "Cisco-IOS-XR-aaa-locald-admin-cfg",<br>
"location": "NETCONF",<br>
"namespace": "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-admin-cfg",<br>
"version": "2015-11-09"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "Cisco-IOS-XR-aaa-locald-cfg",<br>
"location": "NETCONF",<br>
"namespace": "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-cfg",<br>
"version": "2015-11-09"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "Cisco-IOS-XR-aaa-locald-oper",<br>
"location": "NETCONF",<br>
"namespace": "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-oper",<br>
"version": "2015-11-09"<br>
},<br>
!<br>
! OUTPUT IS OMITTED<br>
!<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-interfaces",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/interfaces",<br>
"version": "2015-11-20"<br>
},<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

In such a format all the supported YANG modules are listed. I’ve shown also some details about “openconfig-interfaces” module, which is used in the same Ansible playbook to extract data for particular YANG module, whch is saved in another file:
1
$ more XR3_openconfig_interfaces.json

1
module openconfig-interfaces {

1
  yang-version "1";

// namespace
namespace “http://openconfig.net/yang/interfaces”;

prefix “ocif”;

// import some basic types
import ietf-interfaces { prefix if; }
import ietf-yang-types { prefix yang; }
import openconfig-extensions { prefix oc-ext; }

// meta
organization “OpenConfig working group”;

contact
“OpenConfig working group
netopenconfig@googlegroups.com”;

description
“Model for managing network interfaces.

This model reuses data items defined in the IETF YANG model for
interfaces described by RFC 7223 with an alternate structure
(particularly for operational state data) and with additional
configuration items.”;

oc-ext:openconfig-version “0.2.0”;

revision “2015-11-20” {
description
“OpenConfig public release”;
reference “0.2.0”;
}

1
 
1
2
3
4
5
  revision "2015-10-09" {<br>
description!<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

It’s exactly the file, we have shown in the previous article, which we have downloaded from GitHub OpenConfig folder.

It looks amazing, isn’t it? Basically we can fetch all YANG modules from the device to reconstruct all YANG trees with dependencies, what in its turn could be used to construct proper configuration files and jijna2 templates.

2.2#. netconf_rpc and Arista EOS

In the same fashion we did previously, we just copy Ansible playbook with tasks from Cisco to Ansible folder:

1
$ cp roles/cisco/130_lab/tasks/main.yml roles/arista/130_lab/tasks/main.yml

We don’t change anything into any file more, just execute the playbook directly:
1
2
$ ansible-playbook 130_lab.yml --limit=vEOS1<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
2
PLAY [cisco] *************************************************************************************************************************************************<br>
skipping: no hosts matched

PLAY [nokia] *************************************************************************************************************************************************
skipping: no hosts matched

PLAY [arista] ************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [vEOS1]

TASK [arista/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] ****************************************************************************
ok: [vEOS1]

TASK [arista/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ***************************************************************************************
changed: [vEOS1]

TASK [arista/130_lab : ALL SCHEMAS // FETCHING INFORMATION THROUGH GET] **************************************************************************************
ok: [vEOS1]

TASK [arista/130_lab : ALL SCHEMAS // SAVING OUTPUT TO FILE] *************************************************************************************************
changed: [vEOS1]

TASK [arista/130_lab : OPENCONFIG-INTERFACES SCHEMA // FETCHING INFORMATION THROUGH GET-SCHEMA] **************************************************************
ok: [vEOS1]

TASK [arista/130_lab : OPENCONFIG-INTERFACES SCHEMA // SAVING OUTPUT TO FILE] ********************************************************************************
changed: [vEOS1]

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
vEOS1                      : ok=7    changed=3    unreachable=0    failed=0<br>

As you see, everything is working fine, so we briefly check the available schemes:
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
$ more vEOS1_list_of_schemas.json<br>
{<br>
"data": {<br>
"netconf-state": {<br>
"schemas": {<br>
"schema": [<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-network-instance-l2",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/network-instance",<br>
"version": "2017-12-13"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "ietf-yang-types",<br>
"location": "NETCONF",<br>
"namespace": "urn:ietf:params:xml:ns:yang:ietf-yang-types",<br>
"version": "2013-07-15"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-isis",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/openconfig-isis",<br>
"version": "2017-08-24"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "arista-intf-augments",<br>
"location": "NETCONF",<br>
"namespace": "http://arista.com/yang/openconfig/interfaces/augments",<br>
"version": "2017-10-01"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-mpls-rsvp",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/rsvp",<br>
"version": "2017-08-24"<br>
},<br>
!<br>
! OUTPUT IS OMITTED<br>
!<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-interfaces",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/interfaces",<br>
"version": "2017-12-21"<br>
},<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

And what we have captured from the Arista EOS device as YANG module for “openconfig-interfaces”:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ more vEOS1_openconfig_interfaces.json<br>
module "openconfig-interfaces" {<br>
yang-version "1";<br>
namespace "http://openconfig.net/yang/interfaces";<br>
prefix "oc-if";<br>
import "ietf-interfaces" {<br>
prefix "ietf-if";<br>
}<br>
import "openconfig-yang-types" {<br>
prefix "oc-yang";<br>
}<br>
import "openconfig-types" {<br>
prefix "oc-types";<br>
}<br>
import "openconfig-extensions" {<br>
prefix "oc-ext";<br>
}<br>
organization "OpenConfig working group";<br>
contact "OpenConfig working group<br>
netopenconfig@googlegroups.com";<br>
description "Model for managing network interfaces and subinterfaces.  This<br>
module also defines convenience types / groupings for other<br>
models to create references to interfaces:

1
2
3
4
5
                  base-interface-ref (type) -  reference to a base interface<br>
interface-ref (grouping) -  container for reference to a<br>
interface + subinterface<br>
interface-ref-state (grouping) - container for read-only<br>
(opstate) reference to interface + subinterface

This model reuses data items defined in the IETF YANG model for
interfaces described by RFC 7223 with an alternate structure
(particularly for operational state data) and with
additional configuration items.

Portions of this code were derived from IETF RFC 7223.
Please reproduce this note if possible.

1
 
1
2
3
4
5
                 IETF code is subject to the following copyright and license:<br>
Copyright (c) IETF Trust and the persons identified as authors of<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!<br>

Perfect. Here NETCONF in general shows its power of interoperability across different vendors, so that the same Ansible playbook with tasks provides the same result for Cisco IOS XR and Arista EOS network functions.

2.3#. netconf_rpc and Nokia (Alcatel-Lucent) SR OS

Nokia (Alcatel-Lucent) SR OS comes third in a row for this “netconf_rpc” module, because in current release (SR OS 16.0.R1) not everything worls properly, but step by step. First of all we copy the Ansible playbook to folder with Nokia roles:

1
$ cp roles/cisco/130_lab/tasks/main.yml roles/nokia/130_lab/tasks/main.yml

Then we execute playbook:
1
2
$ ansible-playbook 130_lab.yml --limit=SR6<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
2
PLAY [cisco] *************************************************************************************************************************************************<br>
skipping: no hosts matched

PLAY [nokia] *************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [SR6]

TASK [nokia/130_lab : OPENCONFIG-INTERFACES // FETCHING INFORMATION THROUGH GET] *****************************************************************************
ok: [SR6]

TASK [nokia/130_lab : OPENCONFIG-INTERFACES // SAVING OUTPUT TO FILE] ****************************************************************************************
changed: [SR6]

TASK [nokia/130_lab : ALL SCHEMAS // FETCHING INFORMATION THROUGH GET] ***************************************************************************************
ok: [SR6]

TASK [nokia/130_lab : ALL SCHEMAS // SAVING OUTPUT TO FILE] **************************************************************************************************
ok: [SR6]

TASK [nokia/130_lab : OPENCONFIG-INTERFACES SCHEMA // FETCHING INFORMATION THROUGH GET-SCHEMA] ***************************************************************
fatal: [SR6]: FAILED! => {“changed”: false, “msg”: “Element is not valid in the specified context.”}
to retry, use: –limit @/home/aaa/ansible/130_lab.retry

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
SR6                        : ok=5    changed=1    unreachable=0    failed=1<br>

The “get-schema” request is somewhat not working for Nokia VSR 16.0.R1, but according to Nokia it will be fixed in one of the upcoming releases.

Nevertheless the list of supported schemas is fetched:

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
$ more SR6_list_of_schemas.json<br>
{<br>
"data": {<br>
"netconf-state": {<br>
"schemas": {<br>
"schema": [<br>
{<br>
"format": "yang",<br>
"identifier": "nokia-conf",<br>
"location": "NETCONF",<br>
"namespace": "urn:nokia.com:sros:ns:yang:sr:conf",<br>
"version": "2016-07-06"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "nokia-conf-aaa",<br>
"location": "NETCONF",<br>
"namespace": "None",<br>
"version": "2018-05-09"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "nokia-conf-bfd",<br>
"location": "NETCONF",<br>
"namespace": "None",<br>
"version": "2018-04-02"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "nokia-conf-bmp",<br>
"location": "NETCONF",<br>
"namespace": "None",<br>
"version": "2018-04-02"<br>
},<br>
{<br>
"format": "yang",<br>
"identifier": "nokia-conf-call-trace",<br>
"location": "NETCONF",<br>
"namespace": "None",<br>
"version": "2018-05-09"<br>
},<br>
!<br>
! OUTPUT IS OMITTED<br>
!<br>
{<br>
"format": "yang",<br>
"identifier": "openconfig-interfaces",<br>
"location": "NETCONF",<br>
"namespace": "http://openconfig.net/yang/interfaces",<br>
"version": "2016-12-22"<br>
},<br>
!<br>
! FURTHER OUTPUT IS OMITTED<br>
!

1
<br>
1
 

Despite the failure in the last execution of the playbook, the total result is very optimistic as it gives the opportunity for further automation using Ansible.

BONUS# Replacement of “netconf_config” by “netconf_rpc”

As I said in the beginning, “netconf_rpc” could be used to construct any RPC message. In previous article I have shown you the message flow, when we were testing OpenConfig messages. In Ansible playbook, we have used “netconf_config” module, which is created for configuration of the devices. But “netconf_rpc” also could be used, if we know the exact sequence of the actions, which must be done. For Nokia (Alcatel-Lucent) SR OS we have the following sequence:

Here is the example how it looks like in Ansible playbook using “netconf_rpc” module:

1
2
3
4
$ cat 130_lab_bonus.yml<br>
---<br>
- hosts
: nokia<br>
connection
: netconf

1
2
3
4
5
  tasks:<br>
- name
: lock candidate<br>
netconf_rpc:<br>
rpc
: lock<br>
content
: "{'target': {'candidate': None}}"

1
<code lang="yaml">

– name: config interface
netconf_rpc:
display: json
rpc: edit-config
content: |

loopback

loopback
softwareLoopback
true

0

1
<code lang="yaml">
10.0.11.11

 

10.0.11.11 32

1
<code lang="yaml">

1
<code lang="yaml">
fc00::10:0:11:11

 

fc00::10:0:11:11 128

1
<code lang="yaml">

1
<code lang="yaml">

Base

Base
DEFAULT_INSTANCE

loopback

loopback
loopback
0
IPV4
IPV6

– name: commit changes
netconf_rpc:
rpc: commit

1
<code lang="yaml">

– name: unlock candidate
netconf_rpc:
rpc: unlock
content: “{‘target’: {‘candidate’: None}}”

1
<br>

1
 
1
2
3
4
5
   - name: copy running to startup<br>
netconf_rpc:<br>
rpc
: copy-config<br>
content
: "{'source': {'running': None}, 'target': {'startup': None}}"<br>
...<br>

You see different RPC messages, which is used to fulfil the particular operation. Let’s execute this Ansible playbooks:
1
2
$ ansible-playbook 130_lab_bonus.yml --limit=SR6<br>
[WARNING] Ansible is in a world writable directory (/home/aaa/ansible), ignoring it as an ansible.cfg source.

1
PLAY [nokia] *************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [SR6]

TASK [lock candidate] ****************************************************************************************************************************************
ok: [SR6]

TASK [config interface] **************************************************************************************************************************************
ok: [SR6]

TASK [commit changes] ****************************************************************************************************************************************
ok: [SR6]

TASK [unlock candidate] **************************************************************************************************************************************
ok: [SR6]

TASK [copy running to startup] *******************************************************************************************************************************
ok: [SR6]

1
 
1
2
PLAY RECAP ***************************************************************************************************************************************************<br>
SR6                        : ok=6    changed=0    unreachable=0    failed=0<br>

It works! If we check the CLI output of the SR6, we see the new interfaces:
1
2
[]<br>
A:admin@SR6# show router interface

1
<br>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
===============================================================================<br>
Interface Table (Router: Base)<br>
===============================================================================<br>
Interface-Name                   Adm       Opr(v4/v6)  Mode    Port/SapId<br>
IP-Address                                                  PfxState<br>
-------------------------------------------------------------------------------<br>
oc_1/1/c1/1_13                   Up        Up/Up       Network 1/1/c1/1:13<br>
10.11.33.11/24                                              n/a<br>
fc00::10:11:33:11/112                                       PREFERRED<br>
fe80::a6:ffff:fe00:0/64                                     PREFERRED<br>
oc_1/1/c1/1_14                   Up        Up/Up       Network 1/1/c1/1:14<br>
10.11.44.11/24                                              n/a<br>
fc00::10:11:44:11/112                                       PREFERRED<br>
fe80::a6:ffff:fe00:0/64                                     PREFERRED<br>
oc_loopback_0                    Up        Up/Up       Network loopback<br>
10.0.11.11/32                                               n/a<br>
fc00::10:0:11:11/128                                        PREFERRED<br>
fe80::a6:ffff:fe00:0/64                                     PREFERRED<br>
system                           Up        Up/Up       Network system<br>
10.0.0.11/32                                                n/a<br>
fc00::10:0:0:11/128                                         PREFERRED<br>
-------------------------------------------------------------------------------<br>
Interfaces : 4<br>
===============================================================================<br>

On your own you can play with other vendors, just pay attention to necessary actions and target data store (which is “running” for Arista EOS and “candidate” for Cisco IOS XR and Nokia (Alcatel-Lucent) SR OS).

Playbooks from this lab: 130_lab.tar

Lessons learned

We are never done. We can stop developing something, just because we want to stop or don’t want to continue, but we can’t finish, because everything is done. Which is good in research areas.

Using “get” operation we have collected both operational and configuration data. This configuration data is exactly the structure of variables; we can use for device description.

Conclusion

With the overall trend for network automation and programmability all these YANG data models stars playing the crucial role, as they can really provide the possibility to automate multivendor environment in a predictable way. Now we have more information, which ultimately can be used for other activates, which are on our list, like using OpenConfig to create BGP fabric in data centre. Take care and good bye!

Support us





P.S.

If you have further questions or you need help with your networks, I’m happy to assist you, just send me message. Also don’t forget to share the article on your social media, if you like it.

BR,

Anton Karneliuk

Exit mobile version