A comprehensive tool for converting, validating, and visualizing Cilium Network Policies with a clean web-based dashboard.
- JSON to YAML Conversion: Convert firewall rules from JSON format to Cilium Network Policy YAML
- Comprehensive Validation: YAML syntax checking, schema validation, and style linting
- Real-time Feedback: Instant validation results with detailed error reporting
- Smart Suggestions: Get recommendations for policy improvements
- Network Topology Graph: Interactive network diagrams showing service connections
- Policy Analytics: Statistical analysis of policy rules and configurations
- Multi-format Support: Upload YAML policies or JSON rules for analysis
- Responsive Design: Works on desktop and mobile devices
- Professional UI: Clean, accessible interface with proper color contrast
- Status Indicators: Clear visual feedback for validation status and policy health
- Quick Actions: Easy policy management with one-click operations
- Command Line Interface: Full CLI support for batch processing and automation
- Batch Validation: Validate multiple policy files simultaneously
- Rich Terminal Output: Colored output with tables and progress indicators
- Python 3.8 or higher
- All dependencies from
requirements.txt
-
Clone the repository:
git clone <repository-url> cd CiliTest
-
Create a virtual environment (recommended):
python -m venv .venv .\.venv\Scripts\Activate.ps1 # Windows PowerShell # or source .venv/bin/activate # Linux/Mac
-
Install dependencies:
pip install -r requirements.txt
-
Launch the dashboard:
streamlit run dashboard.py
-
Access the application: Open your browser and navigate to
http://localhost:8501
- Navigate to the "Convert & Validate" page
- Choose between sample data or custom JSON input
- Click "Convert to YAML" to generate Cilium Network Policy
- View validation results with detailed error analysis
- After converting or uploading a policy, access the "Policy Visualizer"
- View interactive network topology graphs
- Analyze policy statistics and service connections
- Explore policy components with detailed metrics
- Upload existing YAML policies for validation
- Upload JSON firewall rules for conversion
- Instant processing with visual feedback
- Browse and analyze existing policy files
- Quick validation of policies in your project directory
- Load policies for visualization
- Dashboard Status: Real-time status of loaded policies
- Quick Actions: One-click policy management
- Session Control: Clear policies or start fresh sessions
- Valid Policy: Policy passes all validation checks
- Invalid Policy: Policy has errors that need fixing
- No Policy Loaded: Ready to convert or upload policies
python -m src.converter input.json output.yamlpython -m src.validator policy.yamlpython -m src.converter sample_data/firewall_rules.json converted_policy.yaml
python -m src.validator converted_policy.yamlCiliTest/
├── dashboard.py # Main Streamlit dashboard application
├── requirements.txt # Python dependencies
├── README.md # This file
├── src/ # Core modules
│ ├── cli.py # Command-line interface
│ ├── converter.py # JSON to YAML conversion
│ ├── validator.py # Policy validation engine
│ ├── tester.py # Policy testing utilities
│ └── visualizer.py # Visualization components
├── sample_data/ # Example data files
│ ├── firewall_rules.json # Sample firewall rules
│ └── cilium_policy.yaml # Sample Cilium policy
├── cilium_policies.yaml # Generated policies
├── converted_policy.yaml # Conversion output
├── test_pods.yaml # Test pod configurations
└── results.json # Test results
- Gradient Headers: Eye-catching headers with professional styling
- Interactive Cards: Hover effects and smooth transitions
- Status Badges: Color-coded indicators for policy health
- Responsive Layout: Adapts to different screen sizes
- Network Graphs: Interactive topology diagrams using Plotly
- Policy Statistics: Comprehensive analytics with charts
- Real-time Updates: Dynamic content updates based on user actions
- Export Options: Save and share your visualizations
- YAML Syntax Validation: Ensures proper YAML formatting
- Schema Validation: Validates against Cilium Network Policy schema
- Style Linting: Checks YAML style and best practices
- Logical Validation: Identifies potential policy conflicts
- Line-by-line Errors: Exact location of syntax issues
- Schema Violations: Detailed explanations of schema mismatches
- Style Warnings: Non-breaking style recommendations
- Improvement Suggestions: Smart recommendations for policy enhancement
- Rule Counts: Track ingress, egress, and endpoint rules
- Service Mapping: Visualize service-to-service connections
- Port Analysis: Monitor port usage and protocols
- Complexity Metrics: Assess policy complexity and maintainability
- Interactive Graphs: Drag-and-drop network visualization
- Service Discovery: Automatic detection of services and connections
- Connection Analysis: Detailed view of allowed traffic flows
- Visual Debugging: Identify policy gaps and overlaps
- Policy Persistence: Maintain policy state across page navigation
- Quick Actions: Clear policies, start new sessions
- Status Tracking: Real-time feedback on policy status
- Multiple Formats: Support for JSON, YAML, and YML files
- Batch Processing: Handle multiple files simultaneously
- Error Recovery: Graceful handling of invalid files
- API Compatible: Easy integration with CI/CD pipelines
- Export Options: Save converted policies and validation reports
- Command Line Tools: Full CLI support for automation
The project includes comprehensive testing capabilities:
- Start the dashboard:
streamlit run dashboard.py - Test conversion: Use sample data or upload your own JSON rules
- Validate policies: Upload YAML files for validation
- Explore visualization: View network graphs and analytics
# Test conversion
python -m src.converter sample_data/firewall_rules.json test_output.yaml
# Test validation
python -m src.validator test_output.yaml
# View generated policy
cat test_output.yaml- Convert Rules: Start with JSON firewall rules
- Generate Policy: Use the converter to create Cilium YAML
- Validate: Check for errors and get improvement suggestions
- Visualize: View network topology and analyze connections
- Refine: Make adjustments based on validation feedback
- Deploy: Use the validated policy in your Kubernetes cluster
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
If you encounter any issues or have questions:
- Check the validation output for detailed error messages
- Review the sample data for correct JSON format
- Ensure all dependencies are properly installed
- Check the Streamlit logs for any runtime errors
Built using Streamlit, Plotly, NetworkX, and modern web technologies.
Convert • Validate • Visualize • Deploy