Skip to content

Assign secondary IP-Addresses to an interface when 'Syncing Network Data From Network' #389

@nerdfunk-net

Description

@nerdfunk-net

Environment

  • Nautobot version: 2.4.x
  • nautobot-device-onboarding version: 4.2.6a0

Proposed Functionality

Currently, only primary IP addresses of a network device (I am using Cisco devices) are added to an interface of a device. Secondary IP addresses are completely ignored. This means that many IP addresses are not included in IPAM. This may even lead to errors: If the management IP address is configured as “Secondary” on a device, it is unassigned in nautobot. After running the app, the device no longer has a primary address configured.

In general, it should be possible to assign a role to an IP address. I think there will be numerous use cases for this.

The command mapper of Cisco XE uses 'show interfaces' to gather the IP-addresses. To get the secondary IP-Adresses you have to use 'show ip interface' instead.

Use Case

I assume that many users use secondary IP addresses, especially when migrating networks. Secondary IP addresses are certainly used more often.

What to do

I have had a look at the whole thing and with a few changes it should work. I have changed the following:

  • In sync_network_data_models.py I have aded the role to 'class SyncNetworkDataIPAddress'. I have modified create and update so that the role is considered.

  • In sync_network_data_adapters.py I have modified 'load_ip_addresses' in 'class SyncNetworkDataNautobotAdapter' and in 'class SyncNetworkDataNetworkAdapter'

  • In 'diffsync_utils.py' I have modiefied 'get_or_create_ip_address'
    and in jinja_filters.py I have added a parser 'parse_cisco_xe_show_ip_interface'

I have forked the code and added my changes. The code seems to work. I haven't contributed code to an open source project yet. Also, the tests now seem to have problems with the new role. I am wondering how I could best contribute the code. It is also difficult for me to adapt the tests. Is there any way that someone can help me with this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions