f5devcentral / vscode-f5-flipper

Exploring Citrix/NetScaler configs
Apache License 2.0
9 stars 4 forks source link

[BUG] AS3 Rendering of UDP Virtual Servers failing #40

Closed samualblair closed 2 months ago

samualblair commented 4 months ago

Describe the bug AS3 Rendering of UDP Virtual Servers failing. AS3 Rendering of similar TCP Virtual Server succeeds.

To Reproduce Steps to reproduce the behavior:

Parse ns.conf with UDP vs configuration. AS3 Template rendering fails for UDP vs, does not disrupt other such as TCP.

Example (TCP working and UDP failing):

add server pool_memeber_1 192.0.3.10 -devno 24696

add lb vserver lb_example_working_TCP TCP 192.0.2.1 443 -timeout 600 -cltTimeout 120 -devno 48594944
bind lb vserver lb_example_working_TCP example_working_TCP_svc
add serviceGroup example_working_TCP_svc TCP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport NO -cltTimeout 120 -svrTimeout 120 -CKA NO -TCPB NO -CMP NO -devno 46399488
bind serviceGroup example_working_TCP_svc pool_memeber_1 443 -devno 339410944

add lb vserver lb_example_broken_UDP UDP 192.0.2.1 443 -timeout 600 -cltTimeout 120 -devno 48594944
bind lb vserver lb_example_broken_UDP example_broken_UDP_svc
add serviceGroup example_broken_UDP_svc UDP -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport NO -cltTimeout 120 -svrTimeout 120 -CKA NO -TCPB NO -CMP NO -devno 46399488
bind serviceGroup example_broken_UDP_svc pool_memeber_1 443 -devno 339410944

Expected behavior Expect successful rendering of AS3.

Screenshots If applicable, add screenshots to help explain your problem.

Failure Console Output

1 [2024-07-09T22:22:54.738Z] [INFO]: ns app FAST Template params:  {
  virtual_address: '192.0.2.1',
  app_name: 'lb_example_broken_UDP',
  virtual_port: '443',
  pool_members: [
    {
      address: [
        { address: '192.0.3.10', name: 'pool_memeber_1', port: '443' }
      ],
      hostname: [],
      port: []
    }
  ]
}
1 [2024-07-09T22:22:54.740Z] [ERROR]: [YAMLException: duplicated mapping key (43:25)

 40 |                             "bigip": "/Common/gateway_icmp"
 41 |                         }
 42 |                     ],
 43 |                         "loadBalancingMode":"least-conn ...
------------------------------^
 44 |                     "class": "Pool"
 45 |                 }
    at generateError (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:187:9)
    at storeMappingPair (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:358:7)
    at readFlowCollection (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:796:7)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1442:11)
    at readFlowCollection (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:791:7)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1442:11)
    at readFlowCollection (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:791:7)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1442:11)
    at readFlowCollection (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:791:7)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1442:11)
    at readFlowCollection (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:791:7)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1442:11)
    at readBlockMapping (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1104:12)
    at composeNode (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1441:12)
    at readDocument (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1625:3)
    at loadDocuments (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.load (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/js-yaml/lib/loader.js:1714:19)
    at JsonPostProcessStrategy (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/@f5devcentral/f5-fast-core/lib/template.js:204:32)
    at Template.render (/Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/node_modules/@f5devcentral/f5-fast-core/lib/template.js:1214:24)
    at /Users/fakeuser/.vscode/extensions/f5devcentral.vscode-f5-flipper-1.10.1/out/fastWebView.js:64:38] {
  reason: 'duplicated mapping key',
  mark: {
    name: null,
    buffer: '{\n' +
      '    "$schema": "https://raw.githubusercontent.com/F5Networks/f5-appsvcs-extension/master/schema/latest/as3-schema.json",\n' +
      '    "class": "AS3",\n' +
      '    "declaration": {\n' +
      '        "class": "ADC",\n' +
      '        "schemaVersion": "3.37.0",\n' +
      '        "id": "urn:uuid:298cd391-c79c-422a-98bf-f4f559f5f591",\n' +
      '        "label": "Converted Declaration",\n' +
      '        "remark": "Generated by Automation Config Converter",\n' +
      '        "t_192.0.2.1": {\n' +
      '            "class": "Tenant",\n' +
      '            "lb_example_broken_UDP-app": {\n' +
      '                "class": "Application",\n' +
      '                "template": "shared",\n' +
      '                "lb_example_broken_UDP": {\n' +
      '                    "layer4": "udp",\n' +
      '                    "pool": "pool_lb_example_broken_UDP",\n' +
      '                    "translateServerAddress": true,\n' +
      '                    "translateServerPort": true,\n' +
      '                    "class": "Service_UDP",\n' +
      '                    "profileUDP": {\n' +
      '                        "bigip": "/Common/udp"\n' +
      '                    },\n' +
      '                    "virtualAddresses": [\n' +
      '                        "192.0.2.1"\n' +
      '                    ],\n' +
      '                    "virtualPort": 443,\n' +
      '                    "snat": "auto"\n' +
      '                },\n' +
      '                "pool_lb_example_broken_UDP": {\n' +
      '                    "loadBalancingMode": "least-connections-member",\n' +
      '                    "members": [\n' +
      '                        {\n' +
      '                        "serverAddresses": ["192.0.3.10"],\n' +
      '                        "shareNodes": true\n' +
      '                        },\n' +
      '                    ],\n' +
      '                    "monitors": [\n' +
      '                        {\n' +
      '                            "bigip": "/Common/gateway_icmp"\n' +
      '                        }\n' +
      '                    ],\n' +
      '                        "loadBalancingMode":"least-connections-member",\n' +
      '                    "class": "Pool"\n' +
      '                }\n' +
      '            }\n' +
      '        }\n' +
      '    }\n' +
      '}\n',
    position: 1672,
    line: 42,
    column: 24,
    snippet: ' 40 |                             "bigip": "/Common/gateway_icmp"\n' +
      ' 41 |                         }\n' +
      ' 42 |                     ],\n' +
      ' 43 |                         "loadBalancingMode":"least-conn ...\n' +
      '------------------------------^\n' +
      ' 44 |                     "class": "Pool"\n' +
      ' 45 |                 }'
  }
}

Successful parsing of TCP version

1 [2024-07-09T22:24:16.006Z] [INFO]: ns app FAST Template params:  {
  virtual_address: '192.0.2.1',
  app_name: 'lb_example_working_TCP',
  persistence: [],
  virtual_port: '443',
  pool_members: [
    {
      address: [
        { address: '192.0.3.10', name: 'pool_memeber_1', port: '443' }
      ],
      hostname: [],
      port: []
    }
  ]
}

Desktop (please complete the following information):

DumpySquare commented 2 months ago

These initial releases of templates were pretty raw. A fresh set will be coming with the next release