-
Notifications
You must be signed in to change notification settings - Fork 233
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
Feat(eos_cli_config_gen): Add match dscp and ecn support to class map type qos #4863
base: devel
Are you sure you want to change the base?
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4863
# Activate the virtual environment
source test-avd-pr-4863/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@match_dscp_4756#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/Vibhu-gslab/avd.git#/ansible_collections/arista/avd/,match_dscp_4756 --force
# Optional: Install AVD examples
cd test-avd-pr-4863
ansible-playbook arista.avd.install_examples |
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
acd1efc
to
9a20ea1
Compare
8bb48db
to
399df90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Show resolved
Hide resolved
8c53c58
to
ed0354e
Compare
0742e05
to
f6221cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
e5a44f8
to
cde98c1
Compare
| DSCP_TEST_1 | dscp | af11 | | ||
| DSCP_TEST_2 | dscp | 2-4, 6 | | ||
| DSCP_TEST_3 | dscp | cs0 | | ||
| DSCP_TEST_4 | dscp | ef | | ||
| DSCP_TEST_5 | ecn | ce | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected to see dscp + ecn on some of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplest is to put them on the same line, but it may not look perfect as we accept DSCP ranges with whitespaces which makes it a bit harder (see line 2) to separate visually DSCP from ECN (although still clear as ECN is always alphabetic)
#### QOS Class Maps Summary
| Name | Field | Value |
| ---- | ----- | ----- |
| DSCP_TEST_1 | dscp ecn | af11 ect-ce |
| DSCP_TEST_2 | dscp ecn | 2-4, 6 non-ect |
| DSCP_TEST_3 | dscp | cs0 |
| DSCP_TEST_4 | dscp ecn | ef ce |
| DSCP_TEST_5 | ecn | ce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I have kept "+", will change if we decide otherwise.
- non-ect (matches 00). | ||
- ect (matches 01 an 10). | ||
- ce (matches 11). | ||
- ect-ce (matches 01, 10 and 11). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the EOS help, which seems easier to follow:
smv030(config-s-claus-cmap-qos-claus)#match dscp af11 ecn ?
ce ECN codepoint CE
ect ECN codepoint ECT(0) or ECT(1)
ect-ce ECN codepoint ECT(0), ECT(1) or CE
non-ect ECN codepoint Not-ECT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like explicitly describing actual binary values associated with each usecase is easier to read than default abstracted EoS terms (like ECT(0)
which is actually a decimal value of 1 (binary 01) or ECT(1)
which is 2 (10) ).
If we don't want to provide this additional info - we can probably just skip this detailed description as it would just be repeating what EoS is already exposing.
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/class_maps.schema.yml
Outdated
Show resolved
Hide resolved
@@ -23,6 +23,12 @@ | |||
{% elif class_map.ip.access_group is arista.avd.defined %} | |||
{% set row.type = 'acl' %} | |||
{% set row.value = class_map.ip.access_group %} | |||
{% elif class_map.dscp is arista.avd.defined %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this would be simpler implemented by just checking for the var and print out the line directly. You can then do elif on all the first ones and then nest dscp and ecn under an else
block and check those with a regular if
inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
..._collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/class-maps.yml
Outdated
Show resolved
Hide resolved
078113e
to
2ffbb41
Compare
00dd03e
to
b829f48
Compare
b829f48
to
a97a49a
Compare
…entory/host_vars/host1/class-maps.yml Co-authored-by: Alexey Gorbunov <[email protected]>
Co-authored-by: Alexey Gorbunov <[email protected]>
…lass_maps.schema.yml Co-authored-by: Claus Holbech <[email protected]>
…lass_maps.schema.yml Co-authored-by: Claus Holbech <[email protected]>
for more information, see https://pre-commit.ci
a97a49a
to
8cfe086
Compare
{ | ||
"name": "avd", | ||
"lockfileVersion": 3, | ||
"requires": true, | ||
"packages": {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NPM? Is this file relevant to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, removed it.
Thanks, I missed it somehow.
@@ -15,19 +15,22 @@ | |||
{% for class_map in class_maps.qos | arista.avd.natural_sort('name') %} | |||
{% set row = namespace() %} | |||
{% if class_map.cos is arista.avd.defined %} | |||
{% set row.type = 'cos' %} | |||
{% set row.value = class_map.cos %} | |||
| {{ class_map.name }} | cos | {{ class_map.cos }} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this row
namespace is not use anymore and can be removed
{% set row = namespace() %}
Change Summary
the current AVD data model does not contain the capability to match class-maps type qos to dscp and ecn.
other options like vlan, cos and ip are available
Related Issue(s)
Fixes #4756
Component(s) name
arista.avd.eos_cli_config_gen
Proposed changes
Added schema and testcases
How to test
molecule run
Checklist
Repository Checklist