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

feat(sumo): support sumo 1.21.0 #424

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ kind: Pod
spec:
containers:
- name: maven-sumo
image: eclipsemosaic/mosaic-ci:jdk17-sumo-1.20.0
image: eclipsemosaic/mosaic-ci:jdk17-sumo-1.21.0
command:
- cat
tty: true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Additional simulators and assessment features are provided by [Fraunhofer FOKUS]

## Related Repositories

* [Eclipse SUMO](https://github.com/eclipse/sumo) is coupled directly using the TraCI interface. We recommend using the SUMO release `1.20.0`.
* [Eclipse SUMO](https://github.com/eclipse/sumo) is coupled directly using the TraCI interface. We recommend using the SUMO release `1.21.0`.
* The coupling to [ns-3](https://www.nsnam.org) is realized by a federate implementation which can be found [in our MOSAIC Addons repository](https://github.com/mosaic-addons/ns3-federate).
We currently support ns-3 version `3.36.1`.
* The coupling to [OMNeT++](https://omnetpp.org) is implemented in a very similar manner. The corresponding federate implementation can be found [in our MOSAIC Addons repository](https://github.com/mosaic-addons/omnetpp-federate).
Expand All @@ -73,7 +73,7 @@ For a successful build you need the following software to be installed:

* **Maven 3.1.x** or higher.
* **Java 17**, or 21 - We recommend using the [Adoptium OpenJDK (aka Eclipse Temurin)](https://adoptium.net/?variant=openjdk17).
* **SUMO 1.20.0** - Older versions > 1.2.0 are most probably supported, but not tested. The environment variable `SUMO_HOME` should be configured properly.
* **SUMO 1.21.0** - Older versions > 1.2.0 are most probably supported, but not tested. The environment variable `SUMO_HOME` should be configured properly.

## Build

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class LibSumoAmbassador extends SumoAmbassador {

private static final String VALID_LIBSUMO_VERSIONS = "1\\.(19|20)\\.";
private static final String VALID_LIBSUMO_VERSIONS = "1\\.(19|20|21)\\.";

public LibSumoAmbassador(AmbassadorParameter ambassadorParameter) {
super(ambassadorParameter);
Expand Down Expand Up @@ -71,34 +71,30 @@ protected void initSumoConnection() throws InternalFederateException {
}

if (new File(libsumoLibrary).exists()) {
// Workaround based on suggestions made in https://github.com/eclipse/sumo/issues/12605
if (operatingSystem == CLocalHost.OperatingSystem.WINDOWS) {
loadQuiet(getFromSumoHome("iconv-2.dll"));
loadQuiet(getFromSumoHome("intl-8.dll"));
loadQuiet(getFromSumoHome("proj_9_0.dll"));
try {
System.load(libsumoLibrary);
} catch (UnsatisfiedLinkError e) {
throw new InternalFederateException("""
The required libsumojni library could be found, but not loaded due to missing dependencies.
Make sure your PATH variable contains the entry "$SUMO_HOME/bin".
""");
}

System.load(libsumoLibrary);

if (incorrectLibSumoVersion()) {
throw new InternalFederateException(
"The loaded Libsumo library at " + libsumoLibrary + " is not compatible with this ambassador. "
+ "Valid versions are: " + VALID_LIBSUMO_VERSIONS);
throw new InternalFederateException("""
The loaded libsumojni library at %s is not compatible with this ambassador. Valid versions are: %s
""".formatted(libsumoLibrary, VALID_LIBSUMO_VERSIONS));
}
} else {
try {
// Workaround based on suggestions made in https://github.com/eclipse/sumo/issues/12605
if (operatingSystem == CLocalHost.OperatingSystem.WINDOWS) {
loadLibraryQuiet("iconv-2");
loadLibraryQuiet("intl-8");
loadLibraryQuiet("proj_9_0");
}

// if no file found, try to load libsumo it directly from java.library.path
System.loadLibrary("libsumojni");
} catch (Throwable e) {
throw new InternalFederateException("The required libsumojni library could not be found in " + libsumoLibrary + ". "
+ "Make sure SUMO_HOME is set properly and that your SUMO installation contains the libsumojni library.");
throw new InternalFederateException("""
The required libsumojni library could not be found in %s.
Make sure SUMO_HOME is set properly and that your SUMO installation contains the libsumojni library.
Furthermore, your PATH variable should contain the entry $SUMO_HOME/bin.
""".formatted(libsumoLibrary));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum SumoVersion {
SUMO_1_18_x("1.18.*", TraciVersion.API_20),
SUMO_1_19_x("1.19.*", TraciVersion.API_21),
SUMO_1_20_x("1.20.*", TraciVersion.API_21),
SUMO_1_21_x("1.21.*", TraciVersion.API_21),

/**
* the lowest version supported by this client.
Expand All @@ -54,7 +55,7 @@ public enum SumoVersion {
/**
* the highest version supported by this client.
*/
HIGHEST(SUMO_1_20_x.sumoVersion, SUMO_1_20_x.traciVersion);
HIGHEST(SUMO_1_21_x.sumoVersion, SUMO_1_21_x.traciVersion);

private final String sumoVersion;
private final TraciVersion traciVersion;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<version.slf4j>2.0.12</version.slf4j><!-- 2.0.12 is approved #13344 -->
<version.sqlite-jdbc>3.42.0.0</version.sqlite-jdbc><!-- 3.42.0.0 is approved in #9089 -->
<!-- note, when upgrading, the field LibSumoAmbassador#VALID_LIBSUMO_VERSIONS needs to be changed too -->
<version.libsumo>1.20.0</version.libsumo>
<version.libsumo>1.21.0</version.libsumo>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion test/ci/ci-image-mvn-sumo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ WORKDIR /home/jenkins
RUN apt-get update && \
apt-get install -y --allow-unauthenticated software-properties-common && \
# adjust this output string to bypass potential caches
echo "Installing SUMO 1.20.0" && \
echo "Installing SUMO 1.21.0" && \
add-apt-repository ppa:sumo/stable && \
apt-get install -y sumo
4 changes: 2 additions & 2 deletions test/ci/ci-image-mvn-sumo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ build and tag the docker image with the latest SUMO version. This image should b
and available in the PPA.

```shell script
docker build . -t eclipsemosaic/mosaic-ci:jdk17-sumo-1.20.0
docker build . -t eclipsemosaic/mosaic-ci:jdk17-sumo-1.21.0
docker login
docker push eclipsemosaic/mosaic-ci:jdk17-sumo-1.20.0
docker push eclipsemosaic/mosaic-ci:jdk17-sumo-1.21.0
```

Afterwards, the image should be available here: https://hub.docker.com/r/eclipsemosaic/mosaic-ci/tags
Expand Down
Loading