f5devcentral / f5-automation-config-converter

Convert BIG-IP configs to AS3 and DO declarations
https://clouddocs.f5.com/products/extensions/f5-automation-config-converter/latest/
Apache License 2.0
35 stars 13 forks source link

Some ltm traffic-matching-criteria fields result in invalid declarations #54

Closed jszczepanskif5 closed 3 years ago

jszczepanskif5 commented 3 years ago

Environment

Summary

Converting a virtual with connected traffic-matching-criteria object having either destination-port-list or destination-address-inline fields defined results in an invalid declaration. The port list gets converted into an array (while Service.virtualPort accepts only integers), and address inline gets converted into a string (while Service.virtualAddresses accepts only lists).

Steps To Reproduce

The issue can be reproduced with your unit test test/converter/service_l4/service_l4.3.conf.

  1. Convert the config from the file above. The output is as follows:

    {
    "class": "ADC",
    "schemaVersion": "3.28.0",
    "id": "urn:uuid:c65a2b04-79bb-4dd0-9c1e-706e6055ee1d",
    "label": "Converted Declaration",
    "remark": "Auto-generated by AS3 Config Converter",
    "Common": {
        "class": "Tenant",
        "Shared": {
            "class": "Application",
            "template": "shared",
            "dest_tmc1_vs": {
                "translateServerAddress": false,
                "translateServerPort": false,
                "class": "Service_L4",
                "profileL4": {
                    "bigip": "/Common/fastL4"
                },
                "virtualAddresses": [
                    "10.10.10.0/24"
                ],
                "virtualPort": [
                    81,
                    82
                ],
                "persistenceMethods": [],
                "snat": "none",
                "layer4": "any"
            },
            "dest_tmc2_vs": {
                "translateServerAddress": false,
                "translateServerPort": false,
                "class": "Service_L4",
                "profileL4": {
                    "bigip": "/Common/fastL4"
                },
                "virtualAddresses": "10.20.30.0",
                "virtualPort": 25,
                "persistenceMethods": [],
                "snat": "none",
                "layer4": "any"
            }
        }
    }
    }
  2. Observe the following error messages when trying to deploy it:

    {
    "code": 422,
    "errors": [
        "/Common/Shared/dest_tmc1_vs/virtualPort: should be integer"
    ],
    "declarationFullId": "",
    "message": "declaration is invalid"
    }
    {
    "code": 422,
    "errors": [
        "/Common/Shared/dest_tmc2_vs/virtualAddresses: should be array"
    ],
    "declarationFullId": "",
    "message": "declaration is invalid"
    }

Expected Behavior

Address should be a simple case - just wrap the singular address in a list. Ports sound harder - might potentially need to create multiple virtuals, one for each port in list (?)

p-semenov-f5 commented 3 years ago

Jira issue: CHARON-468 for PM tracking

p-semenov-f5 commented 3 years ago

Resolved