Attributes training

This training page describes Attributes, which are ad-hoc metadata key-value pairs that can be attached to Perforce IPLM objects. It shows how to set new attributes and, retrieve, delete, and list existing attributes.

Attributes overview

Attributes are a convenient way to assign ad hoc key/value pairs to design objects in Perforce IPLM. These values are often used to track information on IPs and other objects that can be used to support custom flows. If formatted in a specific way, Attributes will display as graphical Widgets in IPLM Web.

General information on attributes can be found on the Attributes page in the User Guide.

Attributes can be set on Libraries, IPs, IPVs, Queries, and Lines. Specific information on managing attributes on each object type can be found at the following links:

The commands used to manage attributes are of the form 'pi <object_type> attribute'.

Setting attributes

Users can assign attributes to IP/IPV objects, using the 'pi ip attribute set' command. Optionally users can define the Attributes value in a text file location defined with --file (useful for more complicated strings etc). Users may also use the standard Unix to direct STDIN to the command directly.

The example below shows how the user can set an attribute on an IPV and Library.

pi attribute set Command
> pi ip attribute set tutorial.digital_top@1.TRUNK regr_results '{"date": "Jan 1 2020", "num tests": "10", "num failed": 5, "results": "/home/digital_top/results/"}'
Successfully set Attribute 'regr_results' on IPV 'tutorial.digital_top@1.TRUNK'

> echo "None" > info.txt
> pi ip attribute set tutorial.digital_top@1.TRUNK additional_info --file info.txt
Successfully set Attribute 'additional_info' on IPV 'tutorial.digital_top@1.TRUNK'

The example below shows one way of  setting an attribute on a Library

> pi lib attribute set tutorial lib_type tsmc
Successfully set Attribute 'lib_type' on Library 'tutorial'

Getting the value of an attribute

To get the value of an attribute set on an IP, using the 'pi ip attribute get' command. The below example shows the value of an attribute applied to an IPV

Attribute Applied to an IPV
> pi ip attribute get tutorial.digital_top@1.TRUNK regr_results
{"date": "Jan 1 2020", "num tests": "10", "num failed": 5, "results": "/home/digital_top/results/"}

mdx@<server>: pi ip attribute get tutorial.digital_top@1.TRUNK additional_info
None

Listing the names of set attributes

To list all of the attributes set on an IP, use the 'pi ip attribute list' command. For Libraries use the command 'pi lib attribute list'.

If attributes have Previously been added to the design object, their names will be listed:

pi attribute list Command
> pi ip attr list tutorial.digital_top@1.TRUNK
┌──────────────┬───────┬───────────────────────────────┐
│ NAME         │ USER  │ TIME                          │
╞══════════════╪═══════╪═══════════════════════════════╡
│ Resources    │ admin │ 2020-06-19 10:15:37 -0400 EDT │
│ regr_results │ admin │ 2020-06-22 10:08:55 -0400 EDT │
└──────────────┴───────┴───────────────────────────────┘
Found 2 matching object(s).

 
> pi lib attr list tutorial
┌───────────────┬───────┬───────────────────────────────┐
│ NAME          │ USER  │ TIME                          │
╞═══════════════╪═══════╪═══════════════════════════════╡
│ Overview      │ admin │ 2020-06-19 10:15:35 -0400 EDT │
│ Project_Links │ admin │ 2020-06-19 10:15:35 -0400 EDT │
└───────────────┴───────┴───────────────────────────────┘
Found 2 matching object(s).

Delete an attribute

Users can delete an attribute from an IP using 'pi ip attribute delete'. 

You will see something similar to below when removing the attribute

pi attribute delete Command
> pi ip attribute del tutorial.digital_top@1.TRUNK regr_results
Successfully removed Attribute 'regr_results' from IPV 'tutorial.digital_top@1.TRUNK'.