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