Lab 6.5: Disable/Enable Pool Member of a Legacy Application Service via the API

Note

Estimated time to complete: 15 minutes

In this lab, we are going to disable a pool member part of a legacy application service managed by BIG-IQ.

We are going to use the following BIG-IQ API:

Lab environment access

If you have not yet visited the page Getting Started, please do so.

Find the Pool Member Reference

  1. Login to BIG-IQ as paula and navigate to IT_apps > media.site42.example.com. Select configuration and see the list of pool members related to this application service.
../../_images/lab-5-13.png
  1. Open Visual Studio Code, then use the Visual Studio code REST client extension and authenticate to BIG-IQ (follow instructions).
  1. Use the BIG-IQ API call and copy/paste the below URL using the GET method in order to retrieve the Legacy Application media.site42.example.co,m details using the BIG-IQ API. Save the URL after https://localhost/ for the next query.

    GET https://10.1.1.4/mgmt/cm/global/config-sets?$filter=configSetName eq 'media.site42.example.com'

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 {
     "totalItems": 1,
     "items": [
         {
             "id": "1d90f2b4-ab1e-3757-b4a2-0999055abf89",
             "kind": "cm:global:config-sets:configsetstate",
             "status": "CREATED",
             "selfLink": "https://localhost/mgmt/cm/global/config-sets/1d90f2b4-ab1e-3757-b4a2-0999055abf89",
             "generation": 82.0,
             "alertRuleName": "media.site42.example.com-health",
             "configSetName": "media.site42.example.com",
             "createDateTime": "2020-04-22T17:41:37.148Z",
             "lastConfigTime": "2020-04-22T17:41:37.148Z",
             "deviceReference": {
                 "link": "https://localhost/mgmt/shared/resolver/device-groups/cm-bigip-allBigIpDevices/dev..."
             },
             "lastUpdateMicros": 1.602771513789654E15,
             "applicationReference": {
                 "link": "https://localhost/mgmt/cm/global/global-apps/c671ad43-9420-354e-942a-d8b9d865e08c"
             },
             "applicationServiceType": "HTTP",
             "classicConfigReference": {
                 "link": "https://localhost/mgmt/cm/global/classic-configs/918b8779-1d1a-32a8-a3a7-7126902986ba"
             }
         }
     ],
     "generation": 26,
     "kind": "cm:global:config-sets:configsetcollectionstate",
     "lastUpdateMicros": 1602771516243558,
     "selfLink": "https://localhost/mgmt/cm/global/config-sets"
 }
  1. Now, let’s query the legacy app service details to get the virtual server details.

    GET /mgmt/cm/global/classic-configs/918b8779-1d1a-32a8-a3a7-7126902986ba

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 {
     "id": "918b8779-1d1a-32a8-a3a7-7126902986ba",
     "kind": "cm:global:classic-configs:classicconfigstate",
     "name": "media.site42.example.com",
     "selfLink": "https://localhost/mgmt/cm/global/classic-configs/918b8779-1d1a-32a8-a3a7-7126902986ba",
     "machineId": "60bd5d38-dd9f-468b-a0f5-f3b78776b079",
     "generation": 1,
     "configObjects": [
         {
             ...
         },
         {
             ...
         },
         {
             ...
         },
         {
             ...
         },
         {
             ...
         }
     ],
     "lastUpdateMicros": 1587577297085824,
     "currentConfigVirtualServerReferences": [
         {
             "link": "https://localhost/mgmt/cm/adc-core/current-config/ltm/virtual/c100e548-106f-3476-b0f5-dacda18ae2e7"
         }
     ]
 }
  1. Using the virtual server reference, do another GET on it. This call will give us the reference of the Pool Member attached to this virtual server.

    GET /mgmt/cm/adc-core/current-config/ltm/virtual/c100e548-106f-3476-b0f5-dacda18ae2e7

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 {
     "id": "c100e548-106f-3476-b0f5-dacda18ae2e7",
     "kind": "cm:adc-core:current-config:ltm:virtual:adcvirtualstate",
     "mask": "255.255.255.255",
     "name": "vip142",
     "nat64": "disabled",
     "state": "enabled",
     "mirror": "disabled",
     "subPath": "app2",
     "gtmScore": 0,
     "policies": [],
     "selfLink": "https://localhost/mgmt/cm/adc-core/current-config/ltm/virtual/c100e548-106f-3476-b0f5-dacda18ae2e7",
     "partition": "legacy",
     "rateLimit": "disabled",
     "generation": 11,
     "ipProtocol": "tcp",
     "sourcePort": "preserve",
     "autoLasthop": "default",
     "description": "app2",
     "vlansEnabled": "disabled",
     "addressStatus": "yes",
     "poolReference": {
         "id": "ef21f8dd-c75d-328d-8f21-8816a76d8c1b",
         "kind": "cm:adc-core:current-config:ltm:pool:adcpoolstate",
         "link": "https://localhost/mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b",
         "name": "Pool",
         "subPath": "app2",
         "partition": "legacy"
     },
     ...
 }
  1. Finally, let’s retrieve the Pool Members or Servers belonging to this Pool.

    GET /mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 {
     "items": [
         {
             "id": "6bd14736-285f-3338-850d-ff2378817fc6",
             "kind": "cm:adc-core:current-config:ltm:pool:members:adcpoolmemberstate",
             "name": "10.1.20.117:80",
             "port": 80,
             "ratio": 1,
             "selfLink": "https://localhost/mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members/6bd14736-285f-3338-850d-ff2378817fc6",
             "partition": "Common",
             ...
         },
         {
             "id": "a4040191-a157-332a-a3d4-c3ca91ff8be2",
             "kind": "cm:adc-core:current-config:ltm:pool:members:adcpoolmemberstate",
             "name": "10.1.20.115:80",
             "port": 80,
             "ratio": 1,
             "selfLink": "https://localhost/mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members/a4040191-a157-332a-a3d4-c3ca91ff8be2",
             "partition": "Common",
             ...
         },
         {
             "id": "63c034a9-9369-3316-93d3-daa0e3a5d62d",
             "kind": "cm:adc-core:current-config:ltm:pool:members:adcpoolmemberstate",
             "name": "10.1.20.116:80",
             "port": 80,
             "ratio": 1,
             "selfLink": "https://localhost/mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members/63c034a9-9369-3316-93d3-daa0e3a5d62d",
             "partition": "Common",
             ...
         }
     ],
     "generation": 1,
     "kind": "cm:adc-core:current-config:ltm:pool:members:adcpoolmembercollectionstate",
     "lastUpdateMicros": 1602785635862603,
     "selfLink": "https://localhost/mgmt/cm/adc-core/current-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members"
 }

Force offline a Pool Member

  1. Now, we are going to force-offline one of the pool member using the BIG-IQ API as the application team is planing to perform an upgrade this specific application server 10.1.20.117:80. We are using the resrouceReference of the pool member to perform the operation to force-offline and turn down this pool member on the F5 load balancer.

    POST /mgmt/cm/adc-core/tasks/self-service

Note

Do not forget to replace current-config with working-config in the link.

  • Working configuration is the BIG-IP service configuration located on BIG-IQ. This is the configuration you manage, edit, and deploy to your managed BIG-IP devices.
  • Current configuration is the BIG-IP service configuration running on a BIG-IP device, which can be different than the working configuration on BIG-IQ if changes were made directly on that BIG-IP device.
1
2
3
4
5
6
 {
     "resourceReference":{
         "link":"https://localhost/mgmt/cm/adc-core/working-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members/6bd14736-285f-3338-850d-ff2378817fc6"
     },
     "operation":"force-offline"
 }

Result:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 {
     "resourceReference": {
         "link": "https://localhost/mgmt/cm/adc-core/working-config/ltm/pool/ef21f8dd-c75d-328d-8f21-8816a76d8c1b/members/6bd14736-285f-3338-850d-ff2378817fc6"
     },
     "operation": "force-offline",
     "id": "9bc4e08b-d7df-4051-9390-01d0be11bf0a",
     "status": "STARTED",
     ...
     "selfLink": "https://localhost/mgmt/cm/adc-core/tasks/self-service/9bc4e08b-d7df-4051-9390-01d0be11bf0a"
 }
  1. Once the previous post is made, you can check the status by checking:

    GET /mgmt/cm/adc-core/tasks/self-service/c7d49112-5927-4c3f-b4d0-fff253494cf9

1
2
3
4
5
6
7
8
9
 {
     "id": "9bc4e08b-d7df-4051-9390-01d0be11bf0a",
     "kind": "cm:adc-core:tasks:self-service:selfservicetaskitemstate",
     "status": "FINISHED",
     "selfLink": "https://localhost/mgmt/cm/adc-core/tasks/self-service/9bc4e08b-d7df-4051-9390-01d0be11bf0a",
     "username": "admin",
     "operation": "force-offline",
     ...
 }
  1. Login to BIG-IQ as david and navigate to Deployment > Quick Updates > Local Traffic & Network and notice the change is being tracked under the deployment tab.
../../_images/lab-5-25.png
  1. Now logout from the david session and login to BIG-IQ as paula and notice the pool member 10.1.20.117:80 is down as desired.
../../_images/lab-5-31.png