Miscellaneous declarations

This section contains declarations that do not fit into one of the other categories.

Use the index under Current Page on the left to locate specific examples.

1: Using PATCH to add a new Application to a Tenant

This example uses the same declaration as in UDP Example 1, but we use the PATCH method to add an new Application to the Sample_non_http_01 tenant.

This PATCH creates the following objects on the BIG-IP:

  • A new Application named NewApp.
  • An HTTP service (virtual server) named serviceMain.
  • A pool named web_poolnew with two servers monitored by the default http health monitor.

If necessary, review the declaration in Example 11 (or first use GET https://<BIG-IP>/mgmt/shared/appsvcs/declare/Sample_misc_11).

Then use PATCH https://<BIG-IP>/mgmt/shared/appsvcs/declare with the following body (because this is a new object, we include the new name in the path):

[
  {
    "op": "add",
    "path": "/Sample_non_http_01/NewAPP",
    "value": {
      "class": "Application",
      "template": "http",
      "serviceMain": {
        "class": "Service_HTTP",
        "virtualAddresses": [
          "10.0.1.10"
        ],
        "pool": "web_poolnew"
      },
      "web_poolnew": {
        "class": "Pool",
        "monitors": [
          "http"
        ],
        "members": [{
          "servicePort": 80,
          "serverAddresses": [
            "192.0.1.10",
            "192.0.1.11"
          ]
        }]
      }
    }
  }
]

After submitting this PATCH, the system returns the following (new application highlighted in yellow):

{
  "results": [
    {
      "message": "success",
      "lineCount": 20,
      "code": 200,
      "host": "localhost",
      "tenant": "Sample_non_http_01",
      "runTime": 1330
    }
  ],
  "declaration": {
    "Sample_non_http_01": {
      "class": "Tenant",
      "DNS_Service": {
        "class": "Application",
        "template": "udp",
        "serviceMain": {
          "class": "Service_UDP",
          "virtualPort": 53,
          "virtualAddresses": [
            "10.1.20.121"
          ],
          "pool": "Pool1"
        },
        "Pool1": {
          "class": "Pool",
          "monitors": [
            "icmp"
          ],
          "members": [
            {
              "servicePort": 53,
              "serverAddresses": [
                "10.1.10.100"
              ]
            },
            {
              "servicePort": 53,
              "serverAddresses": [
                "10.1.10.101"
              ]
            }
          ]
        }
      },
      "NewAPP": {
        "class": "Application",
        "template": "http",
        "serviceMain": {
          "class": "Service_HTTP",
          "virtualAddresses": [
            "10.0.1.10"
          ],
          "pool": "web_poolnew"
        },
        "web_poolnew": {
          "class": "Pool",
          "monitors": [
            "http"
          ],
          "members": [
            {
              "servicePort": 80,
              "serverAddresses": [
                "192.0.1.10",
                "192.0.1.11"
              ]
            }
          ]
        }
      }
    }
  },
  "class": "ADC",
  "schemaVersion": "3.0.0",
  "id": "UDP_DNS_Sample",
  "label": "UDP_DNS_Sample",
  "remark": "Sample of a UDP DNS Load Balancer Service",
  "controls": {
    "archiveTimestamp": "2018-06-04T21:54:18.255Z"
  }
}

Back to top

2: Using the Service_Generic class

This simple example shows how you can use the new Service_Generic class. This class allows the BIG-IP to accept any L4 protocols without requiring a fastl4 profile. For usage options, see https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/3/refguide/schema-reference.html#service-generic

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_misc_02.
  • A Generic service named generic_virtual on port 8080 (note that because this declaration uses the generic template, the service does not have to be named serviceMain).
{
    "class": "ADC",
    "schemaVersion": "3.5.0",
    "id": "Service_Generic",
    "Sample_misc_07": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "template": "generic",
            "generic_virtual": {
                "class":"Service_Generic",
                "virtualAddresses": [
                    "192.0.2.140"
                ],
                "virtualPort": 8080
            }
        }
    }
}

Back to top

3: Using an Analytics profile in a declaration

This example shows how you can use the Application Visibility and Reporting (AVR, or Analytics) module in a declaration as an analytics profile. The Analytics profile is a set of definitions that determines the circumstances under which the system gathers, logs, notifies, and graphically displays information regarding traffic to an application. For detailed information on AVR and the Analytics profile, see the BIG-IP Analytics: Implementations (pdf) guide. Also see the Schema Reference for information and usage options for using these features in your AS3 declarations.

Important notes for using an Analytics profile:

  • You must have AVR provisioned on your BIG-IP system.
  • You cannot be using a BIG-IP version between 13.1 and 13.1.0.6 to use the Analytics profile. There are certain properties that currently do not work on these versions.
  • The notificationBySnmp property set to true requires configuration of SNMP. AS3 does not support configuration of SNMP.
  • The notificationByEmail property set to true requires the configuration of SMTP. In addition a HTTP Analytics profile inherits this property from the base /Common/analytics profile. AS3 does not support configuration of SMTP or modification of the base /Common/analytics profile.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_misc_03.
  • An HTTP service (virtual server) named serviceHttp.
  • An analytics profile for collecting statistics. See the schema reference and documentation for details.
{
    "class": "ADC",
    "schemaVersion": "3.6.0",
    "id": "SAMPLE_ANALYTICS_PROFILE",
    "remark": "Sample analytics profile",
    "Sample_misc_03": {
      "class": "Tenant",
      "Sample_Analytics_Profile": {
        "class": "Application",
        "template": "generic",
        "apTest": {
          "class": "Analytics_Profile",
          "collectedStatsInternalLogging": true,
          "collectedStatsExternalLogging": true,
          "capturedTrafficInternalLogging": true,
          "capturedTrafficExternalLogging": true,
          "externalLoggingPublisher": {"bigip": "/Common/default-ipsec-log-publisher"},
          "notificationBySyslog": true,
          "notificationBySnmp": false,
          "notificationByEmail": true,
          "notificationEmailAddresses": [
            "aaaa@aa.a",
            "bbbb@bb.b",
            "cccc@cc.c"
          ],
          "publishIruleStatistics": true,
          "collectMaxTpsAndThroughput": true,
          "collectPageLoadTime": true,
          "collectClientSideStatistics": true,
          "collectUserSession": true,
          "collectUrl": true,
          "urlsForStatCollection": [
            "a.f5test/a.htm",
            "b.f5test/b.htm",
            "c.f5test/c.htm"
          ],
          "collectGeo": true,
          "countriesForStatCollection": [
            "Afghanistan",
            "Bahamas",
            "Cambodia",
            "Denmark",
            "Ecuador",
            "Falkland Islands (Malvinas)"
          ],
          "collectIp": true,
          "collectSubnet": true,
          "subnetsForStatCollection": [
            "198.19.192.0/24",
            "198.19.224.0/24"
          ],
          "collectResponseCode": true,
          "collectUserAgent": true,
          "collectMethod": true,
          "collectOsAndBrowser": true,
          "sessionCookieSecurity": "always-secure",
          "sessionTimeoutMinutes": 30
        },
        "serviceHttp": {
          "class": "Service_HTTP",
          "virtualAddresses": [
              "192.0.2.240"
          ],
          "virtualPort": 8080,
          "profileAnalytics": { "use": "apTest" }
        }
      }
    }
  }
  

Back to top

4: Using an external monitor in a declaration

This example shows how you can create an external monitor in a declaration. An external monitor allows you to use a custom script for monitoring. In this example, we reference a script located in an external location. You could also reference a script file already present on the BIG-IP.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_misc_04.
  • A pool named externalMonitorPool.
  • An external monitor named mNewExternalMonitorFile, that uses a script hosted in an external location.
{
  "class": "ADC",
  "schemaVersion": "3.6.0",
  "id": "MONITOR_EXTERNAL",
  "remark": "external monitor",
  "Sample_misc_04": {
    "class": "Tenant",
    "Monitors": {
      "class": "Application",
      "label": "simple external monitor",
      "template": "generic",
      "mNewExternalMonitorFile": {
        "class": "Monitor",
        "monitorType": "external",
        "interval": 5,
        "upInterval": 0,
        "timeUntilUp": 0,
        "timeout": 16,
        "expand": false,
        "script": {
          "url": "https://example.com/monitor.sh"
        }
      },
      "monitorExternal_pool": {
        "class": "Pool",
        "members": [
          {
            "servicePort": 443,
            "serverAddresses": [
              "192.0.2.19"
            ],
            "minimumMonitors": 1,
            "monitors": [
              { "use": "mNewExternalMonitorFile" }
            ]
          }
        ]
      }
    }
  }
}

Back to top

5: Using Metadata in a declaration

This example shows how you can add metadata to a service (virtual server) in a declaration. This can be useful for storing information about the application which could be leveraged by other tools for tasks such as validation or auditing.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_misc_05.
  • A generic virtual service named testItem with a metadata entry of example.
{
    "class": "ADC",
    "schemaVersion": "3.7.0",
    "id": "Service_Generic",
    "Sample_misc_05": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "template": "generic",
            "testItem": {
                "class": "Service_Generic",
                "virtualPort": 200,
                "virtualAddresses": [
                    "192.0.2.21"
                ],
                "metadata": {
                    "example": {
                        "value": "example",
                        "persist": true
                    }
                }
            }
        }
    }
}

Back to top