Skip to content

fix: add namedConstraintValue to tolerate identifiers in integer subtypes#15

Open
Jellyfrog wants to merge 1 commit intolextudio:mainfrom
Jellyfrog:fix/named-constraint-value
Open

fix: add namedConstraintValue to tolerate identifiers in integer subtypes#15
Jellyfrog wants to merge 1 commit intolextudio:mainfrom
Jellyfrog:fix/named-constraint-value

Conversation

@Jellyfrog
Copy link
Copy Markdown

MIB files that use named constants in subtype constraints (e.g. SYNTAX Unsigned32 (WAN7 | WAN8) in ARRIS-D5-SLOT-EXT-MIB) would fail with "Bad grammar near token type UPPERCASE_IDENTIFIER" errors.

This adds a new relaxed grammar option that allows UPPERCASE_IDENTIFIER and LOWERCASE_IDENTIFIER in the value rule used for integer subtype constraints.

Please note this code was generated by AI, but tested :)

…ypes

MIB files that use named constants in subtype constraints (e.g.
SYNTAX Unsigned32 (WAN7 | WAN8) in ARRIS-D5-SLOT-EXT-MIB) would fail
with "Bad grammar near token type UPPERCASE_IDENTIFIER" errors.

This adds a new relaxed grammar option that allows UPPERCASE_IDENTIFIER
and LOWERCASE_IDENTIFIER in the value rule used for integer subtype
constraints.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 22, 2026

CLA assistant check
All committers have signed the CLA.

@Jellyfrog
Copy link
Copy Markdown
Author

Few examples from https://github.com/librenms/librenms/tree/master/mibs

 NMS-EPON-OLT-PON (Bad grammar near token type UPPERCASE_IDENTIFIER, value FiberProtectGroup at MIB NMS-EPON-OLT-PON, line 163)
 BINTEC-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value InetAddressV6 at MIB BINTEC-MIB, line 227)
 E7-Calix-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value E7OperStatus at MIB E7-Calix-MIB, line 55)
Failed MIBs: IDKT-F2-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value F2FWDMacAddress at MIB IDKT-F2-MIB, line 115)
Failed MIBs: GW-EPON-DEV-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value PowerVOLTHighThreshold at MIB GW-EPON-DEV-MIB, line 665)
Failed MIBs: DISMUNTELv00-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value PFCTotal at MIB DISMUNTELv00-MIB, line 145)
 HUAWEI-QINQ-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value DISABLE at MIB HUAWEI-QINQ-MIB, line 3049)
 OPTIX-BOARD-MANAGE-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value RowStatus at MIB OPTIX-BOARD-MANAGE-MIB, line 503)

@lextm lextm added priority:low Low priority due to limited impact warning:faulty mib Related to MIB documents that don't follow the standards or conventions labels Jan 23, 2026
@lextm
Copy link
Copy Markdown

lextm commented Jan 23, 2026

Unless there is a compelling example with significant impact on user base, this pull request is not going to be accepted. Problematic MIB documents should be fixed by their vendors.

@Jellyfrog
Copy link
Copy Markdown
Author

These are the current ones from librenms mibs:

Failed MIBs: BINTEC-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value InetAddressV6 at MIB BINTEC-MIB, line 227)
 BINTEC-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value InetAddressV6 at MIB BINTEC-MIB, line 227)
 BINTEC-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value InetAddressV6 at MIB BINTEC-MIB, line 227)
Failed MIBs: ARRIS-D5-SLOT-EXT-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value WAN7 at MIB ARRIS-D5-SLOT-EXT-MIB, line 99)
Failed MIBs: CAMBIUM-PTP800-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value Renamed at MIB CAMBIUM-PTP800-MIB, line 67)
Failed MIBs: NMS-EPON-OLT-PON (Bad grammar near token type UPPERCASE_IDENTIFIER, value FiberProtectGroup at MIB NMS-EPON-OLT-PON, line 163)
Failed MIBs: TN-ACCESS-MGMT-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value Telnet at MIB TN-ACCESS-MGMT-MIB, line 267)
Failed MIBs: GW-EPON-DEV-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value PowerVOLTHighThreshold at MIB GW-EPON-DEV-MIB, line 665)
Failed MIBs: SUPERCAPBATTERY-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value BMS01-AmbientTemperature at MIB SUPERCAPBATTERY-MIB, line 143)
Failed MIBs: NMS-EPON-OLT-PON (Bad grammar near token type UPPERCASE_IDENTIFIER, value FiberProtectGroup at MIB NMS-EPON-OLT-PON, line 163)
Failed MIBs: RIELLOMDU-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value Imminent at MIB RIELLOMDU-MIB, line 431)
Failed MIBs: DISMUNTELv00-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value PFCTotal at MIB DISMUNTELv00-MIB, line 145)
Failed MIBs: E7-Calix-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value E7OperStatus at MIB E7-Calix-MIB, line 55)
Failed MIBs: PERLE-IOLAN-SDS-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value Description at MIB PERLE-IOLAN-SDS-MIB, line 1313)
Failed MIBs: OPTIX-BOARD-MANAGE-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value RowStatus at MIB OPTIX-BOARD-MANAGE-MIB, line 503)
Failed MIBs: IDKT-F2-MIB (Bad grammar near token type UPPERCASE_IDENTIFIER, value F2FWDMacAddress at MIB IDKT-F2-MIB, line 115)

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

Labels

priority:low Low priority due to limited impact warning:faulty mib Related to MIB documents that don't follow the standards or conventions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants