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

Implement functionality to connect RSU Health Monitor to multiple RSUs(4) from same instance #606

Merged
merged 12 commits into from
Apr 18, 2024

Conversation

dan-du-car
Copy link
Collaborator

@dan-du-car dan-du-car commented Apr 16, 2024

PR Details

Description

Update the V2X Hub's RSU Health Monitor plugin supports monitoring the health status of multiple Roadside Units (RSUs) per V2X Hub instance.

Related Issue

NA

Motivation and Context

NA

How Has This Been Tested?

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
    V2XHUB Contributing Guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@dan-du-car dan-du-car marked this pull request as draft April 16, 2024 18:42
@dan-du-car dan-du-car self-assigned this Apr 16, 2024
@dan-du-car dan-du-car changed the title Add multiple rsus config Implement functionality to connect RSU Health Monitor to multiple RSUs(4) from same instance Apr 16, 2024
@dan-du-car dan-du-car marked this pull request as ready for review April 16, 2024 20:50
* @param rsuConfigsStr A JSON string includes all RSUs related configrations.
* @return JSON::Value A JSON object that includes RSUS information.
*/
Json::Value parseJson(const std::string &rsuConfigsStr) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does parse JSON return a JSON value. Isn't the purpose of this object to store the configuration. I would imagine either we have a constructor or initializer that reads in the string and updates the object or we have a function that returns and instance of the object.

RSUConfigurationList parse_rsu_config(const std::string &json) {
...
}
...
RSUConfigurationList rsuConfig = parse_rsu_config(jsonString)

Not saying this way is inherently wrong, just trying to understand why we return Json value and what your thought process was in setting it up this way.

Copy link
Collaborator Author

@dan-du-car dan-du-car Apr 17, 2024

Choose a reason for hiding this comment

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

parseJson is a function used by parseRSUS() which is where we store the config objects. parseRSUS() does not return RSUConfigurationList because it stores the result to instance variable.

@@ -125,7 +125,7 @@ namespace RSUHealthMonitor
try
{
// Create SNMP client and use SNMP V3 protocol
PLOG(logINFO) << "Update SNMP client: RSU IP: " << _rsuIp << ", RSU port: " << _snmpPort << ", User: " << _securityUser << ", auth pass phrase: " << _authPassPhrase << ", security level: "
PLOG(logINFO) << "SNMP client: RSU IP: " << _rsuIp << ", RSU port: " << _snmpPort << ", User: " << _securityUser << ", auth pass phrase: " << _authPassPhrase << ", security level: "
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an issue for this PR but we should figure out how we want to handle external authentication information. Having it written to a log is probably bad practice. Having it stored anywhere as plain text is probably bad practice. Not sure what convention for this is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't this authentication info provided from the UI?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that is why I think this is probably not solvable right now but eventually we want to hide the authentication information you enter similar to a login.

_rsuStatusTimer->ChangeFrequency(_timerThId, std::chrono::milliseconds(_interval * SEC_TO_MILLI));
}
catch (const RSUConfigurationException &ex)
{
PLOG(logERROR) << "Cannot update RSU configurations due to error: " << ex.what();
Copy link
Contributor

Choose a reason for hiding this comment

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

What do we want to happen when there is an error? Will this clear the previous list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will use the previous list. No clear. In the parseRSUS() function, I left a comment saying that it will not clear the list until all configs are updated correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this what we want? Is it better to clear the list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you provide some scenarios where we need to clear this?


namespace RSUHealthMonitor
{
class RSUConfigurationException : public tmx::TmxException
Copy link
Contributor

@paulbourelly999 paulbourelly999 Apr 17, 2024

Choose a reason for hiding this comment

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

Does TmxException have a custom defined move constructor/operator that is not noexcept? I think this is the case since there is a code smell about this. Does TmxException provide any useful functionality here like a stack trace or something? Just curious

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It has stack trace function defined. However, it does not have move constructor.

Copy link
Contributor

@paulbourelly999 paulbourelly999 left a comment

Choose a reason for hiding this comment

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

Some minor comments for discussion

}
else
{
throw RSUConfigurationException("RSU IP does not exist.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't each RSU have an ID or name as well. Then instead of RSU IP does not exist we could have a more descriptive exception. IP is missing for RSU <name>. Otherwise when this exception is thrown and you have 4 RSU configs, only one has a miss spelling of the RSUIPKey then it maybe hard to find. Just a thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, I agree.

Copy link

sonarcloud bot commented Apr 17, 2024

@dan-du-car dan-du-car merged commit c1759dd into develop Apr 18, 2024
3 of 4 checks passed
@dan-du-car dan-du-car deleted the add_multiple_rsus_config branch April 18, 2024 13:23
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.

2 participants