Skip to content

Commit

Permalink
Merge pull request #57 from usdot-jpo-ode/release/2024-q3
Browse files Browse the repository at this point in the history
Merge Release/2024 q3 into master
  • Loading branch information
dan-du-car authored Sep 27, 2024
2 parents 3b40766 + ebd44f1 commit 6ce8588
Show file tree
Hide file tree
Showing 20 changed files with 472 additions and 56 deletions.
81 changes: 81 additions & 0 deletions Dockerfile.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# === BUILDER IMAGE ===
FROM alpine:3.12 as builder
USER root
WORKDIR /asn1_codec
VOLUME ["/asn1_codec_share"]

# add build dependencies
RUN apk add --upgrade --no-cache --virtual .build-deps \
cmake \
g++ \
make \
bash \
automake \
libtool \
autoconf \
librdkafka \
librdkafka-dev \
flex \
bison

# Install pugixml
ADD ./pugixml /asn1_codec/pugixml
RUN cd /asn1_codec/pugixml && mkdir -p build && cd build && cmake .. && make && make install

# Build and install asn1c submodule
ADD ./usdot-asn1c /asn1_codec/asn1c
RUN cd asn1c && test -f configure || autoreconf -iv && ./configure && make && make install

# Make generated files available to the build & compile example
RUN export LD_LIBRARY_PATH=/usr/local/lib
ADD ./asn1c_combined /asn1_codec/asn1c_combined
RUN cd /asn1_codec/asn1c_combined && bash doIt.sh

# Remove any lingering .asn files
RUN rm -rf /asn1c_codec/asn1c_combined/j2735-asn-files
RUN rm -rf /asn1c_codec/asn1c_combined/semi-asn-files
RUN rm -rf /asn1c_codec/asn1c_combined/scms-asn-files

# Remove duplicate files
RUN rm -rf /asn1c_codec/asn1c_combined/generated-files

# add the source and build files
ADD CMakeLists.txt /asn1_codec
ADD ./config /asn1_codec/config
ADD ./include /asn1_codec/include
ADD ./src /asn1_codec/src
ADD ./kafka-test /asn1_codec/kafka-test
ADD ./unit-test-data /asn1_codec/unit-test-data
ADD ./data /asn1_codec/data
ADD ./run_acm.sh /asn1_codec
ADD ./data /asn1_codec/data
ADD ./docker-test /asn1_codec/docker-test

RUN echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.profile
RUN echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc
RUN echo "export CC=gcc" >> ~/.profile
RUN echo "export CC=gcc" >> ~/.bashrc

# Build acm.
RUN mkdir -p /build && cd /build && cmake /asn1_codec && make

# === RUNTIME IMAGE ===
FROM alpine:3.12
USER root
WORKDIR /asn1_codec
VOLUME ["/asn1_codec_share"]

# add runtime dependencies
RUN apk add --upgrade --no-cache \
bash \
python3 \
librdkafka \
librdkafka-dev

# copy the built files from the builder
COPY --from=builder /asn1_codec /asn1_codec
COPY --from=builder /build /build

# run ACM
RUN chmod 7777 /asn1_codec/run_acm.sh
CMD ["/asn1_codec/run_acm.sh"]
13 changes: 5 additions & 8 deletions config/test/c1.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Kafka group.
group.id=0

# ACM operation type specification; default is decode if left out.
acm.type=decode
# acm.type=encode
# ACM operation type specification; default is decode if left out. This gets set in the `standalone.sh` script.
acm.type=encode

# Path (relative or absolute) to the ACM error reporting XML template.
acm.error.template=./config/Output.error.xml

# Kafka topics for ASN.1 Parsing
asn1.topic.consumer=j2735asn1per
asn1.topic.producer=j2735asn1xer
asn1.topic.consumer=topic.Asn1EncoderInput
asn1.topic.producer=topic.Asn1EncoderOutput

# Amount of time to wait when no message is available (milliseconds)
# This is a Kafka configuration parameter that we are using for the
Expand All @@ -20,10 +19,8 @@ asn1.consumer.timeout.ms=5000
# For testing purposes, use one partition.
asn1.kafka.partition=0

# The host ip address for the Broker.
# metadata.broker.list=160.91.216.129:9092
# The host ip address for the Broker. This gets set in the `standalone.sh` script.
metadata.broker.list=172.17.0.1:9092
# metadata.broker.list=localhost:9092

# specify the compression codec for all data generated: none, gzip, snappy, lz4
compression.type=none
Expand Down
4 changes: 3 additions & 1 deletion data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ The data files in this directory are referenced in the following files:
| InputData.encoding.tim.odetimpayload.xml | src/tests.cpp | Encode TIM with payload type 'OdeTimPayload' |
| InputData.encoding.tim.odeasdpayload.xml | src/tests.cpp | Encode TIM with payload type 'OdeAsdPayload' |
| InputData.decoding.bsm.xml | src/tests.cpp | Decode BSM |
| producer_test_xml.txt | do_kafka_test.sh | ./test-scripts/standalone.sh config/test/c1.properties data/producer_test_xml.txt encode 0 |
| producer_test1_xml.txt | do_kafka_test.sh | Encode AdvisorySituationData containing HEX-encoded BSM |
| producer_test2_xml.txt | do_kafka_test.sh | Encode Ieee1609Dot2Data containing HEX-encoded BSM |
| producer_test3_xml.txt | do_kafka_test.sh | Encode AdvisorySituationData containing Ieee1609Dot2Data containing HEX-encoded BSM |
| InputData.Ieee1609Dot2Data.packed.xml | testing.md | Testing Documentation |
| j2735.MessageFrame.Bsm.xml | data/README.md | Building Test Data Files |
| j2735.MessageFrame.Bsm.uper | data/README.md | Building Test Data Files |
Expand Down
1 change: 1 addition & 0 deletions data/producer_test1_xml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><OdeAsn1Data><metadata><payloadType>us.dot.its.jpo.ode.model.OdeAsdPayload</payloadType><serialId><streamId>c05b35e8-2245-4c7e-9291-049ce9122565</streamId><bundleSize>1</bundleSize><bundleId>0</bundleId><recordId>0</recordId><serialNumber>0</serialNumber></serialId><odeReceivedAt>2017-11-14T14:46:09.736Z[UTC]</odeReceivedAt><schemaVersion>3</schemaVersion><validSignature>false</validSignature><sanitized>false</sanitized><request><ode><version>2</version><index>10</index></ode><sdw><serviceRegion><nwCorner><latitude>44.998459</latitude><longitude>-111.040817</longitude></nwCorner><seCorner><latitude>41.104674</latitude><longitude>-104.111312</longitude></seCorner></serviceRegion><ttl>oneweek</ttl></sdw><rsus><rsuTarget>127.0.0.1</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>0</rsuRetries><rsuTimeout>2000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.2</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.3</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><snmp><rsuid>0083</rsuid><msgid>31</msgid><mode>1</mode><channel>178</channel><interval>1</interval><deliverystart>2017-12-01T17:47:11-05:00</deliverystart><deliverystop>2018-12-01T17:47:11-05:15</deliverystop><enable>1</enable><status>4</status></snmp></request><encodings><encodings><elementName>AdvisorySituationData</elementName><elementType>AdvisorySituationData</elementType><encodingRule>UPER</encodingRule></encodings></encodings></metadata><payload><dataType>us.dot.its.jpo.ode.plugin.j2735.DdsAdvisorySituationData</dataType><data><AdvisorySituationData><dialogID>156</dialogID><seqID>5</seqID><groupID>00000000</groupID><requestID>08478278</requestID><timeToLive>3</timeToLive><serviceRegion><nwCorner><lat>449984590</lat><long>-1110408170</long></nwCorner><seCorner><lat>411046740</lat><long>-1041113120</long></seCorner></serviceRegion><asdmDetails><asdmID>08478278</asdmID><asdmType>2</asdmType><distType>1</distType><startTime><year>2017</year><month>12</month><day>1</day><hour>17</hour><minute>47</minute></startTime><stopTime><year>2018</year><month>12</month><day>1</day><hour>17</hour><minute>47</minute></stopTime><advisoryMessage>001480AD562FA8400039E8E717090F9665FE1BACC37FFFFFFFF0003BBAFDFA1FA1007FFF8000000000020214C1C100417FFFFFFE824E100A3FFFFFFFE8942102047FFFFFFE922A1026A40143FFE95D610423405D7FFEA75610322C0599FFEADFA10391C06B5FFEB7E6103CB40A03FFED2121033BC08ADFFED9A6102E8408E5FFEDE2E102BDC0885FFEDF0A1000BC019BFFF7F321FFFFC005DFFFC55A1FFFFFFFFFFFFDD1A100407FFFFFFFE1A2FFFE0000</advisoryMessage></asdmDetails></AdvisorySituationData></data></payload></OdeAsn1Data>
1 change: 1 addition & 0 deletions data/producer_test2_xml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><OdeAsn1Data><metadata><payloadType>us.dot.its.jpo.ode.model.OdeAsdPayload</payloadType><serialId><streamId>c05b35e8-2245-4c7e-9291-049ce9122565</streamId><bundleSize>1</bundleSize><bundleId>0</bundleId><recordId>0</recordId><serialNumber>0</serialNumber></serialId><odeReceivedAt>2017-11-14T14:46:09.736Z[UTC]</odeReceivedAt><schemaVersion>3</schemaVersion><validSignature>false</validSignature><sanitized>false</sanitized><request><ode><version>2</version><index>10</index></ode><sdw><serviceRegion><nwCorner><latitude>44.998459</latitude><longitude>-111.040817</longitude></nwCorner><seCorner><latitude>41.104674</latitude><longitude>-104.111312</longitude></seCorner></serviceRegion><ttl>oneweek</ttl></sdw><rsus><rsuTarget>127.0.0.1</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>0</rsuRetries><rsuTimeout>2000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.2</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.3</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><snmp><rsuid>0083</rsuid><msgid>31</msgid><mode>1</mode><channel>178</channel><interval>1</interval><deliverystart>2017-12-01T17:47:11-05:00</deliverystart><deliverystop>2018-12-01T17:47:11-05:15</deliverystop><enable>1</enable><status>4</status></snmp></request><encodings><encodings><elementName>Ieee1609Dot2Data</elementName><elementType>Ieee1609Dot2Data</elementType><encodingRule>COER</encodingRule></encodings></encodings></metadata><payload><dataType>us.dot.its.jpo.ode.plugin.j2735.DdsAdvisorySituationData</dataType><data><Ieee1609Dot2Data><protocolVersion>3</protocolVersion><content><unsecuredData>001480AD562FA8400039E8E717090F9665FE1BACC37FFFFFFFF0003BBAFDFA1FA1007FFF8000000000020214C1C100417FFFFFFE824E100A3FFFFFFFE8942102047FFFFFFE922A1026A40143FFE95D610423405D7FFEA75610322C0599FFEADFA10391C06B5FFEB7E6103CB40A03FFED2121033BC08ADFFED9A6102E8408E5FFEDE2E102BDC0885FFEDF0A1000BC019BFFF7F321FFFFC005DFFFC55A1FFFFFFFFFFFFDD1A100407FFFFFFFE1A2FFFE0000</unsecuredData></content></Ieee1609Dot2Data></data></payload></OdeAsn1Data>
1 change: 1 addition & 0 deletions data/producer_test3_xml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><OdeAsn1Data><metadata><payloadType>us.dot.its.jpo.ode.model.OdeAsdPayload</payloadType><serialId><streamId>c05b35e8-2245-4c7e-9291-049ce9122565</streamId><bundleSize>1</bundleSize><bundleId>0</bundleId><recordId>0</recordId><serialNumber>0</serialNumber></serialId><odeReceivedAt>2017-11-14T14:46:09.736Z[UTC]</odeReceivedAt><schemaVersion>3</schemaVersion><validSignature>false</validSignature><sanitized>false</sanitized><request><ode><version>2</version><index>10</index></ode><sdw><serviceRegion><nwCorner><latitude>44.998459</latitude><longitude>-111.040817</longitude></nwCorner><seCorner><latitude>41.104674</latitude><longitude>-104.111312</longitude></seCorner></serviceRegion><ttl>oneweek</ttl></sdw><rsus><rsuTarget>127.0.0.1</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>0</rsuRetries><rsuTimeout>2000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.2</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><rsus><rsuTarget>127.0.0.3</rsuTarget><rsuUsername>v3user</rsuUsername><rsuPassword>password</rsuPassword><rsuRetries>1</rsuRetries><rsuTimeout>1000</rsuTimeout></rsus><snmp><rsuid>0083</rsuid><msgid>31</msgid><mode>1</mode><channel>178</channel><interval>1</interval><deliverystart>2017-12-01T17:47:11-05:00</deliverystart><deliverystop>2018-12-01T17:47:11-05:15</deliverystop><enable>1</enable><status>4</status></snmp></request><encodings><encodings><elementName>Ieee1609Dot2Data</elementName><elementType>Ieee1609Dot2Data</elementType><encodingRule>COER</encodingRule></encodings><encodings><elementName>AdvisorySituationData</elementName><elementType>AdvisorySituationData</elementType><encodingRule>UPER</encodingRule></encodings></encodings></metadata><payload><dataType>us.dot.its.jpo.ode.plugin.j2735.DdsAdvisorySituationData</dataType><data><AdvisorySituationData><dialogID>156</dialogID><seqID>5</seqID><groupID>00000000</groupID><requestID>08478278</requestID><timeToLive>3</timeToLive><serviceRegion><nwCorner><lat>449984590</lat><long>-1110408170</long></nwCorner><seCorner><lat>411046740</lat><long>-1041113120</long></seCorner></serviceRegion><asdmDetails><asdmID>08478278</asdmID><asdmType>2</asdmType><distType>1</distType><startTime><year>2017</year><month>12</month><day>1</day><hour>17</hour><minute>47</minute></startTime><stopTime><year>2018</year><month>12</month><day>1</day><hour>17</hour><minute>47</minute></stopTime><advisoryMessage><Ieee1609Dot2Data><protocolVersion>3</protocolVersion><content><unsecuredData>001480AD562FA8400039E8E717090F9665FE1BACC37FFFFFFFF0003BBAFDFA1FA1007FFF8000000000020214C1C100417FFFFFFE824E100A3FFFFFFFE8942102047FFFFFFE922A1026A40143FFE95D610423405D7FFEA75610322C0599FFEADFA10391C06B5FFEB7E6103CB40A03FFED2121033BC08ADFFED9A6102E8408E5FFEDE2E102BDC0885FFEDF0A1000BC019BFFF7F321FFFFC005DFFFC55A1FFFFFFFFFFFFDD1A100407FFFFFFFE1A2FFFE0000</unsecuredData></content></Ieee1609Dot2Data></advisoryMessage></asdmDetails></AdvisorySituationData></data></payload></OdeAsn1Data>
Loading

0 comments on commit 6ce8588

Please sign in to comment.