From 67062cbaa22f45a95324f3bc9c5959bc0853980b Mon Sep 17 00:00:00 2001 From: Gregory Storme Date: Tue, 18 Aug 2020 20:33:56 +0200 Subject: [PATCH] remove interface type on interfaces of virtual_machine objects --- run.py | 2 -- templates/netbox.py | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/run.py b/run.py index 23601b2..9d991ed 100644 --- a/run.py +++ b/run.py @@ -663,7 +663,6 @@ def get_objects(self, vc_obj_type): results["interfaces"].append(nbt.device_interface( device=truncate(obj_name, max_len=64), name=nic_name, - itype=0, # Virtual mac_address=vnic.spec.mac, mtu=vnic.spec.mtu, tags=self.tags, @@ -738,7 +737,6 @@ def get_objects(self, vc_obj_type): results["virtual_interfaces"].append( nbt.vm_interface( virtual_machine=obj_name, - itype=0, name=nic_name, mac_address=nic.macAddress, enabled=nic.connected, diff --git a/templates/netbox.py b/templates/netbox.py index b1eed35..1be8e93 100644 --- a/templates/netbox.py +++ b/templates/netbox.py @@ -269,7 +269,7 @@ def device(self, name, device_role, device_type, platform=None, site=None, } return remove_empty_fields(obj) - def device_interface(self, device, name, itype, enabled=None, mtu=None, + def device_interface(self, device, name, itype=None, enabled=None, mtu=None, mac_address=None, mgmt_only=None, description=None, cable=None, mode=None, untagged_vlan=None, tagged_vlans=None, tags=None): @@ -281,7 +281,7 @@ def device_interface(self, device, name, itype, enabled=None, mtu=None, :param name: Name of the physical interface :type name: str :param itype: Type of interface `0` if Virtual else `32767` for Other - :type itype: int + :type itype: int,optional :param enabled: `True` if the interface is up else `False` :type enabled: bool,optional :param mtu: The configured MTU for the interface @@ -674,7 +674,7 @@ def vlan(self, vid, name, site=None, group=None, tenant=None, status=None, } return remove_empty_fields(obj) - def vm_interface(self, virtual_machine, name, itype=0, enabled=None, + def vm_interface(self, virtual_machine, name, enabled=None, mtu=None, mac_address=None, description=None, mode=None, untagged_vlan=None, tagged_vlans=None, tags=None): """ @@ -684,8 +684,6 @@ def vm_interface(self, virtual_machine, name, itype=0, enabled=None, :type virtual_machine: str :param name: Name of the physical interface :type name: str - :param itype: Type of interface `0` if Virtual else `32767` for Other - :type itype: str, optional :param enabled: `True` if the interface is up else `False` :type enabled: bool,optional :param mtu: The configured MTU for the interface @@ -693,9 +691,7 @@ def vm_interface(self, virtual_machine, name, itype=0, enabled=None, :param mac_address: The MAC address of the interface :type mac_address: str, optional :param description: Description for the interface - :itype description: str, optional :param mode: `100` if access, `200` if tagged, or `300 if` tagged for all vlans - :itype mode: int, optional :param untagged_vlan: NetBox VLAN object id of untagged vlan :type untagged_vlan: int, optional :param tagged_vlans: List of NetBox VLAN object ids for tagged VLANs @@ -706,11 +702,6 @@ def vm_interface(self, virtual_machine, name, itype=0, enabled=None, obj = { "virtual_machine": {"name": truncate(virtual_machine, max_len=64)}, "name": name, - "itype": self._version_dependent( - nb_obj_type="interfaces", - key="type", - value=itype - ), "enabled": enabled, "mtu": mtu, "mac_address": mac_address.upper() if mac_address else None,