From ad178b082cacb47f16f7982c3ede7bd7728cfa5d Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Thu, 30 Jun 2022 14:16:58 +0800 Subject: [PATCH 1/8] Feat: Add teamdctl_state_dump spec to insights_archive Signed-off-by: Xinting Li --- insights/specs/default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/insights/specs/default.py b/insights/specs/default.py index b600c1bdd4..ddd6d81f90 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -190,7 +190,7 @@ class DefaultSpecs(Specs): ethtool_c = foreach_execute(ethernet.interfaces, "/sbin/ethtool -c %s") ethtool_g = foreach_execute(ethernet.interfaces, "/sbin/ethtool -g %s") ethtool_i = foreach_execute(ethernet.interfaces, "/sbin/ethtool -i %s") - ethtool_k = foreach_execute(ethernet.interfaces, "/sbin/ethtool -k %s") + ethtool_k = foreach_execute(ethernet.interfaces, "/bin/ethtool -k %s") fc_match = simple_command("/bin/fc-match -sv 'sans:regular:roman' family fontformat") fcoeadm_i = simple_command("/usr/sbin/fcoeadm -i") findmnt_lo_propagation = simple_command("/bin/findmnt -lo+PROPAGATION") @@ -654,6 +654,7 @@ class DefaultSpecs(Specs): ]) sys_vmbus_device_id = glob_file('/sys/bus/vmbus/devices/*/device_id') sys_vmbus_class_id = glob_file('/sys/bus/vmbus/devices/*/class_id') + teamdctl_state_dump = foreach_execute(ethernet.interfaces, "/bin/teamdctl %s state dump") testparm_s = simple_command("/usr/bin/testparm -s") testparm_v_s = simple_command("/usr/bin/testparm -v -s") tags = simple_file("/tags.json", kind=RawFileProvider) From ef3921e2a3ac4d3372329dcfdee419606ee4bcd9 Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Thu, 30 Jun 2022 16:35:00 +0800 Subject: [PATCH 2/8] fix:erroneously modify ethtool_k Signed-off-by: Xinting Li --- insights/specs/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insights/specs/default.py b/insights/specs/default.py index ddd6d81f90..2e842a28e4 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -190,7 +190,7 @@ class DefaultSpecs(Specs): ethtool_c = foreach_execute(ethernet.interfaces, "/sbin/ethtool -c %s") ethtool_g = foreach_execute(ethernet.interfaces, "/sbin/ethtool -g %s") ethtool_i = foreach_execute(ethernet.interfaces, "/sbin/ethtool -i %s") - ethtool_k = foreach_execute(ethernet.interfaces, "/bin/ethtool -k %s") + ethtool_k = foreach_execute(ethernet.interfaces, "/sbin/ethtool -k %s") fc_match = simple_command("/bin/fc-match -sv 'sans:regular:roman' family fontformat") fcoeadm_i = simple_command("/usr/sbin/fcoeadm -i") findmnt_lo_propagation = simple_command("/bin/findmnt -lo+PROPAGATION") From 0204aab75d4a588189af135385749081bd4abb9b Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Thu, 30 Jun 2022 18:10:43 +0800 Subject: [PATCH 3/8] Modify path Signed-off-by: Xinting Li --- insights/specs/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insights/specs/default.py b/insights/specs/default.py index 2e842a28e4..fd8c4b334a 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -654,7 +654,7 @@ class DefaultSpecs(Specs): ]) sys_vmbus_device_id = glob_file('/sys/bus/vmbus/devices/*/device_id') sys_vmbus_class_id = glob_file('/sys/bus/vmbus/devices/*/class_id') - teamdctl_state_dump = foreach_execute(ethernet.interfaces, "/bin/teamdctl %s state dump") + teamdctl_state_dump = foreach_execute(ethernet.interfaces, "/usr/bin/teamdctl %s state dump") testparm_s = simple_command("/usr/bin/testparm -s") testparm_v_s = simple_command("/usr/bin/testparm -v -s") tags = simple_file("/tags.json", kind=RawFileProvider) From 014dc4e5923fe8ef05082344c14cfcf8500cd0aa Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Tue, 12 Jul 2022 11:17:33 +0800 Subject: [PATCH 4/8] Add team test Signed-off-by: Xinting Li --- insights/specs/datasources/team.py | 47 ++++++++++++++++++++ insights/specs/default.py | 4 +- insights/tests/datasources/test_team.py | 58 +++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 insights/specs/datasources/team.py create mode 100644 insights/tests/datasources/test_team.py diff --git a/insights/specs/datasources/team.py b/insights/specs/datasources/team.py new file mode 100644 index 0000000000..1530758363 --- /dev/null +++ b/insights/specs/datasources/team.py @@ -0,0 +1,47 @@ +""" +Custom datasource for gathering a list of the team interface names. +""" +from insights.core.context import HostContext +from insights.core.dr import SkipComponent +from insights.core.plugins import datasource +from insights.parsers.nmcli import NmcliConnShow + + +@datasource(NmcliConnShow, HostContext) +def team_filter(broker): + """ + This datasource provides a list of the team interfaces available. + + Typical content of the spec is:: + + NAME UUID TYPE DEVICE + enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 + virbr0 7c7dec66-4a8c-4b49-834a-889194b3b83c bridge virbr0 + test-net f858b1cc-d149-4de0-93bc-b1826256847a ethernet -- + team0 bf000427-d9f1-432f-819d-257edb86c6fb team team0 + ens3 1b1f5c95-1026-4699-95e5-2cd5baa033c3 ethernet ens3 + ens8 a2c39643-b356-435a-955c-50cef6b36052 ethernet ens8 + team1 ca07b1cf-b293-4871-b255-17f1abfa991d team team1 + + Sample data returned:: + + ['team0', 'team1'] + + Returns: + list: List of the team interfaces available. + + Raises: + SkipComponent: When there is not any content. + """ + + content = broker[NmcliConnShow].data + if content: + ifaces = [] + for x in content: + if 'team' in x['TYPE']: + ifaces.append(x['DEVICE']) + + if ifaces: + return sorted(ifaces) + + raise SkipComponent diff --git a/insights/specs/default.py b/insights/specs/default.py index fd8c4b334a..220a160b36 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -26,7 +26,7 @@ awx_manage, cloud_init, candlepin_broker, corosync as corosync_ds, dir_list, ethernet, httpd, ipcs, kernel_module_list, lpstat, md5chk, package_provides, ps as ps_datasource, sap, satellite_missed_queues, - ssl_certificate, user_group, yum_updates) + team, ssl_certificate, user_group, yum_updates) from insights.specs.datasources.sap import sap_hana_sid, sap_hana_sid_SID_nr from insights.specs.datasources.pcp import pcp_enabled, pmlog_summary_args @@ -654,7 +654,7 @@ class DefaultSpecs(Specs): ]) sys_vmbus_device_id = glob_file('/sys/bus/vmbus/devices/*/device_id') sys_vmbus_class_id = glob_file('/sys/bus/vmbus/devices/*/class_id') - teamdctl_state_dump = foreach_execute(ethernet.interfaces, "/usr/bin/teamdctl %s state dump") + teamdctl_state_dump = foreach_execute(team.team_filter, "/usr/bin/teamdctl %s state dump") testparm_s = simple_command("/usr/bin/testparm -s") testparm_v_s = simple_command("/usr/bin/testparm -v -s") tags = simple_file("/tags.json", kind=RawFileProvider) diff --git a/insights/tests/datasources/test_team.py b/insights/tests/datasources/test_team.py new file mode 100644 index 0000000000..aadb48f734 --- /dev/null +++ b/insights/tests/datasources/test_team.py @@ -0,0 +1,58 @@ +import pytest + +from insights.core.dr import SkipComponent +from insights.specs.datasources.team import team_filter +from insights.parsers.nmcli import NmcliConnShow +from insights.tests import context_wrap + +RELATIVE_PATH = "insights_commands/ethernet_interfaces" + +NMCLI_C_SHOW_OUTPUT_1 = """ +NAME UUID TYPE DEVICE +enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 +virbr0 7c7dec66-4a8c-4b49-834a-889194b3b83c bridge virbr0 +test-net f858b1cc-d149-4de0-93bc-b1826256847a ethernet -- +team0 bf000427-d9f1-432f-819d-257edb86c6fb team team0 +ens3 1b1f5c95-1026-4699-95e5-2cd5baa033c3 ethernet ens3 +ens8 a2c39643-b356-435a-955c-50cef6b36052 ethernet ens8 +team1 ca07b1cf-b293-4871-b255-17f1abfa991d team team1 +""" + +NMCLI_C_SHOW_OUTPUT_2 = """ +NAME UUID TYPE DEVICE +enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 +""" + +NMCLI_C_SHOW_EMPTY = "" + + +def test_team_filter_1(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_1)) + + broker = { + NmcliConnShow: mmcli_c_show + } + result = team_filter(broker) + assert result is not None + assert isinstance(result, list) + assert result == sorted(['team0', 'team1']) + + +def test_team_filter_2(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_2)) + + broker = { + NmcliConnShow: mmcli_c_show + } + with pytest.raises(SkipComponent): + team_filter(broker) + + +def test_ethernet_interfaces_bad(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_EMPTY)) + + broker = { + NmcliConnShow: mmcli_c_show + } + with pytest.raises(SkipComponent): + team_filter(broker) From 04692d9f76a7cb25241bbc0a7f9f56cc480d98e5 Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Tue, 12 Jul 2022 17:38:52 +0800 Subject: [PATCH 5/8] move team_device to ethernet Signed-off-by: Xinting Li --- insights/specs/datasources/ethernet.py | 30 ++++++++++++++++ insights/specs/datasources/team.py | 47 -------------------------- insights/specs/default.py | 4 +-- 3 files changed, 32 insertions(+), 49 deletions(-) delete mode 100644 insights/specs/datasources/team.py diff --git a/insights/specs/datasources/ethernet.py b/insights/specs/datasources/ethernet.py index 2224f47410..5f5835a4fa 100644 --- a/insights/specs/datasources/ethernet.py +++ b/insights/specs/datasources/ethernet.py @@ -5,6 +5,7 @@ from insights.core.dr import SkipComponent from insights.core.plugins import datasource from insights.core.spec_factory import simple_command +from insights.parsers.nmcli import NmcliConnShow from insights.specs import Specs @@ -55,3 +56,32 @@ def interfaces(broker): return sorted(ifaces) raise SkipComponent + + +@datasource(NmcliConnShow, HostContext) +def team_device(broker): + """ + This datasource provides a list of the team device. + + Sample data returned:: + + ['team0', 'team1'] + + Returns: + list: List of the team device. + + Raises: + SkipComponent: When there is not any content. + """ + + content = broker[NmcliConnShow].data + if content: + team_device_list = [] + for x in content: + if 'team' in x['TYPE']: + team_device_list.append(x['DEVICE']) + + if team_device_list: + return sorted(team_device_list) + + raise SkipComponent diff --git a/insights/specs/datasources/team.py b/insights/specs/datasources/team.py deleted file mode 100644 index 1530758363..0000000000 --- a/insights/specs/datasources/team.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -Custom datasource for gathering a list of the team interface names. -""" -from insights.core.context import HostContext -from insights.core.dr import SkipComponent -from insights.core.plugins import datasource -from insights.parsers.nmcli import NmcliConnShow - - -@datasource(NmcliConnShow, HostContext) -def team_filter(broker): - """ - This datasource provides a list of the team interfaces available. - - Typical content of the spec is:: - - NAME UUID TYPE DEVICE - enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 - virbr0 7c7dec66-4a8c-4b49-834a-889194b3b83c bridge virbr0 - test-net f858b1cc-d149-4de0-93bc-b1826256847a ethernet -- - team0 bf000427-d9f1-432f-819d-257edb86c6fb team team0 - ens3 1b1f5c95-1026-4699-95e5-2cd5baa033c3 ethernet ens3 - ens8 a2c39643-b356-435a-955c-50cef6b36052 ethernet ens8 - team1 ca07b1cf-b293-4871-b255-17f1abfa991d team team1 - - Sample data returned:: - - ['team0', 'team1'] - - Returns: - list: List of the team interfaces available. - - Raises: - SkipComponent: When there is not any content. - """ - - content = broker[NmcliConnShow].data - if content: - ifaces = [] - for x in content: - if 'team' in x['TYPE']: - ifaces.append(x['DEVICE']) - - if ifaces: - return sorted(ifaces) - - raise SkipComponent diff --git a/insights/specs/default.py b/insights/specs/default.py index 220a160b36..902d13dac6 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -26,7 +26,7 @@ awx_manage, cloud_init, candlepin_broker, corosync as corosync_ds, dir_list, ethernet, httpd, ipcs, kernel_module_list, lpstat, md5chk, package_provides, ps as ps_datasource, sap, satellite_missed_queues, - team, ssl_certificate, user_group, yum_updates) + ssl_certificate, user_group, yum_updates) from insights.specs.datasources.sap import sap_hana_sid, sap_hana_sid_SID_nr from insights.specs.datasources.pcp import pcp_enabled, pmlog_summary_args @@ -654,7 +654,7 @@ class DefaultSpecs(Specs): ]) sys_vmbus_device_id = glob_file('/sys/bus/vmbus/devices/*/device_id') sys_vmbus_class_id = glob_file('/sys/bus/vmbus/devices/*/class_id') - teamdctl_state_dump = foreach_execute(team.team_filter, "/usr/bin/teamdctl %s state dump") + teamdctl_state_dump = foreach_execute(ethernet.team_device, "/usr/bin/teamdctl %s state dump") testparm_s = simple_command("/usr/bin/testparm -s") testparm_v_s = simple_command("/usr/bin/testparm -v -s") tags = simple_file("/tags.json", kind=RawFileProvider) From 82bf24e3078afb7d5f12b9eac8011078f42ac0b1 Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Tue, 12 Jul 2022 17:43:42 +0800 Subject: [PATCH 6/8] Update test for team_device Signed-off-by: Xinting Li --- insights/tests/datasources/test_ethernet.py | 54 ++++++++++++++++++- insights/tests/datasources/test_team.py | 58 --------------------- 2 files changed, 53 insertions(+), 59 deletions(-) delete mode 100644 insights/tests/datasources/test_team.py diff --git a/insights/tests/datasources/test_ethernet.py b/insights/tests/datasources/test_ethernet.py index 1d4a35ca97..6aa6d75ed8 100644 --- a/insights/tests/datasources/test_ethernet.py +++ b/insights/tests/datasources/test_ethernet.py @@ -1,8 +1,10 @@ import pytest from insights.core.dr import SkipComponent -from insights.specs.datasources.ethernet import interfaces, LocalSpecs +from insights.specs.datasources.ethernet import interfaces, LocalSpecs, team_device +from insights.parsers.nmcli import NmcliConnShow from mock.mock import Mock +from insights.tests import context_wrap RELATIVE_PATH = "insights_commands/ethernet_interfaces" @@ -16,6 +18,24 @@ IP_LINK_BAD = "" +NMCLI_C_SHOW_OUTPUT_1 = """ +NAME UUID TYPE DEVICE +enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 +virbr0 7c7dec66-4a8c-4b49-834a-889194b3b83c bridge virbr0 +test-net f858b1cc-d149-4de0-93bc-b1826256847a ethernet -- +team0 bf000427-d9f1-432f-819d-257edb86c6fb team team0 +ens3 1b1f5c95-1026-4699-95e5-2cd5baa033c3 ethernet ens3 +ens8 a2c39643-b356-435a-955c-50cef6b36052 ethernet ens8 +team1 ca07b1cf-b293-4871-b255-17f1abfa991d team team1 +""" + +NMCLI_C_SHOW_OUTPUT_2 = """ +NAME UUID TYPE DEVICE +enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 +""" + +NMCLI_C_SHOW_EMPTY = "" + EXPECTED = ['enp1s0', 'enp8s0', 'enp1s0.2'] @@ -35,3 +55,35 @@ def test_ethernet_interfaces_bad(): broker = {LocalSpecs.ip_link: ip_link_command} with pytest.raises(SkipComponent): interfaces(broker) + + +def test_team_device_1(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_1)) + + broker = { + NmcliConnShow: mmcli_c_show + } + result = team_device(broker) + assert result is not None + assert isinstance(result, list) + assert result == sorted(['team0', 'team1']) + + +def test_team_device_2(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_2)) + + broker = { + NmcliConnShow: mmcli_c_show + } + with pytest.raises(SkipComponent): + team_device(broker) + + +def test_team_device_bad(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_EMPTY)) + + broker = { + NmcliConnShow: mmcli_c_show + } + with pytest.raises(SkipComponent): + team_device(broker) diff --git a/insights/tests/datasources/test_team.py b/insights/tests/datasources/test_team.py deleted file mode 100644 index aadb48f734..0000000000 --- a/insights/tests/datasources/test_team.py +++ /dev/null @@ -1,58 +0,0 @@ -import pytest - -from insights.core.dr import SkipComponent -from insights.specs.datasources.team import team_filter -from insights.parsers.nmcli import NmcliConnShow -from insights.tests import context_wrap - -RELATIVE_PATH = "insights_commands/ethernet_interfaces" - -NMCLI_C_SHOW_OUTPUT_1 = """ -NAME UUID TYPE DEVICE -enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 -virbr0 7c7dec66-4a8c-4b49-834a-889194b3b83c bridge virbr0 -test-net f858b1cc-d149-4de0-93bc-b1826256847a ethernet -- -team0 bf000427-d9f1-432f-819d-257edb86c6fb team team0 -ens3 1b1f5c95-1026-4699-95e5-2cd5baa033c3 ethernet ens3 -ens8 a2c39643-b356-435a-955c-50cef6b36052 ethernet ens8 -team1 ca07b1cf-b293-4871-b255-17f1abfa991d team team1 -""" - -NMCLI_C_SHOW_OUTPUT_2 = """ -NAME UUID TYPE DEVICE -enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 -""" - -NMCLI_C_SHOW_EMPTY = "" - - -def test_team_filter_1(): - mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_1)) - - broker = { - NmcliConnShow: mmcli_c_show - } - result = team_filter(broker) - assert result is not None - assert isinstance(result, list) - assert result == sorted(['team0', 'team1']) - - -def test_team_filter_2(): - mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_2)) - - broker = { - NmcliConnShow: mmcli_c_show - } - with pytest.raises(SkipComponent): - team_filter(broker) - - -def test_ethernet_interfaces_bad(): - mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_EMPTY)) - - broker = { - NmcliConnShow: mmcli_c_show - } - with pytest.raises(SkipComponent): - team_filter(broker) From 075b64e22bfb49a9553178de27f00de580cc4eaf Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Wed, 13 Jul 2022 11:12:46 +0800 Subject: [PATCH 7/8] Filtered discounted teams Signed-off-by: Xinting Li --- insights/specs/datasources/ethernet.py | 14 ++++++------- insights/specs/default.py | 2 +- insights/tests/datasources/test_ethernet.py | 23 +++++++++++++++++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/insights/specs/datasources/ethernet.py b/insights/specs/datasources/ethernet.py index 5f5835a4fa..1054c5e21a 100644 --- a/insights/specs/datasources/ethernet.py +++ b/insights/specs/datasources/ethernet.py @@ -59,7 +59,7 @@ def interfaces(broker): @datasource(NmcliConnShow, HostContext) -def team_device(broker): +def team_interfaces(broker): """ This datasource provides a list of the team device. @@ -71,17 +71,17 @@ def team_device(broker): list: List of the team device. Raises: - SkipComponent: When there is not any content. + SkipComponent: When there is not any team ifaces. """ content = broker[NmcliConnShow].data if content: - team_device_list = [] + team_ifaces = [] for x in content: - if 'team' in x['TYPE']: - team_device_list.append(x['DEVICE']) + if 'team' in x['TYPE'] and x['DEVICE'] != '--': + team_ifaces.append(x['DEVICE']) - if team_device_list: - return sorted(team_device_list) + if team_ifaces: + return sorted(team_ifaces) raise SkipComponent diff --git a/insights/specs/default.py b/insights/specs/default.py index 902d13dac6..7b7d91c7b1 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -654,7 +654,7 @@ class DefaultSpecs(Specs): ]) sys_vmbus_device_id = glob_file('/sys/bus/vmbus/devices/*/device_id') sys_vmbus_class_id = glob_file('/sys/bus/vmbus/devices/*/class_id') - teamdctl_state_dump = foreach_execute(ethernet.team_device, "/usr/bin/teamdctl %s state dump") + teamdctl_state_dump = foreach_execute(ethernet.team_interfaces, "/usr/bin/teamdctl %s state dump") testparm_s = simple_command("/usr/bin/testparm -s") testparm_v_s = simple_command("/usr/bin/testparm -v -s") tags = simple_file("/tags.json", kind=RawFileProvider) diff --git a/insights/tests/datasources/test_ethernet.py b/insights/tests/datasources/test_ethernet.py index 6aa6d75ed8..eeccf210f1 100644 --- a/insights/tests/datasources/test_ethernet.py +++ b/insights/tests/datasources/test_ethernet.py @@ -1,7 +1,7 @@ import pytest from insights.core.dr import SkipComponent -from insights.specs.datasources.ethernet import interfaces, LocalSpecs, team_device +from insights.specs.datasources.ethernet import interfaces, LocalSpecs, team_interfaces from insights.parsers.nmcli import NmcliConnShow from mock.mock import Mock from insights.tests import context_wrap @@ -34,6 +34,11 @@ enp0s3 320d4923-c410-4b22-b7e9-afc5f794eecc ethernet enp0s3 """ +NMCLI_C_SHOW_OUTPUT_3 = """ +NAME UUID TYPE DEVICE +team0 bf000427-d9f1-432f-819d-257edb86c6fb team -- +""" + NMCLI_C_SHOW_EMPTY = "" EXPECTED = ['enp1s0', 'enp8s0', 'enp1s0.2'] @@ -63,7 +68,7 @@ def test_team_device_1(): broker = { NmcliConnShow: mmcli_c_show } - result = team_device(broker) + result = team_interfaces(broker) assert result is not None assert isinstance(result, list) assert result == sorted(['team0', 'team1']) @@ -76,7 +81,17 @@ def test_team_device_2(): NmcliConnShow: mmcli_c_show } with pytest.raises(SkipComponent): - team_device(broker) + team_interfaces(broker) + + +def test_team_device_3(): + mmcli_c_show = NmcliConnShow(context_wrap(NMCLI_C_SHOW_OUTPUT_3)) + + broker = { + NmcliConnShow: mmcli_c_show + } + with pytest.raises(SkipComponent): + team_interfaces(broker) def test_team_device_bad(): @@ -86,4 +101,4 @@ def test_team_device_bad(): NmcliConnShow: mmcli_c_show } with pytest.raises(SkipComponent): - team_device(broker) + team_interfaces(broker) From a1ebfc70c42de09194484130f5fcca6447599b07 Mon Sep 17 00:00:00 2001 From: Xinting Li Date: Wed, 13 Jul 2022 11:15:19 +0800 Subject: [PATCH 8/8] correct abbreviation Signed-off-by: Xinting Li --- insights/specs/datasources/ethernet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/insights/specs/datasources/ethernet.py b/insights/specs/datasources/ethernet.py index 1054c5e21a..351b1905af 100644 --- a/insights/specs/datasources/ethernet.py +++ b/insights/specs/datasources/ethernet.py @@ -71,7 +71,7 @@ def team_interfaces(broker): list: List of the team device. Raises: - SkipComponent: When there is not any team ifaces. + SkipComponent: When there is not any team interfaces. """ content = broker[NmcliConnShow].data