-
Notifications
You must be signed in to change notification settings - Fork 40
Codegen for netconf merge #70
Copy link
Copy link
Open
Description
It should be possible to generate the code for def _state_merged method
Two additional pieces of information are required in order to accomplish the codegen
- singular entity name
- key name
Proposal:
Add RESOURCE_KEY_NAMEand RESOURCE_SINGULAR to template:
---
NETWORK_OS: myos
RESOURCE: interfaces
RESOURCE_SINGULAR: interface
RESOURCE_KEY_NAME: name
COPYRIGHT: Copyright 2019 Red Hat
LICENSE: gpl-3.0.txtThis would allow the template to be:
def _state_merged(self, want, have):
""" The command generator when state is merged
:rtype: A list
:returns: the xml necessary to migrate the current configuration
to the desired configuration
"""
{{ resource }}_xml = []
for child in want:
{{ resource }} = build_root_xml_node("{{ resource }}")
{{ resource_singular }}= build_child_xml_node({{ resource }}, "{{ resource_singular }}")
build_child_xml_node(
{{ resource_singular }}, "{{ resource_key_name }}", child["{{ resource_key_name }}"]
)
return {{ resource }}_xmlAdditional codegen could be implemented based on the schema of the resource.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels