Skip to content

Commit

Permalink
Merge pull request #12 from COVESA/multitest
Browse files Browse the repository at this point in the history
Multitest
  • Loading branch information
UlfBj authored Apr 2, 2024
2 parents 93237fd + 70b7dea commit 4d8f4c3
Show file tree
Hide file tree
Showing 47 changed files with 833 additions and 542 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ logs/
.gitignore
***workspace.code-workspace
***.vscode
/bin/
/client/client-1.0/grpc_client/grpc_map_client/static/node_modules/
/client/client-1.0/grpc_client/grpc_client
/client/client-1.0/client-1.0
6 changes: 3 additions & 3 deletions Dockerfile.agtserver
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# To run with redis as state storage use docker compose. This can be used to build individual images but will not
# run.

ARG GO_VERSION=1.18.3
ARG GO_VERSION=1.22.1
ARG VSSTREE_NAME="vss_vissv2.binary"
ARG BUILD_IMAGE="golang:latest"
ARG RUNTIME_IMAGE="debian:bullseye-slim"
Expand All @@ -32,7 +32,7 @@ COPY go.mod go.sum ./
#RUN ls -a etc/

#copy cert info from testCredGen to path expected by w3c server
COPY testCredGen/ca transport_sec/ca
#COPY testCredGen/ca transport_sec/ca
COPY testCredGen/server transport_sec/server
COPY testCredGen/client transport_sec/client

Expand All @@ -50,7 +50,7 @@ RUN apt-get autoremove -y
COPY --from=builder /build/transport_sec/ ../transport_sec/.


FROM golang:1.21-bookworm as agt_server
FROM golang:latest as agt_server
USER root
RUN mkdir transport_sec
WORKDIR /app
Expand Down
29 changes: 15 additions & 14 deletions Dockerfile.rlserver
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# To run with redis as state storage use docker compose. This can be used to build individual images but will not
# run.

ARG GO_VERSION=1.18.3
ARG GO_VERSION=1.22.1
ARG VSSTREE_NAME="vss_vissv2.binary"
ARG BUILD_IMAGE="golang:latest"
ARG BUILD_IMAGE="golang:1.22.1-bookworm"
ARG RUNTIME_IMAGE="debian:bullseye-slim"

#----------------------Builder-----------------------
Expand All @@ -34,7 +34,7 @@ COPY go.mod go.sum ./
RUN ls -a etc/

#copy cert info from testCredGen to path expected by w3c server
COPY testCredGen/ca transport_sec/ca
#COPY testCredGen/ca transport_sec/ca
COPY testCredGen/server transport_sec/server
COPY testCredGen/client transport_sec/client

Expand All @@ -58,17 +58,8 @@ COPY --from=builder /build/etc/redis.conf /etc/.
EXPOSE 6379
ENTRYPOINT ["/usr/bin/redis-server", "/etc/redis.conf" ]

FROM golang:1.21-bookworm as feeder
USER root
WORKDIR /app
COPY --from=builder /build/bin/feeder-rl feeder
COPY --from=builder /build/feeder/feeder-rl/certificate.pem .
COPY --from=builder /build/feeder/feeder-rl/config.json .
COPY --from=builder /build/feeder/feeder-rl/VehicleVssMapData.json .
ENTRYPOINT ["/app/feeder"]


FROM golang:1.21-bookworm as vissv2server
FROM golang:latest as vissv2server
USER root
RUN mkdir transport_sec
WORKDIR /app
Expand All @@ -84,7 +75,17 @@ COPY --from=builder /build/server/agt_server/agt_public_key.rsa .
ENTRYPOINT ["/app/vissv2server","-s","redis"]


FROM golang:1.21-bookworm as agt_server
FROM golang:latest as feeder
USER root
WORKDIR /app
COPY --from=builder /build/bin/feeder-rl feeder
COPY --from=builder /build/feeder/feeder-rl/certificate.pem .
COPY --from=builder /build/feeder/feeder-rl/config.json .
COPY --from=builder /build/feeder/feeder-rl/VehicleVssMapData.json .
ENTRYPOINT ["/app/feeder"]


FROM golang:latest as agt_server
USER root
RUN mkdir transport_sec
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions client/client-1.0/compress_client/compress_client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* (C) 2022 Geotab Inc
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -24,8 +24,8 @@ import (
"time"

"github.com/akamensky/argparse"
"github.com/covesa/vissr/utils"
"github.com/gorilla/websocket"
"github.com/w3c/automotive-viss2/utils"
)

var commandNumber string
Expand Down
4 changes: 2 additions & 2 deletions client/client-1.0/csv_client/csv_client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* (C) 2022 Geotab Inc
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -15,8 +15,8 @@ import (
"flag"
"fmt"
"github.com/akamensky/argparse"
"github.com/covesa/vissr/utils"
"github.com/gorilla/websocket"
"github.com/w3c/automotive-viss2/utils"
"net/url"
"os"
"strconv"
Expand Down
35 changes: 17 additions & 18 deletions client/client-1.0/grpc_client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* (C) 2023 Ford Motor Company
* (C) 2023 Volvo Cars
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -14,16 +14,16 @@ import (
"crypto/x509"
"fmt"
"github.com/akamensky/argparse"
pb "github.com/w3c/automotive-viss2/grpc_pb"
utils "github.com/w3c/automotive-viss2/utils"
pb "github.com/covesa/vissr/grpc_pb"
utils "github.com/covesa/vissr/utils"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"log"
"os"
"time"
"strings"
"strconv"
"strings"
"time"
)

var clientCert tls.Certificate
Expand All @@ -39,14 +39,14 @@ var grpcCompression utils.Compression
var commandList []string

func initCommandList() {
commandList = make([]string, 4) // 0->GET, 1->SET, 2->SUBSCRIBE, X%10=3->UNSUBSCRIBE
commandList = make([]string, 4) // 0->GET, 1->SET, 2->SUBSCRIBE, X%10=3->UNSUBSCRIBE

commandList[0] = `{"action":"get","path":"Vehicle/Speed","requestId":"232"}`
commandList[1] = `{"action":"set", "path":"Vehicle/Body/Lights/IsLeftIndicatorOn", "value":"true", "requestId":"245"}`
commandList[2] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},{"type":"timebased","parameter": {"period":"5000"}}],"requestId":"246"}`
commandList[3] = `{"action":"unsubscribe","subscriptionId":"X","requestId":"240"}` // X is replaced according to input
commandList[3] = `{"action":"unsubscribe","subscriptionId":"X","requestId":"240"}` // X is replaced according to input

/* different variants
/* different variants
commandList[2] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Speed","CurrentLocation.Latitude", "CurrentLocation.Longitude"]}, {"type":"timebased","parameter":{"period":"100"}}],"requestId":"285"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","filter":{"type":"timebased","parameter":{"period":"100"}},"requestId":"246"}`
commandList[0] = `{"action":"get","path":"Vehicle/Cabin/Door/Row1/Right/IsOpen","requestId":"232"}`
Expand All @@ -56,10 +56,9 @@ func initCommandList() {
commandList[1] = `{"action":"subscribe","path":"Vehicle/Speed","requestId":"258"}`
commandList[1] = `{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["Body.Lights.IsLeftIndicatorOn", "Chassis.Accelerator.PedalPosition"]}, {"type":"change","parameter":{"logic-op":"ne", "diff": "0"}}],"requestId":"285"}`
commandList[1] = {"action":"subscribe","path":"Vehicle","filter":{"type":"paths","parameter":["Speed", "Chassis.Accelerator.PedalPosition"]},"requestId":"246"}`
*/
*/
}


func noStreamCall(commandIndex int) {
var conn *grpc.ClientConn
var err error
Expand Down Expand Up @@ -88,23 +87,23 @@ func noStreamCall(commandIndex int) {
defer cancel()
vssRequest := commandList[commandIndex%10]
var vssResponse string
switch commandIndex%10 {
case 0: //get
switch commandIndex % 10 {
case 0: //get
pbRequest := utils.GetRequestJsonToPb(vssRequest, grpcCompression)
pbResponse, err := client.GetRequest(ctx, pbRequest)
if err != nil {
log.Fatal(err)
return
}
vssResponse = utils.GetResponsePbToJson(pbResponse, grpcCompression)
case 1: // set
case 1: // set
pbRequest := utils.SetRequestJsonToPb(vssRequest, grpcCompression)
pbResponse, _ := client.SetRequest(ctx, pbRequest)
vssResponse = utils.SetResponsePbToJson(pbResponse, grpcCompression)
case 3: //unsubscribe
subIdIndex := strings.Index(vssRequest, "X")
vssRequest = vssRequest[:subIdIndex] + strconv.Itoa(commandIndex/10) + vssRequest[subIdIndex+1:]
fmt.Printf("Unsubscribe request=:%s\n", vssRequest)
case 3: //unsubscribe
subIdIndex := strings.Index(vssRequest, "X")
vssRequest = vssRequest[:subIdIndex] + strconv.Itoa(commandIndex/10) + vssRequest[subIdIndex+1:]
fmt.Printf("Unsubscribe request=:%s\n", vssRequest)
pbRequest := utils.UnsubscribeRequestJsonToPb(vssRequest, grpcCompression)
pbResponse, _ := client.UnsubscribeRequest(ctx, pbRequest)
vssResponse = utils.UnsubscribeResponsePbToJson(pbResponse, grpcCompression)
Expand Down Expand Up @@ -189,7 +188,7 @@ func main() {
}
fmt.Printf("Selected request:%s\n", commandList[commandIndex%10])
if commandIndex == 2 { // subscribe
go streamCall(commandIndex%10)
go streamCall(commandIndex % 10)
} else {
go noStreamCall(commandIndex)
}
Expand Down
8 changes: 4 additions & 4 deletions client/client-1.0/grpc_client/grpc_map_client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* (C) 2023 Ford Motor Company
* (C) 2023 Volvo Cars
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -14,10 +14,10 @@ import (
"crypto/x509"
"fmt"
"github.com/akamensky/argparse"
"github.com/covesa/vissr/client/client-1.0/grpc_client/grpc_map_client/mapserver"
pb "github.com/covesa/vissr/grpc_pb"
utils "github.com/covesa/vissr/utils"
"github.com/gorilla/mux"
"github.com/w3c/automotive-viss2/client/client-1.0/grpc_client/grpc_map_client/mapserver"
pb "github.com/w3c/automotive-viss2/grpc_pb"
utils "github.com/w3c/automotive-viss2/utils"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
Expand Down
4 changes: 2 additions & 2 deletions client/client-1.0/mqtt_client/mqtt_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* (C) 2021 Mitsubishi Electrics Automotive
* (C) 2021 Geotab
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -14,8 +14,8 @@ import (
"time"

"github.com/akamensky/argparse"
"github.com/covesa/vissr/utils"
MQTT "github.com/eclipse/paho.mqtt.golang"
"github.com/w3c/automotive-viss2/utils"
)

var uniqueTopicName string
Expand Down
4 changes: 2 additions & 2 deletions client/client-1.0/simple_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* (C) 2023 Ford Motor Company
* (C) 2022 Geotab Inc
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -25,8 +25,8 @@ import (
"time"

"github.com/akamensky/argparse"
"github.com/covesa/vissr/utils"
"github.com/gorilla/websocket"
"github.com/w3c/automotive-viss2/utils"
)

var commandNumber string
Expand Down
30 changes: 14 additions & 16 deletions docker/viss-docker-rl/docker-compose-rl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ services:
volumes:
- /tmp/docker/

redis:
image: redis
container_name: app_redis
privileged: true
user: root
command: redis-server /etc/redis.conf
ports:
- "6379:6379"
volumes:
- ../../redis/redis.conf:/etc/redis.conf
volumes_from:
- tmp


feeder-rl:
container_name: feeder-rl
user: root
Expand All @@ -29,22 +43,6 @@ services:
- tmp


redis:
image: redis
container_name: app_redis
privileged: true
user: root
command: redis-server /etc/redis.conf
ports:
- "6379:6379"
volumes:
- ../../redis/redis.conf:/etc/redis.conf
volumes_from:
- tmp




vissv2server:
container_name: vissv2server
depends_on:
Expand Down
4 changes: 2 additions & 2 deletions feeder/feeder-evic/evicFeeder.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* (C) 2023 Ford Motor Company
*
* All files and artifacts in the repository at https://github.com/w3c/automotive-viss2
* All files and artifacts in the repository at https://github.com/covesa/vissr
* are licensed under the provisions of the license provided by the LICENSE file in this repository.
*
**/
Expand All @@ -12,9 +12,9 @@ import (
"database/sql"
"encoding/json"
"github.com/akamensky/argparse"
"github.com/covesa/vissr/utils"
"github.com/go-redis/redis"
_ "github.com/mattn/go-sqlite3"
"github.com/w3c/automotive-viss2/utils"
"net"
"os"
"sort"
Expand Down
Loading

0 comments on commit 4d8f4c3

Please sign in to comment.