py-junos-eznc icon indicating copy to clipboard operation
py-junos-eznc copied to clipboard

PyEZ table/views for fpc command returns empty

Open aparuchuri1 opened this issue 2 years ago • 0 comments

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()))

aparuchuri1 avatar Sep 25 '23 07:09 aparuchuri1