F5Networks / f5-appsvcs-extension

F5 BIG-IP Application Services 3 Extension
Apache License 2.0
163 stars 52 forks source link

RFE: Always return array for "response" field in BIG-IQ AS3 GET endpoint /mgmt/shared/appscvs/declare #766

Open ghost opened 8 months ago

ghost commented 8 months ago

Is your feature request related to a problem? Please describe.

When the AS3 configuration is retrieved from a BIG-IQ, the "response" field in the JSON response is not a fixed variable type. When a single BIG-IP target exists, the value is a dictionary. When multiple BIG-IP targets exist, the value is an array of dictionaries.

Describe the solution you'd like

BIG-IQ should return an array, even with a single value, keeping the expected variable type the same regardless of item count.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

BIG-IQ AS3 response with single BIG-IP target:

{
  "icode": "AD.200",
  "response": {
    "id": "testing",
    "class": "ADC",
    "label": "Sample 1",
    "remark": "HTTP with custom persistence",
    "target": {
      "address": "10.240.41.74"
    },
    "controls": {
      "class": "Controls",
      "userAgent": "BIG-IQ/8.2 Configured by API"
    },
    "updateMode": "selective",
    "Testing_AS3_Demo": {
      "A1": {
        "class": "Application",
        "jsessionid": {
          "class": "Persist",
          "cookieName": "JSESSIONID",
          "cookieMethod": "hash",
          "persistenceMethod": "cookie"
        },
        "BIGIQ-VS-Demo": {
          "pool": "/Testing_AS3_Demo/A1/AS3-Demo-Itential-Pool",
          "class": "Service_HTTP",
          "virtualAddresses": [
            "10.200.201.28"
          ],
          "persistenceMethods": [
            {
              "use": "/Testing_AS3_Demo/A1/jsessionid"
            }
          ]
        },
        "schemaOverlay": "default",
        "AS3-Demo-Itential-Pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 80,
              "serverAddresses": [
                "10.20.30.40",
                "10.20.30.44"
              ]
            }
          ],
          "monitors": [
            "http"
          ]
        }
      },
      "class": "Tenant"
    },
    "schemaVersion": "3.7.0",
    "Sample_http_01": {
      "A1": {
        "class": "Application",
        "service": {
          "pool": "/Sample_http_01/A1/web_pool",
          "class": "Service_HTTP",
          "virtualAddresses": [
            "10.0.2.30"
          ],
          "persistenceMethods": [
            {
              "use": "/Sample_http_01/A1/jsessionid"
            }
          ]
        },
        "web_pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 80,
              "serverAddresses": [
                "192.0.2.45",
                "192.0.2.55"
              ]
            }
          ],
          "monitors": [
            "http"
          ]
        },
        "jsessionid": {
          "class": "Persist",
          "cookieName": "JSESSIONID",
          "cookieMethod": "hash",
          "persistenceMethod": "cookie"
        },
        "schemaOverlay": "default"
      },
      "class": "Tenant"
    },
    "Test_PoC": {
      "A1": {
        "class": "Application",
        "service": {
          "pool": "/Test_PoC/A1/web_pool",
          "class": "Service_HTTP",
          "virtualAddresses": [
            "10.0.2.40"
          ],
          "persistenceMethods": [
            {
              "use": "/Test_PoC/A1/jsessionid"
            }
          ]
        },
        "web_pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 80,
              "serverAddresses": [
                "192.0.2.60",
                "192.0.2.70"
              ]
            }
          ],
          "monitors": [
            "http"
          ]
        },
        "jsessionid": {
          "class": "Persist",
          "cookieName": "JSESSIONID",
          "cookieMethod": "hash",
          "persistenceMethod": "cookie"
        },
        "schemaOverlay": "default"
      },
      "class": "Tenant"
    }
  },
  "headers": {
    "server": "webd",
    "date": "Tue, 05 Sep 2023 22:54:40 GMT",
    "content-type": "application/json; charset=UTF-8",
    "content-length": "1754",
    "connection": "close",
    "allow": "",
    "pragma": "no-cache",
    "cache-control": "no-store, no-cache, must-revalidate",
    "expires": "-1"
  },
  "metrics": {
    "code": 200,
    "timeouts": 0,
    "redirects": 0,
    "retries": 0,
    "tripTime": 336,
    "isThrottling": false,
    "capabilityTime": "1773ms"
  }
}
{
  "icode": "AD.200",
  "response": [
    {
      "id": "urn:uuid:4bb1440f-cee2-460d-a402-06ff0167b6fb",
      "class": "ADC",
      "label": "Converted Declaration",
      "remark": "Generated by Automation Config Converter",
      "target": {
        "address": "10.240.40.29"
      },
      "controls": {
        "class": "Controls",
        "userAgent": "BIG-IQ/8.2 Configured by API"
      },
      "updateMode": "selective",
      "schemaVersion": "3.37.0",
      "Test-Brownfield": {
        "class": "Tenant",
        "Shared": {
          "BF-VS": {
            "snat": "none",
            "class": "Service_TCP",
            "layer4": "tcp",
            "profileTCP": {
              "bigip": "/Common/tcp"
            },
            "virtualPort": 80,
            "virtualAddresses": [
              "13.13.13.13"
            ],
            "translateServerPort": true,
            "translateServerAddress": true
          },
          "class": "Application",
          "BF-Pool": {
            "class": "Pool",
            "members": [
              {
                "shareNodes": true,
                "servicePort": 80,
                "serverAddresses": [
                  "10.20.30.20",
                  "10.20.30.44"
                ],
                "addressDiscovery": "static"
              }
            ]
          },
          "template": "shared",
          "schemaOverlay": "default"
        }
      },
      "Common": {
        "class": "Tenant",
        "Shared": {
          "class": "Application",
          "template": "shared",
          "schemaOverlay": "default",
          "bigiq-analytics-send_stats": {
            "class": "Data_Group",
            "records": [
              {
                "key": "avr_commands",
                "value": " "
              },
              {
                "key": "sessiondbkeys",
                "value": "session.access.profile session.assigned.resources.na session.assigned.webtop session.client.activex session.client.browscap_info session.client.cpu session.client.js session.client.platform session.client.plugin session.client.type session.client.version session.end session.inactivity_timeout session.logon.last.logonname session.logon.last.result session.logon.last.username session.server.listener.name session.server.network.name session.server.network.port session.server.network.protocol session.state session.stats.bytes.in session.stats.bytes.out session.stats.egress.compressed session.stats.egress.raw session.stats.ingress.compressed session.stats.ingress.raw session.stats.packets.in session.stats.packets.out session.user.agent session.user.clientip session.user.display_sessionid session.user.ip_reputation session.user.ipgeolocation.continent session.user.ipgeolocation.country_code session.user.ipgeolocation.country_name session.user.ipgeolocation.state session.user.starttime session.policy.result session.user.sessiontype session.ui.lang session.assigned.clientip session.check_software.last.hd.state session.check_software.last.av.state"
              },
              {
                "key": "source_metrics_to_ignore",
                "value": "proc_pid_stat.command_line memory_usage_stat.caches_used"
              },
              {
                "key": "tmctl_commands",
                "value": "tmm_stat -1 interface_stat -1 cpu_info_stat -1 disk_info_stat -1 host_info_stat -1 rule_stat -2 virtual_server_stat 0 pool_member_stat 0 profile_dns_stat 1 gtm_wideip_stat -1 dns_cache_resolver_stat -1 tmmdns_zone_stat -1"
              }
            ],
            "keyDataType": "string"
          }
        }
      }
    },
    {
      "id": "Test_AS3_Demo",
      "class": "ADC",
      "label": "Sample 1",
      "remark": "HTTP with custom persistence",
      "target": {
        "address": "10.240.41.74"
      },
      "controls": {
        "class": "Controls",
        "userAgent": "BIG-IQ/8.2 Configured by API"
      },
      "updateMode": "selective",
      "Test_AS3_Demo": {
        "A1": {
          "class": "Application",
          "jsessionid": {
            "class": "Persist",
            "cookieName": "JSESSIONID",
            "cookieMethod": "hash",
            "persistenceMethod": "cookie"
          },
          "BIGIQ-VS-Demo": {
            "pool": "/Test_AS3_Demo/A1/BIGIQ-As3-Demo",
            "class": "Service_HTTP",
            "virtualAddresses": [
              "10.200.201.28"
            ],
            "persistenceMethods": [
              {
                "use": "/Test_AS3_Demo/A1/jsessionid"
              }
            ]
          },
          "schemaOverlay": "default",
          "BIGIQ-As3-Demo": {
            "class": "Pool",
            "members": [
              {
                "servicePort": 80,
                "serverAddresses": [
                  "10.20.30.45",
                  "10.20.30.44"
                ]
              }
            ],
            "monitors": [
              "http"
            ]
          }
        },
        "class": "Tenant"
      },
      "schemaVersion": "3.7.0",
      "Sample_http_01": {
        "A1": {
          "class": "Application",
          "service": {
            "pool": "/Sample_http_01/A1/web_pool",
            "class": "Service_HTTP",
            "virtualAddresses": [
              "10.0.2.30"
            ],
            "persistenceMethods": [
              {
                "use": "/Sample_http_01/A1/jsessionid"
              }
            ]
          },
          "web_pool": {
            "class": "Pool",
            "members": [
              {
                "servicePort": 80,
                "serverAddresses": [
                  "192.0.2.45",
                  "192.0.2.55"
                ]
              }
            ],
            "monitors": [
              "http"
            ]
          },
          "jsessionid": {
            "class": "Persist",
            "cookieName": "JSESSIONID",
            "cookieMethod": "hash",
            "persistenceMethod": "cookie"
          },
          "schemaOverlay": "default"
        },
        "class": "Tenant"
      },
      "Test_PoC": {
        "A1": {
          "class": "Application",
          "service": {
            "pool": "/Test_PoC/A1/web_pool",
            "class": "Service_HTTP",
            "virtualAddresses": [
              "10.0.2.40"
            ],
            "persistenceMethods": [
              {
                "use": "/Test_PoC/A1/jsessionid"
              }
            ]
          },
          "web_pool": {
            "class": "Pool",
            "members": [
              {
                "servicePort": 80,
                "serverAddresses": [
                  "192.0.2.60",
                  "192.0.2.70"
                ]
              }
            ],
            "monitors": [
              "http"
            ]
          },
          "jsessionid": {
            "class": "Persist",
            "cookieName": "JSESSIONID",
            "cookieMethod": "hash",
            "persistenceMethod": "cookie"
          },
          "schemaOverlay": "default"
        },
        "class": "Tenant"
      }
    }
  ],
  "headers": {
    "server": "webd",
    "date": "Thu, 14 Sep 2023 22:03:56 GMT",
    "content-type": "application/json; charset=UTF-8",
    "content-length": "4308",
    "connection": "close",
    "allow": "",
    "pragma": "no-cache",
    "cache-control": "no-store, no-cache, must-revalidate",
    "expires": "-1"
  },
  "metrics": {
    "code": 200,
    "timeouts": 0,
    "redirects": 0,
    "retries": 0,
    "tripTime": 314,
    "isThrottling": false,
    "capabilityTime": "318ms"
  }
}
sunitharonan commented 4 months ago

Thanks for reaching out, have created an internal backlog item AUTOTOOL-4271. In order to prioritize this issue, please reach out to us at automation_toolchain_pm@f5.com