Commit 77faff9a by Adi Amir

improve prints

parent a1729340
......@@ -38,6 +38,7 @@ import java.nio.file.Paths;
public class CiscoManager {
// consts
public static String CISCO = "cisco";
public static String CISCO_DOMAIN = "10.10.20.6";
public static String API_URI = "/apigw/devnetlabapi/cdp/v1/";
public static String API_TOKEN_URI = "/apigw/devnetlabtokenapi/";
......@@ -125,8 +126,8 @@ public class CiscoManager {
// if the request failed due to invalid token - fetch a new one & try again
if (isAccessDenied(brr)) {
logger.info("cisco.executeRequest() - access denied. fetch a new token & try again");
brr = reLogin(loginInfo);
logger.info("cisco.executeRequest() - access denied. login again ...");
brr = login(loginInfo);
if (brr.success) {
brr = executeRequest(serviceId, apiIdAsParams, requestContext);
}
......@@ -214,7 +215,7 @@ public class CiscoManager {
}
} 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);
return errorResponse(err);
}
......@@ -385,7 +386,7 @@ public class CiscoManager {
ObjectNode ps = objMapper.createObjectNode();
// location uid
ps.put("location-uid", csParkingSpot.at("/ParkingSpot/parkingSpaceId").asText());
ps.put("location-uid", csParkingSpot.at("/ParkingSpot/sid").asText());
// coordinates
JsonNode csCoordinates = csParkingSpot.at("/ParkingSpot/geocoordinates");
String p1Loc = csCoordinates.at("/latitude").asText() + "," + csCoordinates.at("/longitude").asText();
......@@ -405,6 +406,8 @@ public class CiscoManager {
parkingSpotsResult.add(ps);
}
logger.info("parseParkingSpotsResp() - found " + parkingSpotsResult.size() + " parking spots. tenant=" + CISCO);
return successResponse(parkingSpotsResult);
} catch (Exception e) {
......
......@@ -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() );
else{
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);
}
......
......@@ -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() );
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());
}
......
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