netenglabs / suzieq

Using network observability to operate and design healthier networks
https://www.stardustsystems.net/
Apache License 2.0
793 stars 106 forks source link

Junos-qfx data collection fails with some Junos releases #368

Open rasanentimo opened 3 years ago

rasanentimo commented 3 years ago

Description

I suppose these issues can be solved only by command/extraction version, https://suzieq.readthedocs.io/en/latest/service/service-format/#version but this is not introduced yet.

The first one is related to LLDP. Suzieq tries to collect LLDP data from Junos QFX switch with command

show lldp neighbors detail | display json | no-more

but the command doesn't have the option 'detail' on the older Junos releases (seems the detail option was introduced in ~18 version)

> show lldp neighbors ?
Possible completions:
  <[Enter]>            Execute this command
  interface            Show LLDP neighbors on this interface
  |                    Pipe through a command
{master:0}
2021-04-28 05:30:09,949 - suzieq.poller.services.service - ERROR - Received non-JSON output where JSON was expected for show lldp neighbors detail | display json | no-more on node old-QFX,
error: syntax error, expecting <command>: detail

The second one is related to command show system uptime | display json which seem to have have some difference as well and it doesn't match the current normalization.

2021-04-29 12:19:36,580 - suzieq.poller.nodes.node - WARNING - Unable to parse junos boot time from {
    "system-uptime-information" : [
    {
        "attributes" : {"xmlns" : "http://xml.juniper.net/junos/20.4R0/junos"},
        "current-time" : [
        {
            "date-time" : [
            {
                "data" : "2021-04-29 12:19:36 UTC",
                "attributes" : {"junos:seconds" : "1619698776"}
            }
            ]
        }
        ],
        "time-source" : [
        {
            "data" : " NTP CLOCK "
        }
        ],
        "system-booted-time" : [
        {
            "date-time" : [
            {
                "data" : "2021-02-04 14:57:59 UTC",
                "attributes" : {"junos:seconds" : "1612450679"}
            }
            ],
            "time-length" : [
            {
                "data" : "11w6d 21:21",
                "attributes" : {"junos:seconds" : "7248097"}
            }
            ]
        }
        ],
        "protocols-started-time" : [
        {
            "date-time" : [
            {
                "data" : "2021-02-04 14:58:33 UTC",
                "attributes" : {"junos:seconds" : "1612450713"}
            }
            ],
            "time-length" : [
            {
                "data" : "11w6d 21:21",
                "attributes" : {"junos:seconds" : "7248063"}
            }
            ]
        }
        ],
        "last-configured-time" : [
        {
            "date-time" : [
            {
                "data" : "2021-04-28 10:07:52 UTC",
                "attributes" : {"junos:seconds" : "1619604472"}
            }
            ],
            "time-length" : [
            {
                "data" : "1d 02:11",
                "attributes" : {"junos:seconds" : "94304"}
            }
            ],
            "user" : [
            {
                "data" : "user"
            }
            ]
        }
        ],
        "uptime-information" : [
        {
            "date-time" : [
            {
                "data" : "12:19PM",
                "attributes" : {"junos:seconds" : "1619698776"}
            }
            ],
            "up-time" : [
            {
                "data" : "83 days, 21:22",
                "attributes" : {"junos:seconds" : "7248120"}
            }
            ],
            "active-user-count" : [
            {
                "data" : "0",
                "attributes" : {"junos:format" : "0 users"}
            }
            ],
            "load-average-1" : [
            {
                "data" : "0.27"
            }
            ],
            "load-average-5" : [
            {
                "data" : "0.29"
            }
            ],
            "load-average-15" : [
            {
                "data" : "0.30"
            }
            ],
            "user-table" : [
            {
            }
            ]
        }
        ]
    }
    ]
}

Steps to reproduce

Issue command show lldp neighbors ? on a Junos QFX switch.

Tested with following hw/sw combinations

Model: qfx5200-32c-32q, Junos: 15.1X53-D232.3 Model: qfx10002-72q, Junos: 17.3R3-S1.5 Model: qfx5100-24q-2p, Junos: 14.1X53-D35.3

> show lldp neighbors | display json
{
    "lldp-neighbors-information" : [
    {
        "attributes" : {"junos:style" : "brief"},
        "lldp-neighbor-information" : [
        {
            "lldp-local-port-id" : [
            {
                "data" : "et-0/0/1"
            }
            ],
            "lldp-local-parent-interface-name" : [
            {
                "data" : "ae1"
            }
            ],
            "lldp-remote-chassis-id-subtype" : [
            {
                "data" : "Mac address"
            }
            ],
            "lldp-remote-chassis-id" : [
            {
                "data" : "14:14:14:14:14:14"
            }
            ],
            "lldp-remote-port-description" : [
            {
                "data" : "fortyGigE 1/53"
            }
            ],
            "lldp-remote-system-name" : [
            {
                "data" : "switch"
            }
            ]
        },
rasanentimo commented 3 years ago

Here's another log message related to this topic

2021-04-29 12:19:38,143 - suzieq.poller.services.service - ERROR - Processing data failed for service evpnVni on node QFX
Traceback (most recent call las):
  File "/root/.local/lib/python3.7/site-packages/suzieq/poller/services/service.py", line 654, in run
    result = self.process_data(output)
  File "/root/.local/lib/python3.7/site-packages/suzieq/poller/services/service.py", line 375, in process_data
    return self.clean_data(result, data)
  File "/root/.local/lib/python3.7/site-packages/suzieq/poller/services/service.py", line 432, in clean_data
    processed_data = dev_clean_fn(processed_data, raw_data)
  File "/root/.local/lib/python3.7/site-packages/suzieq/poller/services/evpnVni.py", line 168, in _clean_junos_data
    'vlan': int(vlan),
ValueError: invalid literal for int() with base 10: 'None'

{
    "vxlan-source-vtep-information" : [
    {
        "attributes" : {"xmlns" : "http://xml.juniper.net/junos/20.4R0/junos-l2al"},
        "svtep-format" : [
        {
            "vtep-logical-system-name" : [
            {
                "data" : "&lt;default&gt;"
            }
            ],
            "vtep-logical-system-id" : [
            {
                "data" : "0"
            }
            ],
            "source-vtep-address" : [
            {
                "data" : "4.4.4.2"
            }
            ],
            "source-vtep-interface" : [
            {
                "data" : "lo0.0"
            }
            ],
            "source-vtep-interface-id" : [
            {
                "data" : "547"
            }
            ],
            "l3-id" : [
            {
                "data" : "0"
            }
            ],
            "vxlan-remote-vtep-information" : [
            {
                "attributes" : {"xmlns" : "http://xml.juniper.net/junos/20.4R0/junos-l2al"},
                "remote-vtep-address" : [
                {
                    "data" : "4.4.4.1"
                }
                ],
                "vtep-routing-instance-name" : [
                {
                    "data" : "default-switch"
                }
                ],
                "remote-vtep-interface-index" : [
                {
                    "data" : "594"
                }
                ],
                "remote-vtep-interface-name" : [
                {
                    "data" : "vtep.32769"
                }
                ],
                "remote-vtep-nh-id" : [
                {
                    "data" : "2276"
                }
                ],
                "remote-vtep-mode" : [
                {
                    "data" : "RNVE"
                }
                ],
                "vxlan-dynamic-information" : [
                {
                    "attributes" : {"junos:style" : "without-nhid"},
                    "vxlan-format" : [
                    {
                        "vn-id" : [
                        {
                            "data" : "1000990"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002500"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1000500"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1000550"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1000599"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002000"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002010"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002496"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002497"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    },
                    {
                        "vn-id" : [
                        {
                            "data" : "1002498"
                        }
                        ],
                        "multicast-address" : [
                        {
                            "data" : "0.0.0.0"
                        }
                        ]
                    }
                    ]
                }
                ]
            }
            ]
        }
        ]
    }
    ]
}```
ddutt commented 2 years ago

This has been fixed for LLDP since version 0.16.0 Please try with version 0.17.1 and let me know if it works. Please close the issue if it works.