Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
522b5be3
Commit
522b5be3
authored
Jan 27, 2019
by
klafyvel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mac_vendor' into 'dev'
Mac vendor See merge request federez/re2o!403
parents
eacad3bd
e0245607
Pipeline
#951
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
machines/models.py
machines/models.py
+11
-1
machines/templates/machines/aff_machines.html
machines/templates/machines/aff_machines.html
+22
-0
No files found.
machines/models.py
View file @
522b5be3
...
@@ -44,7 +44,7 @@ from django.utils import timezone
...
@@ -44,7 +44,7 @@ from django.utils import timezone
from
django.utils.functional
import
cached_property
from
django.utils.functional
import
cached_property
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
macaddress.fields
import
MACAddressField
,
default_dialect
from
macaddress.fields
import
MACAddressField
,
default_dialect
from
netaddr
import
mac_bare
,
EUI
,
IPSet
,
IPRange
,
IPNetwork
,
IPAddress
from
netaddr
import
mac_bare
,
EUI
,
NotRegisteredError
,
IPSet
,
IPRange
,
IPNetwork
,
IPAddress
import
preferences.models
import
preferences.models
import
users.models
import
users.models
...
@@ -1044,6 +1044,16 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
...
@@ -1044,6 +1044,16 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
IPv6Address
(
prefix_v6
)
.
exploded
[:
20
]
+
IPv6Address
(
prefix_v6
)
.
exploded
[:
20
]
+
IPv6Address
(
self
.
id
)
.
exploded
[
20
:]
IPv6Address
(
self
.
id
)
.
exploded
[
20
:]
)
)
@
cached_property
def
get_vendor
(
self
):
"""Retourne le vendeur associé à la mac de l'interface"""
mac
=
EUI
(
self
.
mac_address
)
try
:
oui
=
mac
.
oui
vendor
=
oui
.
registration
()
.
org
except
NotRegisteredError
:
vendor
=
"Unknown vendor"
return
(
vendor
)
def
sync_ipv6_dhcpv6
(
self
):
def
sync_ipv6_dhcpv6
(
self
):
"""Affecte une ipv6 dhcpv6 calculée à partir de l'id de la machine"""
"""Affecte une ipv6 dhcpv6 calculée à partir de l'id de la machine"""
...
...
machines/templates/machines/aff_machines.html
View file @
522b5be3
...
@@ -92,6 +92,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -92,6 +92,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</td>
</td>
<td>
<td>
{{ interface.mac_address }}
{{ interface.mac_address }}
<button
class=
"btn btn-default btn-xs"
type=
"button"
data-toggle=
"collapse"
data-target=
"#collapseVendor_{{ interface.id }}"
aria-expanded=
"true"
aria-controls=
"collapseVendor_{{ interface.id }}"
>
{% trans "Display the vendor" %}
</button>
</td>
</td>
<td>
<td>
<b>
IPv4
</b>
{{ interface.ipv4 }}
<b>
IPv4
</b>
{{ interface.ipv4 }}
...
@@ -163,6 +168,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -163,6 +168,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr>
<td
colspan=
5
style=
"border-top: none; padding: 1px;"
>
<div
class=
"collapse in"
id=
"collapseVendor_{{ interface.id }}"
>
<ul
class=
"list-group"
style=
"margin-bottom: 0;"
>
<li
class=
"list-group-item col-xs-6 col-sm-6 col-md-6"
style=
"border: none;"
>
{{ interface.get_vendor }}
</li>
</ul>
</div>
</td>
</tr>
{% if ipv6_enabled and interface.ipv6 != 'None' %}
{% if ipv6_enabled and interface.ipv6 != 'None' %}
<tr>
<tr>
<td
colspan=
5
style=
"border-top: none; padding: 1px;"
>
<td
colspan=
5
style=
"border-top: none; padding: 1px;"
>
...
@@ -217,6 +233,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -217,6 +233,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
ipv6_div
[
i
].
collapse
(
'
hide
'
);
ipv6_div
[
i
].
collapse
(
'
hide
'
);
}
}
});
});
$
(
"
#machines_table
"
).
ready
(
function
()
{
var
vendor_div
=
[{
%
for
machine
in
machines_list
%
}{
%
for
interface
in
machine
.
interface_set
.
all
%
}{
%
if
interface
.
get_vendor
%
}
$
(
"
#collapseVendor_{{ interface.id }}
"
),
{
%
endif
%
}{
%
endfor
%
}{
%
endfor
%
}];
for
(
var
i
=
0
;
i
<
vendor_div
.
length
;
i
++
)
{
vendor_div
[
i
].
collapse
(
'
hide
'
);
}
});
</script>
</script>
{% if machines_list.paginator %}
{% if machines_list.paginator %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment