print_structured_result
nornir_scrapli.functions.print_structured_result
print_structured_result(result: AggregatedResult, failed: bool = False, severity_level: int = logging.INFO, parser: str = 'textfsm', to_dict: bool = True, fail_to_string: bool = False) -> None
¶
Prints the :obj:nornir.core.task.Result
from a previous task to screen
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result |
AggregatedResult
|
Nornir AggregateResult object from a previous task |
required |
failed |
bool
|
if |
False
|
severity_level |
int
|
Print only errors with this severity level or higher |
logging.INFO
|
parser |
str
|
textfsm|genie -- parser to parse output with |
'textfsm'
|
to_dict |
bool
|
output structured data in dict form instead -- basically put k:v instead of just lists of lists of values for textfsm output; ignored if parser == "genie" |
True
|
fail_to_string |
bool
|
fallback to printing unstructured output or have tasks skipped (because print_result won't print empty lists which scrapli returns if parsing fails) |
False
|
Source code in functions/print_structured_result.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|