-
Notifications
You must be signed in to change notification settings - Fork 25
JTAF Build Steps
The best way to get familiar with JTAF is to build a provider. Let's go!
Navigate to your /var/tmp
directory and create the jtaf_experiment
directory. This is your working directory for running a provider build.
Next, grab the JTAF project, which is written in Go.
go get github.com/Juniper/junos-terraform
Navigate to the junos-terraform directory and build both the cmd/processYang
and cmd/processProviders
binary.
Next, copy the contents of the samples/tf_module_template
directory to your working directory.
One of the first steps is to process the YANG files and create YIN and .txt representations of the YANG contents. For this example, the YANG files are ready to go and you don't have to worry about a thing.
The processing is done via pyang
and we have a requirement to install a Python venv and install Pyang.
Navigate to the processYang
directory.
python -m venv ./venv
source ./venv/bin/activate
pip install pyang
./processYang -config /var/tmp/jtaf_experiment/jtaf_config.toml
At this point, the first part of JTAF will kick in and process the YANG files.
Next, navigate to the cmd/processProviders
directory and execute that program.
./processProviders -config /var/tmp/jtaf_experiment/jtaf_config.toml
If all goes well, you now all have the .go
files in the terraform_providers
directory within your working directory.
You should be able to build the provider simply with:
go build
Enough data is stored in the go.mod
file to instruct the Go compiler what to do.
Next, move the provider to the default Terraform provider directory with the correct version directory. In this example case, the YANG models are for a 20.3xx vSRX and the specifics for the minor numbers are pulled from the vSRX itself.
mkdir -p ~/.terraform.d/plugins/juniper/providers/junos-vsrx/20.32.0101/darwin_amd64
mv terraform-provider-junos-vsrx ~/.terraform.d/plugins/juniper/providers/junos-vsrx/20.32.0101/darwin_amd64
It might be a good idea to export an environment variable as a shortcut for this directory!
You're now in a position to run Terraform through it's paces.
This was tested with Terraform version 0.15.5 on darwin_amd64 (OSX). If you're running on Linux, ensure to change the darwin to linux on the examples above.
THIS IS WORK IN PROGRESS. MORE UPDATES DAILY