Skip to content

Add defined-tags support for nested Logix UDTs#122

Open
lazydreamy wants to merge 1 commit into
pjkundert:masterfrom
lazydreamy:pr/defined-tags-nested-udt
Open

Add defined-tags support for nested Logix UDTs#122
lazydreamy wants to merge 1 commit into
pjkundert:masterfrom
lazydreamy:pr/defined-tags-nested-udt

Conversation

@lazydreamy

Copy link
Copy Markdown

Summary

Add a generic defined-tags JSON loader for EtherNet/IP Logix tag simulation, including nested UDT member access.

This lets the simulator expose structured tags from either a JSON file path or inline JSON text passed with --defined-tags. The implementation is not tied to a customer- or project-specific schema.

Changes

  • Add server.enip.defined_tags for loading tag and UDT definitions.
  • Add --defined-tags CLI support in server.enip.main.
  • Register loaded tags and UDT templates in server.enip.device.
  • Resolve symbolic paths by the longest defined tag prefix, allowing nested member paths under a structured tag.
  • Support atomic tags, arrays, nested UDTs, BOOL bit fields, explicit CIP type codes, and file or inline JSON input.
  • Add focused tests for schema loading and nested path resolution.

Testing

  • py -2.7 -m pytest server/enip/defined_tags_test.py
  • python -m pytest server/enip/defined_tags_test.py
  • py -2.7 -m pytest server/enip/parser_test.py server/enip/defined_tags_test.py server/enip/udt_test.py
  • python -m pytest server/enip/parser_test.py server/enip/defined_tags_test.py server/enip/udt_test.py

Note: the full focused ENIP test command also depends on the separate logging-handler test fix when run in Python 2 environments where pytest has not installed a root logger handler before test collection.

Introduce a generic --defined-tags loader that accepts either a JSON file path or inline JSON text and registers controller tags, nested UDT members, and template metadata against a shared backing buffer.

Expose Symbol Object and Template Object responses so clients can enumerate controller tags and expand UDT definitions through @tags and @udt/<templateId> style requests.

Prefer longest symbolic tag matches during resolution so direct nested member access, including BOOL leaves and atomic arrays, works alongside root STRUCT reads and writes.

Support contribution-ready schema inputs by accepting explicit CIP typeCode values, inferring atomic and template metadata when possible, and honoring explicit BOOL bit positions while retaining the compact JSON shorthand.

Add focused tests for tag listing, UDT payload generation, shared-buffer nested writes, explicit typeCode schemas, UTF-8 JSON loading, inline JSON loading, and symbol/template object responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant