Skip to content

Instantly share code, notes, and snippets.

@LukeDRussell
Created August 28, 2018 00:18
Show Gist options
  • Save LukeDRussell/db8045cb27cd07298b8ad15fdc5fa063 to your computer and use it in GitHub Desktop.
Save LukeDRussell/db8045cb27cd07298b8ad15fdc5fa063 to your computer and use it in GitHub Desktop.
ansible-network.network-engine issue 139
ansible-playbook 2.6.3
config file = /Users/4032956/Documents/network-automation/ansible.cfg
configured module search path = ['/Users/4032956/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible
executable location = /Users/4032956/.pyenv/versions/network-automation/bin/ansible-playbook
python version = 3.6.6 (default, Jul 30 2018, 09:47:46) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
Using /Users/4032956/Documents/network-automation/ansible.cfg as config file
setting up inventory plugins
Parsed /Users/4032956/Documents/network-automation/inventory/network-lab.yml inventory source with yaml plugin
Loading callback plugin debug of type stdout, v2.0 from /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible/plugins/callback/debug.py
PLAYBOOK: test.yml ***********************************************************************************************************************************
1 plays in roles/LukeRussell.cisco_ios/tests/test.yml
PLAY [localhost] *************************************************************************************************************************************
META: ran handlers
TASK [parse `show ip bgp summary`] *******************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:10
File lookup using /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/output/show_ip_bgp_summary/03.14.00.S.txt as file
processing directive: show_ip_bgp_summary
command_parser: using parser version 1.0
processing directive: match sections
processing directive: match lines
processing directive: match neighbors
processing directive: template entries
ok: [localhost] => {
"ansible_facts": {
"cisco_ios": {
"ip_bgp_summary": {
"10.1.19.2": {
"asn": 1234,
"ip_version": 4,
"state_pfxrcd": "Active",
"timer": "00:00:30"
},
"10.15.17.2": {
"asn": 64785,
"ip_version": 4,
"state_pfxrcd": 1125,
"timer": "7w1d"
},
"172.31.3.17": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1641,
"timer": "7w1d"
},
"72.31.0.13": {
"asn": 65004,
"ip_version": 4,
"state_pfxrcd": "Idle",
"timer": "00:00:45"
},
"72.31.0.130": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1644,
"timer": "10:32:44"
}
}
}
},
"changed": false,
"included": [
"/Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/../parser_templates/cli/show_ip_bgp_summary.yaml"
]
}
TASK [test `show ip bgp summary` parser] *************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:16
ok: [localhost] => {
"changed": false
}
MSG:
All assertions passed
TASK [parse `show ip vrf detail`] ********************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:36
File lookup using /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/output/show_ip_vrf_detail/12.2(33)SXH5.txt as file
processing directive: show_ip_vrf_detail
command_parser: using parser version 1.0
processing directive: match vrf section
processing directive: match vrf values
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
processing directive: match vrf nested values
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
processing directive: build a dict for nested values with name as key
The full traceback is:
Traceback (most recent call last):
File "/Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 139, in run
res = self._execute()
File "/Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 577, in _execute
result = self._handler.run(task_vars=variables)
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/command_parser.py", line 159, in run
resp = self._process_directive(task)
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/command_parser.py", line 395, in _process_directive
return meth(**args)
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/command_parser.py", line 413, in do_json_template
return self.template.run(template, self.ds)
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/../lib/network_engine/plugins/template/json_template.py", line 71, in run
val = self.run(items, variables)
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/../lib/network_engine/plugins/template/json_template.py", line 56, in run
templated_value.append(self.run(items, variables))
File "/Users/4032956/Documents/network-automation/roles/ansible-network.network-engine/action_plugins/../lib/network_engine/plugins/template/json_template.py", line 24, in run
key = self.template(item['key'], variables)
TypeError: string indices must be integers
fatal: [localhost]: FAILED! => {}
MSG:
Unexpected failure during module execution.
to retry, use: --limit @/Users/4032956/Documents/network-automation/retry/test.retry
PLAY RECAP *******************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=1
ansible-playbook 2.6.3
config file = /Users/4032956/Documents/network-automation/ansible.cfg
configured module search path = ['/Users/4032956/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible
executable location = /Users/4032956/.pyenv/versions/network-automation/bin/ansible-playbook
python version = 3.6.6 (default, Jul 30 2018, 09:47:46) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
Using /Users/4032956/Documents/network-automation/ansible.cfg as config file
setting up inventory plugins
Parsed /Users/4032956/Documents/network-automation/inventory/network-lab.yml inventory source with yaml plugin
Loading callback plugin debug of type stdout, v2.0 from /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible/plugins/callback/debug.py
PLAYBOOK: test.yml ***********************************************************************************************************************************
1 plays in roles/LukeRussell.cisco_ios/tests/test.yml
PLAY [localhost] *************************************************************************************************************************************
META: ran handlers
TASK [parse `show ip bgp summary`] *******************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:10
File lookup using /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/output/show_ip_bgp_summary/03.14.00.S.txt as file
processing directive: show_ip_bgp_summary
command_parser: using parser version 1.0
processing directive: match sections
processing directive: match lines
processing directive: match neighbors
processing directive: template entries
ok: [localhost] => {
"ansible_facts": {
"cisco_ios": {
"ip_bgp_summary": {
"10.1.19.2": {
"asn": 1234,
"ip_version": 4,
"state_pfxrcd": "Active",
"timer": "00:00:30"
},
"10.15.17.2": {
"asn": 64785,
"ip_version": 4,
"state_pfxrcd": 1125,
"timer": "7w1d"
},
"172.31.3.17": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1641,
"timer": "7w1d"
},
"72.31.0.13": {
"asn": 65004,
"ip_version": 4,
"state_pfxrcd": "Idle",
"timer": "00:00:45"
},
"72.31.0.130": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1644,
"timer": "10:32:44"
}
}
}
},
"changed": false,
"included": [
"/Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/../parser_templates/cli/show_ip_bgp_summary.yaml"
]
}
TASK [test `show ip bgp summary` parser] *************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:16
ok: [localhost] => {
"changed": false
}
MSG:
All assertions passed
TASK [parse `show ip vrf detail`] ********************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:36
File lookup using /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/output/show_ip_vrf_detail/12.2(33)SXH5.txt as file
processing directive: show_ip_vrf_detail
command_parser: using parser version 1.0
processing directive: match vrf section
processing directive: match vrf values
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match description] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match route distinguisher] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route target section] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interface section] in pattern_group
command_parser: loop_var is item
processing directive: match vrf nested values
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match vrf name] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match export route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match import route targets] in pattern_group
command_parser: loop_var is item
command_parser: starting pattern_match [match interfaces] in pattern_group
command_parser: loop_var is item
processing directive: build a dict for nested values with name as key
processing directive: ensure vrf_nested_values is a DICT
processing directive: template export json object
ok: [localhost] => {
"ansible_facts": {
"cisco_ios": {
"ip_bgp_summary": {
"10.1.19.2": {
"asn": 1234,
"ip_version": 4,
"state_pfxrcd": "Active",
"timer": "00:00:30"
},
"10.15.17.2": {
"asn": 64785,
"ip_version": 4,
"state_pfxrcd": 1125,
"timer": "7w1d"
},
"172.31.3.17": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1641,
"timer": "7w1d"
},
"72.31.0.13": {
"asn": 65004,
"ip_version": 4,
"state_pfxrcd": "Idle",
"timer": "00:00:45"
},
"72.31.0.130": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1644,
"timer": "10:32:44"
}
},
"ip_vrf_detail": {
"ABC": {
"description": "ABC VPN",
"export_rt": [
"65000:12"
],
"import_rt": [
"65000:12"
],
"interfaces": [
"\n Te7/3.16\n",
null
],
"name": "ABC",
"rd": "65000:12"
},
"Def": {
"description": "Def VPN",
"export_rt": [
"65000:13",
"65000:120",
"65000:130",
"123:123"
],
"import_rt": [
"65000:13",
"65000:14"
],
"interfaces": [
"\n Vl190 Vl193 Lo10\n Vl85 Vl194 Vl19\n Vl191 Te7/3.194\n",
null
],
"name": "Def",
"rd": "65000:13"
},
"XYzzz0-1-9": {
"description": "A random description",
"export_rt": [
"65000:100"
],
"import_rt": [
"65000:100"
],
"interfaces": [
"\n Vl777 Gi7/3.30\n",
null
],
"name": "XYzzz0-1-9",
"rd": "65111:100"
}
}
},
"dict_vrf_nested_values": {
"ABC": {
"export_rt": [
"65000:12"
],
"import_rt": [
"65000:12"
],
"interface": [
"\n Te7/3.16\n",
null
]
},
"Def": {
"export_rt": [
"65000:13",
"65000:120",
"65000:130",
"123:123"
],
"import_rt": [
"65000:13",
"65000:14"
],
"interface": [
"\n Vl190 Vl193 Lo10\n Vl85 Vl194 Vl19\n Vl191 Te7/3.194\n",
null
]
},
"XYzzz0-1-9": {
"export_rt": [
"65000:100"
],
"import_rt": [
"65000:100"
],
"interface": [
"\n Vl777 Gi7/3.30\n",
null
]
}
},
"vrf_nested_values": {
"ABC": {
"export_rt": [
"65000:12"
],
"import_rt": [
"65000:12"
],
"interface": [
"\n Te7/3.16\n",
null
]
},
"Def": {
"export_rt": [
"65000:13",
"65000:120",
"65000:130",
"123:123"
],
"import_rt": [
"65000:13",
"65000:14"
],
"interface": [
"\n Vl190 Vl193 Lo10\n Vl85 Vl194 Vl19\n Vl191 Te7/3.194\n",
null
]
},
"XYzzz0-1-9": {
"export_rt": [
"65000:100"
],
"import_rt": [
"65000:100"
],
"interface": [
"\n Vl777 Gi7/3.30\n",
null
]
}
}
},
"changed": false,
"included": [
"/Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/../parser_templates/cli/show_ip_vrf_detail.1.yaml"
]
}
TASK [debug] *****************************************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:42
ok: [localhost] => {
"facts": {
"ip_bgp_summary": {
"10.1.19.2": {
"asn": 1234,
"ip_version": 4,
"state_pfxrcd": "Active",
"timer": "00:00:30"
},
"10.15.17.2": {
"asn": 64785,
"ip_version": 4,
"state_pfxrcd": 1125,
"timer": "7w1d"
},
"172.31.3.17": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1641,
"timer": "7w1d"
},
"72.31.0.13": {
"asn": 65004,
"ip_version": 4,
"state_pfxrcd": "Idle",
"timer": "00:00:45"
},
"72.31.0.130": {
"asn": 65530,
"ip_version": 4,
"state_pfxrcd": 1644,
"timer": "10:32:44"
}
},
"ip_vrf_detail": {
"ABC": {
"description": "ABC VPN",
"export_rt": [
"65000:12"
],
"import_rt": [
"65000:12"
],
"interfaces": [
"\n Te7/3.16\n",
null
],
"name": "ABC",
"rd": "65000:12"
},
"Def": {
"description": "Def VPN",
"export_rt": [
"65000:13",
"65000:120",
"65000:130",
"123:123"
],
"import_rt": [
"65000:13",
"65000:14"
],
"interfaces": [
"\n Vl190 Vl193 Lo10\n Vl85 Vl194 Vl19\n Vl191 Te7/3.194\n",
null
],
"name": "Def",
"rd": "65000:13"
},
"XYzzz0-1-9": {
"description": "A random description",
"export_rt": [
"65000:100"
],
"import_rt": [
"65000:100"
],
"interfaces": [
"\n Vl777 Gi7/3.30\n",
null
],
"name": "XYzzz0-1-9",
"rd": "65111:100"
}
}
}
}
TASK [test `show ip vrf detail`] *********************************************************************************************************************
task path: /Users/4032956/Documents/network-automation/roles/LukeRussell.cisco_ios/tests/test.yml:45
fatal: [localhost]: FAILED! => {
"assertion": "facts['ip_vrf_detail']['Def']['interfaces'] == ['Vl190','Vl193','Lo10','Vl85','Vl194','Vl19','Vl191','Te7/3.194']",
"changed": false,
"evaluated_to": false
}
to retry, use: --limit @/Users/4032956/Documents/network-automation/retry/test.retry
PLAY RECAP *******************************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment