Commit 7235e101 authored by Jean Meurice's avatar Jean Meurice Committed by Evgeny Kusmenko

Upgrade to SoftwareSimulator, using CarLang controller configuration

parent 405ec2a5
**/target/*
.settings/*
.settings/
.project
.classpath
.directory
.idea
.idea/*
.vscode/
/target
*.pyc
*.DS_Store
......@@ -12,3 +13,5 @@
/restful/src/main/resources/resources
*.jar
/bin/
HardwareEmulator.*
unittest.txt
\ No newline at end of file
......@@ -5,62 +5,51 @@
# can be found under https://github.com/MontiCore/monticore.
#
image: maven:3-jdk-8
# The docker stage builds the projects and runs the tests
# If it succeeds, run the maven stage to deploy the artifacts (master only)
stages:
- windows
- linux
- docker
- maven
masterJobWindowsRpc:
stage: windows
RPC_maven_master_windows:
stage: maven
only:
- master
tags:
- Windows10_OS
script:
- cd rpc
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings ..\settings.xml
- mvn package sonar:sonar --settings ..\settings.xml -DskipTests
tags:
- Windows10
Restful_maven_master_windows:
stage: maven
only:
- master
masterJobWindowsRestful:
stage: windows
tags:
- Windows10_OS
script:
- cd restful
# TODO: we have to skip tests for now, because most tests require a running instance of zookeeper
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings ..\settings.xml -DskipTests
- mvn package sonar:sonar --settings ..\settings.xml -DskipTests
tags:
- Windows10
only:
- master
branchJobWindowsRpc:
stage: windows
script:
- cd rpc
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings ..\settings.xml
tags:
- Windows10
except:
- master
branchJobWindowsRestful:
stage: windows
script:
- cd restful
# TODO: we have to skip tests for now, because most tests require a running instance of zookeeper
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings ..\settings.xml -DskipTests
tags:
- Windows10
except:
- master
# run tests
branchJobLinux:
docker_branch_linux:
image: docker:dind
stage: docker
except:
- master
tags:
- docker
stage: linux
- shell
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
......@@ -71,18 +60,20 @@ branchJobLinux:
- docker rmi restful-server || true
# pull the latest RMIServer image
- docker pull registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest
- cd docker
- ./build.sh
- cd scripts/linux/docker
- ./build_server.sh
- ./run_test.sh
- ./run_integration_test.sh
except:
- master
# build, test and publish docker images
masterJobLinux:
docker_master_linux:
image: docker:dind
stage: docker
only:
- master
tags:
- docker
stage: linux
- shell
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
......@@ -93,13 +84,11 @@ masterJobLinux:
- docker rmi restful-server || true
# pull the latest RMIServer image
- docker pull registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest
- cd docker
- ./build.sh
- cd scripts/linux/docker
- ./build_server.sh
- ./run_test.sh
- ./run_integration_test.sh
- docker tag rpc-server:latest $CI_REGISTRY_IMAGE:rpc
- docker tag restful-server:latest $CI_REGISTRY_IMAGE:restful
- docker push $CI_REGISTRY_IMAGE:rpc
- docker push $CI_REGISTRY_IMAGE:restful
only:
- master
This diff is collapsed.
......@@ -2,10 +2,12 @@ FROM maven:3-jdk-8 AS montisim-server-builder
WORKDIR /app
COPY . .
RUN apt-get update && \
apt-get install -y --no-install-recommends metis && \
apt-get install -y --no-install-recommends libxext6 libxrender1 libxtst6 metis && \
rm -rf /var/lib/apt/lists/* && \
mvn install -s settings.xml -DskipTests && \
cp rpc/target/rpc-jar-with-dependencies.jar rpc/target/rpc.jar
echo "export LD_LIBRARY_PATH=/usr/local/openjdk-8/jre/lib/amd64" > ~/.bashrc
COPY . .
RUN mvn install -s settings.xml -DskipTests && \
mv rpc/target/rpc-jar-with-dependencies.jar rpc/target/rpc.jar
#!/usr/bin/env bash
CURR_DIR=$(pwd)
cd ..
docker build -f "${CURR_DIR}/Dockerfile" -t montisim-server-builder .
cd rpc
./build.sh
cd ../restful
./build.sh
......@@ -9,7 +9,7 @@ version: "3"
services:
zoo1:
image: zookeeper:3.4
image: zookeeper:latest
restart: always
hostname: zoo1
environment:
......@@ -26,7 +26,7 @@ services:
entrypoint:
- bash
- -c
- "source ~/.bashrc && java -Djava.rmi.server.useLocalHostname -jar rmi-model-server.jar port=10101 autopilots_folder=autopilots no_time os=windows"
- "source ~/.bashrc && java -Djava.rmi.server.useLocalHostname -jar rmi-model-server.jar port=10101 softwares_folder=softwares"
rpc-server:
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/server:rpc
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>server</artifactId>
<groupId>montisim-server</groupId>
<version>${revision}</version>
<packaging>pom</packaging>
<artifactId>server</artifactId>
<groupId>montisim-server</groupId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>rpc</module>
......@@ -16,40 +15,31 @@
</modules>
<properties>
<revision>2.2.5</revision>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<properties>
<revision>2.2.6</revision>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<smartfox.version>2.13</smartfox.version>
<montisim.version>1.0.1</montisim.version>
<!-- .. Plugins ....................................................... -->
<!-- .. Plugins ....................................................... -->
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
<shade.plugin>2.4.3</shade.plugin>
<jacoco.plugin>0.8.1</jacoco.plugin>
<wagon.provider.version>2.6</wagon.provider.version>
<!-- Deployment properties -->
<project.name>ServerExtension</project.name>
<config.file>config.properties</config.file>
<config.dir>main/resources</config.dir>
<wagon.provider.version>2.6</wagon.provider.version>
<java.version>1.8</java.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
</properties>
<!-- ================================================================================ -->
<!-- External additional maven repositories -->
<!-- ================================================================================ -->
<!-- ================================================================================ -->
<!-- External additional maven repositories -->
<!-- ================================================================================ -->
<repositories>
<repository>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
......@@ -62,16 +52,16 @@
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repository>
<!-- In Project (temporal) -->
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
<dependencies>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
......@@ -93,11 +83,11 @@
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!--Unit test-->
......@@ -118,7 +108,7 @@
</dependency>
</dependencies>
<!-- == PROJECT BUILD SETTINGS =========================================== -->
<!-- == PROJECT BUILD SETTINGS =========================================== -->
<build>
<plugins>
......@@ -162,17 +152,17 @@
</plugins>
</build>
<!-- == DISTRIBUTION ==================================================== -->
<distributionManagement>
<repository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-releases/</url>
</repository>
<snapshotRepository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- == DISTRIBUTION ==================================================== -->
<distributionManagement>
<repository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-releases/</url>
</repository>
<snapshotRepository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
......@@ -7,9 +7,8 @@
can be found under https://github.com/MontiCore/monticore.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>montisim-server</groupId>
......@@ -21,13 +20,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<revision>2.2.5</revision>
<revision>2.2.6</revision>
<montisim.commons.version>1.0.11</montisim.commons.version>
<montisim.simulation.version>2.0.4</montisim.simulation.version>
<montisim.simulation.version>2.0.6</montisim.simulation.version>
<montisim.controller.version>1.0.4</montisim.controller.version>
<montisim.simulationlanguage.version>1.1.0-SNAPSHOT</montisim.simulationlanguage.version>
......@@ -72,7 +72,7 @@
<groupId>montisim</groupId>
<artifactId>commons</artifactId>
<version>${montisim.commons.version}</version>
<!-- <version>2.1.0-SNAPSHOT</version>-->
<!-- <version>2.1.0-SNAPSHOT</version>-->
<scope>provided</scope>
<!--<exclusions>
<exclusion>
......@@ -247,10 +247,10 @@
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
......@@ -224,7 +224,7 @@ public class MetisGraph {
String line;
while ((line = reader.readLine()) != null) {
lines.add(line);
logger.info(line);
logger.debug(line);
} while (line != null);
} catch (IOException e) {
logger.warn(e.getMessage(), e);
......
......@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
public class NavigationService {
static Map<String, de.rwth.monticore.EmbeddedMontiArc.simulators.controller.library.structures.Graph> osmGraphs;
private static Logger logger = LoggerFactory.getLogger(VehicleService.class);
private static Logger logger = LoggerFactory.getLogger(NavigationService.class);
public static GraphPath<Vertex, OverlayEdge> findShortestOverlayPath(Graph<Vertex, OverlayEdge> g, Vertex source, Vertex target) {
DijkstraShortestPath<Vertex, OverlayEdge> d = new DijkstraShortestPath<>(g);
......@@ -189,7 +189,7 @@ public class NavigationService {
"no path found between %d(sector: %d) and %d(sector: %d)",
source, sourceSectorIdx, target, targetSectorIdx
);
logger.error(msg);
//logger.error(msg);
throw new PathNotExistException(msg);
}
return bestPath;
......@@ -273,11 +273,11 @@ public class NavigationService {
}
// log it
StringBuilder sb = new StringBuilder();
for (List<Long> segment : result) {
sb.append(String.format("[%s]", segmentToString(mapService, segment)));
}
logger.info(String.format("Trajectory segments:\n[%s]", sb.toString()));
// StringBuilder sb = new StringBuilder();
// for (List<Long> segment : result) {
// sb.append(String.format("[%s]", segmentToString(mapService, segment)));
// }
// logger.info(String.format("Trajectory segments:\n[%s]", sb.toString()));
return result;
}
......
......@@ -43,6 +43,7 @@ public class SimulatorService {
String filename = "";
if (Util.isWindows()){
filename = mapPath.substring(mapPath.lastIndexOf("\\") + 1);
filename = filename.substring(filename.lastIndexOf("/") + 1);
}else{
filename = mapPath.substring(mapPath.lastIndexOf("/") + 1);
}
......
......@@ -86,7 +86,6 @@ public class Util {
public static CarContainer getDefaultCarContainer() {
if (defaultCarContainer == null) {
defaultCarContainer = CarLangTool.parse(Paths.get("src/main/resources/default"), "default").get().getCarContainer();
defaultCarContainer.setController(getProperties().getProperty("v_model", "AutopilotAdapter"));
}
return defaultCarContainer;
}
......
......@@ -27,7 +27,7 @@ public class MetisGraphTest {
@Before
public void skipOnWindows() {
// TODO: may work on windows, if you can get metis to work
Assume.assumeFalse(Util.isWindows());
//Assume.assumeFalse(Util.isWindows());
}
@Before
......@@ -61,7 +61,7 @@ public class MetisGraphTest {
}
for (Long v : expectedNodes) {
System.out.println("checking " + v);
//System.out.println("checking " + v);
assertTrue(actualNodes.contains(v));
}
}
......
......@@ -26,7 +26,7 @@ public class OverlayUtilTest {
@Before
public void skipOnWindows() {
// TODO: may work on windows, if you can get metis to work
Assume.assumeFalse(Util.isWindows());
//Assume.assumeFalse(Util.isWindows());
}
@Test
......
......@@ -24,7 +24,7 @@ public class MapServiceTest {
@Before
public void skipOnWindows() {
// TODO: may work on windows, if you can get metis to work
Assume.assumeFalse(Util.isWindows());
//Assume.assumeFalse(Util.isWindows());
}
@Before
......@@ -72,6 +72,9 @@ public class MapServiceTest {
mapService = new MapService(mapID, 2);
String basePath = getClass().getResource("/straight.osm").getPath().replace(".osm", "");
if (Util.isWindows()) {
basePath = basePath.substring(1);
}
assertEquals(basePath + ".part.2-0.osm", mapService.getSectorMapByIdx(0));
assertEquals(basePath + ".part.2-1.osm", mapService.getSectorMapByIdx(1));
}
......
......@@ -76,7 +76,7 @@ public class NavigationServiceTest {
printTrajectory(mapService, trajectory);
// distance computed with dijkstra on the whole mapService
referenceDist = navService.getDistance(trajectory);
System.out.println(referenceDist);
//System.out.println(referenceDist);
} catch (NavigationService.PathNotExistException e) {
return;
}
......@@ -89,7 +89,7 @@ public class NavigationServiceTest {
printTrajectory(mapService, temp);
double distance = navService.getDistance(temp);
System.out.println(distance);
//System.out.println(distance);
Assert.assertTrue(distance <= referenceDist);
}
......@@ -98,7 +98,7 @@ public class NavigationServiceTest {
for (Vertex v : vertices) {
str.add(v.getOsmId() + "(" + map.getSectorIdxByOsmID(v.getOsmId()) + ")");
}
System.out.println(String.join("->", str));
//System.out.println(String.join("->", str));
}
@Test
......
......@@ -26,7 +26,7 @@ public class VehicleServiceTest {
@BeforeClass
public static void stetUpClass() throws Exception {
// TODO: may work on windows, if you can get metis to work
Assume.assumeFalse(Util.isWindows());
//Assume.assumeFalse(Util.isWindows());
String mapPath = VehicleService.class.getResource("/Aachen.osm").getPath();
int numSectors = 6;
......@@ -58,12 +58,12 @@ public class VehicleServiceTest {
}
System.out.printf("%s(%d)->%s(%d)\n",
s.getOsmId(),
metis.getOsmIdSectorMapping().get(s.getOsmId()),
t.getOsmId(),
metis.getOsmIdSectorMapping().get(t.getOsmId())
);
// System.out.printf("%s(%d)->%s(%d)\n",
// s.getOsmId(),
// metis.getOsmIdSectorMapping().get(s.getOsmId()),
// t.getOsmId(),
// metis.getOsmIdSectorMapping().get(t.getOsmId())
// );
VehicleService vehicleService;
try {
......@@ -87,7 +87,6 @@ public class VehicleServiceTest {
}
}
System.out.println("hi");
}
@Test
......
......@@ -48,11 +48,37 @@ car default {
SENSOR_OBSTACLE;
}
controller = AutopilotAdapter;
controller {
software = Autopilot;
software_simulator = emu {
test_real;
}
time_model = models {
cpu_frequency = 3GHz;
memory_frequency = 2500MHz;
cache_IL1 {
size = 262144;
read = 4;
write = 4;
}
cache_DL1 {
size = 262144;
read = 4;
write = 4;
}
cache_L2 {
size = 2097152;
read = 6;
write = 6;
}
cache_L3 {
size = 12582912;
read = 40;
write = 40;
}
}
}
physics_model = mass_point;
cpu {
frequency = 3GHz;
memory_frequency = 2GHz;
}
}
\ No newline at end of file
......@@ -7,9 +7,8 @@
can be found under https://github.com/MontiCore/monticore.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>montisim-server</groupId>
......@@ -17,12 +16,12 @@
<version>${revision}</version>
<properties>
<revision>2.2.5</revision>
<revision>2.2.6</revision>
<montisim.commons.version>1.0.11</montisim.commons.version>
<montisim.simulation.version>2.0.4</montisim.simulation.version>