Closed elkinaguas closed 6 years ago
I think you hit a bug in the profile. I suspect the problem is here:
As you don't have a routing instance I suspect that's returning nothing and not processing the rules for "network-instance". Would you mind trying to create a dummy routing instance and checking if the problem goes away? In that case we will have to fix that. I think the following should work:
network-instances:
_process:
- path: "configuration"
from: root_network-instances.0
network-instance:
_process:
- key: "{{ 'global' }}"
- path: "routing-instances.instance"
key: name
Please, give it a go if you can and let me know (or send a PR if it works or if you have any other suggestion)
fwiw I replicated the issue from @elkinaguas (napalm-yang returned {}), and implemented @dbarrosop suggestion and it looks like it worked: test.py:
running_config = napalm_yang.base.Root()
running_config.add_model(napalm_yang.models.openconfig_network_instance)
running_config.parse_config(native=[config], profile=["junos"])
pretty_print(running_config.get(filter=True))
Before @dbarrosop's suggestion:
[user@net01 napalm-yang]$ ./test.py
{}
After @dbarrosop's suggestion:
[user@net01 napalm-yang]$ ./test.py
{
"network_instances": {
"network-instance": {
"global": {
"config": {
"enabled": True,
"type": "DEFAULT_INSTANCE"
},
"name": "global",
"protocols": {
"protocol": {
"bgp bgp": {
"bgp": {
"global": {
"config": {
"as": 65000,
"router-id": "192.168.9.9"
}
},
"neighbors": {
"neighbor": {
"192.168.11.11": {
"config": {
"local-as": 65000,
"neighbor-address": "192.168.11.11",
"peer-group": "ibgp"
},
"neighbor-address": "192.168.11.11"
},
"192.168.22.22": {
"config": {
"local-as": 65000,
"neighbor-address": "192.168.22.22",
"peer-group": "ibgp"
},
"neighbor-address": "192.168.22.22"
}
}
}
},
"identifier": "bgp",
"name": "bgp"
},
"lldp lldp": {
"identifier": "lldp",
"name": "lldp"
},
"ospf ospf": {
"identifier": "ospf",
"name": "ospf"
},
"pim pim": {
"identifier": "pim",
"name": "pim"
},
"static static": {
"identifier": "static",
"name": "static",
"static-routes": {
"static": {
"0.0.0.0/0": {
"config": {
"prefix": "0.0.0.0/0"
},
"prefix": "0.0.0.0/0"
}
}
}
}
}
}
}
}
}
}
The translator is a different story :)
Glad to see it worked :) feel free to send a PR if you have the energy, otherwise I will try to find some time and PR it myself (my backlog keeps growing :( )
Is the translator also misbehaving? That's odd. Would you mind sharing your tests and findings there?
Thanks @dbarrosop and @cspeidel for your fast response, I made the change and I confirm that now it works. Very helpful now that I'm still understanding napalm-yang. I will make the PR.
Glad to hear, I will close this issue, feel free to reopen though if there is anything else to address.
Hello, I'll put you in context, I'm trying to populate a model with the BGP configuration from a Junos (JUNOS 12.1X47-D15.4) router that I set up with Vagrant and Virtualbox, here the tutorial. To populate the model I parse the configuration from the device using the
network_instance
model but this is only returning an empty set of curly brackets:{}
.I tried populating the
interfaces
model by the same method and it works just fine. At the beginning I thought that thenetwork_instance
profile was not yet implemented for Junos, but I checked here and I saw that some parts are implemented, e.g. the part for the getting theas-number
, and therouter-id
.I tried populating the model the same way but with an EOS router, also implemented with Vagrant and Virtualbox, and in both cases, with the
interfaces
and thenetwork_instance
model, it worked perfectly. I compared thenetwork_instance
profiles for EOS and Junos and noticed that for both the same parts were implemented, which brings me to my question, why is theparse_config
function returning no information for thenetwork_instance
model in Junos if the profile is already implemented?Maybe I'm forgetting or not noticing something and this is not really a problem, but I don't know what else to do to make this work or if this is not supposed to work yet. I hope some one can take a look at it.
Thanks for reading, Elkin
MORE CONTEXT 1. Here the code I'm using:
2. Router Config: