Repository: sonic-net/sonic-mgmt

Issue:
[VOQ] Internal ports like inband and recycle ports are mistakenly considered as down ports.
<!--
If you are reporting a new issue, make sure that we do not have any duplicates
already open. You can ensure this by searching the issue list for this
repository. If there is a duplicate, please close your issue and add a comment
to the existing issue instead.

If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and will close it. We
will, however, reopen it if you later provide the information.

For more information about reporting issues, see
https://github.com/sonic-net/SONiC/wiki#report-issues

---------------------------------------------------
GENERAL SUPPORT INFORMATION
---------------------------------------------------

The GitHub issue tracker is for bug reports and feature requests.
General support can be found at the following locations:

- SONiC Support Forums - https://groups.google.com/forum/#!forum/sonicproject

---------------------------------------------------
BUG REPORT INFORMATION
---------------------------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->

**Description**

<!--
Briefly describe the problem you are having in a few paragraphs.
-->

We found that internal ports like inband and recycle ports were mistakenly considered as down ports in pre-test sanity check when running t2 sonic-mgmt tests with VOQ chassis.  These ports came up fine according to "show interface status -d all". All linecards in this chassis have only one ASIC. 

**Steps to reproduce the issue:**
1.
2.
3.

**Describe the results you received:**


**Describe the results you expected:**


**Additional information you deem important:**
<!--
software/ASIC/Hardware Flatform version and info
-->
    **Output of `show version`:**

    ```
    (paste your output here)
    ```

    **Attach debug file `sudo generate_dump`:**

    ```
    (paste your output here)
    ```



Discussion:
add @arlakshm for viz.

Resolving patch:
diff --git a/ansible/library/show_interface.py b/ansible/library/show_interface.py
--- a/ansible/library/show_interface.py
+++ b/ansible/library/show_interface.py
@@ -79,6 +79,8 @@ def __init__(self):
                 up_ports=dict(type='raw', default={}),
                 include_internal_intfs=dict(
                     required=False, type=bool, default=False),
+                include_inband_intfs=dict(
+                    required=False, type=bool, default=False),
             ),
             supports_check_mode=False)
         self.m_args = self.module.params
@@ -92,8 +94,9 @@ def run(self):
         """
         namespace = self.m_args["namespace"]
         include_internal_intfs = self.m_args['include_internal_intfs']
+        include_inband_intfs = self.m_args['include_inband_intfs']
         if self.m_args['command'] == 'status':
-            self.collect_interface_status(namespace, include_internal_intfs)
+            self.collect_interface_status(namespace, include_internal_intfs, include_inband_intfs)
         if self.m_args['command'] == 'counter':
             self.collect_interface_counter(namespace, include_internal_intfs)
         self.module.exit_json(ansible_facts=self.facts)
@@ -113,7 +116,7 @@ def _fetch_interface_type(self, line):
         """
         return ' '.join(line.split()[9:-1])
 
-    def collect_interface_status(self, namespace=None, include_internal_intfs=False):
+    def collect_interface_status(self, namespace=None, include_internal_intfs=False, include_inband_intfs=False):
         regex_int_fec = re.compile(
             r'(\S+)\s+[\d,N\/A]+\s+(\w+)\s+(\d+)\s+(rs|fc|N\/A|none)\s+([\w\/]+)\s+(\w+)\s+(\w+)\s+(\w+)')
         regex_int = re.compile(
@@ -167,6 +170,8 @@ def collect_interface_status(self, namespace=None, include_internal_intfs=False)
                     namespace) if namespace is not None else ""
                 if include_internal_intfs and namespace is not None:
                     cli_options += " -d all"
+                if include_inband_intfs:
+                    cli_options += " -d all"
                 intf_status_cmd = "show interface status{}".format(cli_options)
                 rc, self.out, err = self.module.run_command(
                     intf_status_cmd, executable='/bin/bash', use_unsafe_shell=True)


Test patch:
diff --git a/tests/common/plugins/sanity_check/checks.py b/tests/common/plugins/sanity_check/checks.py
--- a/tests/common/plugins/sanity_check/checks.py
+++ b/tests/common/plugins/sanity_check/checks.py
@@ -35,8 +35,12 @@
 
 def _find_down_phy_ports(dut, phy_interfaces):
     down_phy_ports = []
+    include_inband_intfs = True if dut.sonichost.get_facts().get(
+        'switch_type', None) == 'voq' else False
     intf_facts = dut.show_interface(command='status',
-                                    include_internal_intfs=('201811' not in dut.os_version))[
+                                    include_internal_intfs=(
+                                        '201811' not in dut.os_version),
+                                    include_inband_intfs=include_inband_intfs)[
                                         'ansible_facts']['int_status']
     for intf in phy_interfaces:
         try: