Forum Discussion

Alexander_Slink's avatar
Alexander_Slink
Icon for Altostratus rankAltostratus
Mar 31, 2021

An example of an AS3 Rest API call to create a GSLB configuration on BIG-IP.

Hi everyone,

Below you can find an example of an AS3 Rest API call that creates a simple GSLB configuration on BIG-IP devices.

The main purpose of this article is to share this configuration with others.

Of course, on different sites (github, etc) you can find different bits of data, but I think this example will be useful, because it contains all the necessary information about how to create different GSLB objects at the same time, such as: Data Centers (DCs), Servers, Virtual Servers (VSs), Wide IPs, pools and more over.

 {
  "class": "AS3",
  "declaration": {
   "class": "ADC",
   "schemaVersion": "3.21.0",
   "id": "GSLB_test",
   "Common": {
    "class": "Tenant",
    "Shared": {
     "class": "Application",
     "template": "shared",
     "DC1": {
      "class": "GSLB_Data_Center"
     },
     "DC2": {
      "class": "GSLB_Data_Center"
     },
     "device01": {
       "class": "GSLB_Server",
       "dataCenter": {
        "use": "DC1"
       },
      "virtualServers": [
       {
        "name": "/ocp/Shared/ingress_vs_1_443",
        "address": "A.B.C.D",
        "port": 443,
        "monitors": [
        {
         "bigip": "/Common/custom_icmp_2"
        }
        ]
       }
      ],
      "devices": [
       {
       "address": "A.B.C.D"
       }
      ]
     },
     "device02": {
       "class": "GSLB_Server",
       "dataCenter": {
        "use": "DC2"
       },
      "virtualServers": [
       {
        "name": "/ocp2/Shared/ingress_vs_2_443",
        "address": "A.B.C.D",
        "port": 443,
        "monitors": [
        {
         "bigip": "/Common/custom_icmp_2"
        }
        ]
       }
      ],
      "devices": [
       {
       "address": "A.B.C.D"
       }
      ]
     },
     "dns_listener": {
       "class": "Service_UDP",
       "virtualPort": 53,
       "virtualAddresses": [
        "A.B.C.D"
       ],
       "profileUDP": {
        "use": "custom_udp"
       },
       "profileDNS": {
        "use": "custom_dns"
       }
     },
     "custom_dns": {
       "class": "DNS_Profile",
       "remark": "DNS Profile test",
       "parentProfile": {
        "bigip": "/Common/dns"
       }
     },
     "custom_udp": {
       "class": "UDP_Profile",
       "datagramLoadBalancing": true
     },
     "testpage_local": {
      "class": "GSLB_Domain",
      "domainName": "testpage.local",
      "resourceRecordType": "A",
      "pools": [
       {
       "use": "testpage_pool"
       }
      ]
     },
     "testpage_pool": {
      "class": "GSLB_Pool",
      "resourceRecordType": "A",
      "members": [
       {
        "server": {
         "use": "/Common/Shared/device01"
        },
        "virtualServer": "/ocp/Shared/ingress_vs_1_443"
       },
       {
        "server": {
         "use": "/Common/Shared/device02"
       },
        "virtualServer": "/ocp2/Shared/ingress_vs_2_443"
       }
      ]
     }
    }
   }
  }
 }

P.S. The AS3 scheme guide was very helpful:

https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/latest/refguide/schema-reference.html

    • Alexander_Slink's avatar
      Alexander_Slink
      Icon for Altostratus rankAltostratus

      Hi Nik,

       

      I generated this call in the OpenShift Config Map, I believe you can use it on other orchestration platforms.