Forum Discussion

Antony_Hawkins's avatar
3 years ago

Property Unifier PropertySource

Problem: Over time, various PropertySources have created properties of various names for similar functions. These may be core PropertySources, ones you've created, or ones you've imported from the LM Community, but collectively you may have multiple different property names for e.g. serial numbers, soft/firm/hardware versions, etc, from different technologies. When this comes to inventory reporting this can make it tricky to build a concise report of all serial numbers, for example.

Now, you could re-write all the various PropertySources to give consistent outputs, but that's an amount of work and results in modules that deviate from the core, or imported community, versions, and could break any automations and integrations that already rely on those specific properties.

Here's something a lot easier...

This PropertySource allows you to define which existing properties should be considered, to output new, unified, properties.

This is mainly a template - you clearly have to define which properties are considered to populate the unified property, and what that name should be. You do this within a map in the script, e.g.:

def propsMap = [
					'unified.firmware' : 
					[
						'auto.fortinet.fortigate.firmware.version',
						'auto.firmware_version',
						'auto.entphysical.firmwarerev'
					],
					'unified.software' : 
					[
						'auto.jnx.master.software.rev',
						'auto.cisco.expressway.software_version',
						'auto.entphysical.softwarerev'
					],
				];

 

For each applied resource, the contributing properties are checked and the value of the first one that exists / has a value, will be used to populate the desired unified property. A further property (per unified property) will indicate which property fed the new, unified, property.

E.g. that particular above map might result in outputs on the device like:

auto.unified.firmware=1.0(11)2
auto.unified.firmware.origin=auto.firmware_version
auto.unified.software=4.2(7f)
auto.unified.software.origin=auto.entphysical.softwarerev

 

v1.0, Published with lmLocator: FTJL34

No RepliesBe the first to reply