From fb0f651e1659c254b727114f062baf2a1ba07ba9 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Thu, 2 Apr 2020 11:10:33 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E8=B0=83=E8=AF=95=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=85=A8=E9=83=A8=E9=98=B2=E6=8A=A4=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=8E=A5=E5=8F=A3=202.=20=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=98=B2=E6=8A=A4=E5=AF=B9=E8=B1=A1=E5=90=8C?= =?UTF-8?q?=E9=98=B2=E6=8A=A4=E7=AD=96=E7=95=A5=E6=A8=A1=E6=9D=BF=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=85=B3=E7=B3=BB=E6=8E=A5=E5=8F=A3=203.=20=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E4=B8=BA=E9=98=B2=E6=8A=A4=E5=AF=B9=E8=B1=A1=E5=85=B3?= =?UTF-8?q?=E8=81=94=E9=98=B2=E6=8A=A4=E7=AD=96=E7=95=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=204.=20=E8=B0=83=E8=AF=95=E4=B8=BA=E9=98=B2?= =?UTF-8?q?=E6=8A=A4=E5=AF=B9=E8=B1=A1=E8=A7=A3=E9=99=A4=E9=98=B2=E6=8A=A4?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=A8=A1=E6=9D=BF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sableProtectionStrategyTemplateForUMC.java | 49 +++++++++++++++++ ...tAllProtectionStrategyTemplateFromUMC.java | 49 +++++++++++++++++ ...StrategyAssociationRelationshipForUMC.java | 51 ++++++++++++++++++ ...tlinkProtectionStrategyTemplateForUMC.java | 54 +++++++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 src/test/java/com/cmcc/hy/phoenix/dptech/TestdisableProtectionStrategyTemplateForUMC.java create mode 100644 src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionStrategyTemplateFromUMC.java create mode 100644 src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionTargetWithStrategyAssociationRelationshipForUMC.java create mode 100644 src/test/java/com/cmcc/hy/phoenix/dptech/TestlinkProtectionStrategyTemplateForUMC.java diff --git a/src/test/java/com/cmcc/hy/phoenix/dptech/TestdisableProtectionStrategyTemplateForUMC.java b/src/test/java/com/cmcc/hy/phoenix/dptech/TestdisableProtectionStrategyTemplateForUMC.java new file mode 100644 index 00000000..1d50cc43 --- /dev/null +++ b/src/test/java/com/cmcc/hy/phoenix/dptech/TestdisableProtectionStrategyTemplateForUMC.java @@ -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()); + } + } +} diff --git a/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionStrategyTemplateFromUMC.java b/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionStrategyTemplateFromUMC.java new file mode 100644 index 00000000..8eb9e399 --- /dev/null +++ b/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionStrategyTemplateFromUMC.java @@ -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()); + } + } +} diff --git a/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionTargetWithStrategyAssociationRelationshipForUMC.java b/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionTargetWithStrategyAssociationRelationshipForUMC.java new file mode 100644 index 00000000..e5b8f088 --- /dev/null +++ b/src/test/java/com/cmcc/hy/phoenix/dptech/TestgetAllProtectionTargetWithStrategyAssociationRelationshipForUMC.java @@ -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()); + } + } +} diff --git a/src/test/java/com/cmcc/hy/phoenix/dptech/TestlinkProtectionStrategyTemplateForUMC.java b/src/test/java/com/cmcc/hy/phoenix/dptech/TestlinkProtectionStrategyTemplateForUMC.java new file mode 100644 index 00000000..0af9b37c --- /dev/null +++ b/src/test/java/com/cmcc/hy/phoenix/dptech/TestlinkProtectionStrategyTemplateForUMC.java @@ -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()); + } + } +}