YAMS: Managing JCNR with Model Context Protocol¶
Lavanya Kumar Ambatipudi - 07/24/2025
YAMS (Yet Another MCP Server) is a specialized Model Context Protocol server designed to address the operational complexities of managing JCNR deployments at scale. Built specifically for network engineers, testing engineers and DevOps teams, YAMS provides a unified management interface that abstracts the complexity of multi-cluster JCNR operations.
This article was originally posted on: https://github.com/Juniper/yams/blob/main/YAMS_JCNR_Article.md#comprehensive-use-case-multi-cluster-jcnr-network-analysis
Introduction¶
What is JCNR?¶
Juniper Cloud-Native Router (JCNR) is Juniper's next-generation containerized routing solution that transforms traditional networking by bringing enterprise-grade routing capabilities directly into Kubernetes environments. JCNR represents a fundamental shift from hardware-centric to software-defined networking, enabling scalable, cloud-native network functions.
YAMS (Yet Another MCP Server) is a specialized Model Context Protocol server designed to address the operational complexities of managing JCNR deployments at scale. Built specifically for network engineers, testing engineers, and DevOps teams, YAMS provides a unified management interface that abstracts the complexity of multi-cluster JCNR operations.
What is YAMS?¶
YAMS is an HTTP-based MCP server that integrates deeply with Kubernetes clusters and JCNR components. It leverages the Model Context Protocol to provide intelligent, context-aware interactions with the JCNR infrastructure through modern development tools like VS Code Copilot Chat and other MCP-compatible desktops.
Core YAMS Architecture¶
- HTTP-based MCP Server: RESTful API design built on FastAPI framework for high performance and scalability
- Multi-cluster Orchestration: Seamless management of multiple Kubernetes environments with unified authentication
- SSH Tunnel Integration: Secure access to private cloud and on-premises JCNR deployments
- JCNR-Native Tools: Purpose-built commands that understand JCNR's three-tier architecture
- VS Code Integration: Native support for Copilot Chat, enabling natural language network operations
- Real-time Data Access: Direct integration with JCNR's Sandesh HTTP APIs for live operational data
Why YAMS for JCNR?¶
Traditional JCNR management requires network engineers to:
- Connect to each cluster individually using different kubeconfig files
- Execute commands across multiple namespaces (contrail, jcnr) and pod types
- Correlate data between DPDK datapath, routing protocols, and agent components
- Manually aggregate information for cross-cluster analysis
- Switch between different command syntaxes (kubectl, Junos CLI, DPDK commands)
YAMS transforms this workflow into unified operations that work across all clusters simultaneously.
JCNR-Specific Tools in YAMS¶
YAMS provides specialized tools designed specifically for JCNR's three-tier architecture, enabling comprehensive management of control plane, data plane, and agent components across multiple clusters.
1 - cRPD Control Plane Tools¶
Execute Junos CLI commands across all cRPD (Containerized Routing Protocol Daemon) instances in the jcnr namespace.
Key Features:
- Automatically prepends *cli -c *for proper Junos CLI execution
- Supports all standard Junos commands (show, configure, monitor)
- Executes across all cRPD and cSRX pods simultaneously
- Provides unified output from multiple clusters
Common Use Cases:
2 - DPDK Data Plane Tools¶
Execute commands in DPDK pods (vrdpdk) across the contrail namespace for data plane analysis.
Key Features:
- Targets all vrouter-nodes-vrdpdk pods across clusters
- Provides high-performance packet processing insights
- Supports all vRouter command-line tools
- Delivers unified datapath visibility
Common Use Cases:
3 - Contrail Agent Tools¶
JCNR runs an agent module responsible for communicating with cRPD and programming JCNR vrouter data path. Agent provides an HTTP interface called introspect. This is a rich HTTP API interface that gives a comprehensive view of the Agent and its internal data.
HTTP API Integration for Real-time Data:
The Contrail Agent provides rich HTTP API endpoints that YAMS integrates with to provide formatted, real-time operational data.
Common Use Cases:
Benefits of HTTP API Integration:
- Real-time Data: Live operational statistics without pod restart requirements
- Structured Output: Formatted tables for easy analysis and correlation
- Rich Metadata: Additional context like VRF mappings, peer information, and state details
- Performance Insights: Detailed packet/byte counters and error statistics
- Policy Visibility: Security group and ACL information for troubleshooting
- Unified Format: Consistent data presentation across all clusters
4 - Comprehensive JCNR Analysis¶
Provides complete JCNR datapath and control plane analysis by combining data from all three tiers.
Key Features:
- Executes predefined command sets from configurable JSON files
- Fetches real-time data from Sandesh HTTP APIs
- Combines DPDK, Agent, and cRPD outputs in unified reports
- Supports both single-cluster and multi-cluster analysis
Components Analyzed:
- DPDK Commands: nh --list, vif --list, rt --dump, flow -l, mpls --dump
- HTTP API Data: Next-hop tables, VRF lists, route tables, interface statistics
- Junos CLI: Interface status, routing tables, protocol summaries, BGP/OSPF status
5 - Advanced Diagnostic Tools¶
Note: While these tools are showcased with JCNR deployments, they can be applied to any Kubernetes pods and workloads across your clusters for comprehensive diagnostics and monitoring.
pod_command_and_summary
Execute predefined command sets on any JCNR pod with execution statistics.
Key Features:
- Commands loaded from configurable JSON files
- Execution summary with success rates and timing
- Supports custom command lists per cluster
- Targets specific pods for detailed analysis
analyze_logs
Intelligent log analysis across JCNR components.
Key Features:
- Searches for error patterns in DPDK, agent, and cRPD logs
- Configurable regex patterns and time windows
- Multi-node log aggregation
- Customizable output limits
check_core_files
Automated detection of crash dumps and core files.
Key Features:
- Searches common core dump locations
- Age-based filtering for recent crashes
JCNR Network Topology¶
The following diagram illustrates the interconnected JCNR cluster topology used in our multi-cluster deployment examples:
Topology Overview¶
- Ring Topology: All four clusters form a logical ring for redundancy
- SR-MPLS: Segment Routing MPLS for simplified forwarding and traffic engineering
- OSPF Backbone: All clusters participate in OSPF Area 0 for IGP connectivity and SR label distribution
- SR-MPLS L3VPN: VPN services using Segment Routing labels for efficient forwarding
- Load Distribution: Traffic can flow in both directions around the ring using SR paths
Use Case Context:
This topology represents a typical SR-MPLS JCNR deployment where:
- Multiple clusters provide distribution into multiple K8S clusters
- OSPF distributes prefix SIDs and adjacency SIDs for Segment Routing
- SR-MPLS provides simplified forwarding without per-flow state
- Label stacking enables traffic engineering and L3VPN services across all sites
- Ring topology provides path redundancy with automatic failover
Sample HTTP API Outputs from JCNR3 Cluster¶
The following examples show real HTTP API outputs from the JCNR3 cluster (jcnr3.demolab) in the topology above, demonstrating the type of operational data available through YAMS:
Next-hop Table via HTTP API
Text Input: "Get next-hop table from HTTP API in JCNR3 cluster"
Formatted Output:
VRF Table via HTTP API
Text Input: "Show VRF table information from HTTP API"
Formatted Output:
IPv4 Route Table via HTTP API
Text Input: "Display IPv4 routing table from HTTP API in JCNR3"
Formatted Output:
Interface Statistics via HTTP API
Text Input: "Get interface statistics from HTTP API"
Formatted Output:
HTTP API Analysis:
- Network Topology Correlation: The interface IP addresses (192.168.133.3, 192.168.144.3, 192.168.155.6, 192.168.200.3) match the ring topology links shown above
- Route Distribution: Routes for all ring segments (133.x, 144.x, 155.x, 200.x networks) are present, confirming BGP/OSPF operation
- Next-hop Analysis: ARP and interface next-hops for physical links (enp7s0-enp10s0) align with the four-port ring configuration
- Traffic Patterns: Interface statistics show active traffic across all ring links, with enp9s0 showing the highest utilization
Comprehensive Use Case: Multi-Cluster JCNR Network Analysis¶
This use case demonstrates how YAMS enables comprehensive network analysis across multiple JCNR clusters through unified operations. A network operations team needs to perform a complete analysis of their JCNR infrastructure spanning the 4 interconnected clusters shown in the topology above.
Scenario: Production Network Health Assessment¶
Environment:
- 4 JCNR clusters: JCNR3 (SR Control), JCNR4 (SR Control), JCNR6 (SR Transit), JCNR2 (SR Endpoint)
- Each cluster is running OSPF with SR extensions and SR-MPLS L3VPN services in ring topology
- Requirements: Complete SR protocol status, interface statistics, datapath analysis, and specific route investigation
Step 1: BGP Summary Across All Clusters¶
Objective: Get BGP neighbor status and session information from all cRPD instances.
Text Input: "Show me the BGP summary and neighbor status across all JCNR clusters"
Sample Output:
Analysis Results:
- JCNR3: SR-MPLS control node with L3VPN routes, 45 VPN routes distributed
- JCNR4: SR-MPLS control node with established sessions, stable label distribution
- JCNR6: SR-MPLS transit node functioning correctly with forwarding tables
- All clusters: Stable SR-MPLS infrastructure with proper label distribution
Step 2: OSPF Summary Across All Clusters¶
Objective: Verify OSPF adjacencies, SR prefix SID distribution, and area information across all clusters.
Text Input: "Check OSPF neighbor adjacencies and database status in all clusters"
Sample Output:
Analysis Results:
- OSPF Adjacencies: All neighbors in Full state across clusters with SR capability
- LSA Database: Consistent topology information with SR prefix SID advertisements
- SR-MPLS: Area 0.0.0.0 stable with 4 SR-enabled routers, prefix SID distribution working
Step 3: Interface Statistics from All JCNR Clusters¶
Objective: Collect comprehensive interface statistics from DPDK data plane.
Text Input: "Get interface statistics and packet counters from the DPDK data plane across all clusters"
Sample Output:
Analysis Results:
- Traffic Volume: Heavy traffic on primary interfaces (22B+ packets)
- Error Rates: Zero errors on most interfaces, indicating healthy data plane
- Drop Analysis: Some drops detected on high-traffic interfaces (normal behavior)
Step 4: JCNR Summary from All Clusters¶
Objective: Complete datapath and control plane analysis, combining all JCNR components.
Text Input: "Provide a comprehensive JCNR summary with datapath, control plane, and HTTP API data from all clusters"
Sample Output:
Analysis Results:
- Datapath Health: All clusters showing healthy SR-MPLS packet forwarding
- Route Scale: Consistent route counts with proper SR label distribution
- Protocol Status: OSPF stable with SR prefix SID distribution across all clusters
- VPN Services: SR-MPLS L3VPN routes are properly distributed with label stacking
Step 5: Specific Route Analysis¶
Objective: Investigate specific route 30.30.24.11/32 in detail from JCNR3 cluster.
Text Input: "Analyze the route 30.30.24.11/32 in JCNR3 cluster, showing both control plane and data plane details"
Route Analysis Output:
Control Plane (cRPD):
Data Plane (DPDK):
Route Analysis Summary:
- Route Type: BGP L3VPN route (RD: 64512:1)
- Source: PE router 4.4.4.4 via iBGP
- MPLS Labels: VPN label 59, Transport label 14400
- Load Balancing: ECMP across 2 paths (enp7s0, enp9s0)
- Active Forwarding: 22+ billion packets via enp9s0 path
- State: Route active in both control and data planes
Use Case Summary¶
This comprehensive analysis demonstrates YAMS's capability to:
- Unified Protocol Analysis: BGP and OSPF status across all clusters in single commands
- Performance Monitoring: Interface statistics and traffic analysis from DPDK data plane
- Complete Infrastructure View: Combined control plane and data plane visibility
- Detailed Route Investigation: Deep-dive analysis of specific routes with complete forwarding details
Traditional Approach: Manual cluster-by-cluster analysis with individual tool execution. YAMS Approach: Unified automated analysis across all clusters simultaneously.
Key Benefits Demonstrated:
- Significant time reduction for multi-cluster analysis workflows
- Unified visibility across JCNR's three-tier architecture
- Consistent data format regardless of cluster location or deployment method
- Deep diagnostic capabilities for specific route troubleshooting and analysis
Installation and Setup¶
Prerequisites¶
- Docker and Docker Compose installed
- Kubernetes cluster access with appropriate RBAC permissions
- SSH access to remote clusters (if applicable)
- VS Code with MCP support (optional but recommended)
Quick Start with Docker¶
Cluster Configuration¶
Create clusters/clusters.json with your JCNR cluster details. Here's the actual configuration from the YAMS workspace showing different cluster connection methods:
Configuration Examples Explained:
- jcnr3-cluster: Direct kubeconfig access for local/accessible clusters
- jcnr4-cluster: SSH tunnel with key-based authentication to jcnr4.demolab
- jcnr2-cluster: SSH tunnel with password authentication to jcnr2.demolab
- jcnr6-cluster: SSH tunnel with key-based authentication to jcnr6.demolab
Key Configuration Parameters:
- kubeconfig_path: Path to the Kubernetes configuration file
- description: Human-readable cluster description
- ssh.host: SSH jump host for remote clusters
- ssh.username: SSH username for authentication
- ssh.key_path: Path to SSH private key (alternative to password)
- ssh.password: SSH password (alternative to key-based auth)
- ssh.k8s_host: Kubernetes API server hostname/IP
- ssh.k8s_port: Kubernetes API server port (default: 6443)
- ssh.local_port: Local port for SSH tunnel forwarding
- jcnr_command_list: Path to JCNR-specific command configuration
- pod_command_list: Path to general pod diagnostic commands
Command Configuration¶
Configure JCNR-specific command sets in jcnr-command-list.json (actual configuration from YAMS workspace):
Pod Commands (pod-command-list.json - actual configuration):
Configuration Sections Explained:
- datapath_commands: DPDK vRouter commands executed in vrdpdk pods
- junos_cli_commands: Junos CLI commands executed in cRPD pods (automatically prefixed with cli -c)
- http_endpoints: Sandesh HTTP API endpoints for real-time data access
- http_port: Port number for Contrail agent HTTP API (default: 8085)
- analysis_config: Output formatting and analysis parameters
- max_display_lines: Limit displayed lines for large outputs
- max_http_display_chars: Character limit for HTTP API responses
- enable_detailed_analysis: Enable comprehensive analysis features
- truncate_large_outputs: Automatically truncate large command outputs
Command Customization:
- Commands are executed exactly as specified in the JSON configuration
- DPDK commands target /contrail namespace vrdpdk pods
- Junos CLI commands target /jcnr namespace cRPD pods
- HTTP endpoints are accessed via the configured port on agent pod IPs
- Custom command sets can be configured per cluster for different environments
Note: Both JCNR and pod command lists can be modified to include desired commands based on your specific operational requirements. Refer to the JCNR documentation for comprehensive command configuration options and best practices for customizing command sets for different deployment scenarios.
VS Code Integration¶
Add to your VS Code settings.json for Copilot Chat integration:
Benefits and Impact¶
Operational Benefits¶
- Reduction in analysis time in multi-cluster analysis time
- Unified interface for JCNR's three-tier architecture
- Consistent operations across on-premises and cloud deployments
- Enhanced troubleshooting with correlated data from all components
- Reduced human error through automated command execution
- Improved visibility into JCNR datapath and control plane status
Technical Advantages¶
- Real-time data access via Sandesh HTTP API integration
- Flexible configuration with external JSON command sets
- Secure access through SSH tunneling and key-based authentication
- Scalable architecture supporting 50+ clusters
- Modern integration with VS Code and AI-powered workflows
Getting Started¶
- Download and install YAMS using the Docker quick-start method
- Configure your JCNR clusters in the JSON configuration format
- Set up command lists for your specific JCNR deployment patterns
- Integrate with VS Code for enhanced workflow capabilities
- Begin unified JCNR management across all your clusters
YAMS provides the foundation for modern, scalable JCNR operations where multi-cluster complexity meets unified simplicity.
Conclusion¶
YAMS transforms JCNR management from a manual, cluster-by-cluster process into a unified, automated workflow. By providing specialized tools for JCNR's three-tier architecture and enabling comprehensive multi-cluster analysis, YAMS addresses the key operational challenges facing network teams managing cloud-native routing infrastructure.
The combination of DPDK data plane tools, cRPD control plane integration, and Contrail agent management provides complete visibility into JCNR deployments. With features like automated BGP/OSPF analysis, interface statistics collection, comprehensive JCNR summaries, and detailed route investigation, YAMS enables network engineers to operate at scale while maintaining deep technical insight.
For organizations running JCNR in production, YAMS offers a practical solution that reduces operational complexity, improves troubleshooting efficiency, and enables modern DevOps workflows for network infrastructure management.
YAMS provides the foundation for modern, scalable JCNR operations where multi-cluster complexity meets unified simplicity.
Useful links¶
- JCNR Landing Page: https://www.juniper.net/documentation/product/us/en/juniper-cloud-native-router/
- JCNR Troubleshooting guide https://www.juniper.net/documentation/us/en/software/cloud-native-router25.2/cloud-native-router-deployment-guide/topics/topic-map/jcnr-troubleshoot-deployment.html
- JCNR tool list: https://www.juniper.net/documentation/us/en/software/contrail-networking20/contrail-analytics-troubleshooting-guide/topics/concept/contrail-tools.html
- JCNR Deployment Guide: https://www.juniper.net/documentation/us/en/software/cloud-native-router25.2/cloud-native-router-deployment-guide/index.html
- YAMS README: https://github.com/Juniper/yams/blob/main/README.md
- JCNR Agent HTTP API Introspect Guide: https://www.juniper.net/documentation/us/en/software/cloud-native-router24.2/cloud-native-router-user/topics/concept/jcnr-introspect.html
- cSRX Landing Page: https://www.juniper.net/us/en/products/security/srx-series/csrx-containerized-firewall.html
Glossary¶
- cRPD: Containerized JUNOS Routing Protocol Daemon
- cSRX: Containerized JUNOS SRX
- K8S: Kubernetes
- JCNR: Juniper Cloud Native Router
- MCP: Model Context Protocol
- SR-MPLS: Segment Routing MPLS
- YAMS: Yet Another MCP Server
Acknowledgments¶
The author would like to thank Vinod Nair and JCNR team for reviewing and trying this MCP server.