OCT
REM: 1. 调试获取全部防护策略模板接口 2. 调试获取防护对象同防护策略模板关联关系接口 3. 调试为防护对象关联防护策略模板接口 4. 调试为防护对象解除防护策略模板接口
This commit is contained in:
parent
c1d9e74db9
commit
fb0f651e16
|
@ -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"; //目前已配置的防护对象名称有两个:10,23
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"; //目前已配置的防护对象名称有两个:10,23
|
||||||
|
/*
|
||||||
|
防护策略模板UMC管理平台已配置
|
||||||
|
模板名如下:Game_Server_10G、Game_Server_1G、DNS_Server_10G、DNS_Server_1G、WEB_Server_10G
|
||||||
|
WEB_Server_1G、General_Server_10G、General_Server_1G、General_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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue