Although all of the indicated steps need to be carried out correctly in order to implement the model, of particular importance is the correct specification of the data types for the parameters of the apply() method in the C++ class. Refer to the previous section, Modeling User Externs, for more details. Failure to correctly match up the C++ model with the types used in the JSON results in the behavioral model halting with an assertion message of the following form:
p4bm-vitisnetp4: ../behavioral-model-1.11.0/include/bm/bm_sim/actions.h:331: T bm::ActionParam::to(bm::ActionEngineState*) const [with T = bm::Field&]: Assertion `tag == ActionParam::FIELD' failed.
The assertion is triggered at the point where the behavioral model tries to invoke the apply() method provided and detects that the parameters it accepts are not compatible with the parameters that are being passed.
Equally important to the above is ensuring that the const keyword is used correctly with the parameters of the apply() method. The first parameter must be declared as const, while the second parameter must not. Failing to follow this guidance results in the behavioral model halting with an assertion message of the following form:
Assertion 'Default switch case should not be reachable' failed, file '../behavioral-model-1.11.0/include/bm/bm_sim/actions.h' line '286'.