Skip to content

SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200), cisco-sb, and add Catalyst 1300/9200 sysobjectids#23498

Closed
ian28223 wants to merge 14 commits into
masterfrom
ian.bucad/cisco-catalyst-serial-number-metadata
Closed

SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200), cisco-sb, and add Catalyst 1300/9200 sysobjectids#23498
ian28223 wants to merge 14 commits into
masterfrom
ian.bucad/cisco-catalyst-serial-number-metadata

Conversation

@ian28223
Copy link
Copy Markdown
Contributor

@ian28223 ian28223 commented Apr 28, 2026

What does this PR do?

Adds an ENTITY-MIB fallback so the SNMP agent can populate Catalyst serial_number device metadata when the legacy CISCO-STACK-MIB chassisSerialNumberString OID is absent on the device.

Profile change (_cisco-catalyst.yaml):

metadata:
  device:
    fields:
      serial_number:
        symbols:
          # Primary: CISCO-STACK-MIB chassisSerialNumberString
          - OID: 1.3.6.1.4.1.9.5.1.2.19.0
            name: chassisSerialNumberString
          # Fallback: ENTITY-MIB entPhysicalSerialNum at the documented
          # chassis index for Catalyst 1300 / CBS-derived chassis.
          - OID: 1.3.6.1.2.1.47.1.1.1.1.11.67109120
            name: entPhysicalSerialNum

The agent uses the first symbol that returns a non-empty value at collection time, so devices that still report the legacy OID are unaffected.

Test coverage:

  • New unit test test_cisco_catalyst_entity_serial_fallback in snmp/tests/test_profiles.py
  • New core/E2E test test_e2e_core_metadata_cisco_catalyst_entity_serial_fallback in snmp/tests/test_e2e_core_metadata.py
  • New snmprec fixture cisco-catalyst-1300.snmprec modeling a Catalyst 1300 (sysObjectID 1.3.6.1.4.1.9.1.3233, ciscoC130024P4G) that exposes only the ENTITY-MIB fallback, no values that could identify a customer device

Motivation

AGENT-15682: Cisco Catalyst devices that do not implement CISCO-STACK-MIB (e.g. Catalyst 1300 / CBS-derived chassis) currently surface no serial_number in device metadata, breaking downstream tagging and asset correlation.

entPhysicalIndex is arbitrary per the ENTITY-MIB specification, so a generic fallback on index .1 would risk emitting a non-chassis component's serial (PSU, fan, module) on platforms where index 1 is not the chassis. Index .67109120 is the documented chassis row for Catalyst 1300 / CBS-derived chassis per Cisco's SMB switching OID reference, so the fallback is scoped to a device family where the index is stable and known.

Customers on other Catalyst variants where index .1 is reliably the chassis can extend the profile in their own configuration to append additional fallback indexes without shipping that risk to all users.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@ian28223 ian28223 changed the title SNMP: Cisco Catalyst serial_number uses ordered MIB fallbacks SNMP: Cisco Catalyst serial_number fallback when stack MIB serial is absent Apr 28, 2026
@datadog-prod-us1-4
Copy link
Copy Markdown
Contributor

datadog-prod-us1-4 Bot commented Apr 28, 2026

Code Coverage  Pipelines  Tests

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Total coverage percentage gate may be blocking this PR.

Overall coverage for service snmp: 26.22% (threshold: 30.00%)

⚠️ Warnings

🚦 5 Pipeline jobs failed

PR | test / check   View in Datadog   GitHub Actions

PR | test / test (linux, ubuntu-22.04, snmp, SNMP (py3.13-false), py3.13-false) / SNMP (py3.13-false)-py3.13-false   View in Datadog   GitHub Actions

See error Max retries exceeded. Connection to 'ddintegrations.blob.core.windows.net' failed due to NameResolutionError: Failed to resolve 'ddintegrations.blob.core.windows.net'.

PR | test / test (linux, ubuntu-22.04, snmp, SNMP (py3.13-true), py3.13-true) / SNMP (py3.13-true)-py3.13-true   View in Datadog   GitHub Actions

See error Failed to resolve hostname 'ddintegrations.blob.core.windows.net': Name or service not known.

View all 5 failed jobs.

🧪 20 Tests failed in 1 job

PR | run   GitHub Actions

test_bulk_table from test_check.py   View in Datadog (Fix with Cursor)
HTTPSConnectionPool(host=&#39;ddintegrations.blob.core.windows.net&#39;, port=443): Max retries exceeded with url: /snmp/cisco-3850.snmprec (Caused by NameResolutionError(&#34;HTTPSConnection(host=&#39;ddintegrations.blob.core.windows.net&#39;, port=443): Failed to resolve &#39;ddintegrations.blob.core.windows.net&#39; ([Errno -2] Name or service not known)&#34;))
test_cast_metrics from test_check.py   View in Datadog (Fix with Cursor)
HTTPSConnectionPool(host=&#39;ddintegrations.blob.core.windows.net&#39;, port=443): Max retries exceeded with url: /snmp/cisco-3850.snmprec (Caused by NameResolutionError(&#34;HTTPSConnection(host=&#39;ddintegrations.blob.core.windows.net&#39;, port=443): Failed to resolve &#39;ddintegrations.blob.core.windows.net&#39; ([Errno -2] Name or service not known)&#34;))

View all 20 test failures

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 33.33%
Overall Coverage: 18.32% (-69.21%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7d2146e | Docs | Datadog PR Page | Give us feedback!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.06%. Comparing base (87825d7) to head (d4891de).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@victorsprengel victorsprengel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add coverage for the fallback oid in the existing unit tests?

Comment thread snmp/datadog_checks/snmp/data/default_profiles/_cisco-catalyst.yaml
@ian28223 ian28223 requested a review from victorsprengel May 18, 2026 12:14
@ian28223 ian28223 force-pushed the ian.bucad/cisco-catalyst-serial-number-metadata branch from 1c6cd04 to e5577fe Compare May 19, 2026 04:08
@ian28223 ian28223 changed the title SNMP: Cisco Catalyst serial_number fallback when stack MIB serial is absent SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200), cisco-sb, and generic Cisco profiles May 19, 2026
@ian28223 ian28223 changed the title SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200), cisco-sb, and generic Cisco profiles SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200) and cisco-sb profiles May 20, 2026
@ian28223 ian28223 force-pushed the ian.bucad/cisco-catalyst-serial-number-metadata branch from 1d95565 to 6551dd3 Compare May 20, 2026 01:55
@ian28223 ian28223 changed the title SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200) and cisco-sb profiles SNMP: Cisco Catalyst and cisco-sb serial_number fallbacks via entPhysicalSerialNum May 20, 2026
@ian28223 ian28223 changed the title SNMP: Cisco Catalyst and cisco-sb serial_number fallbacks via entPhysicalSerialNum SNMP: extend Cisco serial_number coverage to Catalyst (incl. 1300/9200), cisco-sb, and add Catalyst 1300/9200 sysobjectids May 20, 2026
@victorsprengel
Copy link
Copy Markdown
Contributor

@ian28223 , tests still failing 🙂

ian28223 added a commit that referenced this pull request May 20, 2026
Adds the same one-line comment to _cisco-catalyst.yaml and cisco-sb.yaml
so the CI test selector picks the same e2e tests as PR #23498. Lets us
compare like-for-like on the e2e_core_profiles failures.

No behavior change; not for merge.
@ian28223 ian28223 force-pushed the ian.bucad/cisco-catalyst-serial-number-metadata branch from d4891de to 611a2c1 Compare May 21, 2026 03:12
@ian28223
Copy link
Copy Markdown
Contributor Author

@ian28223 , tests still failing 🙂

@victorsprengel Took some time to rule out the E2E test failures. E2E tests failures are unrelated and to be addressed in #23706

The tests for this PR specifically did pass

tests/test_profiles.py::test_cisco_catalyst PASSED                       [ 80%]
tests/test_profiles.py::test_cisco_catalyst_entity_serial_fallback PASSED [ 80%]

tests/test_e2e_core_metadata.py::test_e2e_core_metadata_cisco_catalyst PASSED [  7%]
tests/test_e2e_core_metadata.py::test_e2e_core_metadata_cisco_catalyst_entity_serial_fallback PASSED [  7%]

@victorsprengel
Copy link
Copy Markdown
Contributor

@ian28223 can you make sure CI is all green?

@ian28223
Copy link
Copy Markdown
Contributor Author

@ian28223 can you make sure CI is all green?

@victorsprengel the CI failures are unrelated and to be addressed in #23706

Use metadata symbols (first fetchable wins) for CISCO-STACK-MIB
chassisSerialNumberString and ENTITY-MIB entPhysicalSerialNum.
Add Circitor MIB references, Source 2 sysDescr note, and stack
index guidance.

Made-with: Cursor
ian28223 and others added 11 commits June 2, 2026 16:41
Made-with: Cursor
Adds a minimal cisco-catalyst-9k.snmprec fixture (no customer data) that
exercises the entPhysicalSerialNum fallback when chassisSerialNumberString
is absent, and asserts serial_number resolution via both a profile unit
test and a core metadata test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sysobjectids

Adds entPhysicalSerialNum.67109120 as the primary ENTITY-MIB fallback for
Cisco devices that expose chassis data at the CBS350/Catalyst 1300 index,
and keeps entPhysicalSerialNum.1 as the secondary fallback.

- _cisco-catalyst.yaml: insert the .67109120 entry ahead of .1 in the
  serial_number symbols list so Catalyst 1300 and Cat 9400/9200 chassis
  (e.g. cisco_switch_c9407r) report a serial even when the legacy
  chassisSerialNumberString is absent.
- _cisco-metadata.yaml: add the same fallback chain so profiles that
  inherit it (cisco.yaml via _base_cisco -> _cisco-generic) gain
  serial_number metadata.
- cisco-sb.yaml: define serial_number with the same chain for CBS350
  devices that fall outside the cisco-catalyst inheritance tree.
- cisco-catalyst.yaml: add Catalyst 9200 (1.3.6.1.4.1.9.1.3079) and
  Catalyst 1300 (.3233, .3236) sysobjectids so those devices match the
  Catalyst profile.

Refs AGENT-15682.
The cisco-sb, _cisco-metadata, and Catalyst 9200/1300 additions broaden
the PR beyond the original Catalyst-only fallback intent.
The .67109120 index is only known on Catalyst 1300 / CBS-derived chassis;
those devices match the cisco-catalyst profile, which keeps its own
.67109120 lookup in _cisco-catalyst.yaml. Keeping .67109120 in the
generic Cisco mixin adds noise without coverage benefit.

Updates the changelog to reflect the narrower mixin scope.
Adding serial_number to _cisco-metadata.yaml turned out to suppress the
leaf-level _cisco-catalyst.yaml symbols list during profile merging, so
cisco-catalyst-profiled devices stopped extracting chassisSerialNumberString
(the previously-working source). The metric mixin scope was already
narrow benefit: the only known cisco_switch_1300 / c9407r devices now
match cisco-catalyst directly, and the other inheritors of _cisco-metadata
(cisco-firepower, cisco-firepower-asa, cisco-ironport-email) don't expose
entPhysicalSerialNum in their test fixtures.

Keep the entPhysicalSerialNum fallbacks in _cisco-catalyst.yaml and
cisco-sb.yaml only.
Drops the Catalyst 9200 / 1300 sysobjectid entries (3079, 3233, 3236)
from this branch; they ship in #23759 instead so the metadata fallback
work here can be evaluated against CI in isolation.
The snmpsim container's entrypoint (datadog/docker-library:snmp) refuses
to start if any .snmprec file isn't `sort -V | uniq` clean. Eight files
in tests/compose/data had unsorted or duplicate OID rows, making the
container exit immediately on boot and the agent collect zero metrics
during e2e runs (`Needed at least 1 candidates for snmp.<metric>, got 0`).

No content change other than line reordering; all OID/value pairs are
preserved.
@ian28223 ian28223 force-pushed the ian.bucad/cisco-catalyst-serial-number-metadata branch from 92b785a to 015b495 Compare June 2, 2026 06:45
Copy link
Copy Markdown
Contributor

@victorsprengel victorsprengel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase and make sure CI is green

Drops the broader entPhysicalSerialNum.1 fallback (entPhysicalIndex is
arbitrary per ENTITY-MIB and .1 is not guaranteed to be the chassis).
Keeps the documented .67109120 chassis index used by Catalyst 1300 /
CBS-derived chassis. Test fixture renamed and re-targeted to a Catalyst
1300 sysObjectID (ciscoC130024P4G, 1.3.6.1.4.1.9.1.3233) so the snmprec
models a device family where this index is actually valid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 4, 2026

Validation Report

Validation Description Status
qa-label Validate the pull request declares whether it needs QA for the next Agent release

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (20)
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

@ian28223
Copy link
Copy Markdown
Contributor Author

ian28223 commented Jun 5, 2026

Closing in favor of #23939, which takes a different approach per the AGENT-15682 discussion: Catalyst 1200/1300 and CBS350 are routed to the cisco-sb profile (they run the SMB software stack, not IOS-XE) where the documented entPhysicalSerialNum.67109120 chassis index is read directly. No generic fallback in cisco-catalyst — entPhysicalIndex is arbitrary and an index-based fallback risked emitting non-chassis serials. For ciscoC9200CX12P2X2G (9.1.3079), the proper fix is dynamic chassis-row resolution (entPhysicalClass = chassis), which will be tracked as an FR.

@ian28223 ian28223 closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants