Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Remove itype from vm_interface #128

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gstorme
Copy link

@gstorme gstorme commented Aug 18, 2020

Upon running a vcenter sync, the interfaces of virtual machine objects would always be updated with a PATCH, but without making any real changes.
The change would be visible in the GUI but without any difference.

Also, the interface type on a vm_interface is removed in Netbox 2.9, since this is always virtual.

GET /api/virtualization/interfaces/1924/

{
  "id": 1924,
  "virtual_machine": {
    "id": 836,
    "url": "https://netbox.masked-ops.net/api/virtualization/virtual-machines/836/",
    "name": "masked-virtual_machine"
  },
  "name": "vNIC0",
  "type": {
    "value": "virtual",
    "label": "Virtual"
  },
  "enabled": true,
  "mtu": null,
  "mac_address": "00:50:56:98:00:BF",
  "description": "",
  "mode": null,
  "untagged_vlan": null,
  "tagged_vlans": [],
  "tags": [
    "vCenter",
    "Synced",
    "masked-vcenter006"
  ]
}

Debug log upon sync doing a unnecessary PATCH, changing nothing, but reporting a change:

[DEBUG] Sending GET to 'https://netbox.masked-ops.net/api/virtualization/interfaces/?virtual_machine=masked-virtual_machine&name=vNIC0&?tag=masked-vcenter006' with data 'None'.
[DEBUG] Received HTTP Status 200.
[DEBUG] NetBox GET request OK; returned 200 status.
[DEBUG] NetBox virtual_interfaces object 'vNIC0' already exists. Comparing values.
[DEBUG] vc_data[virtual_machine] and nb_data[virtual_machine] contain dictionary. Evaluating.
[DEBUG] vc_data[virtual_machine][name] and nb_data[virtual_machine][name] values match.
[DEBUG] Final dictionary compare result: True
[DEBUG] vc_data[virtual_machine] and nb_data[virtual_machine] values match.
[DEBUG] vc_data[name] and nb_data[name] values match.
[DEBUG] vc_data[itype] not a valid key in nb_data[itype].
[DEBUG] vc_data[itype] and nb_data[itype] values do not match.
[INFO] NetBox virtual_interfaces object 'vNIC0' do not match current values.
[DEBUG] Merging tags between vCenter and NetBox object.
[DEBUG] Sending PATCH to 'https://netbox.masked-ops.net/api/virtualization/interfaces/1924/' with data '{'virtual_machine': {'name': 'masked-virtual_machine'}, 'name': 'vNIC0', 'itype': 'virtual', 'enabled': True, 'mac_address': '00:50:56:98:00:BF', 'tags': ['masked-vcenter006', 'vCenter', 'Synced']}'.
[DEBUG] Received HTTP Status 200.
[DEBUG] NetBox PATCH request OK; returned 200 status.

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

Successfully merging this pull request may close these issues.

1 participant