ONOS-2144 - Complete implementation of REST API for flows

- URL for creation of a single flow is now /flows/{deviceId}
- On successful creation of a flow, Location header contains
  a reference to the new object's URI
- POST operation returns status code of CREATED
- implement DELETE operation for /flows/{deviceId}/{flowId}
- removed deprecations and warnings from REST API unit
  test for flows.

Change-Id: Idb43a651a659e60c07a6f36dfd69004c814b146b
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/FlowRuleCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/FlowRuleCodec.java
index 94a1948..bd81ee0 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/FlowRuleCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/FlowRuleCodec.java
@@ -33,7 +33,6 @@
  */
 public final class FlowRuleCodec extends JsonCodec<FlowRule> {
 
-    private static final String APP_ID = "appId";
     private static final String PRIORITY = "priority";
     private static final String TIMEOUT = "timeout";
     private static final String IS_PERMANENT = "isPermanent";
@@ -42,6 +41,7 @@
     private static final String SELECTOR = "selector";
     private static final String MISSING_MEMBER_MESSAGE =
             " member is required in FlowRule";
+    public static final String REST_APP_ID = "org.onosproject.rest";
 
 
     @Override
@@ -52,10 +52,9 @@
 
         FlowRule.Builder resultBuilder = new DefaultFlowRule.Builder();
 
-        short appId = nullIsIllegal(json.get(APP_ID),
-                APP_ID + MISSING_MEMBER_MESSAGE).shortValue();
         CoreService coreService = context.getService(CoreService.class);
-        resultBuilder.fromApp(coreService.getAppId(appId));
+        resultBuilder.fromApp(coreService
+                .registerApplication(REST_APP_ID));
 
         int priority = nullIsIllegal(json.get(PRIORITY),
                 PRIORITY + MISSING_MEMBER_MESSAGE).asInt();
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
index 5eaa20e..2e0e8b3 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
@@ -97,7 +97,7 @@
         flowRuleCodec = context.codec(FlowRule.class);
         assertThat(flowRuleCodec, notNullValue());
 
-        expect(mockCoreService.getAppId(APP_ID.id()))
+        expect(mockCoreService.registerApplication(FlowRuleCodec.REST_APP_ID))
                 .andReturn(APP_ID).anyTimes();
         replay(mockCoreService);
         context.registerService(CoreService.class, mockCoreService);
diff --git a/core/common/src/test/resources/org/onosproject/codec/impl/criteria-flow.json b/core/common/src/test/resources/org/onosproject/codec/impl/criteria-flow.json
index 6df4d0a..7061820 100644
--- a/core/common/src/test/resources/org/onosproject/codec/impl/criteria-flow.json
+++ b/core/common/src/test/resources/org/onosproject/codec/impl/criteria-flow.json
@@ -1,5 +1,4 @@
 {
-  "appId":-29467,
   "priority":1,
   "isPermanent":"false",
   "timeout":1,
diff --git a/core/common/src/test/resources/org/onosproject/codec/impl/instructions-flow.json b/core/common/src/test/resources/org/onosproject/codec/impl/instructions-flow.json
index d60362d..a57731b 100644
--- a/core/common/src/test/resources/org/onosproject/codec/impl/instructions-flow.json
+++ b/core/common/src/test/resources/org/onosproject/codec/impl/instructions-flow.json
@@ -1,5 +1,4 @@
 {
-  "appId":-29467,
   "priority":1,
   "isPermanent":"false",
   "timeout":1,
diff --git a/core/common/src/test/resources/org/onosproject/codec/impl/sigid-flow.json b/core/common/src/test/resources/org/onosproject/codec/impl/sigid-flow.json
index ba576bf..49d6b1c 100644
--- a/core/common/src/test/resources/org/onosproject/codec/impl/sigid-flow.json
+++ b/core/common/src/test/resources/org/onosproject/codec/impl/sigid-flow.json
@@ -1,5 +1,4 @@
 {
-  "appId":-29467,
   "priority":1,
   "isPermanent":"false",
   "timeout":1,
diff --git a/core/common/src/test/resources/org/onosproject/codec/impl/simple-flow.json b/core/common/src/test/resources/org/onosproject/codec/impl/simple-flow.json
index 4011c2d..dc241f5 100644
--- a/core/common/src/test/resources/org/onosproject/codec/impl/simple-flow.json
+++ b/core/common/src/test/resources/org/onosproject/codec/impl/simple-flow.json
@@ -1,5 +1,4 @@
 {
-   "appId":-29467,
    "priority":1,
    "isPermanent":"false",
    "timeout":1,