scapy.contrib.automotive.scanner.test_case

class scapy.contrib.automotive.scanner.test_case.AutomotiveTestCase[源代码]

基类:AutomotiveTestCaseABC

Base class for TestCases

classmethod check_kwargs(kwargs: Dict[str, Any]) None[源代码]
property completed: bool
execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
has_completed(state: EcuState) bool[源代码]
post_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None[源代码]
pre_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None[源代码]
property scanned_states: Set[EcuState]

Helper function to get all scanned states :return: all scanned states

show(dump: bool = False, filtered: bool = True, verbose: bool = False) str | None[源代码]
class scapy.contrib.automotive.scanner.test_case.AutomotiveTestCaseABC[源代码]

基类: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[源代码]

Executes this TestCase for a given state

参数:
  • socket -- Socket object with the connection to a DUT

  • state -- Current state of the DUT

  • kwargs -- Local configuration of the TestCasesExecutor

返回:

abstract has_completed(state: EcuState) bool[源代码]

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[源代码]

Will be executed subsequently to execute. This function can be used for additional evaluations after the execute.

参数:
  • 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[源代码]

Will be executed previously to execute. This function can be used to manipulate the configuration passed to execute.

参数:
  • 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[源代码]

Shows results of TestCase

参数:
  • 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.

返回:

test results of TestCase if parameter dump is True, else None

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[源代码]

基类:object

abstract get_new_edge(socket: _SocketUnion, config: AutomotiveTestCaseExecutorConfiguration) _Edge | None[源代码]
abstract get_transition_function(socket: _SocketUnion, edge: _Edge) _TransitionTuple | None[源代码]
参数:
  • socket -- Socket to target

  • edge -- Tuple of EcuState objects for the requested transition function

返回:

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[源代码]

基类:object

abstract get_generated_test_case() AutomotiveTestCaseABC | None[源代码]