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

* uuid command handling in agent not as expected #419

Closed
EMPreethi opened this issue Mar 6, 2024 · 19 comments · Fixed by #426, #430, #433 or #437
Closed

* uuid command handling in agent not as expected #419

EMPreethi opened this issue Mar 6, 2024 · 19 comments · Fixed by #426, #430, #433 or #437

Comments

@EMPreethi
Copy link

I want to change UUID in agent by sending * uuid command from the adapter as a part of SHDR stream.
PreserveUUID is set to false.

I observed in REST output that UUID is changing, but none of the data items for the device is not getting recognized as below

024-03-06T09:30:53.442189Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: y1_abs 
2024-03-06T09:30:53.442200Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: 0.000000 
2024-03-06T09:30:53.442211Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: y1_axis_interlock

I also observed that UUID is changed for first * uuid command. Any repeated command with different UUID did not reflect in REST output.
Agent configuration as below

Devices = devices.xml
 ServerIP = 0.0.0.0
 Port = 5000
 AllowPut = false
 AllowPutFrom = localhost
 ReconnectInterval = 1000
 WorkerThreads = 2
 BufferSize = 17
 MaxAssets = 8096
 IgnoreTimestamps = true
 SchemaVersion = 2.0
 ShdrVersion = 2.0 # Set Default on all Adapters
 JsonVerson = 2.0
 SuppressIPAddress = true
 MonitorConfigFiles = true
 ConversionRequired = false
 UpcaseDataItemValue = true
 EnableSourceDeviceModels = false
 VersionDeviceXml = false
 Pretty = true
 Adapters {
    Saw {
      RealTime = false
      Protocol = shdr
      Host = 192.168.88.105
      Port = 9800
      PreserveUUID = false
   }
}

I expected to change UUID based on the machine connected to. Adapter streams the uuid command whenever there is change in machine and UUID of that machine is reflected in REST output of agent.

Is this a issue or expected behaviour?

Thanks

@wsobel
Copy link
Member

wsobel commented Mar 6, 2024 via email

@EMPreethi
Copy link
Author

I observed that Device XML file is not rewritten instead i saw changes only in REST output.

@wsobel
Copy link
Member

wsobel commented Mar 6, 2024

Set VersionDeviceXml = true. That will update the device xml.

@EMPreethi
Copy link
Author

Set VersionDeviceXml = true. That will update the device xml.

if VersionDeviceXml = true, I see UUID is overwritten in device XML file along with that i am sending SHDR data for all data items but status is shown as UNAVAILABLE.

When I refer to agent logs, looks like it is not able to identify data items but it is already defined in XML file.

Adapter_uuid_output

device XML :

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet type="text/xsl" href="/styles/styles.xsl"?> 
<MTConnectDevices xmlns:m="urn:mtconnect.org:MTConnectDevices:2.0" xmlns="urn:mtconnect.org:MTConnectDevices:2.0" xmlns:xsi="
[http://www.w3.org/2001/XMLSchema-instance"](http://www.w3.org/2001/XMLSchema-instance%22)
xsi:schemaLocation="urn:mtconnect.org:MTConnectDevices:2.0 /schemas/MTConnectDevices_2.0.xsd"> 
<Header creationTime="2024-03-07T04:30:27Z" sender="e2c573fd5e38" instanceId="0" version="2.3.0.2" deviceModelChangeTime="2024-03-07T04:30:26.367824Z" assetBufferSize="0" assetCount="0" bufferSize="0"/> 
<Devices> 
<Device id="saw" name="Saw" uuid="smartAdapter_9845"> 
<Description manufacturer="omron">SmartSaw</Description> 
<Configuration> 
<CoordinateSystems> 
<CoordinateSystem id="world_coordinates" type="WORLD"> 
<Transformation>

Why agent is not able to identify SHDR data items when UUID changes ?

@wsobel
Copy link
Member

wsobel commented Mar 7, 2024

Please attach or upload the Device xml. I want to see if the original ids are being serialized.

@wsobel
Copy link
Member

wsobel commented Mar 7, 2024

Can you also attach or paste the shdr from the adapter. I want to see or check what's happening in the two.

@EMPreethi
Copy link
Author

Attached a devices XML file :
devices.txt

adapter SHDR :
adapter_test.txt

Thanks

@wsobel
Copy link
Member

wsobel commented Mar 11, 2024

I'll test this, not sure what is going wrong.

@EMPreethi
Copy link
Author

Few of the observation I found:

  1. Looks like after handling UUID command, agent does not updates to new UUID value even though it is changing in REST output.
    Default UUID defined in XML File : smart_9845
    command sent is * uuid : smart_9845_new
2024-03-11T06:53:14.697026Z (0x00007f047f4ebb38) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->ShdrAdapter::protocolCommand: _1a67104bd6:Received protocol command 'description' for device 'smart_9845', but the device could not be found 
2024-03-11T06:53:14.697043Z (0x00007f047f4ebb38) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->ShdrAdapter::protocolCommand: Processing command: manufacturer: omron 
2024-03-11T06:53:14.697051Z (0x00007f047f4ebb38) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->ShdrAdapter::protocolCommand: _1a67104bd6: Cannot find device for name smart_9845 
2024-03-11T06:53:14.697059Z (0x00007f047f4ebb38) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->ShdrAdapter::protocolCommand: _1a67104bd6:Received protocol command 'manufacturer' for device 'smart_9845', but the device could not be found

2.Adding Device configuration within Adapter block results in agent identifying every data item and handling command properly.

Adapters {
    Saw {
      Device = Saw
      RealTime = false
      Protocol = shdr
      Host = 192.168.88.105
      Port = 9800
      PreserveUUID = false
   }
}

If above Device config is not added, then streaming * device: Saw command from Adapter will also results in agent identifying every data items.

Thank you

@wsobel
Copy link
Member

wsobel commented Mar 11, 2024

I'll check in the protocol comment for * uuid. I think I have enough to reproduce the issue.

Thanks

  • W

@EMPreethi
Copy link
Author

EMPreethi commented Mar 26, 2024

@wsobel
When preserveUUID = true and a new UUID is sent from Adapter , I expected that Agent ignore the new UUID and should handle the SHDR data as normal

Based on my observation, it seems that the Agent is not handling the SHDR data properly when a new UUID is sent.

024-03-06T09:30:53.442189Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: y1_abs 
2024-03-06T09:30:53.442200Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: 0.000000 
2024-03-06T09:30:53.442211Z (0x00007fccfd8b9b38) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: y1_axis_interlock

Should the agent ignore the UUID command, or should it consider it as a new device?

@wsobel
Copy link
Member

wsobel commented Mar 26, 2024 via email

@wsobel wsobel reopened this Mar 26, 2024
@emprarthanak
Copy link

emprarthanak commented Apr 2, 2024

@wsobel
Built the image using latest code that's been merged and found that

  1. The latest code, now does not work as expected when * uuid: smart_9845_new command is sent and preserveUUID = false. The uuid gets updated and shown in REST output but shows all dataitems as UNAVAILABLE
2024-04-02T09:09:12.261443Z (0x00007fe9490f4640) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: x0_target
2024-04-02T09:09:12.261450Z (0x00007fe9490f4640) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: 0.000000
2024-04-02T09:09:12.261456Z (0x00007fe9490f4640) [trace] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData->DataItemMapper.ShdrTokenMapper.operator->DataItemMapper.ShdrTokenMapper.mapTokensToDataItem: Could not find data item: x0_abs
  1. It works fine when preserveUUID = true and * uuid: smart_9845_new command is sent

Thanks

@wsobel wsobel reopened this Apr 2, 2024
@wsobel
Copy link
Member

wsobel commented Apr 2, 2024

Reopening this issue to find problem.

@wsobel wsobel linked a pull request Apr 3, 2024 that will close this issue
@wsobel
Copy link
Member

wsobel commented Apr 3, 2024

Made some final changes to support preserve uuid. was not setting preserve in the adapter config for associated device.

@emprarthanak
Copy link

@wsobel
Observed that the issue still exists as when command * uuid: smart_9845_new command is sent and preserveUUID = false, uuid is updated in REST output. I am sending SHDR data for all data items but status is shown as UNAVAILABLE.

Screenshot from 2024-04-05 14-09-31

When I refer to agent logs, looks like it is not able to identify data items but it is already defined in XML file

@wsobel
Copy link
Member

wsobel commented Apr 5, 2024

I was not getting that behavior. Can you upload them device xml, the log file, the cfg, and the adapter data. I tried with the previous data and it worked.

@emprarthanak
Copy link

@wsobel
The previous may be working because the default device defined in the xml is matching with uuid sent as command

Attached xml file, cfg and adapter data for your reference
devices_xml.txt
adapter_test.txt

Devices = devices.xml
 ServerIP = 0.0.0.0
 Port = 5000
 AllowPut = false
 AllowPutFrom = localhost
 ReconnectInterval = 1000
 WorkerThreads = 2
 BufferSize = 17
 MaxAssets = 8096
 IgnoreTimestamps = true
 SchemaVersion = 2.0
 ShdrVersion = 2.0 # Set Default on all Adapters
 JsonVerson = 2.0
 SuppressIPAddress = true
 MonitorConfigFiles = true
 ConversionRequired = false
 UpcaseDataItemValue = true
 EnableSourceDeviceModels = false
 VersionDeviceXml = false
 Pretty = true
 Adapters {
    Saw {
      RealTime = false
      Protocol = shdr
      Host = 192.168.88.105
      Port = 9800
      PreserveUUID = false
   }
}

@wsobel wsobel reopened this Apr 6, 2024
@wsobel
Copy link
Member

wsobel commented Apr 6, 2024

Checking this again with preserve uuid false.

@wsobel wsobel linked a pull request Apr 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment