Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test fail in new image #355

Merged
merged 1 commit into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/library/bgp_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def collect_data(self, command_str):
Collect bgp information by reading output of 'vtysh' command line tool
"""
try:
rc, self.out, err = self.module.run_command('vtysh -c "show ip bgp ' + command_str + '"',
rc, self.out, err = self.module.run_command('docker exec -i bgp vtysh -c "show ip bgp ' + command_str + '"',
executable='/bin/bash', use_unsafe_shell=True)
except Exception as e:
self.module.fail_json(msg=str(e))
Expand Down
8 changes: 4 additions & 4 deletions ansible/library/bgp_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ def main():

if prefix:
if regex_ipv4.match(prefix):
command = "vtysh -c 'show ip bgp " + str(prefix) + "'"
command = "docker exec -i bgp vtysh -c 'show ip bgp " + str(prefix) + "'"
else:
command = "vtysh -c 'show ipv6 bgp " + str(prefix) + "'"
command = "docker exec -i bgp vtysh -c 'show ipv6 bgp " + str(prefix) + "'"
rc, out, err = module.run_command(command)
if rc != 0:
err_message = "command %s failed rc=%d, out=%s, err=%s" %(command, rt, out, err)
Expand All @@ -334,9 +334,9 @@ def main():

elif neighbor:
if netaddr.valid_ipv4(neighbor):
command = "vtysh -c 'show ip bgp neighbor " + str(neighbor) + " " + str(direction) + "'"
command = "docker exec -i bgp vtysh -c 'show ip bgp neighbor " + str(neighbor) + " " + str(direction) + "'"
else:
command = "vtysh -c 'show ipv6 bgp neighbor " + str(neighbor) + " " + str(direction) + "'"
command = "docker exec -i bgp vtysh -c 'show ipv6 bgp neighbor " + str(neighbor) + " " + str(direction) + "'"
rc, out, err = module.run_command(command)
if rc != 0:
err_message = "command %s failed rc=%d, out=%s, err=%s" %(command, rt, out, err)
Expand Down
6 changes: 5 additions & 1 deletion ansible/library/interface_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,12 @@ def parse_ip_output(module, output, secondary=False):

down_ports = []
for name in up_ports:
if not interfaces[name]['link']:
try:
if not interfaces[name]['link']:
down_ports += [name]
except:
down_ports += [name]
pass

results['ansible_interface_facts'] = interfaces
results['ansible_interface_ips'] = ips
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/test/tasks/interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
when: ansible_interface_link_down_ports | length > 0

- name: Verify interfaces are up correctly
assert: { that: "{{ ansible_interface_link_down_ports }}|length == 0" }
assert: { that: "{{ ansible_interface_link_down_ports | length }} == 0" }

- name: Verify port channel interfaces are up correctly
assert: { that: "'{{ ansible_interface_facts[item]['active'] }}' == 'True'" }
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/test/tasks/link_flap/link_flap_helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
when: ansible_interface_link_down_ports | length > 0

- name: Verify interfaces are up correctly
assert: { that: "{{ ansible_interface_link_down_ports }}|length == 0" }
assert: { that: "{{ ansible_interface_link_down_ports | length }} == 0" }

- name: Verify {{intfs_to_exclude}} is down correctly
assert: { that: "'{{ ansible_interface_facts[intfs_to_exclude]['active'] }}' == 'False'" }
Expand Down