Lab Guide - Apstra Freeform
Property Sets
Property sets are collections of key-value pairs that you import into blueprint catalogs to use as variables in Config Templates and IBA probes. The use of Property Sets is optional, but it provides a valuable capability that allows you to fully parameterize Config Templates to separate the static portions of the config template from the variables. Said another way, property sets allow you to enrich the Device Model used to render configuration in an arbitrary and flexible manner.
For example the configuration of NTP on all devices in the enterprise may be consistent, but with differing time sources or strata per geography. The NTP config template can be built using a variable that is different for each of these areas. In this case, you can use the property with the name "ntp".
As an example, your config-template would refer to the NTP server address with '{{ntp}}' in the place of the actual IP address.The configuration is then generated with the value from the "ntp" property.The same Config Template is imported into all blueprints, but blueprints running in the East region would have the “EAST” Property Set imported, and blueprints running in the West region would have the “WEST” Property Set imported.Property sets are by default blueprint wide or global in context.
Freeform also supports property sets that can be assigned to a specific device.This would allow for you to set up specific property sets and assign and use them only in a specified device.Property Sets are part of the Graph and values can be used in IBA probes.
Update and review Property Set information.
In this blueprint, we use one simple Property Set to demonstrate the concept of how to quickly adopt and use a Freeform Blueprint. Most of the time, there will be several Property Sets either assigned at the system level or globally. It is also important to understand that the property set is available to the programmer via the Device Context view in the UI.
Here is a simple example of how to use a property set variable in a Jinja Config Template:
routing-options {
autonomous-system {{ property_sets.data[Bond-Street]['asn'] }};
}
In this example, the Property Set is called data. To access the ASN number stored in this simple example we will use the key 'asn' to retrieve it. The open / closed double curly braces {{}} in Jinja are used to render the output to STDOUT. In our case, STDOUT will be the config file.
Here is the property set used in the current working environment.
{
"bond-street": {
"asn": 47,
"loopback": "10.0.0.2"
},
"piccadilly-circus": {
"asn": 23,
"loopback": "10.0.0.1"
},
"green-park": {
"asn": 86,
"loopback": "10.0.0.3"
},
"oxford-circus": {
"asn": 22,
"loopback": "10.0.0.0"
}
}
With this property set, you can see that the name of the station is used as the key to the dictionary below it. We have two entries in our dictionary: one containing the asn
or autonomous system number, the other contains the loopback
which is the loopback interface IP.