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

device registry - device lifecycle test scenario may fail for some network configurations #1237

Closed
stefanomorson opened this issue Dec 26, 2017 · 4 comments · Fixed by #3697
Assignees
Labels
Bug This is a bug or an unexpected behaviour. Fix it! Test Test related stuff. It's a dirty job, but someone needs to do that!

Comments

@stefanomorson
Copy link
Contributor

stefanomorson commented Dec 26, 2017

Testflow:
This bug happened running the integration tests (qa) in a machine connected to the network through a mobile internet router but it can also happen in other cases when the number of interfaces and ip address exceeds the size of the corresponding fields in the device table.

  • Run class RunDeviceDataI9nTest in debug mode using Cucumber runner

Result:
The test fails, reporting the follwing error:

5:15:02.156 [Camel (camelContext) thread #3 - JmsConsumer[Consumer.eurotech:mainRoutelisteners:EXACTLY_ONCE.VirtualTopic.%3E]] WARN  eclipselink.logging.all - Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: Value too long for column "CONNECTION_IP VARCHAR(64)": "'<more-than-64-chars-list-of-ip-address>' (87)"; SQL statement:
INSERT INTO dvc_device (accept_encoding, app_framework_version, app_identifiers, attributes, bios_version, client_id, connection_interface, connection_ip, created_on, custom_attribute_1, custom_attribute_2, custom_attribute_3, custom_attribute_4, custom_attribute_5, display_name, firmware_version, iccid, imei, imsi, jvm_version, model_id, modified_on, optlock, os_version, osgi_framework_version, properties, serial_number, status, connection_id, created_by, group_id, id, last_event_id, modified_by, scope_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [22001-192]
Error Code: 22001

The list of interfaces and the list of ip addresses are build by kapua-simulator-kura project in class BirthCertificateBuilder which correctly collects all the available information from the system where it is running. The simulator is used by the tests to generate and send a birth certificate to the Kapua messaging service which in turn tries to create a new registry entry and stick that info in a 64 char field.

Expected behaviour:
The test should succeed.

@stefanomorson stefanomorson added Bug This is a bug or an unexpected behaviour. Fix it! Test Test related stuff. It's a dirty job, but someone needs to do that! labels Dec 26, 2017
@andrejn-ct
Copy link
Contributor

The main problem that is highlighted by this issue is that Kapua tries to insert a (potentially long, as is the presented case) list of IPs into a relatively short (64 characters) field.
This is not tied to this specific test case. You can set up a physical device with such a number of interfaces that will cause the same exception to be thrown in the device registry.
This same behavior was observed with a Raspberry Pi 3 running Kura that had 4 network interfaces configured (on-board ethernet, on-board wireless, an USB ethernet and a virtual network interface).
It is of course possible to modify the kura simulator to send only short strings of IPs and interface names, but I am unsure whether this is the correct "fix".
In my mind, the correct solution depends on the intended use of this field ("connection_ip" and consequentially the list of interface names "connection_interface").
@stefanomorson, @Coduz please let me know what you think about this.

@stefanomorson
Copy link
Contributor Author

stefanomorson commented Mar 12, 2018

As for Kura protocol, metrics

  • connection_interface
  • connection_ip

in the payload of the birth message can contain multiple interfaces and IPs.
If fields CONNECTION_INTERFACE and CONNECTION_IP in dev_device of Kapua are meant to contain the the same info, they should adapt an provide enough space or logic to cope with long strings. From this perspective I would say that the test is correctly failing.

@svilenvul
Copy link

svilenvul commented Jun 13, 2018

I experienced the same issue in an integration environment, where several docker images where running on to the gateway and it was really frustrating.

I will support @andrejn-ct that this is not tied to a specific test case and easily can occur in production environment.

The failed insert results into a failure to register the device. It does not show up in Kapua UI and can not be controlled via REST API !

@Coduz
Copy link
Contributor

Coduz commented Aug 29, 2018

I think that we can extend the Device model to improve the managing of the "device profile".
All the information on the Birth certificate sent by the device will be stored in some new fields that will represent information in more than just strings.

For example a device will have a DeviceProfile entity linked.
The DeviceProfile entity will have multiple fields, like a List of ConnectionInterfaces in which every ip and interface on the Birth message will be translated to.
Also modem field can be improved like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it! Test Test related stuff. It's a dirty job, but someone needs to do that!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants