-
Couldn't load subscription status.
- Fork 127
Add structured output support for Huawei and MikroTik devices + command fix update version project python 3.13-alpine and bug fix click type #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…e files using black
…plifying BGPRouteTable initialization
- Add new 'name' mode for BGP communities to append friendly names - New configuration option `structured.communities.mode: name` - Community mappings via `structured.communities.names` dictionary - Communities display as "65000:1000 - Upstream Any" in UI - Backward compatible with existing permit/deny modes - Enhance RPKI configuration documentation - Document both Cloudflare and Routinator backend options - Add `structured.rpki.backend` and `structured.rpki.rpki_server_url` parameters - Clarify Routinator web API endpoint usage vs RTR port - Add comprehensive configuration examples - Update structured output platform support - Document all supported platforms: Arista EOS, FRRouting, Huawei VRP, Juniper Junos, Mikrotik RouterOS/SwitchOS - Frontend enhancements - Parse comma-separated community format in UI components - Display friendly names alongside community codes - Maintain existing functionality for communities without names - Add validation and examples - Validate that 'name' mode has community mappings configured - Include example configuration and test cases - Generic examples using ASN 65000 instead of specific networks
- Update MikroTik parser to return -1 for unavailable age data instead of "0" - Change age property return type from string to int for consistency - Enhance frontend Age component to display "N/A" when age is -1 - Improve MonoField component to handle empty/undefined values gracefully - Add appropriate tooltips and styling for missing data indicators This addresses the issue where MikroTik devices don't provide route age and source RID information, ensuring the UI displays user-friendly indicators instead of potentially misleading placeholder values.
- Add complete configuration reference (complete-config.mdx) with detailed parameter documentation, examples, and descriptions for all config.yaml options - Add user guide (user-guide.mdx) explaining hostname resolution, 'My IP' feature, query types, and troubleshooting for end users - Add quick-start configuration examples (quick-start.mdx) with 8 real-world scenarios: minimal, corporate, privacy-focused, high-performance, ISP, enterprise, development, and monitoring setups - Update navigation structure (_meta.tsx files) to integrate new documentation sections - Provide comprehensive coverage of DNS-over-HTTPS hostname resolution, myip.wtf IP detection, web UI customization, logging/webhooks, structured output, and theme configuration - Include practical examples, use cases, troubleshooting tips, and best practices throughout This addresses documentation gaps by providing both technical reference material for administrators and user-focused guidance for end users, with extensive real-world configuration examples.
- Change MikrotikGarbageOutput to apply to ALL MikroTik platform commands using common=True - Add specialized traceroute output cleaning to handle progressive output and paging prompts - Remove interactive paging prompts (-- [Q quit|C-z pause]) - Deduplicate traceroute hops to show only final results - Clean up command echoes and empty progress lines - Apply to custom directives automatically without manual configuration Fixes messy traceroute output with repeated progress updates and interactive prompts.
- Add type checking to handle already-processed structured output - Skip processing when output is not raw strings (e.g., BGPRouteTable objects) - Prevents AttributeError when trying to call .strip() on tuple/structured data Fixes crash when MikroTik garbage plugin runs after structured parsing plugins.
- Split type checking into two separate conditions for clarity - Add early return when output contains non-string objects - Ensure structured output like MikrotikBGPRouteTable passes through unchanged - Prevent AttributeError on .strip() for tuple containing structured data Resolves remaining crashes when processing already-structured BGP route data.
- Add IPv6 address pattern matching alongside IPv4 - Extract SENT count from traceroute lines to prioritize complete data - Keep lines with highest SENT count (final results) instead of first occurrence - Maintain original hop order while using best data for each IP - Prefer non-timeout results when SENT counts are equal Fixes issues where IPv4 showed early results (SENT=1) instead of final (SENT=3) and IPv6 showed all intermediate steps instead of final consolidated results.
- Fix MED field showing N/A when value is 0 (now correctly shows 0) - Hide Originator field when empty instead of showing N/A - Hide Age field when not available instead of showing N/A - Add HideableField component for fields that should be hidden when empty - Update string output formatting to skip hidden fields in text export Resolves display issues where valid zero values and unavailable fields were showing as N/A instead of proper formatting or being hidden.
Added broader support for external RPKI validation.
- Remove custom __init__ from HuaweiBGPRouteTable class - Use standard BGPRouteTable inheritance like MikroTik does - Add BGPRoute import and instantiate BGPRoute objects in bgp_table() - Enable proper Pydantic validation for both table and routes - Ensure consistent behavior across all BGP parsers - Update .gitignore to exclude dev-build.sh and dev-docker/
…riable naming - Add BGPRoute import to Juniper, Arista, and FRR parsers - Change all parsers to instantiate BGPRoute objects instead of raw dictionaries - Harmonize variable naming across all BGP parsers: - Use 'route_data' for dictionary variable - Use 'routes' for output list - Use 'route' for loop variable - Ensure consistent validation behavior across MikroTik, Huawei, Juniper, Arista, and FRR - All parsers now properly invoke BGP table class validation
- Add BGPRoute import and export in hyperglass.models.data.__init__.py - This allows BGP parsers to properly import BGPRoute for validation - Resolves ImportError when starting hyperglass application
Structured
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CarlosSuporteISP while I have no problem with the Portuguese language would you mind providing an English translation for these samples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this into docs/pages/configuration/config/structured-output.mdx
Description
This pull request (PR) adds structured output support for Huawei and MikroTik devices, which previously only returned text.
Key changes and fixes:
Huawei:
192.0.2.0/24) was not compatible.192.0.2.0 24(replacing the slash with a space).MikroTik:
Command Fix (General):
Related Issues
I fixed the error that Wilhelm mentioned. The issue was related to Click version 8.3.0. I thought it had worked in Python3.13, but I was also using version 8.1.7 as he mentioned.
Modified files (in case you don't want to use my fork):
Motivation and Context
The lack of structured output for very common network devices like Huawei and MikroTik limits hyperglass's usability in heterogeneous environments. This change allows users to get consistent, parsed output from these devices, just like with Juniper or Arista. The command fix is crucial for overall stability and compatibility.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
show ip route/show ipv6 routeshow bgp route/show bgp ipv6 routeping/ping6traceroute/traceroute6Result: All commands now return valid JSON-structured data on these devices instead of raw text.