Revert "Revert "SEBA-814 To support Multi-Tcont on TT-workflow, SADIS configuration is updated.""

(Re-applying changes after releasing and bumping major version)

This reverts commit e4f4b63f171ffd2ec92ee6e3a3f35e8905bce215.

Change-Id: I7b34c094f95455becffa7fa55d1de9eba55d298a
diff --git a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
index e3f2996..4208a5e 100644
--- a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationCodec.java
@@ -16,31 +16,91 @@
 package org.opencord.sadis.impl;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.MacAddress;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
 import org.opencord.sadis.SubscriberAndDeviceInformation;
+import org.opencord.sadis.UniTagInformation;
 
-public  class SubscriberAndDeviceInformationCodec extends JsonCodec<SubscriberAndDeviceInformation> {
-      @Override
-      public ObjectNode encode(SubscriberAndDeviceInformation entry, CodecContext context) {
-          return context.mapper().createObjectNode()
-                                    .put("id", entry.id())
-                                    .put("cTag", (entry.cTag() == null) ? "" : entry.cTag().toString())
-                                    .put("sTag", (entry.sTag() == null) ? "" : entry.sTag().toString())
-                                    .put("nasPortId", entry.nasPortId())
-                                    .put("uplinkPort", entry.uplinkPort())
-                                    .put("slot", entry.slot())
-                                    .put("hardwareIdentifier", (entry.hardwareIdentifier() == null) ? "" :
-                                          entry.hardwareIdentifier().toString())
-                                    .put("ipAddress", (entry.ipAddress() == null) ? "" : entry.ipAddress().toString())
-                                    .put("nasId", entry.nasId())
-                                    .put("circuiltId", (entry.circuitId() == null) ? "" : entry.circuitId())
-                                    .put("remoteId", (entry.remoteId() == null) ? "" : entry.remoteId())
-                                    .put("technologyProfileId", entry.technologyProfileId())
-                                    .put("upstreamBandwidthProfile", (entry.upstreamBandwidthProfile() == null) ?
-                                            "" : entry.upstreamBandwidthProfile())
-                                    .put("downstreamBandwidthProfile", (entry.downstreamBandwidthProfile() == null) ?
-                                            "" : entry.downstreamBandwidthProfile());
+import java.util.ArrayList;
+import java.util.List;
 
-      }
+public class SubscriberAndDeviceInformationCodec extends JsonCodec<SubscriberAndDeviceInformation> {
+
+    private static final String ID = "id";
+    private static final String NAS_PORT_ID = "nasPortId";
+    private static final String UPLINK_PORT = "uplinkPort";
+    private static final String SLOT = "slot";
+    private static final String HARDWARE_IDENTIFIER = "hardwareIdentifier";
+    private static final String IP_ADDRESS = "ipAddress";
+    private static final String NAS_ID = "nasId";
+    private static final String CIRCUIT_ID = "circuitId";
+    private static final String REMOTE_ID = "remoteId";
+    private static final String UNI_TAG_LIST = "uniTagList";
+    private static final String EMPTY_STRING = "";
+    private static final int NO_VALUE = -1;
+
+    @Override
+    public ObjectNode encode(SubscriberAndDeviceInformation entry, CodecContext context) {
+
+        List<ObjectNode> uniTagListNodes = Lists.newArrayList();
+        List<UniTagInformation> uniTagList = entry.uniTagList();
+        if (uniTagList != null) {
+            for (UniTagInformation uniTagInformation : uniTagList) {
+                uniTagListNodes.add(context.encode(uniTagInformation, UniTagInformation.class));
+            }
+        }
+        return context.mapper().createObjectNode()
+                .put(ID, entry.id())
+                .put(NAS_PORT_ID, entry.nasPortId())
+                .put(UPLINK_PORT, entry.uplinkPort())
+                .put(SLOT, entry.slot())
+                .put(HARDWARE_IDENTIFIER, (entry.hardwareIdentifier() == null) ? EMPTY_STRING :
+                        entry.hardwareIdentifier().toString())
+                .put(IP_ADDRESS, (entry.ipAddress() == null) ? EMPTY_STRING : entry.ipAddress().toString())
+                .put(NAS_ID, entry.nasId())
+                .put(CIRCUIT_ID, (entry.circuitId() == null) ? EMPTY_STRING : entry.circuitId())
+                .put(REMOTE_ID, (entry.remoteId() == null) ? EMPTY_STRING : entry.remoteId())
+                .put(UNI_TAG_LIST, uniTagListNodes.toString());
+    }
+
+    @Override
+    public SubscriberAndDeviceInformation decode(ObjectNode json, CodecContext context) {
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+        if (json.get(ID) == null) {
+            return null;
+        }
+
+        SubscriberAndDeviceInformation info = new SubscriberAndDeviceInformation();
+        info.setId(json.get(ID).asText());
+        info.setNasPortId(json.get(NAS_PORT_ID) == null ? EMPTY_STRING : json.get(NAS_PORT_ID).asText());
+        info.setUplinkPort(json.get(UPLINK_PORT) == null ? NO_VALUE : json.get(UPLINK_PORT).asInt());
+        info.setSlot(json.get(SLOT) == null ? NO_VALUE : json.get(SLOT).asInt());
+        info.setNasId(json.get(NAS_ID) == null ? EMPTY_STRING : json.get(NAS_ID).asText());
+        info.setCircuitId(json.get(CIRCUIT_ID) == null ? EMPTY_STRING : json.get(CIRCUIT_ID).asText());
+        info.setRemoteId(json.get(REMOTE_ID) == null ? EMPTY_STRING : json.get(REMOTE_ID).asText());
+
+        if (json.get(HARDWARE_IDENTIFIER) != null) {
+            info.setHardwareIdentifier(MacAddress.valueOf(json.get(HARDWARE_IDENTIFIER).asText()));
+        }
+
+        if (json.get(IP_ADDRESS) != null) {
+            info.setIPAddress(Ip4Address.valueOf(json.get(IP_ADDRESS).asText()));
+        }
+
+        if (json.get(UNI_TAG_LIST) != null) {
+            List<UniTagInformation> uniTagList = new ArrayList<>();
+            json.get(UNI_TAG_LIST).forEach(entry -> {
+                uniTagList.add(new SubscriberAndDeviceInformationConfig()
+                        .getUniTagInformation(entry));
+
+            });
+            info.setUniTagList(uniTagList);
+        }
+        return info;
+    }
 }
diff --git a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
index 61e097b..d794433 100644
--- a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
@@ -20,10 +20,12 @@
 import java.util.List;
 
 import org.onlab.packet.Ip4Address;
+import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 import org.opencord.sadis.BaseConfig;
 import org.opencord.sadis.SubscriberAndDeviceInformation;
 
+import org.opencord.sadis.UniTagInformation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,8 +52,6 @@
  *     "entries" : [
  *         {
  *             "id"                         : "uniqueid",
- *             "ctag"                       : int,
- *             "stag"                       : int,
  *             "nasportid"                  : string,
  *             "port"                       : int,
  *             "slot"                       : int,
@@ -59,10 +59,26 @@
  *             "ipAddress"                  : string,
  *             "nasId"                      : string,
  *             "circuitId"                  : string,
- *             "removeId"                   : string,
- *             "technologyProfileId"        : int,
- *             "upstreamBandwidthProfile"   : string,
- *             "downstreamBandwidthProfile" : string
+ *             "remoteId"                   : string,
+ *             "uniTagList": [
+ *                  {
+ *                  "uniTagMatch"               : int,
+ *                  "ponCTag"                   : string,
+ *                  "ponSTag"                   : string,
+ *                  "usPonCTagPriority"         : int,
+ *                  "dsPonCTagPriority"         : int,
+ *                  "usPonSTagPriority"         : int,
+ *                  "dsPonSTagPriority"         : int,
+ *                  "technologyProfileId"       : int,
+ *                  "upstreamBandwidthProfile"  : string,
+ *                  "downstreamBandwidthProfile": string,
+ *                  "enableMacLearning"         : string,
+ *                  "configuredDacAddress"      : string,
+ *                  "isDhcpRequired"            : string,
+ *                  "isIgmpRequired"            : string,
+ *                  "serviceName"               : string
+ *                 }
+ *                 ]
  *         }, ...
  *     ]
  * }
@@ -71,6 +87,23 @@
 public class SubscriberAndDeviceInformationConfig extends BaseConfig<SubscriberAndDeviceInformation> {
 
     private final Logger log = LoggerFactory.getLogger(this.getClass());
+    private static final int NO_PCP = -1;
+    private static final String NO_SN = "";
+    private static final String UNI_TAG_MATCH = "uniTagMatch";
+    private static final String PON_C_TAG = "ponCTag";
+    private static final String PON_S_TAG = "ponSTag";
+    private static final String US_C_TAG_PCP = "usPonCTagPriority";
+    private static final String US_S_TAG_PCP = "usPonSTagPriority";
+    private static final String DS_C_TAG_PCP = "dsPonCTagPriority";
+    private static final String DS_S_TAG_PCP = "dsPonSTagPriority";
+    private static final String MAC_LEARNING = "enableMacLearning";
+    private static final String TP_ID = "technologyProfileId";
+    private static final String US_BW = "upstreamBandwidthProfile";
+    private static final String DS_BW = "downstreamBandwidthProfile";
+    private static final String SERVICE_NAME = "serviceName";
+    private static final String IS_DHCP_REQ = "isDhcpRequired";
+    private static final String IS_IGMP_REQ = "isIgmpRequired";
+    private static final String MAC_ADDRESS = "configuredMacAddress";
 
     public List<SubscriberAndDeviceInformation> getEntries() {
         List<SubscriberAndDeviceInformation> result = new ArrayList<>();
@@ -78,6 +111,7 @@
         SimpleModule module = new SimpleModule();
         module.addDeserializer(VlanId.class, new VlanIdDeserializer());
         module.addDeserializer(Ip4Address.class, new Ip4AddressDeserializer());
+        module.addDeserializer(UniTagInformation.class, new UniTagDeserializer());
         mapper.registerModule(module);
         final JsonNode entries = this.object.path(ENTRIES);
         entries.forEach(entry -> {
@@ -110,4 +144,44 @@
             return Ip4Address.valueOf(node.asText());
         }
     }
+
+    public class UniTagDeserializer extends JsonDeserializer<UniTagInformation> {
+        @Override
+        public UniTagInformation deserialize(JsonParser jp, DeserializationContext ctxt)
+                throws IOException {
+            ObjectCodec oc = jp.getCodec();
+            JsonNode node = oc.readTree(jp);
+            return getUniTagInformation(node);
+        }
+    }
+
+    public UniTagInformation getUniTagInformation(JsonNode node) {
+        return new UniTagInformation.Builder()
+                .setUniTagMatch(VlanId.vlanId(node.get(UNI_TAG_MATCH) == null ? VlanId.NO_VID
+                        : (short) node.get(UNI_TAG_MATCH).asInt()))
+                .setPonCTag(VlanId.vlanId((short) node.get(PON_C_TAG).asInt()))
+                .setPonSTag(VlanId.vlanId((short) node.get(PON_S_TAG).asInt()))
+                .setUsPonCTagPriority(node.get(US_C_TAG_PCP) == null ? NO_PCP :
+                        node.get(US_C_TAG_PCP).asInt())
+                .setUsPonSTagPriority(node.get(US_S_TAG_PCP) == null ? NO_PCP :
+                        node.get(US_S_TAG_PCP).asInt())
+                .setDsPonCTagPriority(node.get(DS_C_TAG_PCP) == null ? NO_PCP :
+                        node.get(DS_C_TAG_PCP).asInt())
+                .setDsPonSTagPriority(node.get(DS_S_TAG_PCP) == null ? NO_PCP :
+                        node.get(DS_S_TAG_PCP).asInt())
+                .setEnableMacLearning(node.get(MAC_LEARNING) == null ? false :
+                        node.get(MAC_LEARNING).asBoolean())
+                .setTechnologyProfileId(node.get(TP_ID).asInt())
+                .setUpstreamBandwidthProfile(node.get(US_BW) == null ? null
+                        : node.get(US_BW).asText())
+                .setDownstreamBandwidthProfile(node.get(DS_BW) == null ? null
+                        : node.get(DS_BW).asText())
+                .setServiceName(node.get(SERVICE_NAME) == null ? NO_SN :
+                        node.get(SERVICE_NAME).asText())
+                .setIsDhcpRequired(node.get(IS_DHCP_REQ) == null ? false : node.get(IS_DHCP_REQ).asBoolean())
+                .setIsIgmpRequired(node.get(IS_IGMP_REQ) == null ? false : node.get(IS_IGMP_REQ).asBoolean())
+                .setConfiguredMacAddress(node.get(MAC_ADDRESS) == null ? MacAddress.NONE.toString() :
+                        node.get(MAC_ADDRESS).asText())
+                .build();
+    }
 }
diff --git a/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java b/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java
new file mode 100644
index 0000000..5e27e52
--- /dev/null
+++ b/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.opencord.sadis.impl;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.VlanId;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.opencord.sadis.UniTagInformation;
+
+public class UniTagInformationCodec extends JsonCodec<UniTagInformation> {
+
+    private static final String UNI_TAG_MATCH = "uniTagMatch";
+    private static final String PON_CTAG = "ponCTag";
+    private static final String PON_STAG = "ponSTag";
+    private static final String US_PON_CTAG_PCP = "usPonCTagPriority";
+    private static final String US_PON_STAG_PCP = "usPonSTagPriority";
+    private static final String DS_PON_CTAG_PCP = "dsPonCTagPriority";
+    private static final String DS_PON_STAG_PCP = "dsPonSTagPriority";
+    private static final String TP_ID = "technologyProfileId";
+    private static final String US_BP = "upstreamBandwidthProfile";
+    private static final String DS_BP = "downstreamBandwidthProfile";
+    private static final String SN = "serviceName";
+    private static final String MAC_LEARN = "enableMacLearning";
+    private static final String MAC = "configuredMacAddress";
+    private static final String DHCP_REQ = "isDhcpRequired";
+    private static final String IGMP_REQ = "isIgmpRequired";
+    private static final int NO_PCP = -1;
+    private static final int NO_TP = -1;
+    private static final String EMPTY_BP = "";
+    private static final String EMPTY_SN = "";
+    private static final boolean DEFAULT_MAC_LEARN = false;
+    private static final String EMPTY_MAC = "";
+    private static final boolean DEFAULT_DHCP_REQ = false;
+    private static final boolean DEFAULT_IGMP_REQ = false;
+
+    @Override
+    public ObjectNode encode(UniTagInformation entry, CodecContext context) {
+        return context.mapper().createObjectNode()
+                .put(UNI_TAG_MATCH, entry.getUniTagMatch().toShort())
+                .put(PON_CTAG, entry.getPonCTag().toShort())
+                .put(PON_STAG, entry.getPonSTag().toShort())
+                .put(US_PON_CTAG_PCP, entry.getUsPonCTagPriority())
+                .put(US_PON_STAG_PCP, entry.getUsPonSTagPriority())
+                .put(DS_PON_CTAG_PCP, entry.getDsPonCTagPriority())
+                .put(DS_PON_STAG_PCP, entry.getDsPonSTagPriority())
+                .put(TP_ID, entry.getTechnologyProfileId())
+                .put(US_BP, entry.getUpstreamBandwidthProfile())
+                .put(DS_BP, entry.getDownstreamBandwidthProfile())
+                .put(SN, entry.getServiceName())
+                .put(MAC_LEARN, entry.getEnableMacLearning())
+                .put(MAC, entry.getConfiguredMacAddress())
+                .put(DHCP_REQ, entry.getIsDhcpRequired())
+                .put(IGMP_REQ, entry.getIsIgmpRequired());
+    }
+
+    @Override
+    public UniTagInformation decode(ObjectNode json, CodecContext context) {
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+
+        UniTagInformation.Builder tagInfoBuilder = new UniTagInformation.Builder();
+        tagInfoBuilder.setUniTagMatch(json.get(UNI_TAG_MATCH) == null ? VlanId.vlanId(VlanId.NO_VID) :
+                VlanId.vlanId(json.get(UNI_TAG_MATCH).shortValue()))
+                .setPonCTag(json.get(PON_CTAG) == null ? VlanId.vlanId(VlanId.NO_VID) :
+                        VlanId.vlanId(json.get(PON_CTAG).shortValue()))
+                .setPonCTag(json.get(PON_STAG) == null ? VlanId.vlanId(VlanId.NO_VID) :
+                        VlanId.vlanId(json.get(PON_STAG).shortValue()))
+                .setUsPonCTagPriority(json.get(US_PON_CTAG_PCP) == null ? NO_PCP :
+                        json.get(US_PON_CTAG_PCP).asInt())
+                .setUsPonSTagPriority(json.get(US_PON_STAG_PCP) == null ? NO_PCP :
+                        json.get(US_PON_STAG_PCP).asInt())
+                .setDsPonCTagPriority(json.get(DS_PON_CTAG_PCP) == null ? NO_PCP :
+                        json.get(DS_PON_CTAG_PCP).asInt())
+                .setDsPonSTagPriority(json.get(DS_PON_STAG_PCP) == null ? NO_PCP :
+                        json.get(DS_PON_STAG_PCP).asInt())
+                .setTechnologyProfileId(json.get(TP_ID) == null ? NO_TP :
+                        json.get(TP_ID).asInt())
+                .setUpstreamBandwidthProfile(json.get(US_BP) == null ? EMPTY_BP :
+                        json.get(US_BP).asText())
+                .setDownstreamBandwidthProfile(json.get(DS_BP) == null ? EMPTY_BP :
+                        json.get(DS_BP).asText())
+                .setServiceName(json.get(SN) == null ? EMPTY_SN :
+                        json.get(SN).asText())
+                .setEnableMacLearning(json.get(MAC_LEARN) == null ? DEFAULT_MAC_LEARN :
+                        json.get(MAC_LEARN).asBoolean())
+                .setConfiguredMacAddress(json.get(MAC) == null ? EMPTY_MAC :
+                        json.get(MAC).asText())
+                .setIsDhcpRequired(json.get(DHCP_REQ) == null ? DEFAULT_DHCP_REQ :
+                        json.get(DHCP_REQ).asBoolean())
+                .setIsIgmpRequired(json.get(IGMP_REQ) == null ? DEFAULT_IGMP_REQ :
+                        json.get(IGMP_REQ).asBoolean());
+
+        return tagInfoBuilder.build();
+    }
+}
diff --git a/app/src/main/java/org/opencord/sadis/rest/SadisWebResource.java b/app/src/main/java/org/opencord/sadis/rest/SadisWebResource.java
index 160874a..b2bfad2 100644
--- a/app/src/main/java/org/opencord/sadis/rest/SadisWebResource.java
+++ b/app/src/main/java/org/opencord/sadis/rest/SadisWebResource.java
@@ -24,16 +24,11 @@
 import org.opencord.sadis.SubscriberAndDeviceInformation;
 import org.onlab.util.ItemNotFoundException;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-
 import javax.ws.rs.GET;
-import javax.ws.rs.POST;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.Consumes;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
@@ -46,11 +41,6 @@
     private final ArrayNode node = root.putArray("entry");
     private static final String SUBSCRIBER_NOT_FOUND = "Subscriber not found";
     private static final String BP_NOT_FOUND = "Bandwidth Profile not found";
-    private final SadisService sadisService = get(SadisService.class);
-    private final BaseInformationService<SubscriberAndDeviceInformation> subService =
-            sadisService.getSubscriberInfoService();
-    private final BaseInformationService<BandwidthProfileInformation> bpService =
-            sadisService.getBandwidthProfileService();
 
     /**
      * Get subscriber object.
@@ -64,6 +54,9 @@
     @Path("/subscriber/{id}")
     @Produces(MediaType.APPLICATION_JSON)
     public Response getSubscriber(@PathParam("id") String id) {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<SubscriberAndDeviceInformation> subService =
+                sadisService.getSubscriberInfoService();
         final SubscriberAndDeviceInformation entry = subService.get(id);
         if (entry == null) {
            throw new ItemNotFoundException(SUBSCRIBER_NOT_FOUND);
@@ -84,6 +77,9 @@
      @Path("/cache/subscriber/{id}")
      @Produces(MediaType.APPLICATION_JSON)
      public Response getSubscriberCache(@PathParam("id") String id) {
+         SadisService sadisService = get(SadisService.class);
+         BaseInformationService<SubscriberAndDeviceInformation> subService =
+                 sadisService.getSubscriberInfoService();
          final SubscriberAndDeviceInformation entry = subService.getfromCache(id);
          if (entry == null) {
             throw new ItemNotFoundException(SUBSCRIBER_NOT_FOUND);
@@ -93,22 +89,6 @@
      }
 
     /**
-     * Create subscriber object.
-     *
-     * @return 201 Created
-     */
-    @POST
-    @Path("/subscriber")
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response postSubscriber() {
-        try {
-            return Response.created(new URI("/subsciber/123")).build();
-        } catch (URISyntaxException e) {
-            return Response.serverError().build();
-        }
-    }
-
-    /**
      * Delete subscriber object.
      *
      * @param id
@@ -118,6 +98,9 @@
     @DELETE
     @Path("/cache/subscriber/{id}")
     public Response deleteSubscriber(@PathParam("id") String id) {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<SubscriberAndDeviceInformation> subService =
+                sadisService.getSubscriberInfoService();
         subService.invalidateId(id);
         return Response.noContent().build();
     }
@@ -130,6 +113,9 @@
     @DELETE
     @Path("/cache/subscriber/")
     public Response deleteAllSubscribers() {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<SubscriberAndDeviceInformation> subService =
+                sadisService.getSubscriberInfoService();
         subService.invalidateAll();
         return Response.noContent().build();
     }
@@ -138,6 +124,9 @@
     @Path("/bandwidthprofile/{id}")
     @Produces(MediaType.APPLICATION_JSON)
     public Response getBandwidthProfile(@PathParam("id") String id) {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<BandwidthProfileInformation> bpService =
+                sadisService.getBandwidthProfileService();
         final BandwidthProfileInformation entry = bpService.get(id);
         if (entry == null) {
             throw new ItemNotFoundException(BP_NOT_FOUND);
@@ -150,6 +139,9 @@
     @Path("/cache/bandwidthprofile/{id}")
     @Produces(MediaType.APPLICATION_JSON)
     public Response getBandwidthProfileCache(@PathParam("id") String id) {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<BandwidthProfileInformation> bpService =
+                sadisService.getBandwidthProfileService();
         final BandwidthProfileInformation entry = bpService.getfromCache(id);
         if (entry == null) {
             throw new ItemNotFoundException(BP_NOT_FOUND);
@@ -161,13 +153,19 @@
     @DELETE
     @Path("/cache/bandwidthprofile/{id}")
     public Response deleteBandwidthProfile(@PathParam("id") String id) {
-        bpService.invalidateAll();
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<BandwidthProfileInformation> bpService =
+                sadisService.getBandwidthProfileService();
+        bpService.invalidateId(id);
         return Response.noContent().build();
     }
 
     @DELETE
     @Path("/cache/bandwidthprofile/")
     public Response deleteAllBandwidthProfiles() {
+        SadisService sadisService = get(SadisService.class);
+        BaseInformationService<BandwidthProfileInformation> bpService =
+                sadisService.getBandwidthProfileService();
         bpService.invalidateAll();
         return Response.noContent().build();
     }