Adding Netbox

This commit is contained in:
Patrick Toal
2019-05-06 00:34:45 -04:00
parent 832502de34
commit 6e2205a046
278 changed files with 12767 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
---
# IOS providrs for handling acl parsing
#
- name: get output of command 'show ip access-list <id>'
cli_command:
command: show ip access-lists {{ acl_id }}
register: acl_out_buffer
- name: parse acl and validate. create flow info if acl does not have any discrepancy
parse_validate_acl:
show_acl_output_buffer: "{{ acl_out_buffer.stdout }}"
parser: "{{ role_path }}/parser_templates/net_operations/show_ip_access_list.yaml"
generated_flow_file: "{{ generated_flow_file }}"

View File

@@ -0,0 +1,29 @@
---
# IOS providrs for configuring sink before starting traffic test
- name: Configure an access list for catch-all permit
ios_config:
lines:
- permit ip any any log
parents: ip access-list extended ansible_sink
before: no ip access-list extended ansible_sink
register: result
- name: Attach ACl to sink interface
ios_config:
lines:
- ip access-group ansible_sink in
parents: interface {{ sink_capture_interface }}
- name: Configure Access-list log update interval (1 msec)
ios_config:
lines:
- ip access-list logging interval 1
- name: Clear the logs
ios_command:
commands:
- command: 'clear logging'
prompt: 'Clear logging buffer'
answer: "\r\n"
ignore_errors: true

View File

@@ -0,0 +1,32 @@
---
# IOS providrs for handling packet dict generation
#
- name: Delay 10 seconds for log file to be updated
wait_for: timeout=10
- name: Get logs from device
ios_command:
commands: "show logging"
register: result
- name: write logs to disk
copy:
contentr: "{{ result.stdout[0] }}"
dest: /tmp/ansible_acl_logs.txt
- name: parse logs file with help of textfsm
textfsm_parser:
content: "{{ lookup('file', '/tmp/ansible_acl_logs.txt') }}"
file: "{{role_path }}/parser_templates/net_operations/show_logs_acl_logs.yaml"
name: flows_dict
register: result
tags: textfsm
- name: write parsed packets info to disk
copy:
content: "{{ result.ansible_facts.flows_dict | to_nice_json }}"
dest: "{{ sink_path_flow_output }}"
- debug:
msg: "{{ result }}"
tags: debug