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

Remove sonic ports defaults #323

Closed
wants to merge 5 commits into from
Closed

Conversation

iljarotar
Copy link
Contributor

Additional Description

Currently, if the sonic_ports variable is defined the sonic role will require default values for fec, mtu and speed to be set. A more reasonable behavior, in my opinion, is to leave all settings of the running configuration in place, if no value was provided.

Breaking Change

`sonic_ports_default_mtu`, `sonic_ports_default_fec` and `sonic_ports_default_speed` are not used anymore. Each port requires and individual configuration.

@iljarotar iljarotar requested a review from a team as a code owner September 26, 2024 10:40
Copy link
Contributor

@robertvolkmann robertvolkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setting fec, mtu, and speed still tested?

Comment on lines 111 to 119
{% set port = sonic_ports_dict[name] %}
{% if (port is defined and port.speed is defined) or running_cfg.speed is defined %}
speed: "{{ (port | default({})).speed | default(running_cfg.speed) }}"
{% endif %}
{% if (port is defined and port.mtu is defined) or running_cfg.mtu is defined %}
mtu: "{{ (port | default({})).mtu | default(running_cfg.mtu) }}"
{% endif %}
{% if (port is defined and port.fec is defined) or running_cfg.fec is defined %}
fec: "{{ (port | default({})).fec | default(running_cfg.fec) }}"
Copy link
Contributor

@robertvolkmann robertvolkmann Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try?

Suggested change
{% set port = sonic_ports_dict[name] %}
{% if (port is defined and port.speed is defined) or running_cfg.speed is defined %}
speed: "{{ (port | default({})).speed | default(running_cfg.speed) }}"
{% endif %}
{% if (port is defined and port.mtu is defined) or running_cfg.mtu is defined %}
mtu: "{{ (port | default({})).mtu | default(running_cfg.mtu) }}"
{% endif %}
{% if (port is defined and port.fec is defined) or running_cfg.fec is defined %}
fec: "{{ (port | default({})).fec | default(running_cfg.fec) }}"
{% set port = sonic_ports_dict.get(name, {}) %}
{% if port.speed is defined or running_cfg.speed is defined %}
speed: "{{ port.speed | default(running_cfg.speed) }}"
{% endif %}
{% if port.mtu is defined or running_cfg.mtu is defined %}
mtu: "{{ port.mtu | default(running_cfg.mtu) }}"
{% endif %}
{% if port.fec is defined or running_cfg.fec is defined %}
fec: "{{ port.fec | default(running_cfg.fec) }}"

@@ -107,14 +107,16 @@ PORT:
{% if 'parent_port' in running_cfg %}
parent_port: {{ running_cfg.parent_port }}
{% endif %}
{% if sonic_ports_dict[name] is defined %}
{% set port = sonic_ports_dict[name] %}
admin_status: up
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why always setting admin_status to up? Why not similar to fec, mtu, and speed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could introduce another variable for the admin_status, but that would possibly involve a lot of changes to the existing deployments, right?

@iljarotar iljarotar marked this pull request as draft September 27, 2024 06:00
@Gerrit91
Copy link
Contributor

Gerrit91 commented Oct 1, 2024

Closing in favor of #324.

@Gerrit91 Gerrit91 closed this Oct 1, 2024
@Gerrit91 Gerrit91 deleted the remove-sonic-ports-defaults branch October 1, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants