internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: netbox-community/netbox

Issue:
Customizable Device Type > Interface > Form Factor
The 'Form Factor' list is missing "10GE (Copper)" and/or "100M/1G/10G (Copper)" types used on 10GBASE-T devices like Cisco's Nexus 93120TX switch.

This can be resolved by either making the Form Factor list customizable, or adding the necessary 10GBASE-T form factor (which is _not_ available in 10GE SFP+ form factor due to limited SFP+ power).



Discussion:
Will add this and probably some others to the static list. Definitely want to avoid custom interface form factors since only a finite set exists in the real world.


Resolving patch:
diff --git a/netbox/dcim/migrations/0003_auto_20160628_1721.py b/netbox/dcim/migrations/0003_auto_20160628_1721.py
new file mode 100644
--- /dev/null
+++ b/netbox/dcim/migrations/0003_auto_20160628_1721.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-06-28 17:21
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('dcim', '0002_auto_20160622_1821'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='interface',
+            name='form_factor',
+            field=models.PositiveSmallIntegerField(choices=[[0, b'Virtual'], [800, b'10/100M (100BASE-TX)'], [1000, b'1GE (1000BASE-T)'], [1100, b'1GE (SFP)'], [1150, b'10GE (10GBASE-T)'], [1200, b'10GE (SFP+)'], [1300, b'10GE (XFP)'], [1400, b'40GE (QSFP+)']], default=1200),
+        ),
+        migrations.AlterField(
+            model_name='interfacetemplate',
+            name='form_factor',
+            field=models.PositiveSmallIntegerField(choices=[[0, b'Virtual'], [800, b'10/100M (100BASE-TX)'], [1000, b'1GE (1000BASE-T)'], [1100, b'1GE (SFP)'], [1150, b'10GE (10GBASE-T)'], [1200, b'10GE (SFP+)'], [1300, b'10GE (XFP)'], [1400, b'40GE (QSFP+)']], default=1200),
+        ),
+    ]
diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py
--- a/netbox/dcim/models.py
+++ b/netbox/dcim/models.py
@@ -45,14 +45,16 @@
 IFACE_FF_100M_COPPER = 800
 IFACE_FF_1GE_COPPER = 1000
 IFACE_FF_SFP = 1100
+IFACE_FF_10GE_COPPER = 1150
 IFACE_FF_SFP_PLUS = 1200
 IFACE_FF_XFP = 1300
 IFACE_FF_QSFP_PLUS = 1400
 IFACE_FF_CHOICES = [
     [IFACE_FF_VIRTUAL, 'Virtual'],
-    [IFACE_FF_100M_COPPER, '10/100M (Copper)'],
-    [IFACE_FF_1GE_COPPER, '1GE (Copper)'],
+    [IFACE_FF_100M_COPPER, '10/100M (100BASE-TX)'],
+    [IFACE_FF_1GE_COPPER, '1GE (1000BASE-T)'],
     [IFACE_FF_SFP, '1GE (SFP)'],
+    [IFACE_FF_10GE_COPPER, '10GE (10GBASE-T)'],
     [IFACE_FF_SFP_PLUS, '10GE (SFP+)'],
     [IFACE_FF_XFP, '10GE (XFP)'],
     [IFACE_FF_QSFP_PLUS, '40GE (QSFP+)'],


Test patch:
Repository: netbox-community/netbox

Issue:
Interface connection API call
Currently, the only api call relating to interface-connection data is:

```
GET /api/dcim/interface-connections/{pk}/
```

It would be nice if we could get an api call that would return all of the interface-connections:

```
GET /api/dcim/interface-connections/
```

Really, I would ideally like a json version of this table: `/dcim/interface-connections/`
(Names in addition to id's would make things easier)



Discussion:

Resolving patch:
diff --git a/netbox/dcim/api/urls.py b/netbox/dcim/api/urls.py
--- a/netbox/dcim/api/urls.py
+++ b/netbox/dcim/api/urls.py
@@ -61,7 +61,8 @@
     url(r'^interfaces/(?P<pk>\d+)/$', InterfaceDetailView.as_view(), name='interface_detail'),
     url(r'^interfaces/(?P<pk>\d+)/graphs/$', GraphListView.as_view(), {'type': GRAPH_TYPE_INTERFACE},
         name='interface_graphs'),
-    url(r'^interface-connections/(?P<pk>\d+)/$', InterfaceConnectionView.as_view(), name='interfaceconnection'),
+    url(r'^interface-connections/$', InterfaceConnectionListView.as_view(), name='interfaceconnection_list'),
+    url(r'^interface-connections/(?P<pk>\d+)/$', InterfaceConnectionView.as_view(), name='interfaceconnection_detail'),
 
     # Miscellaneous
     url(r'^related-connections/$', RelatedConnectionsView.as_view(), name='related_connections'),
diff --git a/netbox/dcim/api/views.py b/netbox/dcim/api/views.py
--- a/netbox/dcim/api/views.py
+++ b/netbox/dcim/api/views.py
@@ -326,6 +326,14 @@ class InterfaceConnectionView(generics.RetrieveUpdateDestroyAPIView):
     queryset = InterfaceConnection.objects.all()
 
 
+class InterfaceConnectionListView(generics.ListAPIView):
+    """
+    Retrieve a list of all interface connections
+    """
+    serializer_class = serializers.InterfaceConnectionSerializer
+    queryset = InterfaceConnection.objects.all()
+
+
 #
 # Device bays
 #


Test patch:
Repository: netbox-community/netbox

Issue:
Add Device Name Filter to Secrets API
Filter secrets by the devices they're associated to.



Discussion:

Resolving patch:
diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py
--- a/netbox/secrets/filters.py
+++ b/netbox/secrets/filters.py
@@ -1,6 +1,7 @@
 import django_filters
 
 from .models import Secret, SecretRole
+from dcim.models import Device
 
 
 class SecretFilter(django_filters.FilterSet):
@@ -15,7 +16,13 @@ class SecretFilter(django_filters.FilterSet):
         to_field_name='slug',
         label='Role (slug)',
     )
+    device = django_filters.ModelMultipleChoiceFilter(
+        name='device',
+        queryset=Device.objects.all(),
+        to_field_name='name',
+        label='Device (Name)',
+    )
 
     class Meta:
         model = Secret
-        fields = ['name', 'role_id', 'role']
+        fields = ['name', 'role_id', 'role', 'device']


Test patch:
Repository: netbox-community/netbox

Issue:
add interface/port buttons missing on device type
In v1.6.2 the Add Interface/Console Port/etc links are missing from the device type show page. Here's what I am seeing:

![screenshot 2016-10-02 13 57 24](https://cloud.githubusercontent.com/assets/270/19023644/59784552-88a8-11e6-877b-15531bf5d35e.png)

And here's what I'm pretty sure I'm meant to be seeing:

![screenshot 2016-10-02 13 57 45](https://cloud.githubusercontent.com/assets/270/19023647/6256b424-88a8-11e6-889b-e32d05c40486.png)

Through the magic of git bisect I have identified 30c7c2d359f59165093274d6f560bbce1a62f1da as the commit which broke this. It looks like it's the [conditional on line 8 of `netbox/templates/dcim/inc/devicetype_component_table.html`](https://github.com/digitalocean/netbox/commit/30c7c2d359f59165093274d6f560bbce1a62f1da#diff-9bd2b5a22068ed7c8f53e931cc5ebf98R8)... if I remove that conditional block, I get the buttons back.

I'm guessing that the idea there was to make that button disappear if there were between one and ten rows in the table and then reappear if there were ten or more. If that's right, then I think that changing it to `{% if table.rows|length > 10 or table.rows|length == 0 %}` will do the trick. I can submit a PR if y'all want.



Discussion:
I just noticed that I'm getting the same behavior.

Derp. I'll try to get a fix out today. Thanks for catching this!


Resolving patch:
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -12,7 +12,7 @@
                                "the documentation.")
 
 
-VERSION = '1.6.2'
+VERSION = '1.6.2-r1'
 
 # Import local configuration
 for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:


Test patch:
Repository: netbox-community/netbox

Issue:
Updating from V.1.7.1 to V.1.7.2 removes device colours on rack
updated from git and ran upgrade.sh.

This appears to have broken device colours on the rack views.
![image](https://cloud.githubusercontent.com/assets/2319079/20941993/23f5812a-bbf1-11e6-8f5e-59ac0878b39d.png)



Discussion:

Resolving patch:
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -12,7 +12,7 @@
                                "the documentation.")
 
 
-VERSION = '1.7.2'
+VERSION = '1.7.2-r1'
 
 # Import local configuration
 for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:


Test patch:
Repository: netbox-community/netbox

Issue:
v1.9.4 - Model Migration Warning?
### Issue type: Bug Report
**Python version:** 2.7.5
**NetBox version:** 1.9.4 (upgrading from 1.9.3

**Error Message:**
` Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.`

Got the above when upgrading from v1.9.3 to v1.9.4. Not sure if this is intentional (changes in the model that will be added in a future release), or if it's a bug.

**Upgrade Steps:**

1. Stopped Webserver (Apache).
2. Downloaded v1.9.4.zip file to /opt
3. Extracted zip to /opt/netbox-1.9.4
4. Copied configuration.py & ldap_config.py from /opt/netbox/netbox/netbox to /opt/netbox-1.9.4/netbox/netbox
5. Deleted /opt/netbox symlink.
6. Recreated /opt/netbox symlink pointing to /opt/netbox-1.9.4
7. Ran upgrade.sh inside /opt/netbox.
8. Started webserver.




Discussion:

Resolving patch:
diff --git a/netbox/extras/migrations/0005_useraction_add_bulk_create.py b/netbox/extras/migrations/0005_useraction_add_bulk_create.py
new file mode 100644
--- /dev/null
+++ b/netbox/extras/migrations/0005_useraction_add_bulk_create.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2017-04-04 19:45
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('extras', '0004_topologymap_change_comma_to_semicolon'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='useraction',
+            name='action',
+            field=models.PositiveSmallIntegerField(choices=[(1, b'created'), (7, b'bulk created'), (2, b'imported'), (3, b'modified'), (4, b'bulk edited'), (5, b'deleted'), (6, b'bulk deleted')]),
+        ),
+    ]
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -12,7 +12,7 @@
                                "the documentation.")
 
 
-VERSION = '1.9.4'
+VERSION = '1.9.4-r1'
 
 # Import local configuration
 for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:


Test patch:
Repository: netbox-community/netbox

Issue:
DeviceComponentFilterSet by name expects int instead of str.
<!--
    Please note: GitHub issues are to be used only for feature requests
    and bug reports. For installation assistance or general discussion,
    please join us on the mailing list:

        https://groups.google.com/forum/#!forum/netbox-discuss

    Please indicate "bug report" or "feature request" below. Be sure to
    search the existing set of issues (both open and closed) to see if
    a similar issue has already been raised.
-->
### Issue type: Bug

<!--
    If filing a bug, please indicate the version of Python and NetBox
    you are running. (This is not necessary for feature requests.)
-->
**Python version:** 2.7.13
**NetBox version:** v2-develop

<!--
    If filing a bug, please record the exact steps taken to reproduce
    the bug and any errors messages that are generated.

    If filing a feature request, please precisely describe the data
    model or workflow you would like to see implemented, and provide a
    use case.
-->
Searching for interfaces by device name yields a [traceback](http://dpaste.com/2N3D7J2). 

Seems like this fixes. Will file a PR shortly.

```diff
diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py
index 7992f8e..f94b172 100644
--- a/netbox/dcim/filters.py
+++ b/netbox/dcim/filters.py
@@ -401,7 +401,7 @@ class DeviceComponentFilterSet(django_filters.FilterSet):
         label='Device (ID)',
     )
     device = django_filters.ModelMultipleChoiceFilter(
-        name='device',
+        name='device__name',
         queryset=Device.objects.all(),
         to_field_name='name',
         label='Device (name)',
```


Discussion:

Resolving patch:
diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py
--- a/netbox/dcim/filters.py
+++ b/netbox/dcim/filters.py
@@ -401,7 +401,7 @@ class DeviceComponentFilterSet(django_filters.FilterSet):
         label='Device (ID)',
     )
     device = django_filters.ModelMultipleChoiceFilter(
-        name='device',
+        name='device__name',
         queryset=Device.objects.all(),
         to_field_name='name',
         label='Device (name)',


Test patch:
Repository: netbox-community/netbox

Issue:
ValueError: invalid literal for int() with base 10
<!--
    Please note: GitHub issues are to be used only for feature requests
    and bug reports. For installation assistance or general discussion,
    please join us on the mailing list:

        https://groups.google.com/forum/#!forum/netbox-discuss

    Please indicate "bug report" or "feature request" below. Be sure to
    search the existing set of issues (both open and closed) to see if
    a similar issue has already been raised.
-->
### Issue type: Bug

<!--
    If filing a bug, please indicate the version of Python and NetBox
    you are running. (This is not necessary for feature requests.)
-->
**Python version:** 2.7.13
**NetBox version:** develop

<!--
    If filing a bug, please record the exact steps taken to reproduce
    the bug and any errors messages that are generated.

    If filing a feature request, please precisely describe the data
    model or workflow you would like to see implemented, and provide a
    use case.
-->
Filter by `device` isn't working correctly in the `secrets` app. Seems to be looking for an int type. Will have PR to fix shortly.


Discussion:

Resolving patch:
diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py
--- a/netbox/secrets/filters.py
+++ b/netbox/secrets/filters.py
@@ -32,7 +32,7 @@ class SecretFilter(django_filters.FilterSet):
         label='Device (ID)',
     )
     device = django_filters.ModelMultipleChoiceFilter(
-        name='device',
+        name='device__name',
         queryset=Device.objects.all(),
         to_field_name='name',
         label='Device (name)',


Test patch:
Repository: netbox-community/netbox

Issue:
Losing site termination when editing circuit
### Issue type: bug
**Python version:**
**NetBox version:2.0.8**

When editing a circuit that is currently attached to a device it displays that the circuit is terminated on a device and interface in the form. When saving the circuit, it looses this attached device details. The circuit needs to be re-edited with and the device details re-selected before saving the circuit details again.

*No rack is selected as it is not required*




Discussion:

Resolving patch:
diff --git a/netbox/circuits/forms.py b/netbox/circuits/forms.py
--- a/netbox/circuits/forms.py
+++ b/netbox/circuits/forms.py
@@ -252,6 +252,11 @@ def __init__(self, *args, **kwargs):
         super(CircuitTerminationForm, self).__init__(*args, **kwargs)
 
         # Mark connected interfaces as disabled
-        self.fields['interface'].choices = [
-            (iface.id, {'label': iface.name, 'disabled': iface.is_connected}) for iface in self.fields['interface'].queryset
-        ]
+        self.fields['interface'].choices = []
+        for iface in self.fields['interface'].queryset:
+            self.fields['interface'].choices.append(
+                (iface.id, {
+                    'label': iface.name,
+                    'disabled': iface.is_connected and iface.pk != self.initial.get('interface'),
+                })
+            )
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -13,7 +13,7 @@
     )
 
 
-VERSION = '2.0.8'
+VERSION = '2.0.9'
 
 # Import required configuration parameters
 ALLOWED_HOSTS = DATABASE = SECRET_KEY = None
diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py
--- a/netbox/utilities/forms.py
+++ b/netbox/utilities/forms.py
@@ -489,7 +489,7 @@ def __init__(self, *args, **kwargs):
 
                 if filters_dict:
                     field.queryset = field.queryset.filter(**filters_dict)
-                elif not self.is_bound and self.instance and hasattr(self.instance, field_name):
+                elif not self.is_bound and getattr(self, 'instance', None) and hasattr(self.instance, field_name):
                     obj = getattr(self.instance, field_name)
                     if obj is not None:
                         field.queryset = field.queryset.filter(pk=obj.pk)


Test patch:
Repository: netbox-community/netbox

Issue:
Device interface shows twice on IP Addresses page
Python version: 2.7.5
NetBox version: 2.1.2

On the "IP addresses" page the device interface is showing up in both the "Device" column and the Interface Column.

I am able to replicate this issue with any link to the "IP Addresses" page.  I dont see any purpose in listing the interface twice. It just clutters the page.
![2017-08-07 17_06_32-ip addresses - netbox](https://user-images.githubusercontent.com/29483942/29045848-0982b5bc-7b93-11e7-8a3e-15c657e51bb7.png)



Discussion:

Resolving patch:
diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py
--- a/netbox/ipam/tables.py
+++ b/netbox/ipam/tables.py
@@ -80,7 +80,6 @@
 IPADDRESS_DEVICE = """
 {% if record.interface %}
     <a href="{{ record.interface.device.get_absolute_url }}">{{ record.interface.device }}</a>
-    ({{ record.interface.name }})
 {% else %}
     &mdash;
 {% endif %}


Test patch:
Repository: netbox-community/netbox

Issue:
No field to edit Cluster comments
### Issue type
[ ] Feature request <!-- Requesting the implementation of a new feature -->
[X] Bug report      <!-- Reporting unexpected or erroneous behavior -->
[ ] Documentation   <!-- Proposing a modification to the documentation -->

### Environment

* Python version:  3.5.2
* NetBox version:  origin/dev-2.2 e93129f1

### Description

When you view Clusters you can see there is a 'comments' field.  However, when you create a Cluster there is no field to enter the comments. Ditto when you click Edit on an existing cluster (e.g. `/virtualization/clusters/1/edit/`).


Discussion:

Resolving patch:
diff --git a/netbox/virtualization/forms.py b/netbox/virtualization/forms.py
--- a/netbox/virtualization/forms.py
+++ b/netbox/virtualization/forms.py
@@ -49,10 +49,11 @@ class Meta:
 #
 
 class ClusterForm(BootstrapMixin, CustomFieldForm):
+    comments = CommentField(widget=SmallTextarea)
 
     class Meta:
         model = Cluster
-        fields = ['name', 'type', 'group']
+        fields = ['name', 'type', 'group', 'comments']
 
 
 class ClusterCSVForm(forms.ModelForm):


Test patch:
Repository: netbox-community/netbox

Issue:
Add Primary IP for a device to Search Results
<!--
    Before opening a new issue, please search through the existing issues to
    see if your topic has already been addressed. Note that you may need to
    remove the "is:open" filter from the search bar to include closed issues.

    Check the appropriate type for your issue below by placing an x between the
    brackets. If none of the below apply, please raise your issue for
    discussion on our mailing list:

        https://groups.google.com/forum/#!forum/netbox-discuss

    Please note that issues which do not fall under any of the below categories
    will be closed.
--->
### Issue type
[X] Feature request <!-- Requesting the implementation of a new feature -->

<!--
    Please describe the environment in which you are running NetBox. (Be sure
    to verify that you are running the latest stable release of NetBox before
    submitting a bug report.)
-->
### Environment
* Python version:  2.7.5
* NetBox version:  2.1.4

<!--
    BUG REPORTS must include:
        * A list of the steps needed to reproduce the bug
        * A description of the expected behavior
        * Any relevant error messages (screenshots may also help)

    FEATURE REQUESTS must include:
        * A detailed description of the proposed functionality
        * A use case for the new feature
        * A rough description of any necessary changes to the database schema
        * Any relevant third-party libraries which would be needed
-->
### Description
When searching for a device name from the upper-right search box please add the Primary IP (if assigned) to the results.  Currently the Device results include these fields:  Name, Status, Tenant, Site, Rack, Role, Type

This is an example of the URL for this search: https://netbox/search/?q=SW

Use case is, given a name, find the IP as quickly as possible. 

No DB changes or additional libraries should be needed.






Discussion:

Resolving patch:
diff --git a/netbox/netbox/views.py b/netbox/netbox/views.py
--- a/netbox/netbox/views.py
+++ b/netbox/netbox/views.py
@@ -14,7 +14,7 @@
 from circuits.tables import CircuitTable, ProviderTable
 from dcim.filters import DeviceFilter, DeviceTypeFilter, RackFilter, SiteFilter
 from dcim.models import ConsolePort, Device, DeviceType, InterfaceConnection, PowerPort, Rack, Site
-from dcim.tables import DeviceTable, DeviceTypeTable, RackTable, SiteTable
+from dcim.tables import DeviceDetailTable, DeviceTypeTable, RackTable, SiteTable
 from extras.models import TopologyMap, UserAction
 from ipam.filters import AggregateFilter, IPAddressFilter, PrefixFilter, VLANFilter, VRFFilter
 from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
@@ -67,7 +67,7 @@
             'device_type__manufacturer', 'device_role', 'tenant', 'site', 'rack'
         ),
         'filter': DeviceFilter,
-        'table': DeviceTable,
+        'table': DeviceDetailTable,
         'url': 'dcim:device_list',
     }),
     # IPAM


Test patch: