processYang

package
v0.0.0-...-8aeced7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

processYang

This module is to be used to generate yin files from yang files for which terraform api's are to be generated.

Yang file Details to be checked

Check the correct version and device type for the yang files. Yang files for junos devices can be downloaded from the following github repo -

https://github.com/Juniper/yang.git

Generate yin files and xpaths from the yang files

Yin files are an xml representation of the yang files. It makes it easier for the golang code to understand the data. All the xpaths are generated for a corresponding yang file. User can refer it while generating terraform api for the yang model. Refer following links for more details regarding yin files and xpaths

To generate yin file and xpath follow the following steps.

  1. Copy yang files to a particular repository on the device.
  2. Execute the following command -

cd cmd/processyang

go build

./processYang -config /var/tmp/config.toml

The yin-files and xpath-files will be generated in the same repository.

The Sample config file are provided in jtaf/Samples/config.toml . The same arguments can also be passed from command line during binary execution .

Documentation

Overview

Copyright (c) 2017-2022, Juniper Networks Inc. All rights reserved.

License: Apache 2.0

THIS SOFTWARE IS PROVIDED BY Juniper Networks, Inc. ”AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Juniper Networks, Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateYinFileAndXpath

func CreateYinFileAndXpath(jcfg cfg.Config) error

Create Yin files from Yang files and also generate the xpath for the elements

func PrintHeader

func PrintHeader(message string)

PrintHeader accepts a message of any length (ideally no more than 80 chars) and pretty prints it in a box

Types

type Node

type Node struct {
	XMLName xml.Name
	Key     string `xml:"name,attr"`
	Content []byte `xml:",innerxml"`
	Nodes   []Node `xml:",any"`
}

Node is a helper type for traversing the data tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL