Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser does not return the variable names #38

Open
manivannanpk opened this issue Dec 12, 2019 · 1 comment
Open

Parser does not return the variable names #38

manivannanpk opened this issue Dec 12, 2019 · 1 comment

Comments

@manivannanpk
Copy link

Python TextFSM parser returns the names of the variables as the first row. It is useful to match the data and the corresponding variables in the presence of optional variables.

It is crucial to have the same behavior in go-textfsm as well.

@Ali-aqrabawi
Copy link
Contributor

if i understand your concern correctly,
you can get the variable names from the abstractStatmentT like this:

for {

	row, ok := <-record
	if !ok {
		break
	}
	for i,val := range row {
		fmt.Println(abstractStatementT.Vals[i].Variable,":",val)
	}
}

results will be smomething like this:

neighbor : 192.168.74.22
ASN : 
NGROUP : INERNALCPE
DESC : INTERNAL:CPE:ROUTEREFLECTOR
RPIN : 
RPOUT : 
neighbor : 192.168.74.23
ASN : 
NGROUP : INERNALCPE
DESC : INTERNAL:CPE:ROUTEREFLECTOR
RPIN : 
RPOUT : 
neighbor : 192.168.74.24
ASN : 
NGROUP : INERNALCPE
DESC : INTERNAL:CPE:ROUTEREFLECTOR
RPIN : 
RPOUT : 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants