codeout / vscode-junos

Junos Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=codeout.vscode-junos
MIT License
16 stars 1 forks source link

Source NAT pool address-name not recognized as valid syntax #29

Open chris-zenfolio opened 1 month ago

chris-zenfolio commented 1 month ago

I am writing some Junos code for the vSRX (v22.4.x) and have run into a problem where specifying a name on a vSRX is valid, but the plugin flags the syntax as a problem. I have validated this as a bug by trying it in Junos and it accepts the input fine.

Here are the offending commands and how to replicate:

set groups mygroup security address-book global address MY_ADDRESS 10.20.30.40/32
set groups mygroup security nat source pool SNAT_POOL address-name MY_ADDRESS
#
set security address-book global address MY_ADDRESS 10.20.30.40/32
set security nat source pool SNAT_POOL address-name MY_ADDRESS

This is how VS Code represents the block of code above:

image

Here is console output from the Juniper vSRX console:

admin@my_vsrx# show | compare
[edit groups]
   some-routing { ... }
+  mygroup {
+      security {
+          address-book {
+              global {
+                  address MY_ADDRESS 10.20.30.40/32;
+              }
+          }
+          nat {
+              source {
+                  pool SNAT_POOL {
+                      address-name MY_ADDRESS;
+                  }
+              }
+          }
+      }
+  }
codeout commented 1 month ago

Hi chris-zenfolio,

Thank you for reporting this issue, that's because the current version is built on vSRX 18.4 ( quite old! ) which doesn't support security nat source pool xxx address-name xxx. I can update vSRX syntax with a newer version, probably 22.4 or so, but I need some time.

chris-zenfolio commented 1 month ago

Hi @codeout,

Thank you for responding to my issue. I understand a fix will take time. Until it is fixed, I know the syntax is correct, even if VSCode thinks there is a syntax error. I apologize for not being able to suggest a fix or file a PR. I looked at the source and was lost pretty quickly. If I can be of assistance, please let me know.

I don't recall at the moment if MY_ADDRESS showed in the autocompletion window. I created that from my actual config so it would be sanitized for public use.