From a2cd3810d5c23116151658ae18d6070da434219e Mon Sep 17 00:00:00 2001 From: Jon Clayton Date: Tue, 25 May 2021 12:19:40 +0100 Subject: [PATCH] Feature/jimiplugin batfish beta1.0 (#15) * adding to access checker * testing icmp specifically * walked the results of policy checker * now able to display only the permitted hits * all results for all nodes * built results dict * structuring the results into a new object * building access result * now showing all permits * merging permit and deny lists * pulling data from tracetreelist and putting into accept object * adding fields * meaningful data now populating the acceptresult object * adding black formatting and optional type for annotation * tidy ups and annotations * re-engineering parts and adding more functionality / bare bones that wil allow jimi to execute the access checks * Major overhall and squashed a load of commits via rebase interactive renaming snapshot dir renaming snapshot dir setting folder sane defaults in one place fixes fixes fixes fixes fixes fixes various fixes to testing various fixes to testing various fixes to testing various fixes to testing various fixes to testing various fixes to testing various fixes to testing changes fixes fixes fixes fixes testing seems to be working now other than json serializable error seems to be working now other than json serializable error seems to be working now other than json serializable error major deletions and some comments major overhaul, renaming, making more readable, more comments adding drone ci file drone drone drone update drone update adding kube deployment restart * changing remoteConnectBatfish to batfishConnect * changing remoteConnectBatfish to batfishConnect * upgrading plugin version * upgrading plugin version * upgrading plugin version * drone * adding dstPorts as a header constraint * major changes, checks on text inputs, also adding ipProtocols and dstPorts * adding in Route Check to actions to build model adding in eachability check fix typo in reachability check * fixing things by removing old batfishops references that caused exceptions2 * fixing route check via debug * fixing reachability check * major works on deny results * sort reachability data structures and create a new class * WIP: testing simplyfying the returned results and putting into custom class/struct * testing creating new tr class/struct, seems to be working as it should now * more refactoring of reachability checker * a few tweaks to variables/args * work on route checker * latest route tweaks * happy with the traceroute checker in its current form. Its a bit bare bones and you have to ghand feed it the correct data but is working. * some moving around of file, refractoring, simplification and fixing a few issues with the returned data / dicts. Still need to fix the stack overflow that is happening when accessing the returned data. * change version to force re-register models * change version to force re-register models * change version to force re-register models * change version to force re-register models * tidy ups, better commenting, deletions, polishing, fixes, refactoring * moving files around * fixed problems with nodespec being a list but needing to be a string * lots of comments, deletions, tidy-ups and tweaks * remove unneeded brackets * more changes, try/catch, better comments, better naming of functions, adding dstPorts to the returned data * minor tweaks * some class name tweaks to follow best practice * some class name tweaks to follow best practice * docstrings, type hints and some fixes that flake8 reported * refactored and fixed typed hints, but discovered a possible bug with passing in multiple ports which should match more than one accept rule * more type hints * moved some very generic helpers out of a class into helper class with staticmethods, better checking and exceptino handling, more if/elif and logics to check data before starting, added a pre-flight check function * latest tests to find out why single port getting hit in results * adding dataclasses * removed an old helper that was causing an issue and isn't really needed (stopped ports working * have a working version that will iterate through ports separately. * renaming to make more sense * builder class testing (#7) * builder class testing * deleting old data class from w/end tests * moved a couple of helper functions out of data builder and into helpers * fixed an issue with the imports and a few other var naming issues Co-authored-by: Jon Clayton * changing TraceRoute view to a @dataclass (#12) Co-authored-by: Jon Clayton Co-authored-by: Jon Clayton --- includes/result_models/traceroute.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/includes/result_models/traceroute.py b/includes/result_models/traceroute.py index 1ff16b8..7430b71 100644 --- a/includes/result_models/traceroute.py +++ b/includes/result_models/traceroute.py @@ -1,15 +1,15 @@ +from dataclasses import dataclass + + +@dataclass() class DataviewTraceroute: - def __init__( - self, - ): - self.trace_disposition: str - self.hop_node: str - self.originatin_vrf: str - self.arp_ip: str - self.next_hop_ip: str - self.resolved_next_hop_ip: str - self.output_interface: str - self.network: str - self.via_protocol: str - pass + trace_disposition: str = None + hop_node: str = None + originatin_vrf: str = None + arp_ip: str = None + next_hop_ip: str = None + resolved_next_hop_ip: str = None + output_interface: str = None + network: str = None + via_protocol: str = None