Syntax highlighting and snippets for NetApp ONTAP CLI commands in Visual Studio Code.
- Syntax highlighting for
.ontapfiles containing ONTAP CLI commands (runbooks, automation scripts, documentation snippets) - Highlights the command directory (e.g.
volume,network interface,vserver cifs), the action verb (e.g.create,show,modify), parameter switches, strings, IP/IPv6 addresses, WWNs, sizes (100GB), and common enumerated values (online,enabled,true, etc) - Snippets for common administrative tasks across cluster, network, storage, SAN, NAS (vserver), SnapMirror, and security commands; tab-completion is available for enumerated parameters
You can install this extension by following the steps in the Visual Studio Code documentation. In the Extensions pane, search for ontap and install it there. You will get notified automatically about any future extension updates.
This extension is published on the Visual Studio Marketplace.
By default Visual Studio Code will prevent auto-complete/quick suggestions for the values that you enter into the snippet arguments e.g. a volume or vserver name. To enable auto-completion, add the following line to your Visual Studio Code settings.json file:
"editor.suggest.snippetsPreventQuickSuggestions": falseONTAP does not have a single configuration/script file extension the way most other platforms do. This extension activates on files with the .ontap extension. If you keep your ONTAP command runbooks in files with a different extension, associate them in your Visual Studio Code settings.json:
"files.associations": {
"*.txt": "ontap"
}The following snippets provide shortcuts to common ONTAP CLI commands.
Cluster
cluster create,cluster join,cluster showcluster ha modifycluster peer create
Network
network interface create: Add a network interface (LIF)network port modify MTUnetwork port broadcast-domain createnetwork route createnetwork ipspace create
Storage
storage aggregate create,storage aggregate showstorage disk show,storage disk assignstorage failover show
Volume
volume create: Add a volumevolume modify SIZE,volume show,volume online,volume offlinevolume snapshot create,volume snapshot policy createvolume efficiency onvolume quota policy-rule create
Vserver (SVM)
vserver create: Create a Storage Virtual Machinevserver cifs create,vserver cifs share createvserver nfs createvserver export-policy create,vserver export-policy rule createvserver iscsi create
SAN
lun create,lun showlun igroup createlun mapping createlun portset create
SnapMirror
snapmirror create,snapmirror showsnapmirror initialize,snapmirror update,snapmirror break,snapmirror resyncsnapmirror policy create
Security
security login create,security login show,security login locksecurity certificate create,security certificate installsecurity login role create
The grammar is tested with vscode-tmgrammar-test, which runs the real VS Code
tokenizer against fixture files under test/*.test.ontap and checks the scopes it
assigns against inline assertions. A Makefile wraps the workflow:
make test # npm install (if needed) + npm test
make test-snap # snapshot tests
make test-snap-update # regenerate snapshots
make package # test, then build a .vsix with @vscode/vsce
make clean # remove node_modules and built .vsix filesIf you experience any issues with the extension, please report them here.
- @timdenholm
- Command directory, entity, and verb word lists generated from NetApp's published ONTAP CLI command reference
Licensed under the Apache License, Version 2.0
© Tim Denholm
NetApp and ONTAP are trademarks of NetApp, Inc. This is an independent, unofficial project and is not affiliated with or endorsed by NetApp, Inc.