1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

RPC API fixes

This commit is contained in:
Jeremy Stretch
2017-03-21 17:24:16 -04:00
parent a36b138efe
commit a5419ecc5c
2 changed files with 9 additions and 3 deletions

View File

@ -130,8 +130,11 @@ class JunosNC(RPCClient):
for neighbor_raw in lldp_neighbors_raw: for neighbor_raw in lldp_neighbors_raw:
neighbor = dict() neighbor = dict()
neighbor['local-interface'] = neighbor_raw.get('lldp-local-port-id') neighbor['local-interface'] = neighbor_raw.get('lldp-local-port-id')
neighbor['name'] = neighbor_raw.get('lldp-remote-system-name') name = neighbor_raw.get('lldp-remote-system-name')
neighbor['name'] = neighbor['name'].split('.')[0] # Split hostname from domain if one is present if name:
neighbor['name'] = name.split('.')[0] # Split hostname from domain if one is present
else:
neighbor['name'] = ''
try: try:
neighbor['remote-interface'] = neighbor_raw['lldp-remote-port-description'] neighbor['remote-interface'] = neighbor_raw['lldp-remote-port-description']
except KeyError: except KeyError:

View File

@ -47,7 +47,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$.ajax({ $.ajax({
url: "{% url 'dcim-api:device_lldp-neighbors' pk=device.pk %}", url: "{% url 'dcim-api:device-lldp-neighbors' pk=device.pk %}",
dataType: 'json', dataType: 'json',
success: function(json) { success: function(json) {
$.each(json, function(i, neighbor) { $.each(json, function(i, neighbor) {
@ -66,6 +66,9 @@ $(document).ready(function() {
row.addClass('danger'); row.addClass('danger');
} }
}); });
},
error: function(xhr) {
alert(xhr.responseText);
} }
}); });
}); });