Skip to content

Commit

Permalink
[ACL] enable ACL FC when genereting config from minigraph but disable…
Browse files Browse the repository at this point in the history
… by default (#8908)

* [ACL] enable ACL FC when genereting config from minigraph but disable by default
Why I did it
To support ACL counters on Flex Counter Infrastructure.

How I did it
Enable ACL FC in init_cfg and minigraph. Disable when genereting configuration from preset.

How to verify it
Together with depends PRs. Run ACL/Everflow test suite.

Signed-off-by: Stepan Blyshchak <[email protected]>
  • Loading branch information
stepanblyschak authored Nov 11, 2021
1 parent 5f11eb3 commit a2c2d67
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 4 deletions.
1 change: 1 addition & 0 deletions dockers/docker-orchagent/enable_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def enable_counters():
enable_counter_group(db, 'QUEUE_WATERMARK')
enable_counter_group(db, 'BUFFER_POOL_WATERMARK')
enable_counter_group(db, 'PORT_BUFFER_DROP')
enable_counter_group(db, 'ACL')
enable_rates()


Expand Down
7 changes: 7 additions & 0 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
{% endfor %}
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "enable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
},
{%- set features = [("bgp", "enabled", false, "enabled"),
("database", "always_enabled", false, "always_enabled"),
("lldp", "enabled", false, "enabled"),
Expand Down
11 changes: 11 additions & 0 deletions src/sonic-config-engine/config_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
else:
UNICODE_TYPE = unicode

def generate_common_config(data):
data['FLEX_COUNTER_TABLE'] = {
'ACL': {
'FLEX_COUNTER_STATUS': 'disable',
'FLEX_COUNTER_DELAY_STATUS': 'true',
'POLL_INTERVAL': '10000'
}
}
return data

# The following config generation methods exits:
# 't1': generate_t1_sample_config,
# 'l2': generate_l2_config,
Expand Down Expand Up @@ -160,5 +170,6 @@ def get_available_config():
return list(_sample_generators.keys())

def generate_sample_config(data, setting_name):
data = generate_common_config(data)
return _sample_generators[setting_name.lower()](data)

11 changes: 9 additions & 2 deletions src/sonic-config-engine/data/l1intf.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"DEVICE_METADATA": {
"localhost" : {
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
},
{% set ns = {'firstPrinted': False} -%}
"PORT": {
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-config-engine/data/l2switch.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"DEVICE_METADATA": {{ DEVICE_METADATA | tojson }},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
},
{% set ns = {'firstPrinted': False} -%}
"PORT": {
{%- for key, value in PORT.items() -%}
Expand Down
11 changes: 9 additions & 2 deletions src/sonic-config-engine/data/l3intf.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"DEVICE_METADATA": {
"localhost" : {
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
"hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
},
{% set ns = {'firstPrinted': False} -%}
"PORT": {
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py2/l1_intfs.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,12 @@
"mtu": "9100",
"speed": "100000"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py2/l2switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,12 @@
"Vlan1000|Ethernet24": {
"tagging_mode": "untagged"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -643,5 +643,12 @@
"server_ipv6": "fc02:1000::19/128",
"state": "auto"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py2/l3_intfs.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,12 @@
"Ethernet29": {},
"Ethernet30": {},
"Ethernet31": {}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py3/l1_intfs.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,12 @@
"mtu": "9100",
"speed": "100000"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py3/l2switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,12 @@
"Vlan1000|Ethernet124": {
"tagging_mode": "untagged"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -643,5 +643,12 @@
"server_ipv6": "fc02:1000::19/128",
"state": "auto"
}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/sample_output/py3/l3_intfs.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,12 @@
"Ethernet29": {},
"Ethernet30": {},
"Ethernet31": {}
},
"FLEX_COUNTER_TABLE": {
"ACL": {
"FLEX_COUNTER_STATUS": "disable",
"FLEX_COUNTER_DELAY_STATUS": "true",
"POLL_INTERVAL": "10000"
}
}
}

0 comments on commit a2c2d67

Please sign in to comment.