Skip to content

Add error directive to arista_eos show inventory#2323

Draft
mjbear wants to merge 3 commits into
networktocode:masterfrom
mjbear:arista_eos_sh_inv_error-directive
Draft

Add error directive to arista_eos show inventory#2323
mjbear wants to merge 3 commits into
networktocode:masterfrom
mjbear:arista_eos_sh_inv_error-directive

Conversation

@mjbear

@mjbear mjbear commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

During review of PR #2322, it was identified the arista_eos_show_inventory did not have Error directives in its States.

This PR adds those Error directives and any patterns required for parsing to pass successfully against current test data.

I've asked @surudhi if she'd test the modified template against more Arista EOS output.

mjbear added 3 commits June 6, 2026 21:56
These states already had patterns that matched all lines, so
no new patterns needed to be added to them.
Add error directive and patterns to Transceiver state to make
parsing pass successfully.
@mjbear mjbear added the WIP Work in Progress label Jun 7, 2026
@surudhi

surudhi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Tested this against real show inventory output from a fleet of ~16 Arista EOS switches spanning many platform families (7010, 7010TX, 7020R, 7060, 7150, 720XP, 7130, 7280SE/SR3/SR3A/DR3A/CR3) and EOS 4.23.8M → 4.35.0F, using textfsm 2.1.0.

Issues found

1. Not Present transceiver slots → Error (Transceiver state)
The transceiver row rule requires 5 fields:

^\s+${PORT}\s+${DESCR}\s+${PID}\s+${SN}\s+${VID} -> Record

but empty slots print only two:

  2    Not Present

so they fall through to ^. -> Error.

2. The System has N storage device(s) section is unhandled → Error (Transceiver state)
There's no Storage state and Transceiver has no exit transition, so this trailing block (present on every device) hits ^. -> Error:

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC <model>        <serial>      0.0 4

3. Subcomponent serial numbers block → Error (Chassis state)
7130-series chassis emit this right after the chassis block; Chassis has no rule for it:

Subcomponent serial numbers
  Component          Serial Number
  ------------------ --------------
  mainboardOtl       <serial>
  mezzanine          <serial>

4. (non-fatal) Split Model/Description tables
On CCS-720XP / some newer SKUs, Model and Description are printed as two separate tables rather than one. This doesn't error but the Chassis state mis-captures PID/DESCR.

Minimal repro

arista_eos_show_inventory_notpresent.raw:

System information
  Model                    Description
  ------------------------ ----------------------------------------------------
  DCS-7060CX2-32S          32x100GbE QSFP & 2xSFP+ switch

  HW Version  Serial Number  Mfg Date   Epoch
  ----------- -------------- ---------- -----
  11.01       AAA00000000    2019-10-21 01.00

System has 2 power supply slots
  Slot Model            Serial Number
  ---- ---------------- ----------------
  1    PWR-500AC-R      BBB00000000

System has 4 fan modules
  Module  Number of Fans  Model            Serial Number
  ------- --------------- ---------------- ----------------
  1       1               FAN-7000-R       N/A

System has 131 ports
  Type               Count
  ------------------ ----
  Management         1

System has 34 switched transceiver slots
  Port Manufacturer     Model            Serial Number    Rev
  ---- ---------------- ---------------- ---------------- ----
  1    Arista Networks  Q28-PC025        CCC00000000-2    A
  2    Not Present

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC Toshiba 008G70 ddd00000      0.0 4
>>> import textfsm
>>> textfsm.TextFSM(open("arista_eos_show_inventory.textfsm")).ParseText(open("...notpresent.raw").read())
textfsm.parser.TextFSMError: State Error raised. Rule Line: 45. Input Line:   2    Not Present

(Remove the 2 Not Present line and it instead errors on System has 1 storage device, same rule line 45.)

Suggested direction

  • Add a Not Present rule in Transceiver (record PORT with empty optics fields).
  • Add a Storage state and a Transceiver -> Storage transition on ^\s*System.+storage.
  • Add a skip/parse path for the Subcomponent serial numbers block in Chassis.
  • Handle the split Model/Description layout.

Happy to share the full set of anonymized captures across the platform/version matrix if useful for building out the test fixtures.

@mjbear

mjbear commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

Tested this against real show inventory output from a fleet of ~16 Arista EOS switches spanning many platform families (7010, 7010TX, 7020R, 7060, 7150, 720XP, 7130, 7280SE/SR3/SR3A/DR3A/CR3) and EOS 4.23.8M → 4.35.0F, using textfsm 2.1.0.

Exactly why I asked if you'd test. 😀
Thank you @surudhi

Issues found

1. Not Present transceiver slots → Error (Transceiver state) The transceiver row rule requires 5 fields:

^\s+${PORT}\s+${DESCR}\s+${PID}\s+${SN}\s+${VID} -> Record

but empty slots print only two:

  2    Not Present

so they fall through to ^. -> Error.

We'll want to match this Not Present line specifically (and essentially discard it -- non captured).

2. The System has N storage device(s) section is unhandled → Error (Transceiver state) There's no Storage state and Transceiver has no exit transition, so this trailing block (present on every device) hits ^. -> Error:

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC <model>        <serial>      0.0 4

Yep, we'll want to add patterns for the storage.

3. Subcomponent serial numbers block → Error (Chassis state) 7130-series chassis emit this right after the chassis block; Chassis has no rule for it:

Subcomponent serial numbers
  Component          Serial Number
  ------------------ --------------
  mainboardOtl       <serial>
  mezzanine          <serial>

Yep, we'll want to add patterns for the subcomponent section.

4. (non-fatal) Split Model/Description tables On CCS-720XP / some newer SKUs, Model and Description are printed as two separate tables rather than one. This doesn't error but the Chassis state mis-captures PID/DESCR.

Rather than have the PID or DESCR broken on newer SKUs we can fix it in this PR. Good.

Minimal repro

arista_eos_show_inventory_notpresent.raw:

System information
  Model                    Description
  ------------------------ ----------------------------------------------------
  DCS-7060CX2-32S          32x100GbE QSFP & 2xSFP+ switch

  HW Version  Serial Number  Mfg Date   Epoch
  ----------- -------------- ---------- -----
  11.01       AAA00000000    2019-10-21 01.00

System has 2 power supply slots
  Slot Model            Serial Number
  ---- ---------------- ----------------
  1    PWR-500AC-R      BBB00000000

System has 4 fan modules
  Module  Number of Fans  Model            Serial Number
  ------- --------------- ---------------- ----------------
  1       1               FAN-7000-R       N/A

System has 131 ports
  Type               Count
  ------------------ ----
  Management         1

System has 34 switched transceiver slots
  Port Manufacturer     Model            Serial Number    Rev
  ---- ---------------- ---------------- ---------------- ----
  1    Arista Networks  Q28-PC025        CCC00000000-2    A
  2    Not Present

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC Toshiba 008G70 ddd00000      0.0 4
>>> import textfsm
>>> textfsm.TextFSM(open("arista_eos_show_inventory.textfsm")).ParseText(open("...notpresent.raw").read())
textfsm.parser.TextFSMError: State Error raised. Rule Line: 45. Input Line:   2    Not Present

(Remove the 2 Not Present line and it instead errors on System has 1 storage device, same rule line 45.)

Suggested direction

* Add a `Not Present` rule in `Transceiver` (record `PORT` with empty optics fields).

* Add a `Storage` state and a `Transceiver -> Storage` transition on `^\s*System.+storage`.

* Add a skip/parse path for the `Subcomponent serial numbers` block in `Chassis`.

* Handle the split Model/Description layout.

Happy to share the full set of anonymized captures across the platform/version matrix if useful for building out the test fixtures.

If there's raw output from one device that covers all these cases that would be suitable. Otherwise please provide the anonymized raw data for the unique ones that represent the four findings.

@surudhi If you'd like to create a PR against my branch and submit me a PR (against my fork), I can include your updates into this branch/PR. Let me know if you're interested in this collaboration. Thank you!

@surudhi

surudhi commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Tested this against real show inventory output from a fleet of ~16 Arista EOS switches spanning many platform families (7010, 7010TX, 7020R, 7060, 7150, 720XP, 7130, 7280SE/SR3/SR3A/DR3A/CR3) and EOS 4.23.8M → 4.35.0F, using textfsm 2.1.0.

Exactly why I asked if you'd test. 😀 Thank you @surudhi

Issues found

1. Not Present transceiver slots → Error (Transceiver state) The transceiver row rule requires 5 fields:

^\s+${PORT}\s+${DESCR}\s+${PID}\s+${SN}\s+${VID} -> Record

but empty slots print only two:

  2    Not Present

so they fall through to ^. -> Error.

We'll want to match this Not Present line specifically (and essentially discard it -- non captured).

2. The System has N storage device(s) section is unhandled → Error (Transceiver state) There's no Storage state and Transceiver has no exit transition, so this trailing block (present on every device) hits ^. -> Error:

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC <model>        <serial>      0.0 4

Yep, we'll want to add patterns for the storage.

3. Subcomponent serial numbers block → Error (Chassis state) 7130-series chassis emit this right after the chassis block; Chassis has no rule for it:

Subcomponent serial numbers
  Component          Serial Number
  ------------------ --------------
  mainboardOtl       <serial>
  mezzanine          <serial>

Yep, we'll want to add patterns for the subcomponent section.

4. (non-fatal) Split Model/Description tables On CCS-720XP / some newer SKUs, Model and Description are printed as two separate tables rather than one. This doesn't error but the Chassis state mis-captures PID/DESCR.

Rather than have the PID or DESCR broken on newer SKUs we can fix it in this PR. Good.

Minimal repro

arista_eos_show_inventory_notpresent.raw:

System information
  Model                    Description
  ------------------------ ----------------------------------------------------
  DCS-7060CX2-32S          32x100GbE QSFP & 2xSFP+ switch

  HW Version  Serial Number  Mfg Date   Epoch
  ----------- -------------- ---------- -----
  11.01       AAA00000000    2019-10-21 01.00

System has 2 power supply slots
  Slot Model            Serial Number
  ---- ---------------- ----------------
  1    PWR-500AC-R      BBB00000000

System has 4 fan modules
  Module  Number of Fans  Model            Serial Number
  ------- --------------- ---------------- ----------------
  1       1               FAN-7000-R       N/A

System has 131 ports
  Type               Count
  ------------------ ----
  Management         1

System has 34 switched transceiver slots
  Port Manufacturer     Model            Serial Number    Rev
  ---- ---------------- ---------------- ---------------- ----
  1    Arista Networks  Q28-PC025        CCC00000000-2    A
  2    Not Present

System has 1 storage device
  Mount      Type Model          Serial Number Rev Size (GB)
  ---------- ---- -------------- ------------- --- ---------
  /mnt/flash eMMC Toshiba 008G70 ddd00000      0.0 4
>>> import textfsm
>>> textfsm.TextFSM(open("arista_eos_show_inventory.textfsm")).ParseText(open("...notpresent.raw").read())
textfsm.parser.TextFSMError: State Error raised. Rule Line: 45. Input Line:   2    Not Present

(Remove the 2 Not Present line and it instead errors on System has 1 storage device, same rule line 45.)

Suggested direction

* Add a `Not Present` rule in `Transceiver` (record `PORT` with empty optics fields).

* Add a `Storage` state and a `Transceiver -> Storage` transition on `^\s*System.+storage`.

* Add a skip/parse path for the `Subcomponent serial numbers` block in `Chassis`.

* Handle the split Model/Description layout.

Happy to share the full set of anonymized captures across the platform/version matrix if useful for building out the test fixtures.

If there's raw output from one device that covers all these cases that would be suitable. Otherwise please provide the anonymized raw data for the unique ones that represent the four findings.

@surudhi If you'd like to create a PR against my branch and submit me a PR (against my fork), I can include your updates into this branch/PR. Let me know if you're interested in this collaboration. Thank you!

@mjbear hi, I just opened mjbear#4 against your fork adding my changes to this template along with raw data + yaml files for the issues I encountered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP Work in Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants