Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M0022 cancellation #408

Merged
merged 3 commits into from
Aug 23, 2024
Merged

M0022 cancellation #408

merged 3 commits into from
Aug 23, 2024

Conversation

emiltin
Copy link
Contributor

@emiltin emiltin commented Aug 23, 2024

Fixes #400.

Signal Priority Rquests tests updated:
For the normal flow, the test will cancel the requests, and it should then become completed.
Added a new tests, where the request is not cancelled, it should then become stale after a while.

@emiltin emiltin added the enhancement New feature or request label Aug 23, 2024
@emiltin emiltin added the testhub Set this label to trigger test on test hub equipment label Aug 23, 2024
@emiltin emiltin merged commit 88e9933 into main Aug 23, 2024
8 of 10 checks passed
@emiltin emiltin deleted the m0022_cancellation branch August 23, 2024 10:33
@mariusrazvanplugaru
Copy link
Contributor

Hi, i'm trying to test this with the last version of Core and S.X.L. I updated the "local" validator in my PC with your files but i still give this error:

Site::Traffic Light Controller Signal Priority state goes through received, activated, completed
> Subscribing to signal priority request status updates
2024-08-27T08:49:47.606Z 51296 CAR_TC_001 CAR_TC_001 b964 Sent StatusSubscribe {"mType":"rSMsg","type":"StatusSubscribe","cId":"CAR_TC_001","sS":[{"sCI":"S0033","n":"status","uRt":"0","sOc":true}],"mId":"b9648509-b07f-48da-83ce-0f8e2c374b95","ntsOId":"","xNId":""}
2024-08-27T08:49:47.607Z 51296 CAR_TC_001 - - Collect 1338: Waiting for 3 StatusUpdates {:component=>"CAR_TC_001"}
> Send an unrelated signal priority request before
2024-08-27T08:49:47.609Z 51296 CAR_TC_001 CAR_TC_001 37cd Sent CommandRequest {"mType":"rSMsg","type":"CommandRequest","cId":"CAR_TC_001","arg":[{"cCI":"M0022","cO":"requestPriority","n":"requestId","v":"5cd6"},{"cCI":"M0022","cO":"requestPriority","n":"signalGroupId","v":"CAR_SG_001"},{"cCI":"M0022","cO":"requestPriority","n":"type","v":"new"},{"cCI":"M0022","cO":"requestPriority","n":"level","v":"7"},{"cCI":"M0022","cO":"requestPriority","n":"eta","v":"2"},{"cCI":"M0022","cO":"requestPriority","n":"vehicleType","v":"car"}],"mId":"37cd6fb9-d081-43a8-bf8e-d9b552867c2a","ntsOId":"","xNId":""}
> Send our signal priority request
2024-08-27T08:49:47.612Z 51296 CAR_TC_001 CAR_TC_001 102c Sent CommandRequest {"mType":"rSMsg","type":"CommandRequest","cId":"CAR_TC_001","arg":[{"cCI":"M0022","cO":"requestPriority","n":"requestId","v":"8984"},{"cCI":"M0022","cO":"requestPriority","n":"signalGroupId","v":"CAR_SG_001"},{"cCI":"M0022","cO":"requestPriority","n":"type","v":"new"},{"cCI":"M0022","cO":"requestPriority","n":"level","v":"7"},{"cCI":"M0022","cO":"requestPriority","n":"eta","v":"2"},{"cCI":"M0022","cO":"requestPriority","n":"vehicleType","v":"car"}],"mId":"102c40a1-78bd-4c9c-851e-f35af92aa5eb","ntsOId":"","xNId":""}
> Send an unrelated signal priority request after
2024-08-27T08:49:47.614Z 51296 CAR_TC_001 CAR_TC_001 5ce8 Sent CommandRequest {"mType":"rSMsg","type":"CommandRequest","cId":"CAR_TC_001","arg":[{"cCI":"M0022","cO":"requestPriority","n":"requestId","v":"1a77"},{"cCI":"M0022","cO":"requestPriority","n":"signalGroupId","v":"CAR_SG_001"},{"cCI":"M0022","cO":"requestPriority","n":"type","v":"new"},{"cCI":"M0022","cO":"requestPriority","n":"level","v":"7"},{"cCI":"M0022","cO":"requestPriority","n":"eta","v":"2"},{"cCI":"M0022","cO":"requestPriority","n":"vehicleType","v":"car"}],"mId":"5ce8d300-4d5b-4342-8866-60d962727ceb","ntsOId":"","xNId":""}
2024-08-27T08:49:47.623Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DE6A-9306-4930-b930-00009306DE6A", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "24fa","s": "activated","t": "2024-08-27T08:49:39.000Z"}], "q": "recent"}]}
2024-08-27T08:49:47.624Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DE6A-9306-4930-b930-00009306DE6A"}
2024-08-27T08:49:47.655Z 51296 CAR_TC_001 - - Received MessageAck for StatusUnsubscribe 116d {"mType": "rSMsg", "type": "MessageAck", "oMId": "116d4fc9-55b0-4d75-bb88-d1ce219917e6"}
2024-08-27T08:49:47.697Z 51296 CAR_TC_001 - - Received MessageAck for StatusSubscribe b964 {"mType": "rSMsg", "type": "MessageAck", "oMId": "b9648509-b07f-48da-83ce-0f8e2c374b95"}
2024-08-27T08:49:47.698Z 51296 CAR_TC_001 - - StatusSubscribe b964 acknowledged, allowing repeated status values for [{"sCI"=>"S0033", "n"=>"status", "uRt"=>"0", "sOc"=>true}]
2024-08-27T08:49:47.723Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DEBE-9306-4930-b930-00009306DEBE", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [], "q": "recent"}]}
2024-08-27T08:49:47.724Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DEBE-9306-4930-b930-00009306DEBE"}
2024-08-27T08:49:47.754Z 51296 CAR_TC_001 - - Received MessageAck for CommandRequest 37cd {"mType": "rSMsg", "type": "MessageAck", "oMId": "37cd6fb9-d081-43a8-bf8e-d9b552867c2a"}
2024-08-27T08:49:47.804Z 51296 CAR_TC_001 CAR_TC_001 9306 Received CommandResponse {"mType": "rSMsg", "type": "CommandResponse", "mId": "9306DEC1-9306-4930-b930-00009306DEC1", "ntsOId": "", "xNId": "", "cId": "CAR_TC_001","cTS":"2024-08-27T08:49:46.000Z", "rvs": [{"cCI": "M0022", "n": "requestId", "age": "recent", "v": "5cd6"}, {"cCI": "M0022", "n": "signalGroupId", "age": "recent", "v": "CAR_SG_001"}, {"cCI": "M0022", "n": "type", "age": "recent", "v": "new"}, {"cCI": "M0022", "n": "level", "age": "recent", "v": "7"}, {"cCI": "M0022", "n": "eta", "age": "recent", "v": "2"}, {"cCI": "M0022", "n": "vehicleType", "age": "recent", "v": "car"}]}
2024-08-27T08:49:47.806Z 51296 CAR_TC_001 - - Sent MessageAck for CommandResponse 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DEC1-9306-4930-b930-00009306DEC1"}
2024-08-27T08:49:47.821Z 51296 CAR_TC_001 - - Received MessageAck for CommandRequest 102c {"mType": "rSMsg", "type": "MessageAck", "oMId": "102c40a1-78bd-4c9c-851e-f35af92aa5eb"}
2024-08-27T08:49:47.871Z 51296 CAR_TC_001 CAR_TC_001 9306 Received CommandResponse {"mType": "rSMsg", "type": "CommandResponse", "mId": "9306DED1-9306-4930-b930-00009306DED1", "ntsOId": "", "xNId": "", "cId": "CAR_TC_001","cTS":"2024-08-27T08:49:46.000Z", "rvs": [{"cCI": "M0022", "n": "requestId", "age": "recent", "v": "8984"}, {"cCI": "M0022", "n": "signalGroupId", "age": "recent", "v": "CAR_SG_001"}, {"cCI": "M0022", "n": "type", "age": "recent", "v": "new"}, {"cCI": "M0022", "n": "level", "age": "recent", "v": "7"}, {"cCI": "M0022", "n": "eta", "age": "recent", "v": "2"}, {"cCI": "M0022", "n": "vehicleType", "age": "recent", "v": "car"}]}
2024-08-27T08:49:47.873Z 51296 CAR_TC_001 - - Sent MessageAck for CommandResponse 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DED1-9306-4930-b930-00009306DED1"}
2024-08-27T08:49:47.892Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DEDD-9306-4930-b930-00009306DEDD", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "5cd6","s": "received","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:47.893Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DEDD-9306-4930-b930-00009306DEDD"}
2024-08-27T08:49:47.923Z 51296 CAR_TC_001 - - Received MessageAck for CommandRequest 5ce8 {"mType": "rSMsg", "type": "MessageAck", "oMId": "5ce8d300-4d5b-4342-8866-60d962727ceb"}
2024-08-27T08:49:47.971Z 51296 CAR_TC_001 CAR_TC_001 9306 Received CommandResponse {"mType": "rSMsg", "type": "CommandResponse", "mId": "9306DEE0-9306-4930-b930-00009306DEE0", "ntsOId": "", "xNId": "", "cId": "CAR_TC_001","cTS":"2024-08-27T08:49:46.000Z", "rvs": [{"cCI": "M0022", "n": "requestId", "age": "recent", "v": "1a77"}, {"cCI": "M0022", "n": "signalGroupId", "age": "recent", "v": "CAR_SG_001"}, {"cCI": "M0022", "n": "type", "age": "recent", "v": "new"}, {"cCI": "M0022", "n": "level", "age": "recent", "v": "7"}, {"cCI": "M0022", "n": "eta", "age": "recent", "v": "2"}, {"cCI": "M0022", "n": "vehicleType", "age": "recent", "v": "car"}]}
2024-08-27T08:49:47.972Z 51296 CAR_TC_001 - - Sent MessageAck for CommandResponse 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DEE0-9306-4930-b930-00009306DEE0"}
2024-08-27T08:49:47.993Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DEED-9306-4930-b930-00009306DEED", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "5cd6","s": "activated","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:47.995Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DEED-9306-4930-b930-00009306DEED"}
2024-08-27T08:49:48.027Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DF40-9306-4930-b930-00009306DF40", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "8984","s": "received","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:48.028Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DF40-9306-4930-b930-00009306DF40"}
> Priority request reached state 'received'
2024-08-27T08:49:48.028Z 51296 CAR_TC_001 - - Collect 1338: 1 of 3 message collected
2024-08-27T08:49:48.060Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DF4B-9306-4930-b930-00009306DF4B", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "1a77","s": "received","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:48.061Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DF4B-9306-4930-b930-00009306DF4B"}
2024-08-27T08:49:48.098Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DF57-9306-4930-b930-00009306DF57", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "8984","s": "activated","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:48.099Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DF57-9306-4930-b930-00009306DF57"}
> Priority request reached state 'activated'
2024-08-27T08:49:48.099Z 51296 CAR_TC_001 - - Collect 1338: 2 of 3 messages collected
2024-08-27T08:49:48.129Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306DF67-9306-4930-b930-00009306DF67", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:46.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "1a77","s": "activated","t": "2024-08-27T08:49:46.000Z"}], "q": "recent"}]}
2024-08-27T08:49:48.130Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306DF67-9306-4930-b930-00009306DF67"}
2024-08-27T08:49:49.687Z 51296 CAR_TC_001 - 9306 Received Watchdog {"mType": "rSMsg", "type": "Watchdog", "mId": "9306E69C-9306-4930-b930-00009306E69C", "wTs": "2024-08-27T08:49:48.000Z"}
2024-08-27T08:49:49.688Z 51296 CAR_TC_001 - - Sent MessageAck for Watchdog 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306E69C-9306-4930-b930-00009306E69C"}
2024-08-27T08:49:50.396Z 51296 CAR_TC_001 CAR_TC_001 9306 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "9306E965-9306-4930-b930-00009306E965", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:49.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "24fa","s": "stale","t": "2024-08-27T08:49:49.000Z"}], "q": "recent"}]}
2024-08-27T08:49:50.397Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9306 {"mType":"rSMsg","type":"MessageAck","oMId":"9306E965-9306-4930-b930-00009306E965"}
2024-08-27T08:49:57.708Z 51296 CAR_TC_001 CAR_TC_001 9307 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "930705E9-9307-4930-b930-0000930705E9", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:56.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "5cd6","s": "stale","t": "2024-08-27T08:49:56.000Z"}], "q": "recent"}]}
2024-08-27T08:49:57.709Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9307 {"mType":"rSMsg","type":"MessageAck","oMId":"930705E9-9307-4930-b930-0000930705E9"}
2024-08-27T08:49:57.793Z 51296 CAR_TC_001 CAR_TC_001 9307 Received StatusUpdate {"mType": "rSMsg", "type": "StatusUpdate", "mId": "93070645-9307-4930-b930-000093070645", "ntsOId": "CAR_TC_001", "xNId": "", "cId": "CAR_TC_001", "sTs": "2024-08-27T08:49:56.000Z", "sS": [{"sCI": "S0033", "n": "status", "s": [{"r": "8984","s": "stale","t": "2024-08-27T08:49:56.000Z"}], "q": "recent"}]}
2024-08-27T08:49:57.794Z 51296 CAR_TC_001 - - Sent MessageAck for StatusUpdate 9307 {"mType":"rSMsg","type":"MessageAck","oMId":"93070645-9307-4930-b930-000093070645"}
> Priority request reached state 'stale'
2024-08-27T08:49:57.795Z 51296 CAR_TC_001 - - Collect 1338: Done
2024-08-27T08:49:57.813Z 51296 CAR_TC_001 CAR_TC_001 d498 Sent StatusUnsubscribe {"mType":"rSMsg","type":"StatusUnsubscribe","cId":"CAR_TC_001","sS":[{"sCI":"S0033","n":"status"}],"mId":"d4985929-377c-4ee5-852e-d1560f5f2c5e","ntsOId":"","xNId":""}
Failure/Error: expect(states).to eq(sequence), "Expected state sequence #{sequence}, got #{states}"
Expected state sequence ["received", "activated", "completed"], got ["received", "activated", "stale"]

/spec/site/tlc/signal_priority_spec.rb:135:in block (4 levels) in <top (required)>' /spec/support/testee.rb:31:in connected'
/spec/support/test_site.rb:46:in connected' /spec/site/tlc/signal_priority_spec.rb:62:in block (3 levels) in <top (required)>'
/spec/support/validator.rb:81:in block in around_each' /usr/local/bundle/gems/async-2.12.0/lib/async/task.rb:164:in block in run'
/usr/local/bundle/gems/async-2.12.0/lib/async/task.rb:377:in `block in schedule'

Why?
KR

@mariusrazvanplugaru
Copy link
Contributor

I also make the rebuild of gems, it waits always for complete the priority but a cancellation request doesn't arrive. You may understand where is the issue from the logs above?
Thank you!

@emiltin
Copy link
Contributor Author

emiltin commented Aug 27, 2024

It looks like you're not using the latest validator.
In your validator folder run:

git switch main # make sure you're in the main branch
git pull  # get latest validator version
bundle  # update gems

If you have local modifications you would have to either discard them or rebase on main.

You can run this to check the commit you're on:

git log -n 1 --oneline

@mariusrazvanplugaru
Copy link
Contributor

Hi, we are trying to use docker. We downloaded the latest version of rsmp_validator

REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/rsmp-nordic/rsmp_validator latest cd6f5629fa98 4 days ago 1.04GB

with command ->
sudo docker run --name rsmp_validator -it -v /home/marius/Scrivania/Progetti/config:/config -p 12111:12111 ghcr.io/rsmp-nordic/rsmp_validator spec/site --format Validator::Details

give us this error.

spec/site: 1: [: bundle,: unexpected operator

Before with the previous validator it was working. I only updated the image. Do you know for what reason give us this error ?
Thank you!

@emiltin
Copy link
Contributor Author

emiltin commented Aug 28, 2024

Ok I see, you're running via Docker. The Docker images is build automatically, latest is from 5 days ago:
https://github.com/rsmp-nordic/rsmp_validator/pkgs/container/rsmp_validator

I get the same error when I try to run the validator using that image. However it works when I build the Docker images locally and run it.

Not sure why this is happening, but perhaps it's related to the fact that the latest version of the validator updated the .tool-versions file to use Ruby 3.3.2.

I'll look into it.

If you're in a hurry you can install the validator locally as described at https://rsmp-nordic.github.io/rsmp_validator/install/, or optionally build and run the Docker image locally from the Dockerfile in the repo.

@emiltin
Copy link
Contributor Author

emiltin commented Aug 28, 2024

See #414, you can add ":main" to the docker image name to make it work.

@mariusrazvanplugaru
Copy link
Contributor

Thank you!
One question if is possible about the command M0022. On your remote validator when you call this command you use the same parameters (like signalGroupId .... ecc) as the local validator? I ask you because if not we must configure it in validation phase.

KR,

@emiltin
Copy link
Contributor Author

emiltin commented Aug 28, 2024

When running tests against the Cartesio, this config is used:
https://github.com/rsmp-nordic/rsmp_validator/blob/main/config/semaforica_cartesio.yaml

It includes a list of signal groups. This should match what's configured on the device.

The M0022 tests use the first of these configured signal groups:
https://github.com/rsmp-nordic/rsmp_validator/blob/main/spec/site/tlc/signal_priority_spec.rb#L69

signal_group_id = Validator.get_config('components','signal_group').keys.first

@emiltin
Copy link
Contributor Author

emiltin commented Aug 28, 2024

See #414, you can add ":main" to the docker image name to make it work.

Fixed with #415, using no docker image tag now works again.

@emiltin
Copy link
Contributor Author

emiltin commented Aug 28, 2024

If you have additional questions please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testhub Set this label to trigger test on test hub equipment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

M0022/S0033 state sequence?
2 participants