parent
01d42085c8
commit
b0b16e280f
|
@ -2,11 +2,14 @@ package com.dispose.ability.impl;
|
|||
|
||||
import com.dispose.ability.DisposeAbility;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.DisposeObjectType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.IpAddrType;
|
||||
import com.dispose.common.NetflowDirection;
|
||||
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||
import com.dispose.yiyang.dispose.common.YiYangDisposeAbilityRsp;
|
||||
import com.dispose.yiyang.dispose.common.YiYangLoginRsp;
|
||||
import com.dispose.yiyang.dispose.protocol.YiYangInterface;
|
||||
import lombok.Getter;
|
||||
|
@ -14,6 +17,8 @@ import lombok.Setter;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Yi yang ability.
|
||||
|
@ -23,6 +28,15 @@ import javax.annotation.Nullable;
|
|||
@Slf4j
|
||||
public class YiYangAbilityImpl implements DisposeAbility {
|
||||
|
||||
/**
|
||||
* The Protect ip v 4.
|
||||
*/
|
||||
private final List<String> protectIpV4 = new ArrayList<>();
|
||||
/**
|
||||
* The Protect ip v 6.
|
||||
*/
|
||||
private final List<String> protectIpV6 = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The Restful interface.
|
||||
*/
|
||||
|
@ -171,7 +185,40 @@ public class YiYangAbilityImpl implements DisposeAbility {
|
|||
*/
|
||||
@Override
|
||||
public void getDisposeDeviceProtectObject() {
|
||||
try {
|
||||
String url = urlRootPath + "dispose_device/information/capacity";
|
||||
ProtocolRespDTO<YiYangDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token);
|
||||
|
||||
if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()) {
|
||||
|
||||
rspInfo.getMsgContent().getCapacity().forEach(v -> {
|
||||
if (v.getObjectType().equals(DisposeObjectType.DOMAIN.getValue())) {
|
||||
log.error("Unsupported: {}", v.getObjectType());
|
||||
} else if (v.getObjectType().equals(DisposeObjectType.URL.getValue())) {
|
||||
log.error("Unsupported: {}", v.getObjectType());
|
||||
} else {
|
||||
synchronized (this) {
|
||||
|
||||
protectIpV4.clear();
|
||||
protectIpV6.clear();
|
||||
|
||||
if (v.getIPType() == null || v.getIPType().equals(IpAddrType.IPV4_IPV6.getValue())) {
|
||||
if (v.getDisposeIp() == null) {
|
||||
protectIpV4.add("");
|
||||
protectIpV6.add("");
|
||||
}
|
||||
} else if (v.getIPType().equals(IpAddrType.IPV4.getValue())) {
|
||||
protectIpV4.add("");
|
||||
} else if (v.getIPType().equals(IpAddrType.IPV6.getValue())) {
|
||||
protectIpV6.add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue