package org.zstack.utils;

import java.util.UUID;

/**
 * Created by miao on 11/1/16.
 */
public class WwnUtils {
    final String oui = "000f";

    public String getRandomWwn() {
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String wwn = oui + uuid.substring(0, 12);
        return wwn;
    }

    public boolean isValidWwn(final String wwn) {
        return wwn.toLowerCase().matches(oui + "[0-9a-f]{12}");
    }
}

@@ -263,16 +263,23 @@
 ng wwn =
+ %220x%22 +
  oui + u
@@ -418,16 +418,26 @@
 matches(
+%22(0x)?%22 + 
 oui + %22%5B

modify wwn match format