COVESA / capicxx-someip-runtime

Common API C++ SOMEIP runtime
Mozilla Public License 2.0
111 stars 83 forks source link

Not possible to communicate across machine boundaries (Request for Documentation) #26

Closed dprogm closed 1 year ago

dprogm commented 1 year ago

I am trying to connect to a CommonAPI Service that is running on an embedded device.

network_setup

I am basically following the guide SomeIP in 10 minutes, but also tried several settings from the SomeIP User Guide without any success.

The SomeIP configuration at the client side (Linux Host) is similar to the following:

{
  "unicast" : "192.168.1.8",
  "logging":
  {
    "level" : "debug",
    "console" : "true"
  },
  "applications":
  [
    {
      "name" : "Client",
      "id" : "0x2000"
    }
  ],
  "clients":
  [
    {
      "service" : "0x000A",
      "instance" : "0x0014",
      "unreliable" : 
      [
        "30509"
      ],
      "reliable" :
      [
        "30600"
      ]
    }
  ],
  "routing" : "Client",
  "service-discovery":
  {
    "enable" : "true",
    "multicast" : "224.224.224.245"
    "port" : "30490",
    "protocol" : "udp"
  }
}

The SomeIP configuration at the service side (Linux Embedded Device) is similar to the following:

{
  "unicast" : "192.168.1.4",
  "logging":
  {
    "level" : "debug",
    "console" : "true"
  },
  "applications":
  [
    {
      "name" : "Service",
      "id" : "0x1000"
    }
  ],
  "services":
  [
    {
      "service" : "0x000A",
      "instance" : "0x0014",
      "unreliable" : "30509",
      "reliable" : { 
        "port" : "30600", 
        "enable-magic-cookies" : "false" 
      }
    }
  ],
  "routing" : "Service",
  "service-discovery":
  {
    "enable" : "true",
    "multicast" : "224.224.224.245"
    "port" : "30490",
    "protocol" : "udp"
  }
}

The problem is, although setting the logging level to trace there is almost no useful output that could point me to the actual issue. It would be helpful to get something like Could not connect to socket ... or something like that. It would be really helpful to have a guide like CommonAPI SomeIP for Dummies (:grin:). So this issue is not just particular to my problem but also the occasion for providing a thorough introductory guide that is a low burden for new developers. CommonAPI provides a high level of abstraction and ease of use but the complex deployment makes it little bit harder. :wink:

So some of my questions are:

If you need further logging output I can provide it.

Logging output from the client:

[CAPI][DEBUG] Adding proxy mapping: local:Callbacks:v1_0:test --> libCallbacksProxy.so
[CAPI][DEBUG] Adding proxy mapping: local:Request:v1_0:test --> libRequestProxy.so
[CAPI][INFO] Loading configuration file '/etc/commonapi-client.ini'
[CAPI][INFO] Using default binding 'someip'
[CAPI][INFO] Using default shared library folder '/usr/local/lib/commonapi'
[CAPI][DEBUG] Loading library for local:Request:v1_0:test proxy.
[CAPI][DEBUG] Added address mapping: local:Callbacks:v1_0:test <--> [001e.0028(0.0)]
[CAPI][DEBUG] Added address mapping: local:Request:v1_0:test <--> [000a.0014(0.0)]
[CAPI][VERBOSE] Registering function for creating "Request:v1_0" proxy.
[CAPI][DEBUG] Loading interface library "libRequestProxy.so" succeeded.
[CAPI][VERBOSE] Creating proxy for "local:Request:v1_0:test"
[info] Parsed vsomeip configuration in 0ms
[info] Using configuration file: "/etc/someip_config.json".
[info] Configuration module loaded.
[info] Initializing vsomeip application "Client".
[info] Instantiating routing manager [Host].
[info] create_local_server Routing endpoint at /tmp/vsomeip-0
[info] Service Discovery enabled. Trying to load module.
[info] Service Discovery module loaded.
[info] Application(Client, 2000) is initialized (11, 100).
[info] Starting vsomeip application "Client" (2000) using 2 threads I/O nice 255
[info] main dispatch thread id from application: 2000 (Client) is: 7ff446ffd700 TID: 32450
[info] shutdown thread id from application: 2000 (Client) is: 7ff4467fc700 TID: 32451
[info] REQUEST(2000): [000a.0014:0.4294967295]
[info] Watchdog is disabled!
[info] io thread id from application: 2000 (Client) is: 7ff4477fe700 TID: 32449
[info] io thread id from application: 2000 (Client) is: 7ff4457fa700 TID: 32453
[info] Listening at /tmp/vsomeip-2000
Checking availability of the service...
[info] vSomeIP 3.1.20.3 | (default)
[info] Network interface "eno2" state changed: up
[info] Route "224.224.224.245/32 if: eno2 gw: n/a" state changed: up
[info] udp_server_endpoint_impl: SO_RCVBUF is: 212992
[debug] Joining to multicast group 224.224.224.245 from 192.168.1.8
[info] udp_server_endpoint_impl: SO_RCVBUF (Multicast) is: 212992
[info] SOME/IP routing ready.
[info] vSomeIP 3.1.20.3 | (default)
[info] Stopping vsomeip application "Client" (2000).

Logging output from the server:

[CAPI][INFO] Loading configuration file '/data/commonapi-server.ini'
[CAPI][INFO] Using default binding 'someip'
[CAPI][INFO] Using default shared library folder '/usr/local/lib/commonapi'
[CAPI][DEBUG] Loading library for local:Request:v1_0:test stub.
[CAPI][DEBUG] Added address mapping: local:Callbacks:v1_0:test <--> [001e.0028(0.0)]
[CAPI][DEBUG] Added address mapping: local:Request:v1_0:test <--> [000a.0014(0.0)]
[CAPI][DEBUG] Added address mapping: local:Request:v1_0:Request <--> [000a.0014(1.0)]
[CAPI][INFO] Registering function for creating "Request:v1_0" stub adapter.
[CAPI][DEBUG] Loading interface library "librequest-stub.so" succeeded.
[CAPI][INFO] Registering stub for "local:Request:v1_0:test"
[info] Parsed vsomeip configuration in 7ms
[info] Using configuration file: "/data/someip_config.json".
[info] Configuration module loaded.
[info] Initializing vsomeip application "serverapp".
[info] Instantiating routing manager [Host].
[info] create_local_server Routing endpoint at /tmp/vsomeip-0
[info] Service Discovery enabled. Trying to load module.
[info] Service Discovery module loaded.
[info] Application(serverapp, 1000) is initialized (11, 100).
[info] OFFER(1000): [000a.0014:0.0] (true)
[info] Listening at /tmp/vsomeip-1000
[CAPI][DEBUG] Loading library for local:Callbacks:v1_0:test stub.
[info] Starting vsomeip application "serverapp" (1000) using 2 threads I/O nice 255
[info] Watchdog is disabled!
[info] io thread id from application: 1000 (serverapp) is: abfc7450 TID: 3787
[info] vSomeIP 3.1.20.3 | (default)
[info] main dispatch thread id from application: 1000 (serverapp) is: b03ac450 TID: 3788
[info] shutdown thread id from application: 1000 (serverapp) is: b1bcd450 TID: 3789
[info] io thread id from application: 1000 (serverapp) is: ab7a9450 TID: 3791
[CAPI][DEBUG] Added address mapping: local:Callbacks:v1_0:Callbacks <--> [001e.0028(1.0)]
[CAPI][[info] Network interface "bridge0" state changed: up
[error] netlink_connector::receive_cbk received error message: 2 seq 3
[CAPI][INFO] Registering function for creating "Callbacks:v1_0" stub adapter.
[CAPI][DEBUG] Loading interface library "libcallbacks-stub.so" succeeded.
[CAPI][INFO] Registering stub for "local:Callbacks:v1_0:test"

As it can be seen in the logging output there isn't much going on, but I am seeing that there is a REQUEST on the client side and an OFFER on the server side. So something is happening. But no connection attempt. What looks suspicious to me is that the client requests the SomeIP address 000a.0014:0.4294967295 whereas the server offers the address 000a.0014:0.0 which indicates that the minor version is different. Can this be a problem here?

Help is really appreciated :wink: I don't know how to proceed :sweat_smile:

dprogm commented 1 year ago

@lutzbichler Maybe you have an idea here? :cold_sweat:

dprogm commented 1 year ago

Can be closed from my side. It was just a network config issue. But I leave it to the maintainer whether to close the issue.