From b9859e4a5edc55936dfa01f5e9061e57122625fc Mon Sep 17 00:00:00 2001 From: Guillaume Mulocher Date: Wed, 16 Nov 2022 08:40:18 +0100 Subject: [PATCH] Feat(eos_cli_config_gen): Add flow tracking sampled support (#2270) --- .../documentation/devices/flow-tracking.md | 195 ++++++++++++++++++ .../intended/configs/flow-tracking.cfg | 53 +++++ .../inventory/host_vars/flow-tracking.yml | 62 ++++++ .../eos_cli_config_gen/inventory/hosts.ini | 1 + .../avd/roles/eos_cli_config_gen/README.md | 32 +++ .../docs/Input Variables.md | 50 +++++ .../eos_cli_config_gen.jsonschema.json | 136 ++++++++++++ .../schemas/eos_cli_config_gen.schema.yml | 89 ++++++++ .../flow_trackings.schema.yml | 92 +++++++++ .../templates/documentation/flow-trackings.j2 | 57 +++++ .../templates/eos-device-documentation.j2 | 2 + .../templates/eos-intended-config.j2 | 2 + .../templates/eos/ethernet-interfaces.j2 | 3 + .../templates/eos/flow-trackings.j2 | 43 ++++ .../templates/eos/port-channel-interfaces.j2 | 3 + 15 files changed, 820 insertions(+) create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/flow-tracking.md create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/flow-tracking.cfg create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/flow-tracking.yml create mode 100644 ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/flow_trackings.schema.yml create mode 100644 ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/flow-trackings.j2 create mode 100644 ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/flow-trackings.j2 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/flow-tracking.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/flow-tracking.md new file mode 100644 index 00000000000..2660a57383c --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/flow-tracking.md @@ -0,0 +1,195 @@ +# flow-tracking +# Table of Contents + +- [Management](#management) + - [Management Interfaces](#management-interfaces) +- [Authentication](#authentication) +- [Monitoring](#monitoring) + - [Flow Tracking](#flow-tracking) +- [Internal VLAN Allocation Policy](#internal-vlan-allocation-policy) + - [Internal VLAN Allocation Policy Summary](#internal-vlan-allocation-policy-summary) +- [Interfaces](#interfaces) + - [Ethernet Interfaces](#ethernet-interfaces) + - [Port-Channel Interfaces](#port-channel-interfaces) +- [Routing](#routing) + - [IP Routing](#ip-routing) + - [IPv6 Routing](#ipv6-routing) +- [Multicast](#multicast) +- [Filters](#filters) +- [ACL](#acl) +- [Quality Of Service](#quality-of-service) + +# Management + +## Management Interfaces + +### Management Interfaces Summary + +#### IPv4 + +| Management Interface | description | Type | VRF | IP Address | Gateway | +| -------------------- | ----------- | ---- | --- | ---------- | ------- | +| Management1 | oob_management | oob | MGMT | 10.73.255.122/24 | 10.73.255.2 | + +#### IPv6 + +| Management Interface | description | Type | VRF | IPv6 Address | IPv6 Gateway | +| -------------------- | ----------- | ---- | --- | ------------ | ------------ | +| Management1 | oob_management | oob | MGMT | - | - | + +### Management Interfaces Device Configuration + +```eos +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +``` + +# Authentication + +# Monitoring + +## Flow Tracking + +### Flow Tracking Sampled + +Sample: 666 + +#### Trackers Summary + +| Tracker Name | Record Export On Inactive Timeout | Record Export On Interval | MPLS | Number of Exporters | Applied On | +| ------------ | --------------------------------- | ------------------------- | ---- | ------------------- | ---------- | +| T1 | 3666 | 5666 | True | 0 | | +| T2 | - | - | False | 1 | Ethernet40 | +| T3 | - | - | - | 4 | Ethernet41
Ethernet42
Port-Channel42 | + +#### Exporters Summary + +| Tracker Name | Exporter Name | Collector IP/Host | Collector Port | Local Interface | +| ------------ | ------------- | ----------------- | -------------- | --------------- | +| T2 | T2-E1 | - | - | No local interface | +| T3 | T3-E1 | - | - | No local interface | +| T3 | T3-E2 | - | - | No local interface | +| T3 | T3-E3 | - | - | Management1 | +| T3 | T3-E4 | - | - | No local interface | + +### Flow Tracking Configuration + +```eos +! +flow tracking sampled + sample 666 + tracker T1 + record export on inactive timeout 3666 + record export on interval 5666 + record export mpls + tracker T2 + exporter T2-E1 + collector 42.42.42.42 + tracker T3 + exporter T3-E1 + exporter T3-E2 + collector 10.10.10.10 port 777 + exporter T3-E3 + collector this.is.my.awesome.collector.dns.name port 888 + format ipfix version 10 + local interface Management1 + template interval 424242 + exporter T3-E4 + collector dead:beef::cafe + no shutdown +``` + +# Internal VLAN Allocation Policy + +## Internal VLAN Allocation Policy Summary + +**Default Allocation Policy** + +| Policy Allocation | Range Beginning | Range Ending | +| ------------------| --------------- | ------------ | +| ascending | 1006 | 4094 | + +# Interfaces + +## Ethernet Interfaces + +### Ethernet Interfaces Summary + +#### L2 + +| Interface | Description | Mode | VLANs | Native VLAN | Trunk Group | Channel-Group | +| --------- | ----------- | ---- | ----- | ----------- | ----------- | ------------- | +| Ethernet40 | - | access | - | - | - | - | +| Ethernet41 | - | access | - | - | - | - | +| Ethernet42 | - | access | - | - | - | - | + +*Inherited from Port-Channel Interface + +### Ethernet Interfaces Device Configuration + +```eos +! +interface Ethernet40 + switchport + flow tracker sampled T2 +! +interface Ethernet41 + switchport + flow tracker sampled T3 +! +interface Ethernet42 + switchport + flow tracker sampled T3 +``` + +## Port-Channel Interfaces + +### Port-Channel Interfaces Summary + +#### L2 + +| Interface | Description | Type | Mode | VLANs | Native VLAN | Trunk Group | LACP Fallback Timeout | LACP Fallback Mode | MLAG ID | EVPN ESI | +| --------- | ----------- | ---- | ---- | ----- | ----------- | ------------| --------------------- | ------------------ | ------- | -------- | +| Port-Channel42 | - | switched | access | - | - | - | - | - | - | - | + +### Port-Channel Interfaces Device Configuration + +```eos +! +interface Port-Channel42 + switchport + flow tracker sampled T3 +``` + +# Routing + +## IP Routing + +### IP Routing Summary + +| VRF | Routing Enabled | +| --- | --------------- | +| default | False | + +### IP Routing Device Configuration + +```eos +``` +## IPv6 Routing + +### IPv6 Routing Summary + +| VRF | Routing Enabled | +| --- | --------------- | +| default | False | + +# Multicast + +# Filters + +# ACL + +# Quality Of Service diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/flow-tracking.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/flow-tracking.cfg new file mode 100644 index 00000000000..e6fa7cdaf22 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/flow-tracking.cfg @@ -0,0 +1,53 @@ +!RANCID-CONTENT-TYPE: arista +! +flow tracking sampled + sample 666 + tracker T1 + record export on inactive timeout 3666 + record export on interval 5666 + record export mpls + tracker T2 + exporter T2-E1 + collector 42.42.42.42 + tracker T3 + exporter T3-E1 + exporter T3-E2 + collector 10.10.10.10 port 777 + exporter T3-E3 + collector this.is.my.awesome.collector.dns.name port 888 + format ipfix version 10 + local interface Management1 + template interval 424242 + exporter T3-E4 + collector dead:beef::cafe + no shutdown +! +transceiver qsfp default-mode 4x10G +! +hostname flow-tracking +! +no enable password +no aaa root +! +interface Port-Channel42 + switchport + flow tracker sampled T3 +! +interface Ethernet40 + switchport + flow tracker sampled T2 +! +interface Ethernet41 + switchport + flow tracker sampled T3 +! +interface Ethernet42 + switchport + flow tracker sampled T3 +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +! +end diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/flow-tracking.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/flow-tracking.yml new file mode 100644 index 00000000000..68758e565e3 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/flow-tracking.yml @@ -0,0 +1,62 @@ +--- +### Flow Tracking + +flow_trackings: + - type: sampled + sample: 666 + trackers: + - name: T1 + record_export: + on_inactive_timeout: 3666 + on_interval: 5666 + mpls: true + # no exporter + - name: T2 + record_export: + # Should not be rendered + mpls: false + # one exporter + exporters: + - name: T2-E1 + collector: + host: 42.42.42.42 + # no port + - name: T3 + # two exporters + exporters: + - name: T3-E1 + collector: + # only port - should not be rendered + port: 666 + - name: T3-E2 + collector: + host: 10.10.10.10 + port: 777 + - name: T3-E3 + collector: + host: this.is.my.awesome.collector.dns.name + port: 888 + format: + ipfix_version: 10 + local_interface: Management1 + template_interval: 424242 + - name: T3-E4 + collector: + host: dead:beef::cafe + shutdown: false + +ethernet_interfaces: + Ethernet40: + flow_tracker: + sampled: T2 + Ethernet41: + flow_tracker: + sampled: T3 + Ethernet42: + flow_tracker: + sampled: T3 + +port_channel_interfaces: + Port-Channel42: + flow_tracker: + sampled: T3 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini index 664dd8b471e..a4b46d98cbc 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini @@ -21,6 +21,7 @@ errdisable ethernet-interfaces event-handlers event-monitor +flow-tracking generate_device_documentation generate-default-config groups diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README.md index b3d055ec6a9..fd6c2582810 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README.md @@ -704,6 +704,32 @@ as_path: origin: < "any" | "egp" | "igp" | "incomplete" | default -> "any" > ``` +### Flow Tracking + +```yaml +flow_trackings: + # Only 'sampled' is supported for type + - type: < "sampled" > + sample: < 1-4294967295 > + trackers: + - name: < tracker_name > + record_export: + on_inactive_timeout: < 3000-900000 > + on_interval: < 1000-36000000 > + mpls: < true | false > + exporters: + - name: < exporter_name > + collector: + host: < collector_ip_or_hostname > + port: < 1-65535 > + format: + # Note that platforms only support 10 today + ipfix_version: < ipfix_version as integer > + local_interface: < local_interface_name > + template_interval: < 5000-3600000 > + shutdown: < true | false > +``` + ### Generate Device Documentation ```yaml @@ -808,6 +834,8 @@ ethernet_interfaces: type: < routed | switched | l3dot1q | l2dot1q > snmp_trap_link_change: < true | false > vrf: < vrf_name > + flow_tracker: + sampled: < flow_tracker_name > error_correction_encoding: enabled: < true | false | default -> true > fire_code: < true | false > @@ -976,6 +1004,8 @@ ethernet_interfaces: - < trunk_group_name_2 > l2_protocol: encapsulation_dot1q_vlan: < vlan number > + flow_tracker: + sampled: < flow_tracker_name > error_correction_encoding: enabled: < true | false | default -> true > fire_code: < true | false > @@ -1203,6 +1233,8 @@ port_channel_interfaces: vlan: < 1-4094 > l2_protocol: encapsulation_dot1q_vlan: < vlan number > + flow_tracker: + sampled: < flow_tracker_name > mtu: < mtu > mlag: < mlag_id > trunk_groups: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/Input Variables.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/Input Variables.md index c330371821f..c0254dc9423 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/Input Variables.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/Input Variables.md @@ -835,6 +835,56 @@ event_monitor: enabled: ``` +## Flow Trackings + +### Variables + +| Variable | Type | Required | Default | Value Restrictions | Description | +| -------- | ---- | -------- | ------- | ------------------ | ----------- | +| [flow_trackings](## "flow_trackings") | List, items: Dictionary | | | | | +| [  - type](## "flow_trackings.[].type") | String | Required, Unique | | Valid Values:
- sampled | Flow Tracking Type - only 'sampled' supported for now | +| [    sample](## "flow_trackings.[].sample") | Integer | | | Min: 1
Max: 4294967295 | | +| [    trackers](## "flow_trackings.[].trackers") | List, items: Dictionary | | | | | +| [      - name](## "flow_trackings.[].trackers.[].name") | String | Required, Unique | | | Tracker Name | +| [        record_export](## "flow_trackings.[].trackers.[].record_export") | Dictionary | | | | | +| [          on_inactive_timeout](## "flow_trackings.[].trackers.[].record_export.on_inactive_timeout") | Integer | | | Min: 3000
Max: 900000 | Flow record inactive export timeout in milliseconds | +| [          on_interval](## "flow_trackings.[].trackers.[].record_export.on_interval") | Integer | | | Min: 1000
Max: 36000000 | Flow record export interval in milliseconds | +| [          mpls](## "flow_trackings.[].trackers.[].record_export.mpls") | Boolean | | | | Export MPLS forwarding information | +| [        exporters](## "flow_trackings.[].trackers.[].exporters") | List, items: Dictionary | | | | | +| [          - name](## "flow_trackings.[].trackers.[].exporters.[].name") | String | Required, Unique | | | Exporter Name | +| [            collector](## "flow_trackings.[].trackers.[].exporters.[].collector") | Dictionary | | | | | +| [              host](## "flow_trackings.[].trackers.[].exporters.[].collector.host") | String | | | | Collector IPv4 address or IPv6 address or fully qualified domain name | +| [              port](## "flow_trackings.[].trackers.[].exporters.[].collector.port") | Integer | | | Min: 1
Max: 65535 | Collector Port Number | +| [            format](## "flow_trackings.[].trackers.[].exporters.[].format") | Dictionary | | | | | +| [              ipfix_version](## "flow_trackings.[].trackers.[].exporters.[].format.ipfix_version") | Integer | | | | | +| [            local_interface](## "flow_trackings.[].trackers.[].exporters.[].local_interface") | String | | | | Local Source Interface | +| [            template_interval](## "flow_trackings.[].trackers.[].exporters.[].template_interval") | Integer | | | Min: 5000
Max: 3600000 | Template interval in milliseconds | +| [    shutdown](## "flow_trackings.[].shutdown") | Boolean | | False | | | + +### YAML + +```yaml +flow_trackings: + - type: + sample: + trackers: + - name: + record_export: + on_inactive_timeout: + on_interval: + mpls: + exporters: + - name: + collector: + host: + port: + format: + ipfix_version: + local_interface: + template_interval: + shutdown: +``` + ## Generate Default Config ### Description diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json index cfadf9b8106..8504beaab2a 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json @@ -1308,6 +1308,142 @@ "additionalProperties": false, "title": "Event Monitor" }, + "flow_trackings": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "sampled" + ], + "description": "Flow Tracking Type - only 'sampled' supported for now", + "title": "Type" + }, + "sample": { + "type": "integer", + "minimum": 1, + "maximum": 4294967295, + "title": "Sample" + }, + "trackers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Tracker Name", + "title": "Name" + }, + "record_export": { + "type": "object", + "properties": { + "on_inactive_timeout": { + "type": "integer", + "minimum": 3000, + "maximum": 900000, + "description": "Flow record inactive export timeout in milliseconds", + "title": "On Inactive Timeout" + }, + "on_interval": { + "type": "integer", + "minimum": 1000, + "maximum": 36000000, + "description": "Flow record export interval in milliseconds", + "title": "On Interval" + }, + "mpls": { + "type": "boolean", + "description": "Export MPLS forwarding information", + "title": "MPLS" + } + }, + "additionalProperties": false, + "title": "Record Export" + }, + "exporters": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Exporter Name", + "title": "Name" + }, + "collector": { + "type": "object", + "properties": { + "host": { + "type": "string", + "description": "Collector IPv4 address or IPv6 address or fully qualified domain name", + "title": "Host" + }, + "port": { + "type": "integer", + "description": "Collector Port Number", + "minimum": 1, + "maximum": 65535, + "title": "Port" + } + }, + "additionalProperties": false, + "title": "Collector" + }, + "format": { + "type": "object", + "properties": { + "ipfix_version": { + "type": "integer", + "title": "Ipfix Version" + } + }, + "additionalProperties": false, + "title": "Format" + }, + "local_interface": { + "type": "string", + "description": "Local Source Interface", + "title": "Local Interface" + }, + "template_interval": { + "type": "integer", + "minimum": 5000, + "maximum": 3600000, + "description": "Template interval in milliseconds", + "title": "Template Interval" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "title": "Exporters" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "title": "Trackers" + }, + "shutdown": { + "type": "boolean", + "default": false, + "title": "Shutdown" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "title": "Flow Trackings" + }, "generate_default_config": { "type": "boolean", "default": true, diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml index ef75359a8e9..3eed340715f 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml @@ -1026,6 +1026,95 @@ keys: keys: enabled: type: bool + flow_trackings: + type: list + primary_key: type + items: + type: dict + keys: + type: + type: str + valid_values: + - sampled + description: Flow Tracking Type - only 'sampled' supported for now + sample: + type: int + convert_types: + - str + min: 1 + max: 4294967295 + trackers: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + description: Tracker Name + record_export: + type: dict + keys: + on_inactive_timeout: + type: int + convert_types: + - str + min: 3000 + max: 900000 + description: Flow record inactive export timeout in milliseconds + on_interval: + type: int + convert_types: + - str + min: 1000 + max: 36000000 + description: Flow record export interval in milliseconds + mpls: + type: bool + description: Export MPLS forwarding information + exporters: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + description: Exporter Name + collector: + type: dict + keys: + host: + type: str + description: Collector IPv4 address or IPv6 address or fully + qualified domain name + port: + type: int + description: Collector Port Number + min: 1 + max: 65535 + convert_types: + - str + format: + type: dict + keys: + ipfix_version: + type: int + convert_types: + - str + local_interface: + type: str + description: Local Source Interface + template_interval: + type: int + convert_types: + - str + min: 5000 + max: 3600000 + description: Template interval in milliseconds + shutdown: + type: bool + default: false generate_default_config: type: bool default: true diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/flow_trackings.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/flow_trackings.schema.yml new file mode 100644 index 00000000000..a468a775ee2 --- /dev/null +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/flow_trackings.schema.yml @@ -0,0 +1,92 @@ +# yaml-language-server: $schema=../../../../plugins/plugin_utils/schema/avd_meta_schema.json +# Line above is used by RedHat's YAML Schema vscode extension +# Use Ctrl + Space to get suggestions for every field. Autocomplete will pop up after typing 2 letters. +type: dict +keys: + flow_trackings: + type: list + primary_key: type + items: + type: dict + keys: + type: + type: str + valid_values: ['sampled'] + description: Flow Tracking Type - only 'sampled' supported for now + sample: + type: int + convert_types: + - str + min: 1 + max: 4294967295 + trackers: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + description: Tracker Name + record_export: + type: dict + keys: + on_inactive_timeout: + type: int + convert_types: + - str + min: 3000 + max: 900000 + description: Flow record inactive export timeout in milliseconds + on_interval: + type: int + convert_types: + - str + min: 1000 + max: 36000000 + description: Flow record export interval in milliseconds + mpls: + type: bool + description: Export MPLS forwarding information + exporters: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + description: Exporter Name + collector: + type: dict + keys: + host: + type: str + description: Collector IPv4 address or IPv6 address or fully qualified domain name + port: + type: int + description: Collector Port Number + min: 1 + max: 65535 + convert_types: + - str + format: + type: dict + keys: + ipfix_version: + type: int + convert_types: + - str + local_interface: + type: str + description: Local Source Interface + template_interval: + type: int + convert_types: + - str + min: 5000 + max: 3600000 + description: Template interval in milliseconds + shutdown: + type: bool + default: false diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/flow-trackings.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/flow-trackings.j2 new file mode 100644 index 00000000000..bab55a48cbf --- /dev/null +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/flow-trackings.j2 @@ -0,0 +1,57 @@ +{# Flow Tracking #} +{% if flow_trackings is arista.avd.defined %} + +## Flow Tracking +{% for flow_tracking in flow_trackings %} +{% if flow_tracking.type == "sampled" %} + +### Flow Tracking Sampled + +Sample: {{ flow_tracking.sample | arista.avd.default("default") }} +{% if flow_tracking.trackers is arista.avd.defined %} + +#### Trackers Summary + +| Tracker Name | Record Export On Inactive Timeout | Record Export On Interval | MPLS | Number of Exporters | Applied On | +| ------------ | --------------------------------- | ------------------------- | ---- | ------------------- | ---------- | +{% for tracker in flow_tracking.trackers | arista.avd.natural_sort('name') %} +{% set on_inactive_timeout = tracker.record_export.on_inactive_timeout | arista.avd.default("-") %} +{% set on_interval = tracker.record_export.on_interval | arista.avd.default("-") %} +{% set mpls = tracker.record_export.mpls | arista.avd.default("-") %} +{% set count_exporter = tracker.exporters | arista.avd.default([]) | length %} +{% set applied_on = [] %} +{% for ethernet_interface in ethernet_interfaces | arista.avd.convert_dicts('name') %} +{% if ethernet_interface.flow_tracker.sampled is arista.avd.defined(tracker.name) %} +{% do applied_on.append(ethernet_interface.name) %} +{% endif %} +{% endfor %} +{% for port_channel_interface in port_channel_interfaces | arista.avd.convert_dicts('name') %} +{% if port_channel_interface.flow_tracker.sampled is arista.avd.defined(tracker.name) %} +{% do applied_on.append(port_channel_interface.name) %} +{% endif %} +{% endfor %} +| {{ tracker.name }} | {{ on_inactive_timeout }} | {{ on_interval }} | {{ mpls }} | {{ count_exporter }} | {{ applied_on | join("
") }} | +{% endfor %} + +#### Exporters Summary + +| Tracker Name | Exporter Name | Collector IP/Host | Collector Port | Local Interface | +| ------------ | ------------- | ----------------- | -------------- | --------------- | +{% for tracker in flow_tracking.trackers | arista.avd.natural_sort('name') %} +{% for exporter in tracker.exporters | arista.avd.natural_sort('name') %} +{% set host = exporter.host | arista.avd.default("-") %} +{% set port = exporter.port | arista.avd.default("-") %} +{% set local_interface = exporter.local_interface | arista.avd.default("No local interface") %} +| {{ tracker.name }} | {{ exporter.name }} | {{ host }} | {{ port }} | {{ local_interface }} | +{% endfor %} +{% endfor %} +{% endif %} +{% endif %} +{% endfor %} + +### Flow Tracking Configuration + +```eos +{% include 'eos/flow-trackings.j2' %} +``` +{% endif %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-device-documentation.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-device-documentation.j2 index e047d15a067..5bd65d1a049 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-device-documentation.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-device-documentation.j2 @@ -102,6 +102,8 @@ {% include 'documentation/vmtracer-sessions.j2' %} {## Event Handler #} {% include 'documentation/event-handler.j2' %} +{## Flow Tracking #} +{% include 'documentation/flow-trackings.j2' %} {## Object Tracking #} {% include 'documentation/object-tracking.j2' %} {# Monitor Connectivity #} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-intended-config.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-intended-config.j2 index b5e1f7c95e5..24e18201d05 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-intended-config.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos-intended-config.j2 @@ -28,6 +28,8 @@ {% include 'eos/ip-igmp-snooping.j2' %} {# event monitor #} {% include 'eos/event-monitor.j2' %} +{# flow tracking #} +{% include 'eos/flow-trackings.j2' %} {# load-interval #} {% include 'eos/load-interval.j2' %} {# interface defaults #} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/ethernet-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/ethernet-interfaces.j2 index c594fd93e65..01229d55f64 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/ethernet-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/ethernet-interfaces.j2 @@ -159,6 +159,9 @@ interface {{ ethernet_interface.name }} {% if ethernet_interface.l2_protocol.encapsulation_dot1q_vlan is arista.avd.defined %} l2-protocol encapsulation dot1q vlan {{ ethernet_interface.l2_protocol.encapsulation_dot1q_vlan }} {% endif %} +{% if ethernet_interface.flow_tracker.sampled is arista.avd.defined %} + flow tracker sampled {{ ethernet_interface.flow_tracker.sampled }} +{% endif %} {% if ethernet_interface.evpn_ethernet_segment is arista.avd.defined %} evpn ethernet-segment {% if ethernet_interface.evpn_ethernet_segment.identifier is arista.avd.defined %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/flow-trackings.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/flow-trackings.j2 new file mode 100644 index 00000000000..9f526fa3d4a --- /dev/null +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/flow-trackings.j2 @@ -0,0 +1,43 @@ +{% for flow_tracking in flow_trackings | arista.avd.default([]) %} +! +flow tracking {{ flow_tracking.type }} +{% if flow_tracking.sample is arista.avd.defined %} + sample {{ flow_tracking.sample }} +{% endif %} +{% for tracker in flow_tracking.trackers %} + tracker {{ tracker.name }} +{% if tracker.record_export.on_inactive_timeout is arista.avd.defined %} + record export on inactive timeout {{ tracker.record_export.on_inactive_timeout }} +{% endif %} +{% if tracker.record_export.on_interval is arista.avd.defined %} + record export on interval {{ tracker.record_export.on_interval }} +{% endif %} +{% if tracker.record_export.mpls is arista.avd.defined(true) %} + record export mpls +{% endif %} +{% if tracker.exporters is arista.avd.defined %} +{% for exporter in tracker.exporters %} + exporter {{ exporter.name }} +{% if exporter.collector.host is arista.avd.defined %} +{% set collector_cli = 'collector ' ~ exporter.collector.host %} +{% if exporter.collector.port is arista.avd.defined %} +{% set collector_cli = collector_cli ~ ' port ' ~ exporter.collector.port %} +{% endif %} + {{ collector_cli }} +{% endif %} +{% if exporter.format.ipfix_version is arista.avd.defined %} + format ipfix version {{ exporter.format.ipfix_version }} +{% endif %} +{% if exporter.local_interface is arista.avd.defined %} + local interface {{ exporter.local_interface }} +{% endif %} +{% if exporter.template_interval is arista.avd.defined %} + template interval {{ exporter.template_interval }} +{% endif %} +{% endfor %} +{% endif %} +{% endfor %} +{% if flow_tracking.shutdown is arista.avd.defined(false) %} + no shutdown +{% endif %} +{% endfor %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 index 547469194a7..775de4cc1f7 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 @@ -98,6 +98,9 @@ interface {{ port_channel_interface.name }} {% if port_channel_interface.l2_protocol.encapsulation_dot1q_vlan is arista.avd.defined %} l2-protocol encapsulation dot1q vlan {{ port_channel_interface.l2_protocol.encapsulation_dot1q_vlan }} {% endif %} +{% if port_channel_interface.flow_tracker.sampled is arista.avd.defined %} + flow tracker sampled {{ port_channel_interface.flow_tracker.sampled }} +{% endif %} {% if port_channel_interface.evpn_ethernet_segment.identifier | arista.avd.default(port_channel_interface.esi) is arista.avd.defined or port_channel_interface.evpn_ethernet_segment is arista.avd.defined %} evpn ethernet-segment {% if port_channel_interface.evpn_ethernet_segment.identifier | arista.avd.default(port_channel_interface.esi) is arista.avd.defined %}