py-junos-eznc
py-junos-eznc copied to clipboard
PyEZ table/views for fpc command returns empty
import yamlordereddictloader
from jnpr.junos.factory import loadyaml
import yaml
from pprint import pprint
from jnpr.junos import Device
import json
import yamlordereddictloader
from jnpr.junos.factory.factory_loader import FactoryLoader
yaml_data = """
---
EgressCrcErrorsTable:
command: command | display xml
target: fpc9
item: showFwengHistStart/showFwengHist
key:
- headMsg
view: EgressHistTableView
EgressHistTableView:
fields:
headmsg: headMsg
errors: _EgressCrcErrorsView
_EgressCrcErrorsView:
item: fehistErrors
key:
- histChipDpLbl
view: EgressCrcErrorsFieldsView
EgressCrcErrorsFieldsView:
fields:
BT: histChipDpLbl
PFE: histPpfeId
DRAM: drPagCrcErrS
Egress: egrCrcLHdErrs
"""
globals().update(FactoryLoader().load(yaml.load(yaml_data,
Loader=yamlordereddictloader.Loader)))
with Device(host='xyzzy', user='xyzzy', password='xyzzy', port=22) as dev:
stats1 = EgressCrcErrorsTable(dev).get()
print("thesse are stats")
print(stats1)
print("pretty stats")
pprint(json.loads(stats1.to_json()))