Syntax highlighting and snippets for NetApp ONTAP CLI commands in Visual Studio Code.
Features
- Syntax highlighting for
.ontap files 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
Installation
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.
Enable support for auto-complete in snippets (optional)
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": false
Associating files with this extension
ONTAP 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"
}
Snippets
The following snippets provide shortcuts to common ONTAP CLI commands.
Cluster
cluster create, cluster join, cluster show
cluster ha modify
cluster peer create
Network
network interface create: Add a network interface (LIF)
network port modify MTU
network port broadcast-domain create
network route create
network ipspace create
Storage
storage aggregate create, storage aggregate show
storage disk show, storage disk assign
storage failover show
Volume
volume create: Add a volume
volume modify SIZE, volume show, volume online, volume offline
volume snapshot create, volume snapshot policy create
volume efficiency on
volume quota policy-rule create
Vserver (SVM)
vserver create: Create a Storage Virtual Machine
vserver cifs create, vserver cifs share create
vserver nfs create
vserver export-policy create, vserver export-policy rule create
vserver iscsi create
SAN
lun create, lun show
lun igroup create
lun mapping create
lun portset create
SnapMirror
snapmirror create, snapmirror show
snapmirror initialize, snapmirror update, snapmirror break, snapmirror resync
snapmirror policy create
Security
security login create, security login show, security login lock
security certificate create, security certificate install
security login role create
Development
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 files
Reporting issues
If you experience any issues with the extension, please report them here.
Credits
License
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.