Skip to content

Commit

Permalink
Network find: redux
Browse files Browse the repository at this point in the history
This patch addresses doing network find correctly when start and end
times are provided. Instead of merely running queries across all tables
in aggregate, we need to process each row from the ARP table separately.
This is because we need to match up with this time to identify the
correct outgoing interface including tracing the path through an L2
network to the final L2 switch.

Furthermore, many users suggested we display both bond members and the
bond interface itself instead of using resolve_bond=True. That is also
addressed in this patch.

We're making network find a pure find attach point locator for now.
Its only used to find the first hop switch that an IP/MAC is attached
to.

We'll expand to include others via either other verbs or some other
modification to find.

Finally, query-str was not handled correctly for network find even if
the user specified one. Fixed that too.
  • Loading branch information
ddutt committed Oct 24, 2021
1 parent a339e09 commit e6e8cb0
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 322 deletions.
11 changes: 4 additions & 7 deletions suzieq/cli/sqcmds/NetworkCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,25 @@ def show(self, os: str = "", vendor: str = "", model: str = "",

return self._gen_output(df)

@command("find", help="find an address, bgp session by asn, etc")
@command("find", help="find where an IP/MAC address is attached")
@argument("address", type=str, description="IP/MAC address to find")
@argument("vrf", type=str,
description="Find within this VRF, used for IP addr")
@argument("vlan", type=str,
description="Find MAC within this VLAN")
@argument("asn", type=str, description="Autonomous system number")
@argument("resolve_bond", type=bool, description="Resolve the bond")
def find(self, address: str = '', asn: str = '', vrf: str = '',
vlan: str = '', resolve_bond: bool = False):
"""Find a network object such as an IP address, BGP session, etc.
vlan: str = ''):
"""Find the network attach point of a given IP or MAC address.
"""
now = time.time()

df = self.sqobj.find(
namespace=self.namespace,
hostname=self.hostname,
address=address.split(),
asn=asn.split(),
vlan=vlan,
vrf=vrf,
resolve_bond=resolve_bond,
query_str=self.query_str,
)

self.ctxt.exec_time = "{:5.4f}s".format(time.time() - now)
Expand Down
Loading

0 comments on commit e6e8cb0

Please sign in to comment.