COVESA / vsomeip

An implementation of Scalable service-Oriented MiddlewarE over IP
Mozilla Public License 2.0
1.02k stars 651 forks source link

Linux to Linux Communication #572

Closed jsb9945 closed 3 weeks ago

jsb9945 commented 6 months ago

I don't know why it's not working. I'm asking for your help I am currently executing requests and responses in sample. I didn't modify the cpp file and only the config file appears on the wiki, so I modified it and am running it.

======================================================= s32_udp.json

{
    "unicast" : "192.168.0.145",
    "logging" :
    {
        "level" : "debug",
        "console" : "true",
        "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
        "dlt" : "false"
    },
    "applications" :
    [
        {
            "name" : "client-sample",
            "id" : "0x1313"
        }
    ],
    "routing" : "client-sample",
    "service-discovery" :
    {
        "enable" : "true",
        "multicast" : "224.224.224.245",
        "port" : "30490",
        "protocol" : "udp",
        "initial_delay_min" : "10",
        "initial_delay_max" : "100",
        "repetitions_base_delay" : "200",
        "repetitions_max" : "3",
        "ttl" : "3",
        "cyclic_offer_delay" : "2000",
        "request_response_delay" : "1500"
    }
}

================================================ desktop_udp.json

{
    "unicast" : "192.168.0.60",
    "logging" :
    {
        "level" : "debug",
        "console" : "true",
        "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
        "dlt" : "false"
    },
    "applications" :
    [
        {
            "name" : "service-sample",
            "id" : "0x1212"
        }
    ],
    "services" :
    [
        {
            "service" : "0x1234",
            "instance" : "0x5678",
            "unreliable" : "30509"
        }
    ],
    "routing" : "service-sample",
    "service-discovery" :
    {
        "enable" : "true",
        "multicast" : "224.224.224.245",
        "port" : "30490",
        "protocol" : "udp",
        "initial_delay_min" : "10",
        "initial_delay_max" : "100",
        "repetitions_base_delay" : "200",
        "repetitions_max" : "3",
        "ttl" : "3",
        "cyclic_offer_delay" : "2000",
        "request_response_delay" : "1500"
    }
}

=============================================================

Here's the order I did

Host1: $ route add -nv 224.224.224.245 dev eth0

root@nxp-s32g:~/vsomeip/build/examples# VSOMEIP_CONFIGURATION=../../config/s32g_udp.json VSOMEIP_APPLICATION_NAME=client-sample ./request-sample 2023-11-13 15:13:46.763821 [info] Using configuration file: "../../config/s32g_udp.json". 2023-11-13 15:13:46.766381 [info] Parsed vsomeip configuration in 1ms 2023-11-13 15:13:46.766919 [info] Configuration module loaded. 2023-11-13 15:13:46.767271 [info] Initializing vsomeip (3.3.8) application "client-sample". 2023-11-13 15:13:46.768652 [info] Instantiating routing manager [Host]. 2023-11-13 15:13:46.772006 [info] create_routing_root: Routing root @ /tmp/vsomeip-0 2023-11-13 15:13:46.773802 [info] Service Discovery enabled. Trying to load module. 2023-11-13 15:13:46.788140 [info] Service Discovery module loaded. 2023-11-13 15:13:46.790080 [info] Application(client-sample, 1313) is initialized (11, 100). Client settings [protocol=UDP:quiet=false:cycle=1000] 2023-11-13 15:13:46.791267 [info] Starting vsomeip application "client-sample" (1313) using 2 threads I/O nice 255 2023-11-13 15:13:46.795047 [info] Client [1313] routes unicast:192.168.0.145, netmask:255.255.255.0 2023-11-13 15:13:46.794471 [info] main dispatch thread id from application: 1313 (client-sample) is: 7f9cc13130 TID: 503 2023-11-13 15:13:46.795025 [info] shutdown thread id from application: 1313 (client-sample) is: 7f9c403130 TID: 504 2023-11-13 15:13:46.800197 [info] Watchdog is disabled! Service [1234.5678] is NOT available. Service [1235.5678] is NOT available. 2023-11-13 15:13:46.802173 [info] REQUEST(1313): [1234.5678:255.4294967295] 2023-11-13 15:13:46.802817 [info] io thread id from application: 1313 (client-sample) is: 7f9e4a0430 TID: 500 2023-11-13 15:13:46.802759 [info] io thread id from application: 1313 (client-sample) is: 7f9b3e3130 TID: 506 2023-11-13 15:13:46.804889 [info] create_local_server: Listening @ /tmp/vsomeip-1313 2023-11-13 15:13:46.808595 [info] vSomeIP 3.3.8 | (default) 2023-11-13 15:13:46.811727 [info] Network interface "eth0" state changed: up 2023-11-13 15:13:46.814486 [info] Route "default route (0.0.0.0/0) if: eth0 gw: 192.168.0.1" state changed: up 2023-11-13 15:13:46.816484 [info] udp_server_endpoint_impl: SO_RCVBUFFORCE successful. 2023-11-13 15:13:46.816868 [info] udp_server_endpoint_impl: SO_RCVBUF is: 1703936 (1703936) local port:30490 2023-11-13 15:13:46.817590 [debug] Joining to multicast group 224.224.224.245 from 192.168.0.145 2023-11-13 15:13:46.818592 [info] SOME/IP routing ready. 2023-11-13 15:13:46.819730 [warning] Route "224.224.224.245/32 if: eth0 gw: n/a" state changed: up 2023-11-13 15:13:46.819790 [info] udp_server_endpoint_impl: SO_RCVBUFFORCE: successful. 2023-11-13 15:13:46.820594 [info] udp_server_endpoint_impl: SO_RCVBUF is: 1703936 (1703936) local port:30490 2023-11-13 15:13:49.184933 [info] endpoint_manager_impl::create_remote_client: 192.168.0.60:30509 reliable: 0 using local port: 0 2023-11-13 15:13:49.187296 [info] udp_client_endpoint_impl::connect: SO_RCVBUFFORCE successful! 2023-11-13 15:13:49.187690 [info] udp_client_endpoint_impl::connect: SO_RCVBUF is: 1703936 (1703936) local port:0 remote:192.168.0.60:30509 Service [1234.5678] is available. Client/Session [1313/0001] sent a request to Service [1234.5678] 2023-11-13 15:13:56.809385 [info] vSomeIP 3.3.8 | (default) Service [1234.5678] is NOT available. 2023-11-13 15:14:01.219246 [warning] Didn't receive a multicast SD message for 2200ms. 2023-11-13 15:14:01.220308 [debug] Leaving the multicast group 224.224.224.245 from 192.168.0.145 2023-11-13 15:14:01.221008 [debug] Joining to multicast group 224.224.224.245 from 192.168.0.145 2023-11-13 15:14:01.225523 [info] udp_server_endpoint_impl: SO_RCVBUFFORCE: successful. 2023-11-13 15:14:01.226199 [info] udp_server_endpoint_impl: SO_RCVBUF is: 1703936 (1703936) local port:30490

Host2: $ route add -nv 224.224.224.245 dev enp42s0

wkdtjdqls@wkdtjdqls-MS-7C94:~/vsomeip/build/examples$ VSOMEIP_CONFIGURATION=../../config/desktop_udp.json VSOMEIP_APPLICATION_NAME=service-sample ./response-sample 2023-11-14 00:13:49.186387 [info] Parsed vsomeip configuration in 0ms 2023-11-14 00:13:49.186806 [info] Using configuration file: "../../config/desktop_udp.json". 2023-11-14 00:13:49.186898 [info] Configuration module loaded. 2023-11-14 00:13:49.186960 [info] Initializing vsomeip application "service-sample". 2023-11-14 00:13:49.187432 [info] Instantiating routing manager [Host]. 2023-11-14 00:13:49.187643 [info] create_local_server Routing endpoint at /tmp/vsomeip-0 2023-11-14 00:13:49.188020 [info] Service Discovery enabled. Trying to load module. 2023-11-14 00:13:49.189541 [info] Service Discovery module loaded. 2023-11-14 00:13:49.189837 [info] Application(service-sample, 1212) is initialized (11, 100). Static routing OFF 2023-11-14 00:13:49.189974 [info] Starting vsomeip application "service-sample" (1212) using 2 threads I/O nice 255 2023-11-14 00:13:49.190511 [info] main dispatch thread id from application: 1212 (service-sample) is: 7fbd26342700 TID: 97526 2023-11-14 00:13:49.190650 [info] shutdown thread id from application: 1212 (service-sample) is: 7fbd25b41700 TID: 97527 2023-11-14 00:13:49.191443 [info] Watchdog is disabled! Application service-sample is registered. 2023-11-14 00:13:49.191846 [info] io thread id from application: 1212 (service-sample) is: 7fbd26c3c740 TID: 97524 2023-11-14 00:13:49.192025 [info] io thread id from application: 1212 (service-sample) is: 7fbd24b3f700 TID: 97529 2023-11-14 00:13:49.192043 [info] OFFER(1212): [1234.5678:0.0] (true) 2023-11-14 00:13:49.192810 [info] vSomeIP 3.1.37.1 | (default) 2023-11-14 00:13:49.193121 [info] Listening at /tmp/vsomeip-1212 2023-11-14 00:13:49.193257 [info] Network interface "enp42s0" state changed: up 2023-11-14 00:13:49.193302 [info] OFFER(1212): [1235.5678:0.0] (true) 2023-11-14 00:13:49.193550 [info] Port configuration missing for [1235.5678]. Service is internal. 2023-11-14 00:13:49.193717 [info] Route "default route (0.0.0.0/0) if: enp42s0 gw: 192.168.0.1" state changed: up 2023-11-14 00:13:49.194146 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30490 2023-11-14 00:13:49.194276 [debug] Joining to multicast group 224.224.224.245 from 192.168.0.60 2023-11-14 00:13:49.194429 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30490 2023-11-14 00:13:49.195019 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30509 2023-11-14 00:13:49.195118 [info] SOME/IP routing ready. 2023-11-14 00:13:49.195308 [warning] Route "224.0.0.0/4 if: enp42s0 gw: n/a" state changed: up 2023-11-14 00:13:49.195409 [warning] Route "224.224.224.245/32 if: enp42s0 gw: n/a" state changed: up 2023-11-14 00:13:59.196106 [info] vSomeIP 3.1.37.1 | (default) 2023-11-14 00:13:59.215791 [info] STOP OFFER(1212): [1234.5678:0.0] (true) 2023-11-14 00:13:59.216295 [info] STOP OFFER(1212): [1235.5678:0.0] (true)

I'd appreciate your help. Thank you.

fcmonteiro commented 6 months ago

Your host 2 is using vSomeIP 3.1.x Please retest both hosts with the latest vSomeIP 3.4.x

jsb9945 commented 6 months ago

I changed it to 3.4 and ran it, but it says it's the same..

fcmonteiro commented 6 months ago

2023-11-14 00:13:49.193550 [info] Port configuration missing for [1235.5678]. Service is internal.

You are not providing the port configuration in the host2 json file, and the offers are not being sent to the network. Please try to add something like this in your json file (adapt if necessary),

    "services" :
    [
        {
            "service" : "0x1234",
            "instance" : "0x5678",
            "reliable" : { "port" : "31111", "enable-magic-cookies" : "false" },
            "unreliable" : "31111"
        }
    ],

Also check with wireshark if you see the offers/finds in the network.