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

[RFE] support iapp applications tmos configs #74

Closed DumpySquare closed 2 years ago

DumpySquare commented 2 years ago

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

Current ACC engine does not support TMOS configs from iApps

Describe the solution you'd like

Support converting of applications in iapp partition/folders

Describe alternatives you've considered

a mass replace-all works well in vscode, but is an additional step and requires knowledge to implement

Additional context

Some customers are heavy iApp consumers and supporting apps deployed in this way is an important path

fix

replace all '/partition_a/iapp_name.app' references with '/Common'

Seems that ACC already ignores the 'app-service' lines that also reference that the app lives in an iApp.

Example iapp tmos config

ltm virtual /partition_a/iapp_name.app/app1_vs_80_vs {
    app-service /partition_a/iapp_name.app/app1_vs_80
    destination /partition_a/10.6.2.247:80
    ip-protocol tcp
    mask 255.255.255.255
    pool /partition_a/iapp_name.app/app1_vs_80_pool
    profiles {
        /partition_a/iapp_name.app/tcp { }
    }
    serverssl-use-sni disabled
    source 0.0.0.0/0
    source-address-translation {
        pool /partition_a/iapp_name.app/app1_vs_80_snatpool
        type snat
    }
    translate-address enabled
    translate-port enabled
}
ltm pool /partition_a/iapp_name.app/app1_vs_80_pool {
    app-service /partition_a/iapp_name.app/app1_vs_80
    members {
        /partition_a/iapp_name.app/server1:80 {
            address 10.5.2.164
            app-service /partition_a/iapp_name.app/app1_vs_80
        }
        /partition_a/iapp_name.app/server2:80 {
            address 10.5.2.165
            app-service /partition_a/iapp_name.app/app1_vs_80
        }
    }
    monitor /partition_a/iapp_name.app/https
    slow-ramp-time 300
}
ltm snatpool /partition_a/iapp_name.app/app1_vs_80_snatpool {
    app-service /partition_a/iapp_name.app/app1_vs_80
    members {
        /partition_a/172.24.80.247
    }
}

as3 output from iapp tmos config

{
    "class": "ADC",
    "schemaVersion": "3.31.0",
    "id": "urn:uuid:d72de4ac-4b4d-4306-8816-fb1989411e95",
    "label": "Converted Declaration",
    "remark": "Auto-generated by AS3 Config Converter"
}

fixed example

fixed source tmos config (no iapp references)

ltm virtual /Common/app1_vs_80_vs {
    app-service /Common/app1_vs_80
    destination /asi/10.6.2.247:4414
    ip-protocol tcp
    mask 255.255.255.255
    pool /Common/app1_vs_80_pool
    profiles {
        /Common/tcp { }
    }
    serverssl-use-sni disabled
    source 0.0.0.0/0
    source-address-translation {
        pool /Common/app1_vs_80_snatpool
        type snat
    }
    translate-address enabled
    translate-port enabled
}
ltm pool /Common/app1_vs_80_pool {
    app-service /Common/app1_vs_80
    members {
        /Common/server1:80 {
            address 10.5.2.164
            app-service /Common/app1_vs_80
        }
        /Common/server2:80 {
            address 10.5.2.165
            app-service /Common/app1_vs_80
        }
    }
    monitor /Common/https
    slow-ramp-time 300
}
ltm snatpool /Common/app1_vs_80_snatpool {
    app-service /Common/app1_vs_80
    members {
        /asi/172.24.80.247
    }
}

fixed/working as3 conversion

{
    "class": "ADC",
    "schemaVersion": "3.31.0",
    "id": "urn:uuid:be8a87fd-ca37-4da5-a6af-646a33a86585",
    "label": "Converted Declaration",
    "remark": "Auto-generated by AS3 Config Converter",
    "Common": {
        "class": "Tenant",
        "Shared": {
            "class": "Application",
            "template": "shared",
            "app1_vs_80_vs": {
                "layer4": "tcp",
                "pool": "app1_vs_80_pool",
                "translateServerAddress": true,
                "translateServerPort": true,
                "class": "Service_TCP",
                "profileTCP": {
                    "bigip": "/Common/tcp"
                },
                "virtualAddresses": [
                    "10.6.2.247"
                ],
                "virtualPort": 4414,
                "persistenceMethods": [],
                "snat": {
                    "use": "/Common/Shared/app1_vs_80_snatpool"
                }
            },
            "app1_vs_80_pool": {
                "members": [
                    {
                        "addressDiscovery": "static",
                        "servicePort": 80,
                        "serverAddresses": [
                            "10.5.2.164",
                            "10.5.2.165"
                        ],
                        "shareNodes": true
                    }
                ],
                "monitors": [
                    {
                        "bigip": "/Common/https"
                    }
                ],
                "slowRampTime": 300,
                "class": "Pool"
            },
            "app1_vs_80_snatpool": {
                "snatAddresses": [
                    "172.24.80.247"
                ],
                "class": "SNAT_Pool"
            }
        }
    }
}
mdditt2000 commented 2 years ago

@DumpySquare http iApp is support in ACC 1.17

Merge branch 'http_iapp' into 'develop'

Here is beta code - docker pull mdditt2000/f5-as3-config-converter:http_iapp

docker run --rm -v "$PWD":/app/data f5-as3-config-converter:http_iapp -o data/iapp.json -c data/app.conf

mdditt2000 commented 2 years ago

Converted above configuration

ltm virtual /partition_a/iapp_name.app/app1_vs_80_vs {
    app-service /partition_a/iapp_name.app/app1_vs_80
    destination /partition_a/10.6.2.247:80
    ip-protocol tcp
    mask 255.255.255.255
    pool /partition_a/iapp_name.app/app1_vs_80_pool
    profiles {
        /partition_a/iapp_name.app/tcp { }
    }
    serverssl-use-sni disabled
    source 0.0.0.0/0
    source-address-translation {
        pool /partition_a/iapp_name.app/app1_vs_80_snatpool
        type snat
    }
    translate-address enabled
    translate-port enabled
}
ltm pool /partition_a/iapp_name.app/app1_vs_80_pool {
    app-service /partition_a/iapp_name.app/app1_vs_80
    members {
        /partition_a/iapp_name.app/server1:80 {
            address 10.5.2.164
            app-service /partition_a/iapp_name.app/app1_vs_80
        }
        /partition_a/iapp_name.app/server2:80 {
            address 10.5.2.165
            app-service /partition_a/iapp_name.app/app1_vs_80
        }
    }
    monitor /partition_a/iapp_name.app/https
    slow-ramp-time 300
}
ltm snatpool /partition_a/iapp_name.app/app1_vs_80_snatpool {
    app-service /partition_a/iapp_name.app/app1_vs_80
    members {
        /partition_a/172.24.80.247
    }
}

Output


    "class": "ADC",
    "schemaVersion": "3.32.0",
    "id": "urn:uuid:163a453f-95c6-4284-affc-7bb28dbd359d",
    "label": "Converted Declaration",
    "remark": "Auto-generated by AS3 Config Converter",
    "partition_a": {
        "class": "Tenant",
        "iapp_name.app": {
            "class": "Application",
            "template": "generic",
            "app1_vs_80_vs": {
                "layer4": "tcp",
                "pool": "app1_vs_80_pool",
                "translateServerAddress": true,
                "translateServerPort": true,
                "class": "Service_Generic",
                "virtualAddresses": [
                    "10.6.2.247"
                ],
                "virtualPort": 80,
                "persistenceMethods": [],
                "snat": {
                    "use": "/partition_a/iapp_name.app/app1_vs_80_snatpool"
                }
            },
            "app1_vs_80_pool": {
                "members": [
                    {
                        "addressDiscovery": "static",
                        "servicePort": 80,
                        "serverAddresses": [
                            "10.5.2.164",
                            "10.5.2.165"
                        ],
                        "shareNodes": true
                    }
                ],
                "monitors": [],
                "slowRampTime": 300,
                "class": "Pool"
            },
            "app1_vs_80_snatpool": {
                "snatAddresses": [
                    "172.24.80.247"
                ],
                "class": "SNAT_Pool"
            }
        }
    }
}
mdditt2000 commented 2 years ago

Closing coming in ACC 1.17