diff --git a/changelogs/fragments/fix_lad_interfaces.yaml b/changelogs/fragments/fix_lad_interfaces.yaml
new file mode 100644
index 00000000..f3379152
--- /dev/null
+++ b/changelogs/fragments/fix_lad_interfaces.yaml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+ - Fix the lag_interfaces facts for gigether supported model.
diff --git a/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py
index 9442769b..4fd11eff 100644
--- a/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py
@@ -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 = []
@@ -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",
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml
index 02a7be52..6877a89f 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml
@@ -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: []
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg b/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg
index 7133d00d..e0f9e964 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg
@@ -45,6 +45,7 @@
ae0
+
@@ -53,6 +54,7 @@
ae0
+
@@ -62,6 +64,7 @@
ae0
+
@@ -71,6 +74,7 @@
ae0
+
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml
index e6124286..4831f9b6 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml
@@ -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
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml
index abbd1c74..611805c5 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml
@@ -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
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml
index 0607e581..44ad486f 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml
@@ -13,6 +13,7 @@
- name: ae1
members:
- member: ge-0/0/2
+ ether_option_type: "ether"
mode: active
- block:
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml
index c5634d00..b1bed96d 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml
@@ -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:
@@ -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
diff --git a/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml b/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml
index 67d35220..2bd1f734 100644
--- a/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml
+++ b/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml
@@ -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