vcenter-netbox-sync icon indicating copy to clipboard operation
vcenter-netbox-sync copied to clipboard

Specify a VRF in settings.py

Open inetman28 opened this issue 5 years ago • 7 comments

Is your feature request related to a problem? Please describe. I cannot specify a VRF to which ip-addresses will belong.

Describe the solution you'd like I have a lot of tenants with overlap ip-space.

inetman28 avatar May 06 '20 17:05 inetman28

Yes we have the same problem.

Fortunately everything in our vCenter belongs to the same VRF. So my solution at the moment is to declare a default VRF and make sure it is used for every ipam post/get request.

I still have some Problems when looking for existing addresses in Netbox but I can share my code after I fixed those.

Haeki avatar May 06 '20 20:05 Haeki

Hello @inetman28 and @Haeki!

I too have this need for one of my instances and wrote a function which lookups up the VRF based on the most specific matching parent prefix. As @inetman28 mentioned though, this does not solve the use case of having overlapping IPs thus I've left it out of the main project so far.

Would it be preferable to have an additional key in the vCenter hosts list that allows you to specify the VRF all IPs detected in that vCenter instance should go in to?

synackray avatar May 07 '20 12:05 synackray

Would it be preferable to have an additional key in the vCenter hosts list that allows you to specify the VRF all IPs detected in that vCenter instance should go in to?

exactly. This option must specify in vcenter hosts list because automatically ip-lookup will not work correctly.

inetman28 avatar May 07 '20 12:05 inetman28

Sounds good. I'll test that out and report back.

synackray avatar May 07 '20 12:05 synackray

Yes an additional key in the vCenter hosts list would be perfect. From my testing I can tell that the search_prefix() function needs to be changed. Also when checking in Netbox for existing IPs or prefixes the vrf has to be filtered or else there will be a Problem with multiple objects found.

Haeki avatar May 07 '20 12:05 Haeki

Got it. Those are all great points. Let me see what I can do.

synackray avatar May 07 '20 16:05 synackray

I created a Pull Request with my Implementation: Specify a VRF in settings.py Implementation We have been using this for the last few weeks without Problems. But I am not sure if this will be enough to deal with Identifying and assigning VRF and tenants problem #114 so maybe you will have to improve this further.

Haeki avatar Jun 23 '20 14:06 Haeki