Skip to content
This repository was archived by the owner on Jan 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 3 additions & 12 deletions templates/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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):
"""
Expand All @@ -684,18 +684,14 @@ 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
:type mtu: int,optional
: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
Expand All @@ -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,
Expand Down