Commit 77faff9a by Adi Amir

improve prints

parent a1729340
...@@ -38,6 +38,7 @@ import java.nio.file.Paths; ...@@ -38,6 +38,7 @@ import java.nio.file.Paths;
public class CiscoManager { public class CiscoManager {
// consts // consts
public static String CISCO = "cisco";
public static String CISCO_DOMAIN = "10.10.20.6"; public static String CISCO_DOMAIN = "10.10.20.6";
public static String API_URI = "/apigw/devnetlabapi/cdp/v1/"; public static String API_URI = "/apigw/devnetlabapi/cdp/v1/";
public static String API_TOKEN_URI = "/apigw/devnetlabtokenapi/"; public static String API_TOKEN_URI = "/apigw/devnetlabtokenapi/";
...@@ -125,8 +126,8 @@ public class CiscoManager { ...@@ -125,8 +126,8 @@ public class CiscoManager {
// if the request failed due to invalid token - fetch a new one & try again // if the request failed due to invalid token - fetch a new one & try again
if (isAccessDenied(brr)) { if (isAccessDenied(brr)) {
logger.info("cisco.executeRequest() - access denied. fetch a new token & try again"); logger.info("cisco.executeRequest() - access denied. login again ...");
brr = reLogin(loginInfo); brr = login(loginInfo);
if (brr.success) { if (brr.success) {
brr = executeRequest(serviceId, apiIdAsParams, requestContext); brr = executeRequest(serviceId, apiIdAsParams, requestContext);
} }
...@@ -214,7 +215,7 @@ public class CiscoManager { ...@@ -214,7 +215,7 @@ public class CiscoManager {
} }
} catch (Exception e) { } catch (Exception e) {
String err = "ge.getCameraList() failed with exception. e=" + e.toString(); String err = CISCO + ".getParkingSpots() failed with exception. e=" + e.toString();
logger.error(err); logger.error(err);
return errorResponse(err); return errorResponse(err);
} }
...@@ -385,7 +386,7 @@ public class CiscoManager { ...@@ -385,7 +386,7 @@ public class CiscoManager {
ObjectNode ps = objMapper.createObjectNode(); ObjectNode ps = objMapper.createObjectNode();
// location uid // location uid
ps.put("location-uid", csParkingSpot.at("/ParkingSpot/parkingSpaceId").asText()); ps.put("location-uid", csParkingSpot.at("/ParkingSpot/sid").asText());
// coordinates // coordinates
JsonNode csCoordinates = csParkingSpot.at("/ParkingSpot/geocoordinates"); JsonNode csCoordinates = csParkingSpot.at("/ParkingSpot/geocoordinates");
String p1Loc = csCoordinates.at("/latitude").asText() + "," + csCoordinates.at("/longitude").asText(); String p1Loc = csCoordinates.at("/latitude").asText() + "," + csCoordinates.at("/longitude").asText();
...@@ -405,6 +406,8 @@ public class CiscoManager { ...@@ -405,6 +406,8 @@ public class CiscoManager {
parkingSpotsResult.add(ps); parkingSpotsResult.add(ps);
} }
logger.info("parseParkingSpotsResp() - found " + parkingSpotsResult.size() + " parking spots. tenant=" + CISCO);
return successResponse(parkingSpotsResult); return successResponse(parkingSpotsResult);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -40,7 +40,7 @@ public class MapJsonToJsonOperation extends MapIntermediateOperation<JsonNode, J ...@@ -40,7 +40,7 @@ public class MapJsonToJsonOperation extends MapIntermediateOperation<JsonNode, J
throw new Exception("MapJsonToJsonOperation: http action failed with status code: "+resp.getStatusCode()+" errorMsg: "+ resp.getContent() ); throw new Exception("MapJsonToJsonOperation: http action failed with status code: "+resp.getStatusCode()+" errorMsg: "+ resp.getContent() );
else{ else{
content=resp.getContent(); content=resp.getContent();
System.out.println("MapJsonToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content); //System.out.println("MapJsonToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content);
return JsonHandler.getJsonNodeFromObject(content); return JsonHandler.getJsonNodeFromObject(content);
} }
......
...@@ -38,7 +38,7 @@ public class MapStringToJsonOperation extends MapIntermediateOperation<JsonNode, ...@@ -38,7 +38,7 @@ public class MapStringToJsonOperation extends MapIntermediateOperation<JsonNode,
throw new Exception("MapJsonToJsonOperation: http action failed with status code: "+resp.getStatusCode()+" errorMsg: "+ resp.getContent() ); throw new Exception("MapJsonToJsonOperation: http action failed with status code: "+resp.getStatusCode()+" errorMsg: "+ resp.getContent() );
content=resp.getContent(); content=resp.getContent();
System.out.println("MapStringToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content.toString()); //System.out.println("MapStringToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content.toString());
return JsonHandler.getJsonNodeFromString(resp.getContent()); return JsonHandler.getJsonNodeFromString(resp.getContent());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment