Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
TextParser now supports composite_key
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Apr 29, 2017
1 parent f5565e5 commit 5e42826
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion napalm_yang/parsers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ def _parse_list_block(cls, mapping):
if isinstance(match, dict):
yield match["key"], match["block"] or "Aasd123asv", match["extra_vars"]
else:
composite_key = mapping.get("composite_key", None)

extra_vars = match.groupdict()
key = extra_vars.pop("key")
block = extra_vars.pop("block")

if composite_key:
key = " ".join([match.group(k) for k in composite_key])
else:
key = extra_vars.pop("key")
yield key, block, extra_vars

@classmethod
Expand Down

0 comments on commit 5e42826

Please sign in to comment.