Bug 25463 - Weitere MAC-Adressenformate unterstützen
Weitere MAC-Adressenformate unterstützen
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Computers
UCS 3.0
Other Linux
: P4 normal (vote)
: UCS 3.0-1
Assigned To: Sönke Schwardt-Krummrich
Arvid Requate
:
: 7028 21547 (view as bug list)
Depends on: 25203
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-13 14:22 CET by Andreas Büsching
Modified: 2012-12-03 11:36 CET (History)
6 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
klaeser: Patch_Available+


Attachments
add support for common mac address formats (979 bytes, patch)
2012-01-06 13:23 CET, Lukas Walter
Details | Diff
modify long description for mac property of computer objects (7.92 KB, patch)
2012-01-06 13:28 CET, Lukas Walter
Details | Diff
add support for common mac address formats (2.05 KB, patch)
2012-01-06 17:31 CET, Lukas Walter
Details | Diff
add support for common mac address formats (1.88 KB, patch)
2012-01-12 16:56 CET, Lukas Walter
Details | Diff
add support for common mac address formats (1.89 KB, patch)
2012-01-12 17:08 CET, Lukas Walter
Details | Diff
add support for common mac address formats (1.89 KB, patch)
2012-01-16 08:52 CET, Lukas Walter
Details | Diff
add support for common mac address formats (1.88 KB, patch)
2012-01-16 09:42 CET, Lukas Walter
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Büsching univentionstaff 2011-12-13 14:22:05 CET
Aus Bug #25203:

(In reply to comment #6)
> Für die Eingabe (UI→Backend)sollte IMHO folgendes akzeptiert werden, damit man
> das schnell per Copy&Paste von anderswo einfügen kann:
>  1. 001122334455 (ohne alles)
>  2. 00:11:22:33:44:55 (Standard unter Linux)
>  3. 00-11-22-33-44-55 (Windows-Format)
>  4. 0011.2233.4455 (CISCO-Format)
> 
> Bei der Aufbereitung für die Anzeige von Daten (Backend→UI) sollten wir einfach
> ein (lesbares) Format standardmäßig verwenden; ich persönlich bevorzuge 2.,
> weil es in der Linux-/Debian-/UCS-Welt das gebräuchlichste ist.
Comment 1 Florian Best univentionstaff 2011-12-13 14:41:46 CET
*** Bug 7028 has been marked as a duplicate of this bug. ***
Comment 2 Lukas Walter univentionstaff 2012-01-06 13:23:24 CET
Created attachment 4073 [details]
add support for common mac address formats

Dieser Patch erweitert die Klasse MAC_Address um die folgenden regulären Ausdrücke:

==================================================================================
([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2} für MAC Adressen des Formats xx:xx:xx:xx:xx:xx,
([0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2} für MAC Adressen des Formats xx-xx-xx-xx-xx-xx,
[0-9a-fA-F]{12} für MAC Adressen des Formats xxxxxxxxxxxx,
([0-9a-fA-F]{4}.){2}[0-9a-fA-F]{4} für MAC-Adresen des Formats xxxx.xxxx.xxxx
==================================================================================

Darüber hinaus wird der Aufruf von re.compile in der Klasse so angepasst, dass in dem zurückgegebenen regex-Objekt jeder der oben geannten regulären Ausdruck als Alternativausdruck verwendet wird.
Comment 3 Lukas Walter univentionstaff 2012-01-06 13:28:50 CET
Created attachment 4074 [details]
modify long description for mac property of computer objects

Passt die Mouseover Hilfemeldung des Feldes "MAC-Adresse" beim Anlegen/Bearbeiten eines Computerobjekts so an, dass der User erkennen kann welche Formate für die Eingabe der MAC-Adresse untersützt werden.

===========================================================================
"Valid formats are: xx:xx:xx:xx:xx:xx, xx-xx-xx-xx-xx-xx, xxxxxxxxxxxx, xxxx.xxxx.xxxx (each \'x\' has to be replaced by an hexadecimal digit)"
===========================================================================
Comment 4 Lukas Walter univentionstaff 2012-01-06 17:31:13 CET
Created attachment 4075 [details]
add support for common mac address formats
Comment 5 Philipp Hahn univentionstaff 2012-01-09 09:00:31 CET
(In reply to comment #2)
> Created an attachment (id=4073) [details]
> ([0-9a-fA-F]{4}.){2}[0-9a-fA-F]{4} für MAC-Adresen des Formats xxxx.xxxx.xxxx

Der Punkt ('.') ist eine RegExp-Metazeichen und muß hier gequotet werden, damit es hier tatsächlich für den Punkt steht und nicht für ein beliebiges Zeichen!
Comment 6 Alexander Kläser univentionstaff 2012-01-09 16:48:51 CET
Das sieht sehr gut aus :) ... kleine Anmerkungen:

* Am besten Raw-Strings benutzen (r'...')

* Du könntest direkt die RegExps kompilieren: regexLinuxFormat = re.compile(r'^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$')

* Eine ausführlichere Fehlermeldung wäre toll, 'that' durch 'this' ersetzen: error_message = _( 'This is not a valid MAC address. Valid formats are: ...' )

* In der letzten Überprüfung ist es beser, den String einmal zu "translaten", ansonsten wird dies jedes Mal bei einem erneuten Aufruf getan, bspw.:

  tmpStr = text.translate(None, '.')
  for i in range(0, len(tmpStr)-1, 2):
      temp.append(tmpStr[i:i+2])
Comment 7 Lukas Walter univentionstaff 2012-01-12 16:56:13 CET
Created attachment 4088 [details]
add support for common mac address formats
Comment 8 Lukas Walter univentionstaff 2012-01-12 17:08:34 CET
Created attachment 4089 [details]
add support for common mac address formats
Comment 9 Philipp Hahn univentionstaff 2012-01-13 08:26:20 CET
(In reply to comment #8)
+	regexCiscoFormat = re.compile( r'^([0-9a-fA-F]{4}.){2}[0-9a-fA-F]{4}$' )

$ python
>>> import re
>>> regexCiscoFormat = re.compile( r'^([0-9a-fA-F]{4}.){2}[0-9a-fA-F]{4}$' )
>>> regexCiscoFormat.match('1234=5678/9abc')
<_sre.SRE_Match object at 0x13927b0>

Vergleiche dazu mein comment #5

+			tmpStr = text.translate(None, '.'))-1, 2):

Syntax-Error
Comment 10 Lukas Walter univentionstaff 2012-01-16 08:52:21 CET
Created attachment 4092 [details]
add support for common mac address formats
Comment 11 Philipp Hahn univentionstaff 2012-01-16 09:21:55 CET
(In reply to comment #10)
> Created an attachment (id=4092) [details]

+			tmpStr = text.translate(None, '.')-1, 2):
Syntax-Error nach Copy-paste?
  tmpStr = text.translate(None, '.')

+			tmpList = []
+			for i in range(0, len(tmpStr)-1, 2):
+				tmpList.append(tmpStr)[i:i+2])

  tmpList = [tmpStr[i:i+2] for i in range(0, len(tmpStr), 2)]
Comment 12 Lukas Walter univentionstaff 2012-01-16 09:42:02 CET
Created attachment 4094 [details]
add support for common mac address formats
Comment 13 Lukas Walter univentionstaff 2012-01-17 15:51:46 CET
Patch wurde eingepflegt, Paket gebaut.

univention-directory-manager-modules (7.0.213-1) unstable; urgency=low

  * add support for common mac address formats (Bug #25463)
Comment 14 Andreas Büsching univentionstaff 2012-02-22 16:51:25 CET
Alle Formate bis auf das Cisco-Format funktionieren. Wird das eingegeben kommt folgender Traceback:

>>> syn.MAC_Address.parse( '1a1a.1a1a.1a1a' )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/univention/admin/syntax.py", line 1121, in parse
    tmpList.append(tmpStr)[i:i+2]


Bei falschen Eingaben kommt eine entsprechende Fehlermeldung
Comment 15 Sönke Schwardt-Krummrich univentionstaff 2012-02-24 15:39:50 CET
univention-directory-manager-modules (7.0.228-1) unstable; urgency=low
Typo wurde behoben; Paket baut gerade
Comment 16 Arvid Requate univentionstaff 2012-02-27 10:43:20 CET
Verifed:
 * Syntaxprüfung OK
 * Changelog OK
Comment 17 Sönke Schwardt-Krummrich univentionstaff 2012-03-04 14:34:20 CET
UCS 3.0-1 wurde veröffentlicht. Sollte der hier beschriebene Bug mit einer
neueren Version von UCS erneut auftreten, so sollte dieser Bug dupliziert
werden: "Clone This Bug"
Comment 18 Philipp Hahn univentionstaff 2012-12-03 11:36:27 CET
*** Bug 21547 has been marked as a duplicate of this bug. ***