Customize scripted extension points

  • Release version: Australia
  • Updated December 19, 2024
  • 1 minute to read
  • Customize how license expiration dates for Fortinet devices are stored on CIs by implementing scripted extension points.

    Before you begin

    Service Graph Connector for Fortinet must be installed. For instructions, see Configure a Fortinet SD-WAN Service Graph Connector.

    Role required: tsom_visibility_admin

    About this task

    By default, Fortinet SGC stores license expiration dates as separate CI key-value pairs for each device, using the naming convention license_expiration_date_SERVICE_CODE. You can customize this behavior using scripted extension points to implement alternative storage logic, such as storing only the earliest expiration date across all devices.

    Procedure

    1. Navigate to All > System Scripted Extension Points > Scripted Extension Points.
    2. Search for Fortinet in the Extension Points search field.
    3. From the API Name search results list, select sn_gnc_fortinet.FortinetCustomizedContractParsing.
    4. Select the Create implementation related link.
    5. In the Script field, modify the buildLicenseAttributes function to return an array of {key, value} objects containing the CI key-value pairs you want to store.
      For example, to store only the earliest expiration date across all devices instead of one key-value pair per device, the script would need to loop through contractItems, find the minimum date value, and return it as a single object: { key: "license_expiration_date", value: "<earliest_date>" }.Contract items parsing implementation interface
    6. Run your implementation before the default by setting the Order field to a value less than 100.
      The default implementation has an order of 100; implementations with a lower order number execute first and take precedence.
    7. Select Update.

    Result

    Your custom implementation is saved and active. The next time Fortinet SGCSGC discovers devices, your script runs first and stores the license key-value pairs you defined on the relevant CIs, overriding the default per-device key-value pairs behavior.