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

Endpoint redirection documentation #447

Merged
merged 20 commits into from
Sep 21, 2022
Merged

Conversation

noursaidi
Copy link
Collaborator

@noursaidi noursaidi commented Sep 8, 2022

@noursaidi
Copy link
Collaborator Author

noursaidi commented Sep 8, 2022

@johnrandolph PTAL only at the sequence diagrams - are they correct with what the sequencer tests? Quality of other information can be sorted later. If you click "View File" it should render the diagrams


### Valid Endpoint (Successful) Reconfiguration

```mermaid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a place we can go to see a rendered version of this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noursaidi
Copy link
Collaborator Author

@grafnu - https://noursaidi.github.io/udmi/docs/specs/sequences/endpoint_reconfiguration

But the states final and applied don't appear to be in the schema so either I might be wrong about those?

@grafnu
Copy link
Collaborator

grafnu commented Sep 10, 2022 via email

@noursaidi
Copy link
Collaborator Author

noursaidi commented Sep 12, 2022

@grafnu comments incorporated.

Re the locking mechanism, is that an additional test represented as another sequence diagram - "If the config which initiates the redirect includes a nonce, only commit the new endpoint if the device receives a config from the new endpoint with the same nonce"? Or is it core functionality?

Copy link
Collaborator

@grafnu grafnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come I never just have one simple comment for anything??!?!

D-->>E':CONNECTION ATTEMPT
E'->>D:CONFIG MESSAGE
D->>E':STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.blob.phase = "final"
D->>E':STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.phase = "final"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add an additional config/state sequence at the end that starts with config.blobset.blobs._iot_endpoint_config = null and then we verify that the state.blobset.blobs._iot_endpoint_config == null The fundamental reason is that we want to verify that the state block only shows up when expected.

@@ -22,11 +22,11 @@ sequenceDiagram
participant D as Device
participant E as Original Endpoint
participant E' as New Endpoint
E->>D:CONFIG MESSAGE<br>blobset.blobs._iot_endpoint_config.base64 = <ENDPOINT><br>blobset.blobs._iot_endpoint.blob.phase = "final"
D->>E:STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.blob.phase = "apply"
E->>D:CONFIG MESSAGE<br>blobset.blobs._iot_endpoint_config.base64 = <ENDPOINT><br>blobset.blobs._iot_endpoint.phase = "final"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedantically there should be a check at the start that verifies that state.blobset.blobs._iot_endpoint_config == null (as the config block is empty so there should be no corresponding state).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

D-->>E':CONNECTION ATTEMPT
E'->>D:CONFIG MESSAGE
D->>E':STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.blob.phase = "final"
D->>E':STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.phase = "final"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a check in here that the system.last_update time of the state message matches the config timestamp from the new endpoint (so might need to indicate that too). Goal is to check that they don't just connect and then use the wrong reply.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does phase: final stay in the state message for? Atleast 1? Noting also that the new endpoint probably won't have a blobset.blob._iot_endpoint_config blob

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added last_update and timestamps for config and state messages

E->>D:CONFIG MESSAGE<br>blobset.blobs._iot_endpoint_config.blob = <ENDPOINT><br>blobset.blobs._iot_endpoint.blob.phase = "final"
D->>E:STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.phase = "apply"
D-->>E':CONNECTION ATTEMPT
note over D: Failure, e.g. endpoint doesn't exist, incorrect credentials, ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about a time limit here? I'd be worried that somebody implements a "try for 3h before reporting failure" scenario... so we should just have a fixed time-bound (which will be needed for the test anyway)... 30s? We can always increase it later, and devices can always report failure faster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added note for 30 seconds

note over D: Failure, e.g. endpoint doesn't exist, incorrect credentials, ...
D-->>E:CONNECTION ATTEMPT
E->>D:CONFIG MESSAGE
D->>E:STATE MESSAGE<BR>blobset.blobs._iot_endpoint_config.phase = "final"<BR/>blobset.blobs._iot_endpoint_config.status.level=500 (ERROR)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somewhere we need to introduce a category(s) for this too...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we differentiate for different types of failure? Or is it a single endpoint.reconfig.failed or similar?
A pretty common error I've encountered before is an endpoint "unreachable" because of firewall or network restrictions. Would that be its own category, or is that level of detail left to the message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Category added

@grafnu
Copy link
Collaborator

grafnu commented Sep 15, 2022 via email

@grafnu
Copy link
Collaborator

grafnu commented Sep 15, 2022 via email

@noursaidi
Copy link
Collaborator Author

So for this, I think there's the
obvious categories of { receive, parse, apply } -- like, I received the
update, I could understand the update, and then I could apply the update --
but the actual underlying reasons (firewall bad) wouldn't be categories.
Okay, using blobset.blob as the prefix e.g. blobset.blob.apply

Also, it's highly unlikely that a device would know that a firewall is
causing a problem. So... not something that would be a useful
categorization from that perspective.
Yes, butthe device can differentiate "could not reach host", "could connect to host but no MQTT broker" and "MQTT broker denied connection (usually incorrect credentials)". But I think you're notes are fine, the message is sufficient and it's not anything that can't be deduced from other means too.

@noursaidi
Copy link
Collaborator Author

@johnrandolph @grafnu I think I've incorporated comments, please take a look.

bin/gencode_docs_examples Show resolved Hide resolved
docs/specs/categories.md Outdated Show resolved Hide resolved
docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved
docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved
D-->>E':CONNECTION ATTEMPT
E'->>D:CONFIG MESSAGE<br>timestamp = t2<br/>blobset.blobs._iot_endpoint_config.base64 = <ENDPOINT><br>blobset.blobs._iot_endpoint_config.phase = "final"
D->>E':STATE MESSAGE<br/>system.last_update = t2<br/>blobset.blobs._iot_endpoint_config.phase = "final"
E->>D:CONFIG MESSAGE<br/>timestamp = t3<br/>blobset.blobs._iot_endpoint_config = null (unset)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure all the timestamp signaling in here makes anything clearer. It's explicitly required for ALL config/state messages, and there's nothing special about these cases. What value or specific thing are we trying to indicate by showing it all here? Just "because it's true" isn't sufficient b/c then you could argue that we should indicate that the VERSION should be included :-).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using t0, t1, etc.. to indicate a new different config message. The specific intent was to show the state message sent after a reconnect is in response to the config message sent from the new endpoint

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just a note to say last_update matches timestamp of the config message received from the new endpoint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed all the timestamps/last_updates except for the first config from the new endpoint.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's entirely redundant. Every config message is followed by a state message with a matching timestamp. What problem are you trying to "fix" by having that information there? What loss of information is there if it's taken out? My point is that 1) it causes more questions than it answers, and 2) is just more "noise" without much signal behind it. Every other line in the sequence is indicating something that's specific/unique to endpoint sequences... except for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grafnu I was trying to address this comment - #447 (comment)

docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved
docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved
docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved
docs/specs/sequences/endpoint_reconfiguration.md Outdated Show resolved Hide resolved

**Notes**
- `<NEW_ENDPOINT>` is a **base64** encoded endpoint object
- `blobset.blobs_iot_endpoint_config` is present in a device's state message if, and only if, the last received config message has a `blobset.blobs_iot_endpoint_config` block.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing . after blobs (two places)

@grafnu
Copy link
Collaborator

grafnu commented Sep 20, 2022 via email

@noursaidi noursaidi marked this pull request as ready for review September 21, 2022 10:52
Copy link
Collaborator

@grafnu grafnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment about the position of the state comparison note, but otherwise all looks good to me!

D-->>E':CONNECTION ATTEMPT
end
E'->>D:CONFIG MESSAGE<br/>blobset.blobs._iot_endpoint_config.base64 = <NEW_ENDPOINT><br/>blobset.blobs._iot_endpoint_config.phase = "final"
note over E': system.last_update in state matches timestamp of config from new endpoint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this one line down so it happens AFTER the state is received, since that's when the comparison would be made.

@noursaidi noursaidi merged commit 640f035 into faucetsdn:master Sep 21, 2022
@grafnu
Copy link
Collaborator

grafnu commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants