parent
a40a7d7f7c
commit
a57f441a07
|
@ -32,6 +32,14 @@ import java.util.List;
|
|||
@Component
|
||||
@Slf4j
|
||||
public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||
/**
|
||||
* The constant OBJECT_MAPPER.
|
||||
*/
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
/**
|
||||
* The Restful interface.
|
||||
*/
|
||||
private final HuaWeiInterface restfulInterface = new HuaWeiInterface();
|
||||
/**
|
||||
* The Timer cnt.
|
||||
*/
|
||||
|
@ -40,16 +48,6 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
* The Device link status.
|
||||
*/
|
||||
private boolean deviceLinkStatus = false;
|
||||
/**
|
||||
* The Restful interface.
|
||||
*/
|
||||
private final HuaWeiInterface restfulInterface = new HuaWeiInterface();
|
||||
|
||||
/**
|
||||
* The constant OBJECT_MAPPER.
|
||||
*/
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* The Url root path.
|
||||
*/
|
||||
|
@ -116,7 +114,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
|
||||
if (addr.isIPv4()) {
|
||||
disposeObj = disposeObject + "/32";
|
||||
}else if(addr.isIPv6()) {
|
||||
} else if (addr.isIPv6()) {
|
||||
disposeObj = disposeObject + "/128";
|
||||
}
|
||||
|
||||
|
@ -147,7 +145,8 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
}
|
||||
|
||||
if (resp != ErrorCode.ERR_OK) {
|
||||
log.error("----Error HuaWei start clean {} return error: {}, {}", disposeObject, resp.getCode(), resp.getMsg());
|
||||
log.error("----Error HuaWei start clean {} return error: {}, {}", disposeObject, resp.getCode(),
|
||||
resp.getMsg());
|
||||
return new MulReturnType<>(ErrorCode.ERR_HUAWEI_ERROR, null);
|
||||
}
|
||||
|
||||
|
@ -184,7 +183,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
|
||||
if (addr.isIPv4()) {
|
||||
disposeObj = disposeObject + "-32";
|
||||
}else if(addr.isIPv6()) {
|
||||
} else if (addr.isIPv6()) {
|
||||
disposeObj = disposeObject + "-128";
|
||||
}
|
||||
|
||||
|
@ -254,18 +253,18 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
@Override
|
||||
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||
DeviceFirewareInfo.builder()
|
||||
.vendor("HuaWei")
|
||||
.model("Unknown")
|
||||
.firmware("Unknown")
|
||||
.os("Linux Server")
|
||||
.kernel("Linux")
|
||||
.arch("x86_64")
|
||||
.version("Unknown")
|
||||
.memory(-1)
|
||||
.freeMemory(-1)
|
||||
.cpuUsed(-1)
|
||||
.build());
|
||||
DeviceFirewareInfo.builder()
|
||||
.vendor("HuaWei")
|
||||
.model("Unknown")
|
||||
.firmware("Unknown")
|
||||
.os("Linux Server")
|
||||
.kernel("Linux")
|
||||
.arch("x86_64")
|
||||
.version("Unknown")
|
||||
.memory(-1)
|
||||
.freeMemory(-1)
|
||||
.cpuUsed(-1)
|
||||
.build());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,8 +312,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
|||
if (response.getStatus() == HttpServletResponse.SC_OK) {
|
||||
deviceLinkStatus = true;
|
||||
}
|
||||
} catch (
|
||||
Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
log.error(ex.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,20 +24,20 @@ import java.util.Map;
|
|||
@Slf4j
|
||||
public class RestfulInterface {
|
||||
/**
|
||||
* Instantiates a new Restful interface.
|
||||
* The constant OBJECT_MAPPER.
|
||||
*/
|
||||
private RestfulInterface () {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
/**
|
||||
* The constant timeOutValue.
|
||||
*/
|
||||
private static int timeOutValue = 1000;
|
||||
|
||||
/**
|
||||
* The constant OBJECT_MAPPER.
|
||||
* Instantiates a new Restful interface.
|
||||
*/
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
private RestfulInterface() {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Init env.
|
||||
|
@ -203,11 +203,11 @@ public class RestfulInterface {
|
|||
/**
|
||||
* huawei pro run protocol resp dto.
|
||||
*
|
||||
* @param <E> the type parameter
|
||||
* @param url the url
|
||||
* @param token the token
|
||||
* @param obj the obj
|
||||
* @param reqType the req type
|
||||
* @param <E> the type parameter
|
||||
* @param url the url
|
||||
* @param token the token
|
||||
* @param obj the obj
|
||||
* @param reqType the req type
|
||||
* @return the t
|
||||
*/
|
||||
public static <E> HttpResponse huaWeiProRun(String url, String token, E obj, RequestMethod reqType) {
|
||||
|
|
Loading…
Reference in New Issue