summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
589b630)
Ensure lower case alpha hex representation is included in MAC
regex match in all cases.
Change-Id: Ic2da17146cf8f9325cc5d951f70d614ec61762a0
Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
@Path("/ports")
public class NeutronPortsNorthbound {
@Path("/ports")
public class NeutronPortsNorthbound {
+ final String mac_regex="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$";
+
private NeutronPort extractFields(NeutronPort o, List<String> fields) {
return o.extractFields(fields);
}
private NeutronPort extractFields(NeutronPort o, List<String> fields) {
return o.extractFields(fields);
}
return Response.status(404).build();
}
if (singleton.getMacAddress() == null ||
return Response.status(404).build();
}
if (singleton.getMacAddress() == null ||
- !singleton.getMacAddress().matches("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$")) {
+ !singleton.getMacAddress().matches(mac_regex)) {
return Response.status(400).build();
}
if (portInterface.macInUse(singleton.getMacAddress())) {
return Response.status(400).build();
}
if (portInterface.macInUse(singleton.getMacAddress())) {
if (!networkInterface.networkExists(test.getNetworkUUID())) {
return Response.status(404).build();
}
if (!networkInterface.networkExists(test.getNetworkUUID())) {
return Response.status(404).build();
}
- if (!test.getMacAddress().matches("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$")) {
+ if (!test.getMacAddress().matches(mac_regex)) {
return Response.status(400).build();
}
if (portInterface.macInUse(test.getMacAddress())) {
return Response.status(400).build();
}
if (portInterface.macInUse(test.getMacAddress())) {