X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fnetworkconfiguration%2Fneutron%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetworkconfig%2Fneutron%2Fnorthbound%2FNeutronPortsNorthbound.java;h=c26e0229d0271ed6a6a0a10f0e17755176f69595;hp=d3c262f222f7f62bd612193944b0b0d919a50271;hb=ef41cf35255cddfdd8d732471c13a7462ecd2018;hpb=d8b2ea8f945aa225138d13f8681bd8ae879caf01 diff --git a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java index d3c262f222..c26e0229d0 100644 --- a/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java +++ b/opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java @@ -30,7 +30,6 @@ import org.codehaus.enunciate.jaxrs.StatusCodes; import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD; import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware; import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD; -import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware; import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD; import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; import org.opendaylight.controller.networkconfig.neutron.NeutronPort; @@ -61,6 +60,8 @@ import org.opendaylight.controller.sal.utils.ServiceHelper; @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 fields) { return o.extractFields(fields); } @@ -208,7 +209,7 @@ public class NeutronPortsNorthbound { 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())) { @@ -268,7 +269,7 @@ public class NeutronPortsNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null); + Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null); while (i.hasNext()) { NeutronPort test = i.next(); @@ -299,7 +300,7 @@ public class NeutronPortsNorthbound { 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())) {