jedelman8/pycsco

get_facts function issue on n3k running 7.x

seismiccollision opened this issue · 0 comments

the 'show environment' command as part of the pycsco/nxos/utils/nxapi_lib.py get_facts function results in unexpected json tags https://github.com/jedelman8/pycsco/blob/master/pycsco/nxos/utils/nxapi_lib.py#L2445

seen in 3 revs of 7.0(3)I2(X)
I don't think I know enough python yet to propose a smart fix but I could give it a shot if it's any help

>>> print json.dumps(result, indent=2)
{
  "ins_api": {
    "type": "cli_show", 
    "version": "1.0", 
    "sid": "eoc", 
    "outputs": {
      "output": {
        "body": {
          "powersup": {
            "voltage_level": "12", 
            "TABLE_psinfo_n3k": {
              "ROW_psinfo_n3k": [
                {
                  "psnum": "1", 
                  "psmodel": "N2200-PAC-400W", 
                  "input_type": "AC", 
                  "watts": "396.00", 
                  "amps": "33.00", 
                  "ps_status": "ok"
                }, 
                {
                  "psnum": "2", 
                  "psmodel": "--", 
                  "input_type": "--", 
                  "watts": "--", 
                  "amps": "--", 
                  "ps_status": "fail/not-powered-up"
                }
              ]
            }, 
            "TABLE_mod_pow_info_n3k": {
              "ROW_mod_pow_info_n3k": {
                "modnum": "1", 
                "mod_model": "N3K-C3048TP-1GE", 
                "watts_requested": "144.00", 
                "amps_requested": "12.00", 
                "watts_alloced": "144.00", 
                "amps_alloced": "12.00", 
                "modstatus": "powered-up"
              }
            }, 
            "power_summary_n3k": {
              "ps_redun_mode": "Redundant", 
              "ps_redun_op_mode": "Non-redundant", 
              "tot_pow_capacity": "396.00 W", 
              "reserve_sup": "144.00 W", 
              "pow_used_by_mods": "0.00 W", 
              "available_pow": "252.00 W"
            }
          }, 
          "fandetails": {
            "TABLE_faninfo": {
              "ROW_faninfo": [
                {
                  "fanname": "Fan1(sys_fan1)", 
                  "fanmodel": "N3K-C3048-FAN", 
                  "fanhwver": "0.0", 
                  "fandir": "front-to-back", 
                  "fanstatus": "Ok", 
                  "failfanlet": null
                }, 
                {
                  "fanname": "Fan_in_PS1", 
                  "fanmodel": "N2200-PAC-400W", 
                  "fanhwver": "--", 
                  "fandir": "front-to-back", 
                  "fanstatus": "Ok"
                }, 
                {
                  "fanname": "Fan_in_PS2", 
                  "fanmodel": "N2200-PAC-400W", 
                  "fanhwver": "--", 
                  "fandir": "front-to-back", 
                  "fanstatus": "None"
                }
              ]
            }, 
            "TABLE_fan_zone_speed": {
              "ROW_fan_zone_speed": {
                "zone": "1", 
                "speed": "0x28"
              }
            }, 
            "fan_filter_status": "NotSupported"
          }, 
          "TABLE_tempinfo": {
            "ROW_tempinfo": [
              {
                "tempmod": "1", 
                "sensor": "Back        (D0)", 
                "majthres": "70", 
                "minthres": "45", 
                "curtemp": "33", 
                "alarmstatus": "Ok"
              }, 
              {
                "tempmod": "1", 
                "sensor": "Front-Middle(D1)", 
                "majthres": "70", 
                "minthres": "57", 
                "curtemp": "41", 
                "alarmstatus": "Ok"
              }, 
              {
                "tempmod": "1", 
                "sensor": "Front-Right (D2)", 
                "majthres": "70", 
                "minthres": "52", 
                "curtemp": "35", 
                "alarmstatus": "Ok"
              }, 
              {
                "tempmod": "1", 
                "sensor": "Front-Left  (D3)", 
                "majthres": "70", 
                "minthres": "51", 
                "curtemp": "35", 
                "alarmstatus": "Ok"
              }
            ]
          }
        }, 
        "input": "show environment", 
        "msg": "Success", 
        "code": "200"
      }
    }
  }
}