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

Merge release/2024-q3 into master #69

Merged
merged 25 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
33377d6
Update dockerhub.yml
SaikrishnaBairamoni Jun 12, 2024
7564ac4
Merge pull request #57 from usdot-jpo-ode/replace/tags
dan-du-car Jun 12, 2024
c9d26d0
Merge pull request #59 from usdot-jpo-ode/release/tags
dan-du-car Jun 13, 2024
bc59e41
Bump docker/build-push-action from 5 to 6
dependabot[bot] Jun 17, 2024
5b04ef6
Merge pull request #64 from usdot-jpo-ode/master
dan-du-car Jun 18, 2024
9fe8a43
Merge pull request #63 from usdot-jpo-ode/dependabot/github_actions/d…
drewjj Jul 17, 2024
ac5ad86
Add processed bsm classes
drewjj Jul 26, 2024
09ecc42
Added a vscode dev container for easier development
drewjj Aug 12, 2024
dae1a58
Added ProcessedBsm support with unit tests and schema
drewjj Aug 12, 2024
e1ae2bc
Update documentation to include the ProcessedBsm
drewjj Aug 12, 2024
c66989e
Turn the key String into an object and include log file name
drewjj Aug 12, 2024
1a7ec4d
Fix unit tests
drewjj Aug 12, 2024
38bf1b6
Added the generic partitioner back for the BSM topology
drewjj Aug 12, 2024
5f89554
Added bsmId to the RsuLogKey key object for the BSM topology
drewjj Aug 12, 2024
2113118
Changed the GenericPartitioner to be specific to the RsuLogKey object
drewjj Aug 13, 2024
b4592cd
Changed the ERROR value to the bsmId when processing fails since the …
drewjj Aug 13, 2024
c63776f
Partitioner bug fix and make RsuLogKey partition by rsuId and bsmId last
drewjj Aug 13, 2024
656aaed
Adjust unit test
drewjj Aug 13, 2024
ecd03b8
Add final scenario for partitioning the object as last resort
drewjj Aug 13, 2024
25e58d4
Merge pull request #66 from usdot-jpo-ode/processed_bsm
drewjj Aug 14, 2024
1985022
allows unknown properties in jackson object mapper
Michael7371 Aug 22, 2024
eac49c4
Merge pull request #67 from usdot-jpo-ode/allow-unknown-props
Michael7371 Aug 23, 2024
85061b2
Add release notes and update the pom.xml version
drewjj Sep 6, 2024
7bef71f
Merge pull request #68 from usdot-jpo-ode/Update/release-notes-1.4.0
drewjj Sep 9, 2024
23adfe7
update Jpo-ode submodule to the latest version
SaikrishnaBairamoni Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM eclipse-temurin:21-jdk

# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1234
ARG USER_GID=$USER_UID

# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install --no-install-recommends apt-utils dialog 2>&1

# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
RUN groupadd --gid $USER_GID $USERNAME
RUN useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
# [Optional] Add sudo support for the non-root user
RUN apt-get install -y sudo
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
RUN chmod 0440 /etc/sudoers.d/$USERNAME

# Verify git, needed tools installed
RUN apt-get -y install git openssh-client less iproute2 procps curl lsb-release zip unzip sed kafkacat telnet

#-------------------Install SDKMan----------------------------------
RUN curl -s https://get.sdkman.io | bash
RUN chmod a+x "$HOME/.sdkman/bin/sdkman-init.sh"
#-------------------------------------------------------------------------------------------------------------

#-------------------Install Maven CLI Tools----------------------------------
ARG MAVEN_VERSION=3.6.3
RUN /bin/bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION}"
#-------------------------------------------------------------------------------------------------------------

# Install snmp (rsu-data-controller dependency)
RUN apt-get -y install snmp

#-------------------Install Kafka----------------------------------
RUN mkdir ~/Downloads
RUN curl "https://archive.apache.org/dist/kafka/3.6.1/kafka_2.12-3.6.1.tgz" -o ~/Downloads/kafka.tgz
RUN mkdir ~/kafka \
&& cd ~/kafka \
&& tar -xvzf ~/Downloads/kafka.tgz --strip 1
RUN echo "\nadvertised.listeners=PLAINTEXT://localhost:9092" >> ~/kafka/config/server.properties
#-------------------------------------------------------------------------------------------------------------

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog

# Allow for a consistant java home location for settings - image is changing over time
RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi

COPY kafka /etc/init.d/kafka
RUN chmod 775 /etc/init.d/kafka && update-rc.d kafka defaults

COPY ./docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
ENTRYPOINT ["./docker-entrypoint.sh"]
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/java-8
{
"name": "JPO GeoJSONConverter Java 21",
"dockerFile": "Dockerfile",
"overrideCommand": false,
"shutdownAction": "stopContainer",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"vscjava.vscode-java-pack",
"vscjava.vscode-java-debug",
"vscjava.vscode-maven",
"vscjava.vscode-java-dependency",
"vscjava.vscode-java-test",
"hbenl.vscode-test-explorer",
"ms-vscode.test-adapter-converter",
"esbenp.prettier-vscode",
"mhutchie.git-graph",
"tabnine.tabnine-vscode",
"redhat.java",
"redhat.vscode-commons"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [8080, 9090, 46753, 46800, 5555, 6666, 8090, 2181, 9092],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/post-create.sh",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
"runArgs": [
"--network=host"
]
}
22 changes: 22 additions & 0 deletions .devcontainer/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

trap stop SIGTERM SIGINT SIGQUIT SIGHUP ERR

start() {
echo "Container started, starting kafka..." >>/root/startup.txt
sudo service kafka start
}

stop() {
echo "Container stopped, performing cleanup..." >>/root/shutdown.txt
sudo service kafka stop
sleep 2
exit 0
}

start

while
sleep 1 &
wait $!
do :; done
11 changes: 11 additions & 0 deletions .devcontainer/jpo-geojsonconverter.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "automatic",
"java.server.launchMode": "Standard"
}
}
36 changes: 36 additions & 0 deletions .devcontainer/kafka
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
DAEMON_PATH=/root/kafka
PATH=$PATH:$DAEMON_PATH/bin
PATH=$PATH:/root/.sdkman/candidates/java/current/bin

export LOG_DIR=/var/log/kafka

# See how we were called.
case "$1" in
start)
# Start daemon.
echo "Starting Kafka";
$DAEMON_PATH/bin/kafka-server-start.sh -daemon $DAEMON_PATH/config/server.properties
;;
stop)
# Stop daemons.
echo "Shutting down Kafka";
$DAEMON_PATH/bin/kafka-server-stop.sh
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
pid=`ps ax | grep -i 'kafka.Kafka' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Kafka is Running as PID: $pid"
else
echo "Kafka is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
22 changes: 22 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cd ~/kafka/
KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"

bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.properties

# start kafka
bin/kafka-server-start.sh -daemon config/kraft/server.properties
# wait 2 seconds for the server to start and be able to add partitions
sleep 2s
# add topics

# BSM
bin/kafka-topics.sh --create --topic "topic.OdeBsmJson" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
bin/kafka-topics.sh --create --topic "topic.ProcessedBsm" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1

# MAP
bin/kafka-topics.sh --create --topic "topic.OdeMapJson" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
bin/kafka-topics.sh --create --topic "topic.ProcessedMap" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1

# SPaT
bin/kafka-topics.sh --create --topic "topic.OdeSpatJson" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
bin/kafka-topics.sh --create --topic "topic.ProcessedSpat" --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6

sonar:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: echo "TAG=$(echo ${GITHUB_REF##*/} | sed 's/\//-/g')" >> $GITHUB_ENV

- name: Build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
tags: usdotjpoode/geojsonconverter:${{ env.TAG }}
78 changes: 75 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ The current version and release history of the JPO GeoJSON Converter: [Release N

## 1. Usage Example

The jpo-geojsonconverter is used to convert the ODE JSON output of MAP and SPaT messages into GeoJSON ProcessedMap messages and enhanced ProcessedSpat messages. In order to verify your jpo-geojsonconverter is functioning, you must run the jpo-ode, then the jpo-geojsonconverter, and then send the jpo-ode raw ASN1 encoded MAP and SPaT data.
The jpo-geojsonconverter is used to convert the ODE JSON output of MAP, SPaT and BSM messages into GeoJSON ProcessedMap, enhanced ProcessedSpat, and GeoJSON ProcessedBsm messages. In order to verify your jpo-geojsonconverter is functioning, you must run the jpo-ode, then the jpo-geojsonconverter, and then send the jpo-ode raw ASN1 encoded MAP, SPaT and BSM data.

Follow the configuration section to properly configure and launch your jpo-ode and jpo-geojsonconverter.

Run one of the UDP sender Python scripts from the [jpo-ode repository](https://github.com/usdot-jpo-ode/jpo-ode/tree/dev/scripts/tests) to generate some example MAP and SPaT messages. Make sure to set your DOCKER_HOST_IP environment variable so the script will properly send the ASN1 encoded messages to your locally running JPO-ODE.
Run one of the UDP sender Python scripts from the [jpo-ode repository](https://github.com/usdot-jpo-ode/jpo-ode/tree/dev/scripts/tests) to generate some example MAP/SPaT/BSM messages. Make sure to set your DOCKER_HOST_IP environment variable so the script will properly send the ASN1 encoded messages to your locally running JPO-ODE.

Once the message has been sent to the jpo-ode, it will be eventually be decoded and serialized into a JSON string. This string will be placed into the Kafka topics topic.OdeMapJson and topic.OdeSpatJson. The jpo-geojsonconverter will then transform them into geoJSON. If a user needs WKT formatted GeoJSON, it is possible to turn this on by specifying the geometry.output.mode environment variable to "WKT".
Once the message has been sent to the jpo-ode, it will be eventually be decoded and serialized into a JSON string. This string will be placed into the Kafka topics topic.OdeMapJson, topic.OdeSpatJson, and topic.OdeBsmJson. The jpo-geojsonconverter will then transform them into geoJSON. If a user needs WKT formatted GeoJSON, it is possible to turn this on by specifying the geometry.output.mode environment variable to "WKT". Currently WKT does not support the BSM messages.

### <b>Output Message Types</b>

Expand Down Expand Up @@ -123,6 +123,78 @@ Example ProcessedSpat message:
}
```

### ProcessedBsm
When an OdeBsmJson message is processed through the jpo-geojsonconverter, a ProcessedBsm message is created. This message is a GeoJSON feature collection that contains extra metadata fields that represents a single BSM.

- *type* - The type of object the JSON is. This will always be a 'FeatureCollection'.
- *features* - Feature Collection for storing all of the unique BSM payload and geographic data for each lane in an intersection. Mapping this object would display a single point representing the BSM.
- *schemaVersion* - The schema version that the JSON object was generated for.
- *messageType* - The message type the FeatureCollection represents.
- *odeReceivedAt* - A date-time string representing when the BSM was received by the ODE.
- *timestamp* - A date-time string representing when the BSM processed and transformed into a ProcessedBsm.
- *originIp* - An IP string representing the RSU the BSM was generated by if there is a IP present.
- *validationMessages* - A list of validation messages that specify issues found within the original OdeBsmJson object based on the JSON schema.

```
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-105.0342901,
40.5671913
]
},
"properties": {
"accelSet": {
"accelLat": 2001,
"accelLong": 0,
"accelVert": -127,
"accelYaw": 0
},
"accuracy": {
"semiMajor": 5,
"semiMinor": 2,
"orientation": 0
},
"brakes": {
"wheelBrakes": {
"leftFront": false,
"rightFront": false,
"unavailable": true,
"leftRear": false,
"rightRear": false
},
"traction": "unavailable",
"abs": "unavailable",
"scs": "unavailable",
"brakeBoost": "unavailable",
"auxBrakes": "unavailable"
},
"heading": 359.4,
"id": "12A7A951",
"msgCnt": 25,
"secMark": 2800,
"size": {
"width": 208,
"length": 586
},
"transmission": "UNAVAILABLE"
}
}
],
"schemaVersion": 1,
"messageType": "BSM",
"odeReceivedAt": "2024-08-12T12:32:03.811Z",
"originIp": "172.19.0.1",
"validationMessages": [],
"timeStamp": "2024-08-12T12:32:04.3034091Z"
}
```

[Back to top](#toc)

<!--
Expand Down
10 changes: 10 additions & 0 deletions docs/Release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
JPO GeoJSON Converter Release Notes
----------------------------

Version 1.4.0
----------------------------------------

### **Summary**
This release includes adding support for processing OdeBsmJson messages and creating ProcessedBsm. ProcessedBsm messages are geojson objects representing FeatureCollections with additional processed fields for additional context. ProcessedBsm currently only supports standard geojson format and not WKT format.

Enhancements in this release:
- PR67: Allow unknown properties via Jackson properties.
- PR66: Adds ProcessedBsm as a new message type that is created utilizing OdeBsmJson output from the jpo-ode.

Version 1.3.0
----------------------------------------

Expand Down
Binary file modified docs/jpo-geojsonconverter_arch_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion jpo-geojsonconverter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-geojsonconverter</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jpo-geojsonconverter</name>
<description>J2735 message to GeoJSON converter for US DOT ITS JPO ODE</description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package us.dot.its.jpo.geojsonconverter;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
Expand All @@ -13,6 +14,7 @@ public class DateJsonMapper {
objectMapper.registerModule(new JavaTimeModule());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setSerializationInclusion(Include.NON_NULL);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

public static ObjectMapper getInstance() {
Expand Down
Loading
Loading