Skip to content

Commit 6c49828

Browse files
authored
Merge pull request #793 from netenglabs/fix-device-version-ne
Fix device version ne
2 parents b3bb719 + 5c79e63 commit 6c49828

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

suzieq/engines/pandas/device.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def get(self, **kwargs):
117117
df = df.loc[df.status.isin(status)]
118118
if os_version:
119119
opdict = {'>': operator.gt, '<': operator.lt, '>=': operator.ge,
120-
'<=': operator.le, '=': operator.eq, '!=': operator.ne}
120+
'<=': operator.le, '=': operator.eq, '!': operator.ne}
121121
op = operator.eq
122122
for osv in os_version:
123+
# Introduced in 0.19.1, we do this for backwards compatibility
124+
osv = osv.replace('!=', '!')
123125
for elem, val in opdict.items():
124126
if osv.startswith(elem):
125127
osv = osv.replace(elem, '')

suzieq/poller/worker/nodes/node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,11 @@ async def _parse_device_type_hostname(self, output, _) -> None:
409409
f'Detected {devtype} for {self.address}:{self.port},'
410410
f' {hostname}')
411411
self._set_devtype(devtype, version_str)
412-
self._set_hostname(hostname)
412+
# We don't set the hostname here because the real hostname
413+
# is retrieved via a different command on some platforms
414+
# and can contain the FQDN. The hostname stored with a
415+
# record needs to be one that is also used in LLDP so that we
416+
# can find interface peers
413417
self.current_exception = None
414418

415419
async def _detect_node_type(self):

tests/integration/sqcmds/common-samples/not.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102769,3 +102769,24 @@ tests:
102769102769
["ae1", "ae2", "ge-0/0/0"], "vlan": 10, "timestamp": 1631009089744}, {"namespace":
102770102770
"vmx", "hostname": "CRP-DIS-SW01", "vlanName": "vl20", "state": "active", "interfaces":
102771102771
["ae1", "ae2", "ge-0/0/0"], "vlan": 20, "timestamp": 1631009089744}]'
102772+
- command: device show --version="!9.3(4)" --namespace=nxos --format=json
102773+
data-directory: tests/data/parquet/
102774+
marks: device show negate
102775+
output: '[{"namespace": "nxos", "hostname": "server101", "model": "vm", "version":
102776+
"18.04.3 LTS", "vendor": "Ubuntu", "architecture": "x86-64", "status": "alive",
102777+
"address": "10.255.2.204", "bootupTimestamp": 1619182381.0, "timestamp": 1619275256203},
102778+
{"namespace": "nxos", "hostname": "server102", "model": "vm", "version": "18.04.3
102779+
LTS", "vendor": "Ubuntu", "architecture": "x86-64", "status": "alive", "address":
102780+
"10.255.2.39", "bootupTimestamp": 1619182381.0, "timestamp": 1619275256290}, {"namespace":
102781+
"nxos", "hostname": "server301", "model": "vm", "version": "18.04.3 LTS", "vendor":
102782+
"Ubuntu", "architecture": "x86-64", "status": "alive", "address": "10.255.2.140",
102783+
"bootupTimestamp": 1619182381.0, "timestamp": 1619275256319}, {"namespace": "nxos",
102784+
"hostname": "server302", "model": "vm", "version": "18.04.3 LTS", "vendor": "Ubuntu",
102785+
"architecture": "x86-64", "status": "alive", "address": "10.255.2.114", "bootupTimestamp":
102786+
1619182381.0, "timestamp": 1619275256394}, {"namespace": "nxos", "hostname": "firewall01",
102787+
"model": "vm", "version": "18.04.3 LTS", "vendor": "Ubuntu", "architecture": "x86-64",
102788+
"status": "alive", "address": "10.255.2.249", "bootupTimestamp": 1619013132.0,
102789+
"timestamp": 1619275256497}, {"namespace": "nxos", "hostname": "dcedge01", "model":
102790+
"vqfx-10000", "version": "19.4R1.10", "vendor": "Juniper", "architecture": "",
102791+
"status": "alive", "address": "10.255.2.250", "bootupTimestamp": 1619013129.329,
102792+
"timestamp": 1619275258329}]'

0 commit comments

Comments
 (0)