Skip to content

Commit

Permalink
rename testers binfuzz + refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ElNiak committed Oct 17, 2024
1 parent 5eb45c9 commit e7997c1
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 140 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ panther_worker/app/implementations/quic-implementations/quic-go/quic-go/go1.16.l
panther/outputs/qlogs/*/*.qlog
panther/outputs/qlogs/*/*.log
panther/outputs/qlogs/*
panther/outputs/*/
panther/outputs/*/*
panther/config/certs
panther/config/tls_keys
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
path = panther/plugins/testers/panther_ivy
url = [email protected]:ElNiak/PANTHER-Ivy.git
[submodule "panther/plugins/testers/BinFuzz"]
path = panther/plugins/testers/BinFuzz
path = panther/plugins/testers/panther_binfuzz/
url = [email protected]:ElNiak/BinFuzz.git
80 changes: 40 additions & 40 deletions panther/config/experiment_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,44 +90,44 @@ tests:
endpoint: "8081/health" # Adjust based on health endpoint
expected_status: 200

- name: "QUIC Client-Server Communication Test III"
description: "Verify that the Picoquic client can communicate with the Picoquic server over Docker Compose network."
protocol: "quic" # Protocol name should match the folder name in plugins/
network_environment: "docker_compose" # Environment plugin name
execution_environment: None
services:
picoquic_server:
name: "picoquic_server" # Added 'name' key
implementation: "picoquic" # parameters are presents in folder plugins/implementations/quic/picoquic/config.yaml
version: "rfc9000"
type: "iut"
role: "server"
ports:
- "4443:4443"
- "8080:8080" # Health check endpoint
ivy_client:
name: "ivy_client" # Added 'name' key
implementation: "ivy"
protocol: "quic"
version: "rfc9000"
role: "client"
type: "tester"
target: "picoquic_server" # Docker Compose service name
ports:
- "5000:5000" # Example port if needed
- "8081:8081" # Changed to avoid port conflict
steps:
# record_pcap: True
wait:
duration: 20 # seconds to wait during the test
# record_pcap: False
assertions:
- type: "service_responsive"
service: "picoquic_server"
endpoint: "8080/health" # Adjust based on health endpoint
expected_status: 200
- type: "service_responsive"
service: "ivy_client"
endpoint: "8081/health" # Adjust based on health endpoint
expected_status: 200
# - name: "QUIC Client-Server Communication Test III"
# description: "Verify that the Picoquic client can communicate with the Picoquic server over Docker Compose network."
# protocol: "quic" # Protocol name should match the folder name in plugins/
# network_environment: "docker_compose" # Environment plugin name
# execution_environment: None
# services:
# picoquic_server:
# name: "picoquic_server" # Added 'name' key
# implementation: "picoquic" # parameters are presents in folder plugins/implementations/quic/picoquic/config.yaml
# version: "rfc9000"
# type: "iut"
# role: "server"
# ports:
# - "4443:4443"
# - "8080:8080" # Health check endpoint
# ivy_client:
# name: "ivy_client" # Added 'name' key
# implementation: "ivy"
# protocol: "quic"
# version: "rfc9000"
# role: "client"
# type: "tester"
# target: "picoquic_server" # Docker Compose service name
# ports:
# - "5000:5000" # Example port if needed
# - "8081:8081" # Changed to avoid port conflict
# steps:
# # record_pcap: True
# wait:
# duration: 20 # seconds to wait during the test
# # record_pcap: False
# assertions:
# - type: "service_responsive"
# service: "picoquic_server"
# endpoint: "8080/health" # Adjust based on health endpoint
# expected_status: 200
# - type: "service_responsive"
# service: "ivy_client"
# endpoint: "8081/health" # Adjust based on health endpoint
# expected_status: 200

13 changes: 0 additions & 13 deletions panther/core/experiment.py

This file was deleted.

2 changes: 1 addition & 1 deletion panther/core/experiment_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import requests
import yaml

from utils.plugin_loader import PluginLoader
from core.utils.plugin_loader import PluginLoader
from plugins.implementations.protocol_interface import IProtocolPlugin
from plugins.environments.environment_interface import IEnvironmentPlugin
from plugins.implementations.service_manager_interface import IServiceManager
Expand Down
21 changes: 21 additions & 0 deletions panther/core/results/result_handlers/local_storage_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

from core.results.result_handler import ResultHandler


class LocalStorageHandler(ResultHandler):
"""
Concrete implementation of ResultHandler for storing results in a local database.
Attributes:
db (Database): The local database to store the results in.
Methods:
__init__(db: Database) -> None:
Initializes the StorageHandler with the given local database.
handle(request) -> None:
Stores the request in the local database.
"""

def __init__(self, db) -> None:
self.db = db

def handle(self, request) -> None:
self.db.store(request)
35 changes: 35 additions & 0 deletions panther/core/test_cases/test_case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import logging
from omegaconf import DictConfig
from core.test_interface import ITestCase


class TestCase(ITestCase):
def __init__(self, test_config: DictConfig, logger: logging.Logger):
super().__init__(test_config, logger)

def run(self):
"""Runs the test case based on the provided configuration."""
try:
self.logger.info(f"Starting test: {self.test_config.name}")
self._run_services()
self._execute_steps()
self._validate_assertions()
self.logger.info(f"Test '{self.test_config.name}' completed successfully.")
except Exception as e:
self.logger.error(f"Test '{self.test_config.name}' failed: {e}")
raise

def _run_services(self):
"""Starts the services defined in the test configuration."""
# Placeholder for starting services logic, e.g., Docker containers
self.logger.info("Services started.")

def _execute_steps(self):
"""Executes steps defined in the test configuration."""
# Placeholder for executing steps, such as waiting or recording
self.logger.info("Test steps executed.")

def _validate_assertions(self):
"""Validates assertions defined in the test configuration."""
# Placeholder for validating assertions, such as service responsiveness
self.logger.info("Assertions validated.")
28 changes: 28 additions & 0 deletions panther/core/test_cases/test_interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# PANTHER-SCP/panther/core/test_case_interface.py

from abc import ABC, abstractmethod
import logging

class ITestCase(ABC):
def __init__(self, logger: logging.Logger):
self.logger = logger

@abstractmethod
def run(self):
"""Runs the test case."""
pass

@abstractmethod
def run_services(self):
"""Starts the services defined in the test configuration."""
pass

@abstractmethod
def execute_steps(self):
"""Executes steps defined in the test configuration."""
pass

@abstractmethod
def validate_assertions(self):
"""Validates assertions defined in the test configuration."""
pass
Empty file removed panther/core/test_interface.py
Empty file.
80 changes: 0 additions & 80 deletions panther/core/test_manager.py

This file was deleted.

4 changes: 4 additions & 0 deletions panther/core/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""panther package.
This package contains the panther application and its modules.
"""
2 changes: 1 addition & 1 deletion panther/core/utils/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Dict, Any, List

import yaml
from utils.docker_builder import DockerBuilder
from core.utils.docker_builder import DockerBuilder


class PluginLoader:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ services:
# TODO protocol + duration
- "(tshark -a duration:10 -i any -w /app/logs/picoquic_server.pcap;) & (sleep 2; ./picoquicdemo -c /opt/certs/cert.pem -k /opt/certs/key.pem -a hq-interop -l - -n servername -D -L -e eth0 -p 4443 > /app/logs/server.log 2>&1)"
volumes:
- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/outputs/experiment_2024-10-17_10-22-31/logs/picoquic_server/:/app/logs/"
- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/outputs/experiment_2024-10-17_10-35-19/logs/picoquic_server/:/app/logs/"

- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/config/certs/cert.pem:/opt/certs/cert.pem"

Expand Down Expand Up @@ -90,7 +90,7 @@ services:
# TODO protocol + duration
- "(tshark -a duration:10 -i any -w /app/logs/picoquic_client.pcap;) & (sleep 2; sleep 5;./picoquicdemo -c /opt/certs/cert.pem -k /opt/certs/key.pem -T /opt/ticket/ticket.key -a hq-interop -l - -D -L -e eth0 -v 00000001 picoquic_server 4443 > /app/logs/client.log 2>&1)"
volumes:
- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/outputs/experiment_2024-10-17_10-22-31/logs/picoquic_client/:/app/logs/"
- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/outputs/experiment_2024-10-17_10-35-19/logs/picoquic_client/:/app/logs/"

- "/home/crochetch/Documents/Projects/VerificationQUIC/PANTHER-SCP/panther/config/certs/cert.pem:/opt/certs/cert.pem"

Expand Down
2 changes: 1 addition & 1 deletion panther/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from plugins.environments.execution_environment.execution_environment_interface import IExecutionEnvironment
from plugins.implementations.service_manager_interface import IServiceManager
from plugins.environments.environment_interface import IEnvironmentPlugin
from utils.plugin_loader import PluginLoader
from core.utils.plugin_loader import PluginLoader


class PluginManager:
Expand Down
Submodule panther_binfuzz updated from 000000 to 17e920

0 comments on commit e7997c1

Please sign in to comment.