Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dumpj null field value bug #37

Open
JohannesGarm opened this issue Nov 28, 2024 · 3 comments
Open

dumpj null field value bug #37

JohannesGarm opened this issue Nov 28, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JohannesGarm
Copy link
Contributor

JohannesGarm commented Nov 28, 2024

Attempting to log some rendered templates, I ran into dumpj prints some fields as null even though dumps prints them fine.

Routing Instance template to be applied: [{"name": null}, {"instance-type": null}, {"protocols": {"evpn": {"encapsulation": "vxlan", "default-gatewa>

@krihal
Copy link
Collaborator

krihal commented Nov 28, 2024

Can you give an XML example which I can use to reproduce this?

@krihal krihal self-assigned this Nov 28, 2024
@krihal krihal added the bug Something isn't working label Nov 28, 2024
@JohannesGarm
Copy link
Contributor Author

ROUTING_INSTANCE_XML = '''
<instance cl:creator="evpn[service-name='{{SERVICE_NAME}}']" nc:operation="replace" xmlns:cl="http://clicon.org/lib" xmlns="http://yang.juniper.net/junos-qfx/conf/routing-instances">
    <name>MAC-VRF{{VLAN_ID}}_{{NI_ID}}</name>
    <instance-type>mac-vrf</instance-type>
    <protocols>
        <evpn>
            <encapsulation>vxlan</encapsulation>
            <default-gateway>no-gateway-community</default-gateway>
            <extended-vni-list>{{VLAN_ID}}</extended-vni-list>
        </evpn>
    </protocols>
    <vtep-source-interface>
    <interface-name>lo0.0</interface-name>
    </vtep-source-interface>
    <service-type>vlan-based</service-type>
    {{INTERFACES}}
    <route-distinguisher>
        <rd-type>{{RD_TYPE}}</rd-type>
    </route-distinguisher>
    <vrf-target>
        <community>target:{{VLAN_ID}}:{{VLAN_ID}}</community>
    </vrf-target>
    <vlans>
        <vlan>
            <name>VN{{VLAN_ID}}</name>
            <description>VN669</description>
            <vlan-id>{{VLAN_ID}}</vlan-id>
            <vxlan>
                <vni>{{VLAN_ID}}</vni>
            </vxlan>
        </vlan>
    </vlans>
</instance>
'''

@krihal
Copy link
Collaborator

krihal commented Nov 28, 2024

# Works
root = parse_template(
    xml, SERVICE_NAME="foo", VLAN_ID=1, NI_ID=2, INTERFACES="eth0", RD_TYPE="blah"
)

print(root.dumpj())

# Not working
root = parse_template(
    xml, SERVICE_NAME="foo", VLAN_ID=1, NI_ID=2, INTERFACES="eth0", RD_TYPE="blah"
).instance

print(root.dumpj())

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants