Skip to content

Commit

Permalink
Merge pull request #41 from CDOT-CV/feature/handle-ntcip1218-spec
Browse files Browse the repository at this point in the history
Support NTCIP1218 RSU SNMP Specification
  • Loading branch information
payneBrandon authored Sep 26, 2023
2 parents cdf11a5 + 05ed6f9 commit 2d8e402
Show file tree
Hide file tree
Showing 14 changed files with 1,570 additions and 321 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ The current version and release history of the JPO-ODE: [ODE Release Notes](<doc
10. [Credits and Acknowledgement](#credits-and-acknowledgement)
11. [Code.gov Registration Info](#codegov-registration-info)
12. [Kubernetes](#kubernetes)
13. Sonar Token Configuration([#Sonar cloud](https://sonarqube.ow2.org/documentation/user-guide/user-token/))
13. [Sonar Cloud](#sonar-token-configuration) ([Documentation](https://sonarcloud.io/documentation/user-guide/user-token/))
14. [SNMP](#snmp)

<!--
#########################################
Expand Down Expand Up @@ -598,23 +599,27 @@ Contact Name: James Lieu

Contact Phone: (202) 366-3000

<a name="kubernetes"/>

## 12. Kubernetes
The ODE can be run in a k8s environment.
See [this document](./docs/Kubernetes.md) for more details about this.

[Back to top](#toc)

<a name="sonar-token-configuration"/>

## 13. Sonar Token Configuration
Generating and Using Tokens
Users can generate tokens that can be used to run analyses or invoke web services without access to the user's actual credentials.

USDOT-JPO-ODE SonarCloud Organization : https://sonarcloud.io/organizations/usdot-jpo-ode-1/

## Generating a token
### Generating a token
You can generate new tokens at User > My Account > Security.
The form at the bottom of the page allows you to generate new tokens. Once you click the Generate button, you will see the token value. Copy it immediately; once you dismiss the notification you will not be able to retrieve it.

## Using a token
### Using a token
SonarScanners running in GitHub Actions can automatically detect branches and pull requests being built so you don't need to specifically pass them as parameters to the scanner.

**<ins>To analyze your projects with GitHub Actions, you need to: </ins>**
Expand All @@ -632,5 +637,19 @@ Configure your workflow YAML file as below:

Commit and push your code to start the analysis.

## Revoking a token
### Revoking a token
You can revoke an existing token at User > My Account > Security by clicking the Revoke button next to the token.

<a name="snmp"/>

## 14. SNMP
The ODE is capable of communicating with RSUs to:
- Query TIMs
- Deposit TIMs
- Delete TIMs

The following SNMP protocols are supported for communication with RSUs:
- DSRC 4.1 (defined in 'Dedicated Short-Range Communications Roadside Unit Specifications')
- NTCIP1218 (defined in 'National Transportation Communications for ITS Protocol')

Additionally, the ODE supports the execution of PDM operations on RSUs. PDM operations are not defined in NTCIP1218, but are defined DSRC 4.1.
280 changes: 158 additions & 122 deletions jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/RoadSideUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,126 +18,162 @@
import us.dot.its.jpo.ode.model.OdeObject;

public class RoadSideUnit {
public static class RSU extends OdeObject {

private static final long serialVersionUID = 3149576493038209597L;

private String rsuTarget;
private String rsuUsername;
private String rsuPassword;
private int rsuRetries;
private int rsuTimeout;
private int rsuIndex;

public RSU() {
super();
}

public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout) {
super();
this.rsuTarget = rsuTarget;
this.rsuUsername = rsuUsername;
this.rsuPassword = rsuPassword;
this.rsuRetries = rsuRetries;
this.rsuTimeout = rsuTimeout;
}

public String getRsuTarget() {
return rsuTarget;
}

public void setRsuTarget(String rsuTarget) {
this.rsuTarget = rsuTarget;
}

public String getRsuUsername() {
return rsuUsername;
}

public void setRsuUsername(String rsuUsername) {
this.rsuUsername = rsuUsername;
}

public String getRsuPassword() {
return rsuPassword;
}

public void setRsuPassword(String rsuPassword) {
this.rsuPassword = rsuPassword;
}

public int getRsuRetries() {
return rsuRetries;
}

public void setRsuRetries(int rsuRetries) {
this.rsuRetries = rsuRetries;
}

public int getRsuTimeout() {
return rsuTimeout;
}

public void setRsuTimeout(int rsuTimeout) {
this.rsuTimeout = rsuTimeout;
}

public int getRsuIndex() {
return rsuIndex;
}

public void setRsuIndex(int rsuIndex) {
this.rsuIndex = rsuIndex;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + rsuIndex;
result = prime * result + ((rsuPassword == null) ? 0 : rsuPassword.hashCode());
result = prime * result + rsuRetries;
result = prime * result + ((rsuTarget == null) ? 0 : rsuTarget.hashCode());
result = prime * result + rsuTimeout;
result = prime * result + ((rsuUsername == null) ? 0 : rsuUsername.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RSU other = (RSU) obj;
if (rsuIndex != other.rsuIndex)
return false;
if (rsuPassword == null) {
if (other.rsuPassword != null)
return false;
} else if (!rsuPassword.equals(other.rsuPassword))
return false;
if (rsuRetries != other.rsuRetries)
return false;
if (rsuTarget == null) {
if (other.rsuTarget != null)
return false;
} else if (!rsuTarget.equals(other.rsuTarget))
return false;
if (rsuTimeout != other.rsuTimeout)
return false;
if (rsuUsername == null) {
if (other.rsuUsername != null)
return false;
} else if (!rsuUsername.equals(other.rsuUsername))
return false;
return true;
}
}

private RoadSideUnit() {
throw new UnsupportedOperationException();
}
public static class RSU extends OdeObject {

private static final long serialVersionUID = 3149576493038209597L;

private String rsuTarget;
private String rsuUsername;
private String rsuPassword;
private int rsuRetries;
private int rsuTimeout;
private int rsuIndex;
private SnmpProtocol snmpProtocol;

public RSU() {
super();

// default to 4.1 SNMP protocol
this.snmpProtocol = SnmpProtocol.FOURDOT1;
}

public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout) {
super();
this.rsuTarget = rsuTarget;
this.rsuUsername = rsuUsername;
this.rsuPassword = rsuPassword;
this.rsuRetries = rsuRetries;
this.rsuTimeout = rsuTimeout;

// default to 4.1 SNMP protocol
this.snmpProtocol = SnmpProtocol.FOURDOT1;
}

public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout, SnmpProtocol snmpProtocol) {
this(rsuTarget, rsuUsername, rsuPassword, rsuRetries, rsuTimeout);
this.snmpProtocol = snmpProtocol;
}

public String getRsuTarget() {
return rsuTarget;
}

public void setRsuTarget(String rsuTarget) {
this.rsuTarget = rsuTarget;
}

public String getRsuUsername() {
return rsuUsername;
}

public void setRsuUsername(String rsuUsername) {
this.rsuUsername = rsuUsername;
}

public String getRsuPassword() {
return rsuPassword;
}

public void setRsuPassword(String rsuPassword) {
this.rsuPassword = rsuPassword;
}

public int getRsuRetries() {
return rsuRetries;
}

public void setRsuRetries(int rsuRetries) {
this.rsuRetries = rsuRetries;
}

public int getRsuTimeout() {
return rsuTimeout;
}

public void setRsuTimeout(int rsuTimeout) {
this.rsuTimeout = rsuTimeout;
}

public int getRsuIndex() {
return rsuIndex;
}

public void setRsuIndex(int rsuIndex) {
this.rsuIndex = rsuIndex;
}

public SnmpProtocol getSnmpProtocol() {
return snmpProtocol;
}

public void setSnmpProtocol(SnmpProtocol snmpProtocol) {
this.snmpProtocol = snmpProtocol;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + rsuIndex;
result = prime * result + ((rsuPassword == null) ? 0 : rsuPassword.hashCode());
result = prime * result + rsuRetries;
result = prime * result + ((rsuTarget == null) ? 0 : rsuTarget.hashCode());
result = prime * result + rsuTimeout;
result = prime * result + ((rsuUsername == null) ? 0 : rsuUsername.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}

RSU other = (RSU) obj;
if (rsuIndex != other.rsuIndex) {
return false;
}
if (rsuPassword == null) {
if (other.rsuPassword != null) {
return false;
}
}
else if (!rsuPassword.equals(other.rsuPassword)) {
return false;
}
if (rsuRetries != other.rsuRetries) {
return false;
}
if (rsuTarget == null) {
if (other.rsuTarget != null) {
return false;
}
}
else if (!rsuTarget.equals(other.rsuTarget)) {
return false;
}
if (rsuTimeout != other.rsuTimeout) {
return false;
}
if (rsuUsername == null) {
if (other.rsuUsername != null) {
return false;
}
}
else if (!rsuUsername.equals(other.rsuUsername)) {
return false;
}
return true;
}
}

private RoadSideUnit() {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package us.dot.its.jpo.ode.plugin;

public enum SnmpProtocol {
FOURDOT1,
NTCIP1218
}
Loading

0 comments on commit 2d8e402

Please sign in to comment.