scapy.contrib.automotive.scanner.test_case
- class scapy.contrib.automotive.scanner.test_case.AutomotiveTestCase[source]
Bases:
AutomotiveTestCaseABC
Base class for TestCases
- property completed: bool
- execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None [source]
- post_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None [source]
- pre_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None [source]
- class scapy.contrib.automotive.scanner.test_case.AutomotiveTestCaseABC[source]
Bases:
object
Base class for “TestCase” objects. In automotive scanners, these TestCase objects are used for individual tasks, for example enumerating over one kind of functionality of the protocol. It is also possible, that these TestCase objects execute complex tests on an ECU. The TestCaseExecuter object has a list of TestCases. The executer manipulates a device under test (DUT), to enter a certain state. In this state, the TestCase object gets executed.
- abstract property completed: bool
Tells if this TestCase is completely executed :return: True, if TestCase is completely executed
- abstract execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None [source]
Executes this TestCase for a given state
- Parameters:
socket – Socket object with the connection to a DUT
state – Current state of the DUT
kwargs – Local configuration of the TestCasesExecutor
- Returns:
- abstract has_completed(state: EcuState) bool [source]
Tells if this TestCase was executed for a certain state :param state: State of interest :return: True, if TestCase was executed in the questioned state
- abstract post_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration # noqa: E501) None [source]
Will be executed subsequently to
execute
. This function can be used for additional evaluations after theexecute
.- Parameters:
socket – Socket object with the connection to a DUT
state – Current state of the DUT
global_configuration – Configuration of the TestCaseExecutor
- abstract pre_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration # noqa: E501) None [source]
Will be executed previously to
execute
. This function can be used to manipulate the configuration passed to execute.- Parameters:
socket – Socket object with the connection to a DUT
state – Current state of the DUT
global_configuration – Configuration of the TestCaseExecutor
- abstract show(dump: bool = False, filtered: bool = True, verbose: bool = False) str | None [source]
Shows results of TestCase
- Parameters:
dump – If True, the results will be returned; If False, the results will be printed.
filtered – If True, the negative responses will be filtered dynamically.
verbose – If True, additional information will be provided.
- Returns:
test results of TestCase if parameter
dump
is True, elseNone
- abstract property supported_responses: List[EcuResponse]
Tells the supported responses in TestCase :return: The list of supported responses
- class scapy.contrib.automotive.scanner.test_case.StateGenerator[source]
Bases:
object
- abstract get_new_edge(socket: _SocketUnion, config: AutomotiveTestCaseExecutorConfiguration) _Edge | None [source]
- abstract get_transition_function(socket: _SocketUnion, edge: _Edge) _TransitionTuple | None [source]
- Parameters:
socket – Socket to target
edge – Tuple of EcuState objects for the requested transition function
- Returns:
Returns an optional tuple consisting of a transition function, a keyword arguments dictionary for the transition function and a cleanup function. Both functions take a Socket and the TestCaseExecutor configuration as arguments and return True if the execution was successful. The first function is the state enter function, the second function is a cleanup function
- class scapy.contrib.automotive.scanner.test_case.TestCaseGenerator[source]
Bases:
object
- abstract get_generated_test_case() AutomotiveTestCaseABC | None [source]