Merge "remove redundant methods for compatibility"
[neutron.git] / northbound-api / src / main / java / org / opendaylight / neutron / northbound / api / NeutronPortsNorthbound.java
index 57c311a53196f5862db86ab75c26b96bd64be0d8..7168298a18101922ed62114d316c52c38c65721c 100644 (file)
@@ -31,10 +31,7 @@ import javax.ws.rs.core.UriInfo;
 
 import org.codehaus.enunciate.jaxrs.ResponseCode;
 import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
-import org.opendaylight.neutron.spi.INeutronPortAware;
 import org.opendaylight.neutron.spi.INeutronPortCRUD;
-import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
 import org.opendaylight.neutron.spi.NeutronCRUDInterfaces;
 import org.opendaylight.neutron.spi.NeutronPort;
 
@@ -58,7 +55,7 @@ import org.opendaylight.neutron.spi.NeutronPort;
 
 @Path("/ports")
 public class NeutronPortsNorthbound
-    extends AbstractNeutronNorthboundIAware<NeutronPort, NeutronPortRequest, INeutronPortCRUD, INeutronPortAware> {
+    extends AbstractNeutronNorthbound<NeutronPort, NeutronPortRequest, INeutronPortCRUD> {
 
     private static final String RESOURCE_NAME = "Port";
 
@@ -104,47 +101,6 @@ public class NeutronPortsNorthbound
         return new NeutronPortRequest(o);
     }
 
-    @Override
-    protected Object[] getInstances() {
-        return NeutronUtil.getInstances(INeutronPortAware.class, this);
-    }
-
-    @Override
-    protected int canCreate(Object instance, NeutronPort singleton) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        return service.canCreatePort(singleton);
-    }
-
-    @Override
-    protected void created(Object instance, NeutronPort singleton) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        service.neutronPortCreated(singleton);
-    }
-
-    @Override
-    protected int canUpdate(Object instance, NeutronPort delta, NeutronPort original) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        return service.canUpdatePort(delta, original);
-    }
-
-    @Override
-    protected void updated(Object instance, NeutronPort updated) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        service.neutronPortUpdated(updated);
-    }
-
-    @Override
-    protected int canDelete(Object instance, NeutronPort singleton) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        return service.canDeletePort(singleton);
-    }
-
-    @Override
-    protected void deleted(Object instance, NeutronPort singleton) {
-        INeutronPortAware service = (INeutronPortAware) instance;
-        service.neutronPortDeleted(singleton);
-    }
-
     @Context
     UriInfo uriInfo;
 
@@ -166,12 +122,13 @@ public class NeutronPortsNorthbound
             @QueryParam("id") String queryID,
             @QueryParam("network_id") String queryNetworkID,
             @QueryParam("name") String queryName,
-            @QueryParam("admin_state_up") String queryAdminStateUp,
+            @QueryParam("admin_state_up") Boolean queryAdminStateUp,
             @QueryParam("status") String queryStatus,
             @QueryParam("mac_address") String queryMACAddress,
             @QueryParam("device_id") String queryDeviceID,
             @QueryParam("device_owner") String queryDeviceOwner,
             @QueryParam("tenant_id") String queryTenantID,
+            @QueryParam("port_security_enabled") Boolean queryPortSecurityEnabled,
             // linkTitle
             @QueryParam("limit") Integer limit,
             @QueryParam("marker") String marker,
@@ -179,7 +136,7 @@ public class NeutronPortsNorthbound
             // sorting not supported
             ) {
         INeutronPortCRUD portInterface = getNeutronInterfaces(false, false).getPortInterface();
-        List<NeutronPort> allPorts = portInterface.getAllPorts();
+        List<NeutronPort> allPorts = portInterface.getAll();
         List<NeutronPort> ans = new ArrayList<NeutronPort>();
         Iterator<NeutronPort> i = allPorts.iterator();
         while (i.hasNext()) {
@@ -192,7 +149,8 @@ public class NeutronPortsNorthbound
                     (queryMACAddress == null || queryMACAddress.equals(oSS.getMacAddress())) &&
                     (queryDeviceID == null || queryDeviceID.equals(oSS.getDeviceID())) &&
                     (queryDeviceOwner == null || queryDeviceOwner.equals(oSS.getDeviceOwner())) &&
-                    (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) {
+                    (queryTenantID == null || queryTenantID.equals(oSS.getTenantID())) &&
+                    (queryPortSecurityEnabled == null || queryPortSecurityEnabled.equals(oSS.getPortSecurityEnabled()))) {
                 if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
                 } else {
@@ -281,6 +239,7 @@ public class NeutronPortsNorthbound
     //@TypeHint(OpenStackPorts.class)
     @StatusCodes({
         @ResponseCode(code = HttpURLConnection.HTTP_OK, condition = "Operation successful"),
+        @ResponseCode(code = HttpURLConnection.HTTP_NOT_FOUND, condition = "Not Found"),
         @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
     public Response updatePort(
             @PathParam("portUUID") String portUUID,
@@ -298,6 +257,7 @@ public class NeutronPortsNorthbound
     @DELETE
     @StatusCodes({
         @ResponseCode(code = HttpURLConnection.HTTP_NO_CONTENT, condition = "No Content"),
+        @ResponseCode(code = HttpURLConnection.HTTP_NOT_FOUND, condition = "Not Found"),
         @ResponseCode(code = HttpURLConnection.HTTP_UNAVAILABLE, condition = "No providers available") })
     public Response deletePort(
             @PathParam("portUUID") String portUUID) {