Wireless-Innovation-Forum / Citizens-Broadband-Radio-Service-Device

Apache License 2.0
31 stars 19 forks source link

More reasonable handling of request messages after test has completed #104

Closed cwilliams-ericsson closed 6 years ago

cwilliams-ericsson commented 6 years ago

Currently, after a test has completed, but before the next one starts, the test harness provides a response with responseCode = 103 to all request messages.

For some CBSD this may not lead to a good state at the end of a test case. So, it may require a state machine reset or hard reset to move to the next case. In some cases, allowing a CBSD to RLQ and/or DRG may provide for faster test execution.

I propose that we hook up the Engine.py generate_canned_response() to the FlaskServer for the case that a request messages arrive after a test has completed, but before the next one is run. This already exists since it was needed to keep CBSD1 happy in the case that CBSD1 completes all steps in a testcase, but CBSD2 has not yet completed (for DP + 2 CBSD test cases). It provides the following response messages:

registrationRequest: responseCode = 200 (does not allow new registrations) spectrumInquiryRequest: responseCode = 0 (shows 3550 - 3555 MHz available) grantRequest: responseCode = 400 (does not allow new grants) heartbeatRequest: responseCode = 0 (allows a heartbeating CBSD to continue) relinquishmentRequest: responseCode = 0 (allows CBSD to relinquish a grant) deregistrationRequest: responseCode = 0 (allows CBSD to deregister)

This has the advantage that, after a test has completed, the CBSD could RLQ and DRG, to prepare for the next test case, rather than requiring (possibly) a hard reset. If a vendor prefers instead to perform a state machine reset on their device between test cases, then this should not impact them.

cwilliams-ericsson commented 6 years ago

If a test case ends with CBSD grant suspended, then the above would allow it to move back to AUTHORIZED state when the test ends, potentially failing the test since the CBSD could start transmitting again after the last step in the test has completed.

Therefore, need to modify the logic above as follows: heartbeatRequest: if in 'AUTHORIZED' state, then responseCode = 0 if in 'GRANTED' state, then responseCode = 501 (i.e. keep in suspended state)

That way, if the test ends with grant suspended, CBSD behaving properly should not start transmitting again after the test has completed.

cwilliams-ericsson commented 6 years ago

I made the changes as indicated above, to latest working branch. I included two flags to file cbrsPython/model/flaskServer.py to enable/disable functionality.

As shown below, I have defaulted nice msg handling to ON. If this has any unforeseen problems, you can go back to the old msg handling (responseCode=103 for all messages) by setting it to 'False'.

Also as shown below, I added a flag to allow printing these "in between test" requests/responses to stdout (i.e. using print statements, not logging to file). This is default OFF, but available for development if you want to see the messages happening after a test has completed, but before the next test starts (since these are not logged to the per-test log files).

NICE_MSG_HANDLING_BETWEEN_TESTS: Turns on/off nice msg handling in time between test cases. True: (DEFAULT) - enables nice msg handling False: reverts to old msg handling (resp with responseCode=103 to all req msg)

PRINT_MSG_BETWEEN_TESTS: For use in debugging, if problems occur between test cases: False = no printing of msg received in idle time between test cases (DEFAULT) True = prints req/resp msg to std out if request msg is recevied during idle time between two test cases