diff --git a/src/ibek/entity_factory.py b/src/ibek/entity_factory.py index 02faa2a78..5d95e4f4e 100644 --- a/src/ibek/entity_factory.py +++ b/src/ibek/entity_factory.py @@ -139,7 +139,7 @@ def lookup_instance(cls, id): # add the type literal which discriminates between the different Entity classes typ = Literal[full_name] # type: ignore - args["entity_type"] = (typ, Field(description=definition.description)) + args["type"] = (typ, Field(description=definition.description)) class_name = full_name.replace(".", "_") entity_cls = create_model( @@ -187,7 +187,7 @@ def resolve_sub_entities(self, entities: List[Entity]) -> List[Entity]: # add in SubEntities if any for sub_entity in definition.sub_entities: # find the Entity Class that the SubEntity represents - entity_cls = self._entity_models[sub_entity.entity_type] + entity_cls = self._entity_models[sub_entity.type] # get the SubEntity arguments sub_args_dict = sub_entity.model_dump() # jinja render any references to parent Args in the SubEntity Args diff --git a/src/ibek/ioc.py b/src/ibek/ioc.py index 8344626d9..81186c90d 100644 --- a/src/ibek/ioc.py +++ b/src/ibek/ioc.py @@ -50,7 +50,7 @@ class Entity(BaseSettings): A baseclass for all generated Entity classes. """ - entity_type: str = Field(description="The type of this entity") + type: str = Field(description="The type of this entity") entity_enabled: bool = Field( description="enable or disable this entity instance", default=True ) diff --git a/src/ibek/ioc_factory.py b/src/ibek/ioc_factory.py index df1b30b57..7ebff476d 100644 --- a/src/ibek/ioc_factory.py +++ b/src/ibek/ioc_factory.py @@ -59,7 +59,7 @@ def make_ioc_model(self, entity_models: List[Type[Entity]]) -> Type[IOC]: """ entity_union = Union[tuple(entity_models)] # type: ignore - discriminated = Annotated[entity_union, Field(discriminator="entity_type")] # type: ignore + discriminated = Annotated[entity_union, Field(discriminator="type")] # type: ignore class NewIOC(IOC): entities: Sequence[discriminated] = Field( # type: ignore diff --git a/src/ibek/sub_entity.py b/src/ibek/sub_entity.py index c6fd41599..9d8cf23d8 100644 --- a/src/ibek/sub_entity.py +++ b/src/ibek/sub_entity.py @@ -8,7 +8,7 @@ class SubEntity(BaseModel, extra="allow"): section """ - entity_type: str = Field(description="The type of this entity") + type: str = Field(description="The type of this entity") entity_enabled: bool = Field( description="enable or disable this entity instance", default=True diff --git a/tests/samples/iocs/bad_counter.ibek.ioc.yaml b/tests/samples/iocs/bad_counter.ibek.ioc.yaml index e7a2ab679..fb6289d78 100644 --- a/tests/samples/iocs/bad_counter.ibek.ioc.yaml +++ b/tests/samples/iocs/bad_counter.ibek.ioc.yaml @@ -3,7 +3,7 @@ ioc_name: counter description: an example motion ioc for ibek testing entities: - - entity_type: epics.InterruptVectorVME + - type: epics.InterruptVectorVME name: Vec0 - - entity_type: epics.InterruptVectorVME2 + - type: epics.InterruptVectorVME2 name: Vec1 diff --git a/tests/samples/iocs/bad_counter2.ibek.ioc.yaml b/tests/samples/iocs/bad_counter2.ibek.ioc.yaml index f6f6ae188..b3e4af463 100644 --- a/tests/samples/iocs/bad_counter2.ibek.ioc.yaml +++ b/tests/samples/iocs/bad_counter2.ibek.ioc.yaml @@ -3,11 +3,11 @@ ioc_name: counter description: an example motion ioc for ibek testing entities: - - entity_type: epics.InterruptVectorVME2 + - type: epics.InterruptVectorVME2 name: Vec1 - - entity_type: epics.InterruptVectorVME2 + - type: epics.InterruptVectorVME2 name: Vec2 - - entity_type: epics.InterruptVectorVME2 + - type: epics.InterruptVectorVME2 name: Vec3 - - entity_type: epics.InterruptVectorVME2 + - type: epics.InterruptVectorVME2 name: Vec4 diff --git a/tests/samples/iocs/bad_db.ibek.ioc.yaml b/tests/samples/iocs/bad_db.ibek.ioc.yaml index 315cd8a04..9c18bcdc7 100644 --- a/tests/samples/iocs/bad_db.ibek.ioc.yaml +++ b/tests/samples/iocs/bad_db.ibek.ioc.yaml @@ -2,5 +2,5 @@ ioc_name: test-bad-db-ioc description: demo bad database definition entities: - - entity_type: object_module.RefObject + - type: object_module.RefObject name: Ref1 diff --git a/tests/samples/iocs/bad_default.ibek.ioc.yaml b/tests/samples/iocs/bad_default.ibek.ioc.yaml index c8a57187f..c1b5fc4e3 100644 --- a/tests/samples/iocs/bad_default.ibek.ioc.yaml +++ b/tests/samples/iocs/bad_default.ibek.ioc.yaml @@ -5,5 +5,5 @@ description: an example for testing missing non-default values entities: # deliberately do not specify port to test failure case - - entity_type: asyn.AsynIP + - type: asyn.AsynIP name: controllerOnePort diff --git a/tests/samples/iocs/bad_ref.ibek.ioc.yaml b/tests/samples/iocs/bad_ref.ibek.ioc.yaml index b4a4bcaf5..0860d9174 100644 --- a/tests/samples/iocs/bad_ref.ibek.ioc.yaml +++ b/tests/samples/iocs/bad_ref.ibek.ioc.yaml @@ -4,11 +4,11 @@ ioc_name: test-multiple-ioc description: demo bad object reference entities: - - entity_type: asyn.AsynIP + - type: asyn.AsynIP name: controllerOnePort port: 192.168.0.55:2002 - - entity_type: motorSim.simMotorController + - type: motorSim.simMotorController port: controllerOnePort_BAD_REF controllerName: controllerOne numAxes: 4 diff --git a/tests/samples/iocs/gauges.ibek.ioc.yaml b/tests/samples/iocs/gauges.ibek.ioc.yaml index b129ce6ee..a24c348db 100644 --- a/tests/samples/iocs/gauges.ibek.ioc.yaml +++ b/tests/samples/iocs/gauges.ibek.ioc.yaml @@ -4,31 +4,31 @@ ioc_name: "{{ ioc_yaml_file_name }}" description: Example of initialising a gauge group with defaults to gauge1 entities: - - entity_type: asyn.AsynIP + - type: asyn.AsynIP name: controllerOnePort port: 192.168.0.55:2002 - - entity_type: asyn.AsynIP + - type: asyn.AsynIP name: controllerTwoPort port: 192.168.0.55:2002 - - entity_type: gauges.Mks937bGauge + - type: gauges.Mks937bGauge port: controllerOnePort name: MyGauge1 P: "IBEK-VA-GAUGE-01:" - - entity_type: gauges.Mks937bGauge + - type: gauges.Mks937bGauge port: controllerTwoPort name: MyGauge2 P: "IBEK-VA-GAUGE-02:" # an un-referenced Gauge - - entity_type: gauges.Mks937bGauge + - type: gauges.Mks937bGauge port: controllerTwoPort name: MyGauge3 P: "IBEK-VA-GAUGE-03:" - - entity_type: gauges.GaugeGroup + - type: gauges.GaugeGroup name: MyGaugeGroup gauge1: MyGauge1 gauge2: MyGauge2 diff --git a/tests/samples/iocs/ipac-test.ibek.ioc.yaml b/tests/samples/iocs/ipac-test.ibek.ioc.yaml index 47c83b62c..3392a812f 100644 --- a/tests/samples/iocs/ipac-test.ibek.ioc.yaml +++ b/tests/samples/iocs/ipac-test.ibek.ioc.yaml @@ -5,15 +5,15 @@ ioc_name: ipac-test description: example IOC with IPAC modules entities: - - entity_type: epics.InterruptVectorVME + - type: epics.InterruptVectorVME name: Vec1 - - entity_type: epics.InterruptVectorVME + - type: epics.InterruptVectorVME name: Vec2 - - entity_type: ipac.Hy8002 + - type: ipac.Hy8002 slot: 4 interrupt_vector: Vec1 - - entity_type: ipac.Hy8002 + - type: ipac.Hy8002 slot: 5 interrupt_vector: Vec2 diff --git a/tests/samples/iocs/listarg.ibek.ioc.yaml b/tests/samples/iocs/listarg.ibek.ioc.yaml index e35bcabd9..6a7c28b85 100644 --- a/tests/samples/iocs/listarg.ibek.ioc.yaml +++ b/tests/samples/iocs/listarg.ibek.ioc.yaml @@ -3,9 +3,9 @@ ioc_name: counter description: an example motion ioc for ibek testing entities: - - entity_type: listtest.lister + - type: listtest.lister friends: ["Rimmer", "Holly", "Cat", "Kryten"] - - entity_type: listtest.lister + - type: listtest.lister friends: |- {{ ["Rimmer"] + ["tt"] | list }} diff --git a/tests/samples/iocs/motorSim.ibek.ioc.yaml b/tests/samples/iocs/motorSim.ibek.ioc.yaml index becd28d4d..7a833a03d 100644 --- a/tests/samples/iocs/motorSim.ibek.ioc.yaml +++ b/tests/samples/iocs/motorSim.ibek.ioc.yaml @@ -4,17 +4,17 @@ ioc_name: "{{ ioc_yaml_file_name }}" description: Example simulated motion IOC for Testing ibek entities: - - entity_type: asyn.AsynIP + - type: asyn.AsynIP name: controllerOnePort port: 192.168.0.55:2002 - - entity_type: motorSim.simMotorController + - type: motorSim.simMotorController port: controllerOnePort controllerName: controllerOne numAxes: 4 P: "IBEK-MO-TST-01:" - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne # Use ADDR in other fields to verify jinja templating between Args M: M{{ADDR}} @@ -23,7 +23,7 @@ entities: DESC: "Motor {{ADDR}} for ioc {{ioc_name}}" home: 500 - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne M: M{{ADDR}} ADDR: 1 @@ -31,21 +31,21 @@ entities: DESC: "Motor {{ADDR}} {% raw %} {{enclosed in escaped curly braces}} {% endraw %}" home: 500 - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne M: M{{ADDR}} ADDR: 2 # testing default DESC home: 1500 - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne M: M{{ADDR}} ADDR: 3 DESC: "Motor {{ADDR}}" home: 2500 - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne M: CS_M{{ADDR}} ADDR: 1 @@ -54,7 +54,7 @@ entities: CS_NUM: 3 is_cs: true - - entity_type: motorSim.simMotorAxis + - type: motorSim.simMotorAxis controller: controllerOne M: CS_M{{ADDR}} ADDR: 2 diff --git a/tests/samples/iocs/quadem.ibek.ioc.yaml b/tests/samples/iocs/quadem.ibek.ioc.yaml index b4b8bce02..d40034fe8 100644 --- a/tests/samples/iocs/quadem.ibek.ioc.yaml +++ b/tests/samples/iocs/quadem.ibek.ioc.yaml @@ -4,14 +4,14 @@ ioc_name: "{{ __utils__.get_env('IOC_NAME') }}" description: Example TetrAMM for BL03I entities: - - entity_type: quadEM.TetrAMM + - type: quadEM.TetrAMM PORT: XBPM1.DRV P: BL03I-EA-XBPM-01 R: ":DRV:" QSIZE: 20 IP: "172.23.103.85:10001" - - entity_type: quadEM.Plugins + - type: quadEM.Plugins DEVICE: XBPM1.DRV PORTPREFIX: XBPM1 STAT_NCHAN: 1000 diff --git a/tests/samples/iocs/technosoft.ibek.ioc.yaml b/tests/samples/iocs/technosoft.ibek.ioc.yaml index 650ba1697..651547f12 100644 --- a/tests/samples/iocs/technosoft.ibek.ioc.yaml +++ b/tests/samples/iocs/technosoft.ibek.ioc.yaml @@ -5,7 +5,7 @@ description: YAG motors shared: - &motor - entity_type: motorTML.motorAxis + type: motorTML.motorAxis controller: TML NSTEPS: 200 NMICROSTEPS: 256 @@ -25,7 +25,7 @@ shared: TIMEOUT: 0 entities: - - entity_type: motorTML.CreateController + - type: motorTML.CreateController controllerName: TML P: "SPARC:TML" TTY: /tmp # /var/tmp/ttyV0 diff --git a/tests/samples/iocs/utils.ibek.ioc.yaml b/tests/samples/iocs/utils.ibek.ioc.yaml index d52fbf014..d4eabe21c 100644 --- a/tests/samples/iocs/utils.ibek.ioc.yaml +++ b/tests/samples/iocs/utils.ibek.ioc.yaml @@ -3,5 +3,5 @@ ioc_name: counter description: an example motion ioc for ibek testing entities: - - entity_type: epics.InterruptVectorVME + - type: epics.InterruptVectorVME name: Vec0 diff --git a/tests/samples/schemas/gauges.ibek.ioc.schema.json b/tests/samples/schemas/gauges.ibek.ioc.schema.json index f17e3dde0..e9fd9499c 100644 --- a/tests/samples/schemas/gauges.ibek.ioc.schema.json +++ b/tests/samples/schemas/gauges.ibek.ioc.schema.json @@ -3,10 +3,10 @@ "asyn_AsynIP": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "asyn.AsynIP", "description": "Asyn IP Port", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -147,7 +147,7 @@ } }, "required": [ - "entity_type", + "type", "port", "name" ], @@ -183,10 +183,10 @@ "gauges_GaugeGroup": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "gauges.GaugeGroup", "description": "Group of gauges", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -220,7 +220,7 @@ } }, "required": [ - "entity_type", + "type", "name", "gauge1" ], @@ -230,10 +230,10 @@ "gauges_Mks937bGauge": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "gauges.Mks937bGauge", "description": "MKS 937b Gauge controller", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -257,7 +257,7 @@ } }, "required": [ - "entity_type", + "type", "port", "name", "P" @@ -304,7 +304,7 @@ "gauges.GaugeGroup": "#/$defs/gauges_GaugeGroup", "gauges.Mks937bGauge": "#/$defs/gauges_Mks937bGauge" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/ibek.support.schema.json b/tests/samples/schemas/ibek.support.schema.json index c96c93515..b938d8b78 100644 --- a/tests/samples/schemas/ibek.support.schema.json +++ b/tests/samples/schemas/ibek.support.schema.json @@ -625,9 +625,9 @@ "additionalProperties": true, "description": "A loosely defined class to declare the Entities\nin an ibek.support.yaml file in the 'sub_entities' property of an Entity\nsection", "properties": { - "entity_type": { + "type": { "description": "The type of this entity", - "title": "Entity Type", + "title": "Type", "type": "string" }, "entity_enabled": { @@ -638,7 +638,7 @@ } }, "required": [ - "entity_type" + "type" ], "title": "SubEntity", "type": "object" diff --git a/tests/samples/schemas/ipac.ibek.ioc.schema.json b/tests/samples/schemas/ipac.ibek.ioc.schema.json index f8fbf5029..6ef34a0f9 100644 --- a/tests/samples/schemas/ipac.ibek.ioc.schema.json +++ b/tests/samples/schemas/ipac.ibek.ioc.schema.json @@ -22,10 +22,10 @@ "epics_EpicsCaMaxArrayBytes": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.EpicsCaMaxArrayBytes", "description": "Set the maximum size in bytes for sending arrays over channel access", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -51,7 +51,7 @@ } }, "required": [ - "entity_type" + "type" ], "title": "epics_EpicsCaMaxArrayBytes", "type": "object" @@ -59,10 +59,10 @@ "epics_EpicsEnvSet": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.EpicsEnvSet", "description": "Set an environment variable in the ioc Shell", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -82,7 +82,7 @@ } }, "required": [ - "entity_type", + "type", "name", "value" ], @@ -92,10 +92,10 @@ "epics_EpicsTsMinWest": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.EpicsTsMinWest", "description": "Set the relative time zone minutes West relative to GMT (+/-720)", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -121,7 +121,7 @@ } }, "required": [ - "entity_type" + "type" ], "title": "epics_EpicsTsMinWest", "type": "object" @@ -129,10 +129,10 @@ "epics_InterruptVectorVME": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.InterruptVectorVME", "description": "Reserve a VME interrupt vector", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -169,7 +169,7 @@ } }, "required": [ - "entity_type", + "type", "name" ], "title": "epics_InterruptVectorVME", @@ -178,10 +178,10 @@ "epics_PostStartupCommand": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.PostStartupCommand", "description": "Adds an arbitrary command in the startup script after iocInit", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -197,7 +197,7 @@ } }, "required": [ - "entity_type" + "type" ], "title": "epics_PostStartupCommand", "type": "object" @@ -205,10 +205,10 @@ "epics_StartupCommand": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.StartupCommand", "description": "Adds an arbitrary command in the startup script before iocInit", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -224,7 +224,7 @@ } }, "required": [ - "entity_type" + "type" ], "title": "epics_StartupCommand", "type": "object" @@ -232,10 +232,10 @@ "epics_dbpf": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.dbpf", "description": "Set a PV value after iocInit", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -255,7 +255,7 @@ } }, "required": [ - "entity_type", + "type", "pv", "value" ], @@ -284,10 +284,10 @@ "ipac_Hy8001": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ipac.Hy8001", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -431,7 +431,7 @@ } }, "required": [ - "entity_type", + "type", "slot", "direction", "cardid" @@ -442,10 +442,10 @@ "ipac_Hy8002": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ipac.Hy8002", "description": "Configure a Hytec 8002 Carrier card", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -508,7 +508,7 @@ } }, "required": [ - "entity_type", + "type", "slot", "interrupt_vector" ], @@ -518,10 +518,10 @@ "ipac_Hy8005": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ipac.Hy8005", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -593,7 +593,7 @@ } }, "required": [ - "entity_type", + "type", "slot", "cardnum" ], @@ -603,10 +603,10 @@ "ipac_Hy8005_Channel": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ipac.Hy8005_Channel", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -719,7 +719,7 @@ } }, "required": [ - "entity_type", + "type", "parent", "ipslot", "cardnum", @@ -794,7 +794,7 @@ "ipac.Hy8005": "#/$defs/ipac_Hy8005", "ipac.Hy8005_Channel": "#/$defs/ipac_Hy8005_Channel" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/listarg.ibek.schema.json b/tests/samples/schemas/listarg.ibek.schema.json index c0523a75b..445f14a40 100644 --- a/tests/samples/schemas/listarg.ibek.schema.json +++ b/tests/samples/schemas/listarg.ibek.schema.json @@ -3,10 +3,10 @@ "listtest_lister": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "listtest.lister", "description": "The protagonist from Red Dwarf", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -38,7 +38,7 @@ } }, "required": [ - "entity_type", + "type", "friends" ], "title": "listtest_lister", @@ -64,7 +64,7 @@ "mapping": { "listtest.lister": "#/$defs/listtest_lister" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/motorSim.ibek.ioc.schema.json b/tests/samples/schemas/motorSim.ibek.ioc.schema.json index 90ece21d3..6b18b51bc 100644 --- a/tests/samples/schemas/motorSim.ibek.ioc.schema.json +++ b/tests/samples/schemas/motorSim.ibek.ioc.schema.json @@ -11,10 +11,10 @@ "asyn_AsynIP": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "asyn.AsynIP", "description": "Asyn IP Port", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -155,7 +155,7 @@ } }, "required": [ - "entity_type", + "type", "port", "name" ], @@ -191,10 +191,10 @@ "motorSim_simMotorAxis": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorSim.simMotorAxis", "description": "Creates a simulation motor axis", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -351,7 +351,7 @@ } }, "required": [ - "entity_type", + "type", "controller", "M", "ADDR" @@ -362,10 +362,10 @@ "motorSim_simMotorController": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorSim.simMotorController", "description": "Creates a simulation motion controller", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -410,7 +410,7 @@ } }, "required": [ - "entity_type", + "type", "controllerName", "P", "numAxes", @@ -458,7 +458,7 @@ "motorSim.simMotorAxis": "#/$defs/motorSim_simMotorAxis", "motorSim.simMotorController": "#/$defs/motorSim_simMotorController" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/quadem.ibek.ioc.schema.json b/tests/samples/schemas/quadem.ibek.ioc.schema.json index 404a85e08..a2bc9520f 100644 --- a/tests/samples/schemas/quadem.ibek.ioc.schema.json +++ b/tests/samples/schemas/quadem.ibek.ioc.schema.json @@ -3,10 +3,10 @@ "ADCore_NDAttrPlot": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDAttrPlot", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -176,7 +176,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -192,10 +192,10 @@ "ADCore_NDAttribute": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDAttribute", "description": "This plugin displays NDArray attributes", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -367,7 +367,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -379,10 +379,10 @@ "ADCore_NDAttributes": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDAttributes", "description": "Add an attribute to the NDAttributes file for a particular ADDriver or\n NDPlugin, and associate it with the NDAttributes file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -409,15 +409,6 @@ "title": "Attrname", "type": "string" }, - "type": { - "allOf": [ - { - "$ref": "#/$defs/type" - } - ], - "default": "EPICS_PV", - "description": "Where the data should be picked up from" - }, "dbrtype": { "allOf": [ { @@ -459,7 +450,7 @@ } }, "required": [ - "entity_type", + "type", "port", "source", "name", @@ -472,10 +463,10 @@ "ADCore_NDCircularBuff": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDCircularBuff", "description": "This plugin provides a pre and post external trigger frame capture buffer", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -657,7 +648,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -669,10 +660,10 @@ "ADCore_NDCodec": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDCodec", "description": "This plugin can compress or decompress NDArrays", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -822,7 +813,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -834,10 +825,10 @@ "ADCore_NDColorConvert": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDColorConvert", "description": "This plugin converts arrays from one colour type to another, e.g. Bayer -> RGB1", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -987,7 +978,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -999,10 +990,10 @@ "ADCore_NDFFT": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFFT", "description": "This plugin is used to calculate the FFT of a time series", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1221,7 +1212,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -1234,10 +1225,10 @@ "ADCore_NDFileHDF5": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileHDF5", "description": "This plugin can compress NDArrays to HDF5 and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1387,7 +1378,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -1399,10 +1390,10 @@ "ADCore_NDFileJPEG": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileJPEG", "description": "This plugin can compress NDArrays to JPEG and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1536,7 +1527,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -1548,10 +1539,10 @@ "ADCore_NDFileMagick": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileMagick", "description": "This plugin can compress NDArrays to a range of formats supported by\n graphics magick and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1685,7 +1676,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -1697,10 +1688,10 @@ "ADCore_NDFileNetCDF": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileNetCDF", "description": "This plugin can compress NDArrays to NetCDF and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1834,7 +1825,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "NDARRAY_PORT", @@ -1846,10 +1837,10 @@ "ADCore_NDFileNexus": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileNexus", "description": "This plugin can compress NDArrays to Nexus and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -1983,7 +1974,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -1995,10 +1986,10 @@ "ADCore_NDFileNull": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileNull", "description": "Null file plugin for deleting driver files", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -2132,7 +2123,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -2144,10 +2135,10 @@ "ADCore_NDFileTIFF": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDFileTIFF", "description": "This plugin can compress NDArrays to TIFF and write them to file", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -2281,7 +2272,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "NDARRAY_PORT", @@ -2293,10 +2284,10 @@ "ADCore_NDGather": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDGather", "description": "This plugin is used to gather NDArrays from multiple upstream plugins and merge them into a single stream", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -2447,7 +2438,7 @@ } }, "required": [ - "entity_type", + "type", "NDARRAY_PORT", "PORT", "P", @@ -2459,10 +2450,10 @@ "ADCore_NDGather8": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDGather8", "description": "This plugin is used to gather NDArrays from multiple upstream plugins and merge them into a single stream", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -2607,7 +2598,7 @@ } }, "required": [ - "entity_type", + "type", "NDARRAY_PORT", "PORT", "P", @@ -2621,10 +2612,10 @@ "ADCore_NDOverlay": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDOverlay", "description": "This plugin writes overlays on the array, like cursors and boxes", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -2829,7 +2820,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -2852,10 +2843,10 @@ "ADCore_NDPosPlugin": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDPosPlugin", "description": "This plugin attaches position information to NDArrays", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3021,7 +3012,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3033,10 +3024,10 @@ "ADCore_NDProcess": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDProcess", "description": "This plugin does image processing like flat field correction, background\n subtraction, and recursive filtering", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3170,7 +3161,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3182,10 +3173,10 @@ "ADCore_NDPvaPlugin": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDPvaPlugin", "description": "This plugin makes NDArrays available through PVAccess", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3356,7 +3347,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3369,10 +3360,10 @@ "ADCore_NDROI": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDROI", "description": "This plugin selects a region of interest and optionally scales it to\n fit in a particular data type", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3522,7 +3513,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3534,10 +3525,10 @@ "ADCore_NDROIStat": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDROIStat", "description": "This plugin calculates statistics of ROIs", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3719,7 +3710,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3731,10 +3722,10 @@ "ADCore_NDScatter": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDScatter", "description": "This plugin is used to distribute processing of NDArrays to multiple downstream plugins", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -3884,7 +3875,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -3896,10 +3887,10 @@ "ADCore_NDStats": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDStats", "description": "This plugin calculates statistics like X and Y profile, centroid, and plots a histogram of binned pixels", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -4116,7 +4107,7 @@ } }, "required": [ - "entity_type", + "type", "PORT", "NDARRAY_PORT", "HIST_SIZE", @@ -4131,10 +4122,10 @@ "ADCore_NDStdArrays": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDStdArrays", "description": "This plugin provides a waveform record that can display the NDArrays\n produced by its NDARRAY_PORT", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -4312,7 +4303,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -4327,10 +4318,10 @@ "ADCore_NDTimeSeries": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDTimeSeries", "description": "This plugin creates time series arrays from callback data", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -4538,7 +4529,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -4552,10 +4543,10 @@ "ADCore_NDTransform": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore.NDTransform", "description": "This plugin selects a region of interest and optionally scales it to fit in a particular data type", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -4705,7 +4696,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -4717,10 +4708,10 @@ "ADCore__NDCircularBuff": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "ADCore._NDCircularBuff", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -4855,7 +4846,7 @@ } }, "required": [ - "entity_type", + "type", "P", "R", "PORT", @@ -4922,10 +4913,10 @@ "quadEM_Plugins": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "quadEM.Plugins", "description": "Instantiates\n 12 NDStats plugins for Current, Sum, Diff and Pos Channels\n 12 NDTimeSeries plugins\n 12 NDArray plugins", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -5006,7 +4997,7 @@ } }, "required": [ - "entity_type", + "type", "DEVICE", "PORTPREFIX", "STAT_NCHAN", @@ -5018,10 +5009,10 @@ "quadEM_TetrAMM": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "quadEM.TetrAMM", "description": "TODO:ADD DESCRIPTION", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -5083,7 +5074,7 @@ } }, "required": [ - "entity_type", + "type", "PORT", "P", "R", @@ -5091,14 +5082,6 @@ ], "title": "quadEM_TetrAMM", "type": "object" - }, - "type": { - "enum": [ - "EPICS_PV", - "PARAM" - ], - "title": "type", - "type": "string" } }, "additionalProperties": false, @@ -5149,7 +5132,7 @@ "quadEM.Plugins": "#/$defs/quadEM_Plugins", "quadEM.TetrAMM": "#/$defs/quadEM_TetrAMM" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/single.ibek.ioc.schema.json b/tests/samples/schemas/single.ibek.ioc.schema.json index 05b18d4ba..3ce11ba73 100644 --- a/tests/samples/schemas/single.ibek.ioc.schema.json +++ b/tests/samples/schemas/single.ibek.ioc.schema.json @@ -11,10 +11,10 @@ "motorSim_simMotorAxis": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorSim.simMotorAxis", "description": "Creates a simulation motor axis", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -171,7 +171,7 @@ } }, "required": [ - "entity_type", + "type", "controller", "M", "ADDR" @@ -182,10 +182,10 @@ "motorSim_simMotorController": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorSim.simMotorController", "description": "Creates a simulation motion controller", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -230,7 +230,7 @@ } }, "required": [ - "entity_type", + "type", "controllerName", "P", "numAxes", @@ -260,7 +260,7 @@ "motorSim.simMotorAxis": "#/$defs/motorSim_simMotorAxis", "motorSim.simMotorController": "#/$defs/motorSim_simMotorController" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/technosoft.ibek.ioc.schema.json b/tests/samples/schemas/technosoft.ibek.ioc.schema.json index 6fe7dafbd..777d34a9a 100644 --- a/tests/samples/schemas/technosoft.ibek.ioc.schema.json +++ b/tests/samples/schemas/technosoft.ibek.ioc.schema.json @@ -11,10 +11,10 @@ "motorTML_CreateController": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorTML.CreateController", "description": "Creates a Technosoft motion controller connected to a serial line", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -82,7 +82,7 @@ } }, "required": [ - "entity_type", + "type", "controllerName", "P", "TTY", @@ -94,10 +94,10 @@ "motorTML_motorAxis": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "motorTML.motorAxis", "description": "Creates a motor axis", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -423,7 +423,7 @@ } }, "required": [ - "entity_type", + "type", "controller", "axid" ], @@ -451,7 +451,7 @@ "motorTML.CreateController": "#/$defs/motorTML_CreateController", "motorTML.motorAxis": "#/$defs/motorTML_motorAxis" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/schemas/utils.ibek.ioc.schema.json b/tests/samples/schemas/utils.ibek.ioc.schema.json index 3c1a26ea1..82eb9ecdd 100644 --- a/tests/samples/schemas/utils.ibek.ioc.schema.json +++ b/tests/samples/schemas/utils.ibek.ioc.schema.json @@ -3,10 +3,10 @@ "epics_InterruptVectorVME": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.InterruptVectorVME", "description": "Reserve an interrupt vector for use with VME hardware.\n", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -33,7 +33,7 @@ } }, "required": [ - "entity_type", + "type", "name" ], "title": "epics_InterruptVectorVME", @@ -42,10 +42,10 @@ "epics_InterruptVectorVME2": { "additionalProperties": false, "properties": { - "entity_type": { + "type": { "const": "epics.InterruptVectorVME2", "description": "naughty second use of same counter", - "title": "Entity Type" + "title": "Type" }, "entity_enabled": { "default": true, @@ -60,7 +60,7 @@ } }, "required": [ - "entity_type", + "type", "name" ], "title": "epics_InterruptVectorVME2", @@ -87,7 +87,7 @@ "epics.InterruptVectorVME": "#/$defs/epics_InterruptVectorVME", "epics.InterruptVectorVME2": "#/$defs/epics_InterruptVectorVME2" }, - "propertyName": "entity_type" + "propertyName": "type" }, "oneOf": [ { diff --git a/tests/samples/support/ADCore.ibek.support.yaml b/tests/samples/support/ADCore.ibek.support.yaml index e03983af6..feb1523be 100644 --- a/tests/samples/support/ADCore.ibek.support.yaml +++ b/tests/samples/support/ADCore.ibek.support.yaml @@ -1977,7 +1977,7 @@ defs: NDStatsConfigure("{{PORT}}", {{QUEUE}}, {{BLOCK}}, "{{NDARRAY_PORT}}", {{NDARRAY_ADDR}}, 0, 0, 0, 0, {{MAX_THREADS}}) sub_entities: - - { entity_type: ADCore.NDTimeSeries, P: "{{P}}", R: "{{R}}TS:", PORT: "{{PORT}}_TS", NDARRAY_PORT: "{{PORT}}", NAME: "{{PORT}}_TS", NCHANS: "{{NCHANS}}", TIMEOUT: "{{TIMEOUT}}", ADDR: 0, NDARRAY_ADDR: 1, ENABLED: "{{ENABLED}}", QUEUE: "{{QUEUE}}", BLOCK: "{{BLOCK}}", NSIGNALS: 23 } + - { type: ADCore.NDTimeSeries, P: "{{P}}", R: "{{R}}TS:", PORT: "{{PORT}}_TS", NDARRAY_PORT: "{{PORT}}", NAME: "{{PORT}}_TS", NCHANS: "{{NCHANS}}", TIMEOUT: "{{TIMEOUT}}", ADDR: 0, NDARRAY_ADDR: 1, ENABLED: "{{ENABLED}}", QUEUE: "{{QUEUE}}", BLOCK: "{{BLOCK}}", NSIGNALS: 23 } pvi: yaml_path: NDPluginStats.pvi.device.yaml diff --git a/tests/samples/support/quadem.ibek.support.yaml b/tests/samples/support/quadem.ibek.support.yaml index 9ff4d37db..a1dd3d120 100644 --- a/tests/samples/support/quadem.ibek.support.yaml +++ b/tests/samples/support/quadem.ibek.support.yaml @@ -110,8 +110,8 @@ defs: # shared: - - &stats { entity_type: ADCore.NDStats, P: "{{DEVICE.P}}", NCHANS: "{{STAT_NCHAN}}", XSIZE: "{{STAT_XSIZE}}", YSIZE: 0, HIST_SIZE: "{{HIST_SIZE}}", NDARRAY_PORT: "{{DEVICE}}", ENABLED: 1 } - - &arrays { entity_type: ADCore.NDStdArrays, P: "{{DEVICE.P}}", NDARRAY_PORT: "{{DEVICE}}", ENABLED: 1, TYPE: "Float64", FTVL: "DOUBLE", NELEMENTS: "{{STAT_XSIZE}}" } + - &stats { type: ADCore.NDStats, P: "{{DEVICE.P}}", NCHANS: "{{STAT_NCHAN}}", XSIZE: "{{STAT_XSIZE}}", YSIZE: 0, HIST_SIZE: "{{HIST_SIZE}}", NDARRAY_PORT: "{{DEVICE}}", ENABLED: 1 } + - &arrays { type: ADCore.NDStdArrays, P: "{{DEVICE.P}}", NDARRAY_PORT: "{{DEVICE}}", ENABLED: 1, TYPE: "Float64", FTVL: "DOUBLE", NELEMENTS: "{{STAT_XSIZE}}" } sub_entities: - { <<: *stats, PORT: "{{PORTPREFIX}}.STATS.I1", R: Cur1 } diff --git a/tests/test_render.py b/tests/test_render.py index 38c17ea6b..97c6ecd5b 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -9,23 +9,23 @@ from ibek.render_db import RenderDb -def find_entity_class(entity_classes, entity_type): +def find_entity_class(entity_classes, type): for entity_class in entity_classes: - literal = Literal[entity_type] # type: ignore - if entity_class.model_fields["entity_type"].annotation == literal: + literal = Literal[type] # type: ignore + if entity_class.model_fields["type"].annotation == literal: return entity_class else: - raise ValueError(f"{entity_type} not found in entity_classes") + raise ValueError(f"{type} not found in entity_classes") def test_pre_init_script(asyn_classes): definition = find_entity_class(asyn_classes, "asyn.AsynIP") - # NOTE: because we have switched from type to entity_type in the + # NOTE: because we have switched from type to type in the # we need to pass it to the constructor # Not ideal - but does not affect deserialization of these types - port1 = definition(name="asyn1", port="10.0.1.1", entity_type="asyn.AsynIP") - port2 = definition(name="asyn2", port="10.0.1.2", entity_type="asyn.AsynIP") + port1 = definition(name="asyn1", port="10.0.1.1", type="asyn.AsynIP") + port2 = definition(name="asyn2", port="10.0.1.2", type="asyn.AsynIP") render = Render() script_txt = render.render_script(port1, port1.__definition__.pre_init) @@ -49,13 +49,13 @@ def test_obj_ref_script(motor_classes): asyn_def = find_entity_class(motor_classes, "asyn.AsynIP") motor_def = find_entity_class(motor_classes, "motorSim.simMotorController") - asyn_def(name="asyn1", port="10.0.1.1", entity_type="asyn.AsynIP") + asyn_def(name="asyn1", port="10.0.1.1", type="asyn.AsynIP") motor_obj = motor_def( port="asyn1", controllerName="ctrl1", P="IBEK-MO-01:", numAxes=4, - entity_type="motorSim.simMotorController", + type="motorSim.simMotorController", ) render = Render() @@ -73,7 +73,7 @@ def test_database_render(motor_classes): sim_def = find_entity_class(motor_classes, "motorSim.simMotorController") motor_def = find_entity_class(motor_classes, "motorSim.simMotorAxis") - asyn1 = asyn_def(name="asyn1", port="10.0.1.1", entity_type="asyn.AsynIP") + asyn1 = asyn_def(name="asyn1", port="10.0.1.1", type="asyn.AsynIP") # TODO removing DESC below causes a failure in jinja templating # The default DESC field contains jinja escaping and this fails for some # reason. But it works fine in the test test_build_runtime_motorSim which @@ -84,17 +84,15 @@ def test_database_render(motor_classes): P="IBEK-MO-01:", numAxes=4, DESC="test", - entity_type="motorSim.simMotorController", - ) - motor1 = motor_def( - controller="ctrl1", M="M1", ADDR=1, entity_type="motorSim.simMotorAxis" + type="motorSim.simMotorController", ) + motor1 = motor_def(controller="ctrl1", M="M1", ADDR=1, type="motorSim.simMotorAxis") motor2 = motor_def( controller="ctrl1", M="M2", ADDR=2, is_cs=True, - entity_type="motorSim.simMotorAxis", + type="motorSim.simMotorAxis", ) # make a dummy IOC with two entities as database render works against @@ -123,7 +121,7 @@ def test_database_render(motor_classes): def test_environment_variables(motor_classes): asyn_def = find_entity_class(motor_classes, "asyn.AsynIP") - asyn_obj = asyn_def(name="asyn1", port="10.0.1.1", entity_type="asyn.AsynIP") + asyn_obj = asyn_def(name="asyn1", port="10.0.1.1", type="asyn.AsynIP") render = Render() env_text = render.render_environment_variables(asyn_obj) diff --git a/tests/test_unit.py b/tests/test_unit.py index c2559acb9..9575c2304 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -45,15 +45,15 @@ def test_object_references(entity_factory): ioc_name="", description="", entities=[ - dict(entity_type="mymodule.port", name="PORT"), - dict(entity_type="mymodule.device", port="PORT"), + dict(type="mymodule.port", name="PORT"), + dict(type="mymodule.device", port="PORT"), ], ) ioc = ioc_model(**d) port, device = ioc.entities # TODO try to get rid of the need for '' - assert port.entity_type == "mymodule.port" - assert device.entity_type == "mymodule.device" + assert port.type == "mymodule.port" + assert device.type == "mymodule.device" assert device.port is port assert id_to_entity == {"PORT": port}