netbox-ssot icon indicating copy to clipboard operation
netbox-ssot copied to clipboard

[Bug] Primary IP selection with VMware

Open n-rodriguez opened this issue 8 months ago • 6 comments

Is this urgent?

Yes, it's critical

How are you running netbox-ssot?

From source (Go)

Which version of netbox are you using

4.2.6

Which version of netbox-ssot are you running

1.11.4

Which module has the issue?

VMware

Share your configuration

---
logger:
  level: 3
  dest: ""

netbox:
  apiToken: "foo"
  hostname: "netbox.foo.corp"
  httpScheme: http
  port: 80
  timeout: 30
  sourcePriority: ["vcenter67.corp"]
  removeOrphans: false

source:
  - name: vcenter67.corp
    type: vmware
    hostname: vcenter67.corp
    username: [email protected]
    password: "password"
    clusterSiteRelations:
      - .* = Foo
    hostSiteRelations:
      - .* = Foo
    clusterTenantRelations:
      - .* = ACME
    hostTenantRelations:
      - .* = ACME
    vmTenantRelations:
      - .* = ACME
    hostRoleRelations:
      - .* = Hypervisor ESX
    vmRoleRelations:
      - .* = Virtual Machine ESX
    vlanTenantRelations:
      - .* = ACME
    vlanSiteRelations:
      - .* = Foo

What is the problem?

netbox-ssot picks the wrong primary ip address

Steps to reproduce

  1. create a vm with 2 ip addresses
  2. run netbox-ssot
  3. the wrong primary ip address is assigned to the virtual machine in netbox

What did you expect to happen?

The right primary ip address is assigned to the virtual machine in netbox

What actually happened?

the wrong primary ip address is assigned to the virtual machine in netbox

Share DEBUG-level logs (remove sensitive information)


Share your environment details

No response

n-rodriguez avatar Mar 27 '25 17:03 n-rodriguez

I think we should use vmwareVM.Guest.IpAddress and vmwareVM.Guest.Net to get VM ip addresses (like netbox-sync: https://github.com/bb-Ricardo/netbox-sync/blob/main/module/sources/vmware/connection.py#L2432) :

2025/03/27 23:29:02 vmware_sync.go:1263 DEBUG   (vcenter.corp): FOO: foo.corp => 10.3.26.251 # vmwareVM.Guest.IpAddress (this is the real primary ip address)
2025/03/27 23:29:02 vmware_sync.go:1271 DEBUG   (vcenter.corp): FOO: foo.corp => [10.3.26.251 10.3.26.248 10.3.26.243 10.3.26.154 10.3.26.249 10.3.26.247 10.3.26.228 fe80::20c:29ff:fe35:e1f2] # vmwareVM.Guest.Net

2025/03/27 23:29:02 vmware_sync.go:1263 DEBUG   (vcenter.corp): FOO: bar.corp => 10.3.26.152 # vmwareVM.Guest.IpAddress (this is the real primary ip address)
2025/03/27 23:29:02 vmware_sync.go:1271 DEBUG   (vcenter.corp): FOO: bar.corp => [10.3.26.152 10.3.26.3 fe80::250:56ff:febe:363d] # vmwareVM.Guest.Net

n-rodriguez avatar Mar 27 '25 22:03 n-rodriguez

Hey nice find, I agree. Logic for selecting primary IP was never properly implemented.

bl4ko avatar Mar 28 '25 14:03 bl4ko

@bl4ko hi there! any news?

n-rodriguez avatar Apr 10 '25 08:04 n-rodriguez

@bl4ko hi there! any news? this issue is blocking us 😢 thank you!

n-rodriguez avatar Apr 23 '25 09:04 n-rodriguez

@bl4ko hi there! any news? this issue is really blocking us to the point I'm thinking to rollback to netbox-sync (because we generate Icinga configuration from Netbox inventory and not having the right primary address leads to manual modifications which is really painful) 😢 thank you!

n-rodriguez avatar May 05 '25 15:05 n-rodriguez

Hi, sorry for late reply. Currentlly I don't have much time to maintain this anymore 🙁. It also looks like, that SRC-doo won't be making changes to this in the near future, so I guess currently your best bet is to rollback to netbox-sync.

bl4ko avatar May 05 '25 15:05 bl4ko

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 05 '25 02:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jul 12 '25 03:07 github-actions[bot]