REM:
1. 调试获取全部防护策略模板接口
2. 调试获取防护对象同防护策略模板关联关系接口
3. 调试为防护对象关联防护策略模板接口
4. 调试为防护对象解除防护策略模板接口
This commit is contained in:
chenlinghy 2020-04-02 11:10:33 +08:00
parent c1d9e74db9
commit fb0f651e16
4 changed files with 203 additions and 0 deletions

View File

@ -0,0 +1,49 @@
package com.cmcc.hy.phoenix.dptech;
import org.apache.axis2.transport.http.HTTPConstants;
import java.rmi.RemoteException;
public class TestdisableProtectionStrategyTemplateForUMC {
public static void main(String[] args) {
try{
org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator basicAuthentication =
new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
basicAuthentication.setUsername("admin");
basicAuthentication.setPassword("UMCAdministrator");
AbnormalFlowCleaningServiceStub stub = new AbnormalFlowCleaningServiceStub();
/*
为指定防护对象解除指定的防护策略模板
输入参数
protectName 防护对象名称
templateName 防护策略模板名称
*/
AbnormalFlowCleaningServiceStub.DisableProtectionStrategyTemplateForUMC disable_temp;
disable_temp = new AbnormalFlowCleaningServiceStub.DisableProtectionStrategyTemplateForUMC();
String protectName = "23"; //目前已配置的防护对象名称有两个1023
String templateName = "Game_Server_10G";
disable_temp.setProtectName(protectName);
disable_temp.setTemplateName(templateName);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
/*
response
输出参数NtcRequestResultInfo类 该类为UMC封装请求返回状态信息类
NtcRequestResultInfo类的属性信息如下
resultRetVal 返回状态码
resultInfo 请求执行结果描述
*/
AbnormalFlowCleaningServiceStub.DisableProtectionStrategyTemplateForUMCResponse resp_disable_temp;
resp_disable_temp = stub.disableProtectionStrategyTemplateForUMC(disable_temp);
System.out.println("ResultInfo: " + resp_disable_temp.localOut.getResultInfo());
System.out.println("resultReVal: " + resp_disable_temp.localOut.getResultRetVal());
} catch (RemoteException ex) {
System.out.println(ex.toString());
}
}
}

View File

@ -0,0 +1,49 @@
package com.cmcc.hy.phoenix.dptech;
import java.rmi.RemoteException;
public class TestgetAllProtectionStrategyTemplateFromUMC {
public static void main(String[] args) {
try{
org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator basicAuthentication =
new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
basicAuthentication.setUsername("admin");
basicAuthentication.setPassword("UMCAdministrator");
AbnormalFlowCleaningServiceStub stub = new AbnormalFlowCleaningServiceStub();
/*
获取UMC已配置的全部可用防护策略模板信息及防护策略模板描述
输入参数
*/
AbnormalFlowCleaningServiceStub.GetAllProtectionStrategyTemplateFromUMC getProStrategy;
getProStrategy = new AbnormalFlowCleaningServiceStub.GetAllProtectionStrategyTemplateFromUMC();
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication);
/*
response
输出参数ArrayOfProtectionStrategyTemplateForService 该类为防护策略模板的数组
ArrayOfProtectionStrategyTemplateForService类为ProtectionStrategyTemplateForService类的数组
ProtectionStrategyTemplateForService类的属性信息如下
name 模板名称
description 模板描述
*/
AbnormalFlowCleaningServiceStub.GetAllProtectionStrategyTemplateFromUMCResponse respProStrategy;
respProStrategy = stub.getAllProtectionStrategyTemplateFromUMC(getProStrategy);
try {
for(AbnormalFlowCleaningServiceStub.ProtectionStrategyTemplateForService p : respProStrategy.localOut.getProtectionStrategyTemplateForService())
{
System.out.println("name: " + p.localName);
//System.out.println("name: " + p.getName());
System.out.println("description: " + p.localDescription);
//System.out.println("description: " + p.getDescription());
}
}catch(NullPointerException ex){
System.out.println(ex.toString());
}
} catch (RemoteException ex) {
System.out.println(ex.toString());
}
}
}

View File

@ -0,0 +1,51 @@
package com.cmcc.hy.phoenix.dptech;
import org.apache.axis2.transport.http.HTTPConstants;
import java.rmi.RemoteException;
public class TestgetAllProtectionTargetWithStrategyAssociationRelationshipForUMC {
public static void main(String[] args) {
try{
org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator basicAuthentication =
new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
basicAuthentication.setUsername("admin");
basicAuthentication.setPassword("UMCAdministrator");
AbnormalFlowCleaningServiceStub stub = new AbnormalFlowCleaningServiceStub();
/*
获取UMC已配置的全部防护对象同防护策略模板关联关系信息
输入参数
*/
AbnormalFlowCleaningServiceStub.GetAllProtectionTargetWithStrategyAssociationRelationshipForUMC getassocrel;
getassocrel = new AbnormalFlowCleaningServiceStub.GetAllProtectionTargetWithStrategyAssociationRelationshipForUMC();
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
/*
response
输出参数 ArrayOfProtectionTargetWithStrategyForService 该类为防护对象同防护策略模板关联关系的对象数组
ArrayOfProtectionTargetWithStrategyForService类为ProtectionTargetWithStrategyForService类的数组
ProtectionTargetWithStrategyForService类的属性信息如下
protectionTargetName 防护对象名称
protectionStrategyName 防护策略模板名称未关联任何策略模板返回空串
*/
AbnormalFlowCleaningServiceStub.GetAllProtectionTargetWithStrategyAssociationRelationshipForUMCResponse respassocrel;
respassocrel = stub.getAllProtectionTargetWithStrategyAssociationRelationshipForUMC(getassocrel);
try {
for(AbnormalFlowCleaningServiceStub.ProtectionTargetWithStrategyForService p: respassocrel.localOut.getProtectionTargetWithStrategyForService())
{
System.out.println("protectionTargetName: " + p.localProtectionTargetName);
//System.out.println("protectionTargetName: " + p.getProtectionTargetName());
System.out.println("protectionStrategyName: " + p.localProtectionStrategyName);
//System.out.println("protectionStrategyName: " + p.getProtectionStrategyName());
}
}catch(NullPointerException ex){
System.out.println(ex.toString());
}
} catch (RemoteException ex) {
System.out.println(ex.toString());
}
}
}

View File

@ -0,0 +1,54 @@
package com.cmcc.hy.phoenix.dptech;
import org.apache.axis2.transport.http.HTTPConstants;
import java.rmi.RemoteException;
public class TestlinkProtectionStrategyTemplateForUMC {
public static void main(String[] args) {
try{
org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator basicAuthentication =
new org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl.Authenticator();
basicAuthentication.setUsername("admin");
basicAuthentication.setPassword("UMCAdministrator");
AbnormalFlowCleaningServiceStub stub = new AbnormalFlowCleaningServiceStub();
/*
指定防护对象关联防护策略模板关联后该防护策略模板将对该防护对象生效
输入参数
protectName 防护对象名称
templateName 防护策略模板名称
*/
AbnormalFlowCleaningServiceStub.LinkProtectionStrategyTemplateForUMC link_temp;
link_temp = new AbnormalFlowCleaningServiceStub.LinkProtectionStrategyTemplateForUMC();
String protectName = "23"; //目前已配置的防护对象名称有两个1023
/*
防护策略模板UMC管理平台已配置
模板名如下:Game_Server_10GGame_Server_1GDNS_Server_10GDNS_Server_1GWEB_Server_10G
WEB_Server_1GGeneral_Server_10GGeneral_Server_1GGeneral_Server_100M
*/
String templateName = "Game_Server_10G";
link_temp.setProtectName(protectName);
link_temp.setTemplateName(templateName);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
/*
response
输出参数NtcRequestResultInfo类 该类为UMC封装请求返回状态信息类
NtcRequestResultInfo类的属性信息如下
resultRetVal 返回状态码
resultInfo 请求执行结果描述
*/
AbnormalFlowCleaningServiceStub.LinkProtectionStrategyTemplateForUMCResponse resp_link_temp;
resp_link_temp = stub.linkProtectionStrategyTemplateForUMC(link_temp);
System.out.println("ResultInfo: " + resp_link_temp.localOut.getResultInfo());
System.out.println("resultReVal: " + resp_link_temp.localOut.getResultRetVal());
} catch (RemoteException ex) {
System.out.println(ex.toString());
}
}
}