This chapter describes FNS attributes and how to administer them.
Attributes can be applied to named objects. Attributes are optional. A named object can have no attributes, one attribute, or multiple attributes.
Each attribute has a unique attribute identifier, an attribute syntax, and a set of zero or more distinct attribute values.
XFN defines the base attribute interface for examining and modifying the values of attributes associated with existing named objects. These objects can be contexts or any other type of object. Associated with a context are syntax attributes that describe how the context parses compound names.
The extended attribute interface contains operations that search for specific attributes and that create objects and their associated attributes.
Search for attributes with the fnsearch command.
The syntax of the fnsearch command is
fnsearch [-ALlv] [-n max] [-s scope] name [-a ident]... [-O|-U] filter_expr [filter_arg] |
Option |
Description |
---|---|
-n max |
Display only max number of objects. |
-s scope |
Set the scope of the search |
-a ident |
Display only those attributes that match ident. |
name |
Composite name |
filter_expr |
Boolean, logical, grouping, relational, and comparison operators (see Table 27-2) |
filter_arg |
Arguments for filter expressions (see Table 27-2] |
-A |
Consult only the authoritative source. |
-L |
Follow XFN links. |
-l |
Display the object references for the matching objects. |
-v |
Verbose. Display detailed object references for the matching objects. |
-O |
Use an OSI OID as the identifier |
-U |
Use a DCE UUID as the identifier |
With the fnsearch command, you can search for objects that are associated with the attributes you choose.
For example, to find all the objects that are associated with the attribute for_sale in orgunit/sales/site/, you would enter the following command:
% fnsearch orgunit/sales/site/ for_sale |
You can also use all the following in filter expressions in your search patterns.
Table 27-2 fnsearch Filter Expression Operators
Filter Expression Operator |
Symbols and Forms |
---|---|
Logical operators |
or, and, not |
Parentheses for grouping |
( ) |
Relational operators: Compare an attribute to a supplied value |
== True if at least one attribute value is equal to the supplied value. != True if none of the attribute values are equal to the supplied value. < True if at least one attribute value is less than the supplied value. <= True if at least one attribute value is less than or equal to the supplied value. > True if at least one attribute value is greater than the supplied value. >= True if at least one attribute value is greater than or equal to the supplied value. ~= True if at least one attribute value matches the supplied value according to some context-specific approximate matching criterion. This criterion must subsume strict equality. |
Example: |
% fnsearch name "not (make == 'olds' and year == 1983)" |
Substitution tokens: Helpful when writing shell scripts; allow the use of OSI OIDs and DCE UUIDs when used with the -O and -U options |
%a for attribute %s for string %i for identifier %v for attribute value (only fn_attr_syntax_ascii is currently supported) |
Example: |
The following three examples are equivalent. % fnsearch name "color == 'red'" % fnsearch name "%a == 'red'" color % fnsearch name "%a == %s" color red |
Wild card strings |
*, *string, string*, str*ing, %s* |
Extended operators |
'name'(wildcarded_string), 'reftype'(identifier), 'addrtype' (identifier) |
Example: |
Search for objects with names starting with "Bill" and IQ attributes over 80. % fnsearch name "'name'('bill'*) and IQ > 80" |
See the fnsearch man page for detailed information about creating search patterns.
The fnattr command lets you update and examine attributes associated with FNS named objects. You can perform four attribute operations with the fnattr command:
fnattr -a [-s] name [-O|-U] identifier values |
fnattr -d name [[-O|-U] identifier [values]] |
fnattr -m name [-O|-U identifier oldvalue newvalue |
fnattr -l name [[-O|-U] identifier |
Option |
Description |
---|---|
name |
Composite name. |
identifier |
Attribute name. |
values |
One or more attributes values |
oldvalue |
The attribute value that you want to change. |
newvalue |
The new attribute value. |
-aa |
Add (create) a new attribute |
-d |
Delete an attribute |
-m |
Change (modify) an attribute |
-l |
List attribute values |
-s |
Add in "supersede" mode. Removes any existing values for the identifier attribute and creates new attribute values. |
-l |
List attributes and values. |
-O |
Use an OSI OID as the identifier |
-U |
Use a DCE UUID as the identifier |
In each of these cases, the identifier format is FN_ID_STRING, unless the option -O or -U is used.
The -a option is for adding an attribute or adding a value to an attribute. Specify the composite name the attribute is associated with, the attribute identifier, and the values to add.
fnattr -a [-s] name [-O | -U] identifier value1 [value2+] |
The following example adds the attribute identifier model and the value hplaser to thisorgunit/service/printer.
# fnattr -a thisorgunit/service/printer model hplaser |
The -s option means "add in supersede" mode. If an attribute with the specified identifier already exists, -s removes all of its values and replaces them with the values added. If this option is omitted, the resulting values for the specified attribute includes the existing values and the new values added.
# fnattr -as thisorgunit/service/printer model hplaser |
The example above will first remove any existing values associated with model and add hplaser as the value.
To delete an attribute associated with an FNS named object, use the -d option.
fnattr -d name [[-O | -U] identifier value1 [value2+]]] |
You can control what to delete:
Name only. If only the composite name is specified and no attribute identifier is specified, all the attributes associated with the named object are removed.
Name and identifier only. If only the composite name and an attribute identifier is specified, but no attribute values are specified, the entire attribute identified by identifier is removed.
Name, identifier, and values. If the composite name, an attribute identifier, and one or more attribute values are specified, then only those values are removed from the attribute. (Removal of the last remaining value of an attribute is the same as removing the attribute itself.)
For example, to delete all the attributes associated with thisorgunit/service/printer.
# fnattr -d thisorgunit/service/printer |
The -l option is for listing attributes and their values.
fnattr -l name [[-O | -U] identifier] |
For example to list the values of the model attribute of thisorgunit/service/printer.
# fnattr -l thisorgunit/service/printer model laser postscript |
If an identifier is not specified, all the attributes associated with the named object are displayed.
The -m option lets you modify an attribute value.
fnattr -m name [-O | -U] identifier old_value new_value |
For example, to replace the value postscript with laser you would enter:
# fnattr -m thisorgunit/service/printer model postscript laser |
Only the specified values are affected. Other attributes and values associated with the name are not affected.
The -O option assumes the format of the attribute identifier is an ASN.1 dot-separated integer string list (FN_ID_ISO_OID_STRING).
The -U option assumes the format of the attribute identifier is a DCE UUID string form (FN_ID_DCE_UUID).