package org.onap.so.apihandlerinfra;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
 import java.sql.Timestamp;
 import java.util.HashMap;
 import java.util.UUID;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
 import com.fasterxml.jackson.core.JsonProcessingException;
     @Autowired
     private ResponseHandler responseHandler;
 
+    @Value("${subnetCapability.config.file}")
+    private String subnetCapabilityConfigFile;
+
     /**
      * POST Requests for 3GPP Service create Instance on a version provided
      *
         }
     }
 
-    // To be implemented for fetching Subnet capabilities
     private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
         ObjectMapper oMapper = new ObjectMapper();
-        InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+        String inputFileString = "";
         Map<String, Object> subnetCapability = new HashMap<>();
+        BufferedReader br = null;
         try {
-            subnetCapability = oMapper.readValue(inputStream, Map.class);
+            logger.debug("Reading SubnetCapability file");
+            br = new BufferedReader(new FileReader(new File(subnetCapabilityConfigFile)));
+            StringBuilder sb = new StringBuilder();
+            String line = br.readLine();
+            while (line != null) {
+                sb.append(line);
+                sb.append("\n");
+                line = br.readLine();
+            }
+            inputFileString = sb.toString();
+            subnetCapability = oMapper.readValue(inputFileString, Map.class);
         } catch (Exception e) {
             logger.debug("Exception while reading subnet capability value from json", e);
         }
 
         String request = "{\"subnetTypes\":[\"AN\"]}";
         QuerySubnetCapability subnetCapabilityRequest = MAPPER.readValue(request, QuerySubnetCapability.class);
         String expectedResponse =
-                "{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
+                "{\"AN\":{\"latency\":5,\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
         Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");
         String actualResponse = (String) response.getEntity();
         assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());