-
Notifications
You must be signed in to change notification settings - Fork 46
Conversation
* develop: Fixed mappers to use real yang names Fixes \napalm-automation#36 Don't assume device_config is a list of strings. Fix indent level in _exec_commands Added ansible examples to the tutorial Added ansible examples Bump version Updating requirements Load dict now update even on defaults and added compliance_report to Root class Conflicts: napalm_yang/parser.py
This parser can understand Python dictionaries from devices and JSON strings injected into native.
component: | ||
_parse: | ||
mode: dict | ||
from: "{%- set data = {} -%}{%- for k, v in bookmarks.components.0.0.items() -%}{%- if v is mapping and k is not equalto 'systemInformation' -%}{%- for kk, vv in v.items() -%}{%- do data.update({'{}_{}'.format(k,kk): vv}) -%} {%- endfor -%} {%- endif -%} {%- endfor -%} {{ data|json }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbarrosop commented in slack that this might be better implemented as a custom filter, which I had not thought of. Should we standardize device output transformation through filters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it can be generalized, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_parse_leaf_transform(cls, mapping):
Have a mapping["method"] to call? How would we make sure the method is imported? Looking at how complex transforming the json into the model is, doing the brunt of the transformation in python might be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should have helpers in the driver classes to transform data for us?
I will pull your branch during the weekend and try to use it for parsing interfaces' state before merging. |
* develop: Now you can have a closing steatement for list elements Unify naming Removed root BGP and added network instances with all protocols instead Update README.md
* init_native: Now you can have a closing steatement for list elements Unify naming Removed root BGP and added network instances with all protocols instead Update README.md
Sorry for the late reply on this. This looks good but CI is broken :( |
Will look this weekend
|
Yes, the JSON in matches the JSON out. Go figure.
I am holding onto this one for a few more days. I am going to implement some changes that might break your PR but don't worry about that. I will fix them myself and then merge :) |
Can we decouple the |
Sure, will rebase today, and work on creating openconfig-interfaces eos profile |
Great, thanks. Don't try to parse too much, something similar to the |
* develop: (74 commits) add post-process-filter attribute to text parser (napalm-automation#59) Allow each parser to modify native on start (napalm-automation#28) Updated CHANGELOG Updated docs Removed negate_recursively as it's unnecessary Added network-instance/junos translator Added reuse and replace_on_merge When using lists of actions allow advancing containers in xml Added _translate_leaf_map Added config parser for network-instances/junos Added missing key Various improvement to xml parser Minor fix to network-instance/eos Added tests for network-instance/eos Added network-instance parser/translator for EOS We can now remove elements recursively in cases where the nesting of YANG model doesnt reflect the nesting in native configuration Minor fixes to the logic of the lists Propagate attribute name rather than yang_name Adapted network instances model to lists Find translation point per rule as before ... Conflicts: napalm_yang/helpers.py napalm_yang/parser.py
Jesus that merge took longer to troubleshoot than I thought it would. Will work on replacing openconfig-platform with openconfig-interfaces for test case purposes next. |
Couple of notes:
|
Further note -- this profile is mostly just for testing, as it cannot correctly handle subinterfaces, which show up as regular interfaces in native. :/ |
It's alright. I am going to merge it as I want to re-do some parts of the whole parser framework and I will break stuff so having it merged will allow me to fix it myself rather than having to ask you again to do it yourself. In case you are curious, I want to do three main changes to the framework:
|
Basic JSON parser, first profile using it, and a bonus profile template for openconfig-platform.
This branch is based on #28