PANTHER Environment Plugins¤
Execution and network environment management for testing
Environment plugins manage where and how tests execute within PANTHER. They provide abstractions for different deployment scenarios, from localhost testing to containerized environments and network simulation platforms.
Environment Types
PANTHER supports two main environment categories:
- Execution Environments: Add monitoring, profiling, and analysis during test runs
- Network Environments: Manage network topology, containers, and simulation infrastructure
Environment Categories¤
Execution Environments¤
Execution environment plugins provide monitoring, profiling, and analysis capabilities during test execution.
Tool | Purpose | Documentation |
---|---|---|
gperf_cpu | CPU profiling and performance analysis | Documentation |
gperf_heap | Memory allocation profiling | Documentation |
strace | System call tracing | Documentation |
memcheck | Memory error detection | Documentation |
helgrind | Thread error detection | Documentation |
Network Environments¤
Network environment plugins manage network topology, containerization, and simulation infrastructure.
Environment | Purpose | Documentation |
---|---|---|
docker_compose | Multi-container testing environments | Documentation |
shadow_ns | Network simulation and emulation | Documentation |
Quick Start¤
Using an Execution Environment¤
# filepath: example_execution_env.py
from panther.plugins.plugin_loader import PluginLoader
# Load CPU profiling environment
loader = PluginLoader()
gperf_cpu = loader.load_plugin('environments', 'execution_environment', 'gperf_cpu')
# Configure profiling
config = {
"profile_frequency": 100,
"output_file": "/tmp/cpu_profile.prof",
"target_process": "picoquic_server"
}
gperf_cpu.initialize(config)
Using a Network Environment¤
# filepath: example_network_env.py
from panther.plugins.plugin_loader import PluginLoader
# Load Docker Compose environment
loader = PluginLoader()
docker_env = loader.load_plugin('environments', 'network_environment', 'docker_compose')
# Configure network topology
config = {
"compose_file": "docker-compose.yml",
"network_name": "panther_test_net",
"services": ["quic_server", "quic_client"]
}
docker_env.setup_environment(config)
Directory Structure¤
environments/
├── README.md # This file
├── environment_interface.py # Base environment interface
├── config_schema.py # Configuration validation
├── execution_environment/ # Execution monitoring tools
│ ├── README.md
│ ├── config_schema.py
│ ├── execution_environment_interface.py
│ ├── gperf_cpu/ # CPU profiling
│ ├── gperf_heap/ # Memory profiling
│ ├── strace/ # System call tracing
│ ├── memcheck/ # Memory error detection
│ └── helgrind/ # Thread error detection
└── network_environment/ # Network deployment
├── README.md
├── docker_compose/ # Container orchestration
└── shadow_ns/ # Network simulation
Environment Interfaces¤
Base Environment Interface¤
# filepath: /panther/plugins/environments/environment_interface.py
from panther.plugins.plugin_interface import IPlugin
class EnvironmentInterface(IPlugin):
"""Base interface for environment plugins."""
def setup_environment(self, config):
"""Setup the testing environment."""
pass
def teardown_environment(self):
"""Clean up the testing environment."""
pass
def get_environment_status(self):
"""Get current environment status."""
pass
Execution Environment Interface¤
# filepath: /panther/plugins/environments/execution_environment/execution_environment_interface.py
from panther.plugins.environments.environment_interface import EnvironmentInterface
class ExecutionEnvironmentInterface(EnvironmentInterface):
"""Interface for execution monitoring environments."""
def start_monitoring(self, target_process):
"""Start monitoring target process."""
pass
def stop_monitoring(self):
"""Stop monitoring and collect results."""
pass
def get_monitoring_data(self):
"""Retrieve collected monitoring data."""
pass
Configuration¤
Common Configuration Options¤
All environment plugins support these base options:
- environment_name: Unique identifier for the environment
- cleanup_on_exit: Automatically clean up resources when done
- timeout: Maximum setup/execution time
- logging_level: Environment-specific logging
Execution Environment Configuration¤
- target_process: Process or service to monitor
- monitoring_duration: How long to collect data
- output_directory: Where to store monitoring results
- sampling_rate: Data collection frequency
Network Environment Configuration¤
- network_topology: Network layout and connections
- deployment_target: Where to deploy (local, cloud, simulation)
- resource_limits: CPU, memory, network constraints
- service_dependencies: Service startup order and dependencies
Environment Integration¤
Environment plugins integrate with the PANTHER experiment lifecycle:
- Setup Phase: Environment plugins prepare the testing infrastructure
- Execution Phase: Monitor and manage running tests
- Collection Phase: Gather results and monitoring data
- Teardown Phase: Clean up resources and temporary files
Execution Flow¤
# filepath: example_environment_flow.py
# 1. Setup environment
environment.setup_environment(config)
# 2. Start monitoring (execution environments)
if isinstance(environment, ExecutionEnvironmentInterface):
environment.start_monitoring(target_process)
# 3. Run tests (handled by core framework)
# ...
# 4. Stop monitoring and collect results
if isinstance(environment, ExecutionEnvironmentInterface):
monitoring_data = environment.get_monitoring_data()
# 5. Teardown environment
environment.teardown_environment()
Development¤
For information on creating new environment plugins:
- Environment Plugin Development Guide: Comprehensive development documentation
- Execution Environment Development: Creating monitoring tools
- Network Environment Development: Creating deployment environments