Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

intro-mdp/mission01/netconf_functions.py doesn't handle multiple addresses #43

Open
mbrainar opened this issue Nov 5, 2018 · 1 comment

Comments

@mbrainar
Copy link

mbrainar commented Nov 5, 2018

When running the solution, I get the following error:

Device: ios-xe-mgmt.cisco.com
  Interface: GigabitEthernet2
Traceback (most recent call last):
  File "netconf_configure_ips.py", line 62, in <module>
    check_ip(device)
  File "/Users/mbrainar/coding/DevNet/dnav3-code/intro-mdp/mission01/netconf_functions.py", line 81, in check_ip
    ipv4["ip"], ipv4["config"]["prefix-length"]
TypeError: list indices must be integers or slices, not str

I believe it is because the instance of ios-xe-mgmt.cisco.com has multiple addresses configured on GigabitEthernet2:

<ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
                                                        <addresses>
                                                                <address>
                                                                        <ip>10.255.255.1</ip>
                                                                        <config>
                                                                                <ip>10.255.255.1</ip>
                                                                                <prefix-length>24</prefix-length>
                                                                        </config>
                                                                </address>
                                                                <address>

                                                                        <ip>10.255.255.10</ip>
                                                                        <config>
                                                                                <ip>10.255.255.10</ip>
                                                                                <prefix-length>31</prefix-length>
                                                                        </config>
                                                                </address>
                                                                <address>
                                                                        <ip>10.255.255.12</ip>
                                                                        <config>
                                                                                <ip>10.255.255.12</ip>
                                                                                <prefix-length>24</prefix-length>
                                                                        </config>
                                                                </address>
                                                        </addresses>
                                                </ipv4>
@einarnn
Copy link
Contributor

einarnn commented Nov 5, 2018

Just an FYI, but the openconfig model in theory allows multiple IP addresses on a subinterface. The first should be assigned as the primary IP and other should be added as secondary IP addresses. However, the problem above seems to be more about a Python coding error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants