Skip to content

Commit

Permalink
Fix the condition for ether options (#527)
Browse files Browse the repository at this point in the history
* Fix the condition for ether options

Signed-off-by: rohitthakur2590 <[email protected]>

* update tests

Signed-off-by: rohitthakur2590 <[email protected]>

---------

Signed-off-by: rohitthakur2590 <[email protected]>
  • Loading branch information
rohitthakur2590 authored Jul 10, 2024
1 parent fc643ca commit b270e3f
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 9 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/fix_lad_interfaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Fix the lag_interfaces facts for gigether supported model.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def populate_facts(self, connection, ansible_facts, data=None):
data = etree.fromstring(
to_bytes(data, errors="surrogate_then_replace"),
)
data_string = etree.tostring(data, pretty_print=True, encoding="unicode")
self._resources = data.xpath("configuration/interfaces/interface")

objs = []
Expand Down Expand Up @@ -129,18 +128,24 @@ def get_member_config(self, interface_obj, intf_name):
interface_obj,
"ether-options/ieee-802.3ad/primary",
data="tag",
) or utils.get_xml_conf_arg(
):
member_config["link_type"] = "primary"
member_config["ether_option_type"] = "ether"
elif utils.get_xml_conf_arg(
interface_obj,
"gigether-options/ieee-802.3ad/primary",
data="tag",
):
member_config["link_type"] = "primary"
member_config["ether_option_type"] = "ether"
member_config["ether_option_type"] = "gigether"
elif utils.get_xml_conf_arg(
interface_obj,
"ether-options/ieee-802.3ad/backup",
data="tag",
) or utils.get_xml_conf_arg(
):
member_config["link_type"] = "backup"
member_config["ether_option_type"] = "ether"
elif utils.get_xml_conf_arg(
interface_obj,
"gigether-options/ieee-802.3ad/backup",
data="tag",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
- name: ae1
members:
- member: ge-0/0/1
ether_option_type: "ether"

- member: ge-0/0/2
ether_option_type: "ether"
mode: active
expected_deleted_2_output: []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<gigether-options>
<ieee-802.3ad>
<bundle>ae0</bundle>
<primary/>
</ieee-802.3ad>
</gigether-options>
</interface>
Expand All @@ -53,6 +54,7 @@
<gigether-options>
<ieee-802.3ad>
<bundle>ae0</bundle>
<primary/>
</ieee-802.3ad>
</gigether-options>
</interface>
Expand All @@ -62,6 +64,7 @@
<gigether-options>
<ieee-802.3ad>
<bundle>ae0</bundle>
<primary/>
</ieee-802.3ad>
</gigether-options>
</interface>
Expand All @@ -71,6 +74,7 @@
<gigether-options>
<ieee-802.3ad>
<bundle>ae0</bundle>
<primary/>
</ieee-802.3ad>
</gigether-options>
</interface>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
- name: ae1
members:
- member: ge-0/0/1
ether_option_type: "ether"
- member: ge-0/0/2
ether_option_type: "ether"
mode: active

- name: ae2
link_protection: true
members:
- member: ge-0/0/3
ether_option_type: "ether"
link_type: primary

- member: ge-0/0/4
ether_option_type: "ether"
link_type: backup
mode: passive

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
- name: ae1
members:
- member: ge-0/0/1
ether_option_type: "ether"

- member: ge-0/0/2
ether_option_type: "ether"
mode: active

- name: ae2
link_protection: true
members:
- member: ge-0/0/3
ether_option_type: "ether"
link_type: primary

- member: ge-0/0/4
ether_option_type: "ether"
link_type: backup
mode: passive

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- name: ae1
members:
- member: ge-0/0/2
ether_option_type: "ether"
mode: active

- block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
- name: ae0
members:
- member: xe-0/1/0
ether_option_type: ether
ether_option_type: gigether
link_type: "primary"
- member: xe-0/1/1
ether_option_type: ether
ether_option_type: gigether
link_type: "primary"
- member: xe-0/1/4
ether_option_type: ether
ether_option_type: gigether
link_type: "primary"
- member: xe-0/1/5
ether_option_type: ether
ether_option_type: gigether
link_type: "primary"
mode: active
- name: ae1
members:
Expand All @@ -31,7 +35,7 @@
ether_option_type: ether
link_type: primary
- member: ge-0/0/4
ether_option_type: gigether
ether_option_type: ether
link_type: backup
mode: passive

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
- name: ae1
members:
- member: ge-0/0/1
ether_option_type: "ether"
mode: passive

- name: ae2
link_protection: true
members:
- member: ge-0/0/3
ether_option_type: "ether"
link_type: primary

- member: ge-0/0/4
ether_option_type: "ether"
link_type: backup
mode: passive

Expand Down

0 comments on commit b270e3f

Please sign in to comment.