summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-23 14:56:12 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-23 16:49:56 -0400
commit87c95be02a8a4d77e165dede90777e811b59dcae (patch)
tree4712199fc3520b530dda0c4d3b074c327df547f2
parent7e547eaa55920dfbc9691eab33bb728395b50cf2 (diff)
Commit includes ControlLoopPolicy API and bugfixes
Change-Id: I3e18bb8b4c31a0d908bb0cff4c85e2a3fb450a63 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
-rw-r--r--BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java3
-rw-r--r--BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java34
-rw-r--r--BRMSGateway/src/main/resources/logback.xml2
-rw-r--r--ECOMP-ASDC/pom.xml37
-rw-r--r--ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Resource.java159
-rw-r--r--ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceInstance.java157
-rw-r--r--ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceType.java40
-rw-r--r--ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Service.java140
-rw-r--r--ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ServiceInstance.java177
-rw-r--r--ECOMP-ASDC/src/main/resources/definitions.yaml76
-rw-r--r--ECOMP-ControlloopPolicy/pom.xml29
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/CompilerException.java1
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompiler.java401
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java54
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoop.java110
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicy.java22
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/FinalResult.java2
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/OperationsAccumulateParams.java22
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Policy.java184
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/PolicyResult.java1
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Target.java22
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/TargetType.java7
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/BuilderException.java8
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java83
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java230
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ResultsImpl.java4
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Constraint.java69
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuard.java27
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Guard.java14
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/GuardPolicy.java79
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java6
-rw-r--r--ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java79
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompilerTest.java80
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java101
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java516
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyTest.java101
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java193
-rw-r--r--ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardTest.java91
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_policies_1.yaml25
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_1.yaml95
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_2.yaml95
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml12
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test.yaml95
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml26
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test.yaml95
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test_evil.yaml25
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml21
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml27
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml11
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_policy.yaml2
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml24
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml15
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml1698
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml2525
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml677
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml677
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/pgstreams.json26
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml47
-rw-r--r--ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml58
-rw-r--r--ECOMP-PAP-REST/policyelk.properties30
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java6
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java20
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java14
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java39
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java20
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java17
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java12
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java24
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java8
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java40
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java38
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java22
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java8
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java311
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java10
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java33
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java45
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java21
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java2
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java6
-rw-r--r--ECOMP-PAP-REST/src/main/resources/logback.xml4
-rw-r--r--ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java36
-rw-r--r--ECOMP-PAP-REST/xacml.pap.properties2
-rw-r--r--ECOMP-PAP-REST/xacml.pap.test.properties2
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/CreateUpdateConfigPolicyService.java2
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDecisionService.java2
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetMetricsService.java7
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java330
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PDPServices.java25
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/SendEventService.java2
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java4
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/impl/XACMLPdpPolicyFinderFactory.java2
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java4
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationController.java8
-rw-r--r--ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationServer.java4
-rw-r--r--ECOMP-PDP-REST/src/main/resources/logback.xml4
-rw-r--r--ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java4
-rw-r--r--ECOMP-PDP-REST/xacml.pdp.properties2
-rw-r--r--ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java41
-rw-r--r--ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java4
-rw-r--r--ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/PolicyList.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionAccessPermittedTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionArithmeticTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagIsInTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagOneAndOnlyTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagSizeTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionComparisonTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionDateTimeArithmeticTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionEqualityTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHigherOrderBagTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHomogeneousSimpleTest.java4
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionLogicalTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionNumberTypeConversionTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionRegexpMatchTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSetTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSpecialMatchTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringConversionTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringEqualIgnoreCaseTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringFunctionsTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringNormalizeTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionURIStringConcatenateTest.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformancePIPEngine.java6
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceRepository.java4
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceScopeResolver.java6
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceTestSet.java4
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomDataTypeFactory.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomFunctionDefinitionFactory.java2
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestBase.java6
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestCustom.java2
-rw-r--r--ECOMP-PDP/src/test/resources/logback.xml4
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java14
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/IdMap.java42
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java20
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java14
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java196
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/VendorSpecificData.java38
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java4
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Obadvice.java2
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java12
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPResolver.java6
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java10
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java34
-rw-r--r--ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java2
-rw-r--r--ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/Register.java2
-rw-r--r--ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java2
-rw-r--r--ECOMP-SDK-APP/xacml.admin.properties2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java16
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java6
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDP.java4
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java8
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroupStatus.java24
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPStatus.java14
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java8
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/TestBase.java6
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseConformanceTest.java2
-rw-r--r--LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java274
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java42
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java14
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyUserInfoController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/RESTfulPAPEngine.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/HumanPolicyComponent.java7
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java16
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java11
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java10
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AdminTabController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AutoPushController.java16
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java10
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java341
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java103
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreatePolicyController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java16
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java14
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java20
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyController.java23
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyRolesController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java20
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/daoImp/CommonClassDaoImpl.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPGroupContainer.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPPolicyContainer.java2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/b2b-angular.css231
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js37
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html8
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html16
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html4
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/search-main-table.html74
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_SearchFilter.html2
-rw-r--r--PolicyEngineAPI/pom.xml13
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java4
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java9
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java4
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java15
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java6
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java2
-rw-r--r--PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java22
-rw-r--r--PolicyEngineAPI/src/main/resources/logback.xml2
-rw-r--r--PolicyEngineClient/config.properties4
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java12
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java7
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java4
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java4
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java14
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java10
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java2
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java10
-rw-r--r--PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java6
-rw-r--r--PolicyEngineUtils/src/main/java/org/openecomp/policy/std/NotificationStore.java12
-rw-r--r--PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BackUpMonitor.java4
-rw-r--r--PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BusPublisher.java2
-rw-r--r--PolicyEngineUtils/src/test/java/org/openecomp/policy/test/PolicyUtilsTest.java6
-rw-r--r--packages/base/src/assembly/zip.xml6
-rw-r--r--packages/base/src/files/bin/backup.sh1
-rw-r--r--packages/base/src/files/bin/policy.sh12
-rw-r--r--packages/base/src/files/etc/cron.d/audit.cron1
-rw-r--r--packages/base/src/files/etc/cron.d/logrotate.cron2
-rw-r--r--packages/base/src/files/etc/logrotate.d/elk.conf7
-rw-r--r--packages/base/src/files/etc/monitor/monitor.cfg4
-rw-r--r--packages/base/src/files/install/elk/bin/elk.sh166
-rw-r--r--packages/base/src/files/install/elk/config/elasticsearch.yml392
-rw-r--r--packages/base/src/files/install/elk/init.d/elkd76
-rw-r--r--packages/base/src/files/install/servers/brmsgw/client.properties3
-rw-r--r--packages/base/src/files/install/servers/pdp/bin/client.properties21
-rw-r--r--packages/install/src/files/brmsgw.conf2
-rw-r--r--packages/install/src/files/elk.conf3
-rw-r--r--packages/install/src/files/pdp.conf2
-rw-r--r--packages/install/src/files/pypdp.conf25
-rw-r--r--pom.xml1
262 files changed, 11806 insertions, 1949 deletions
diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
index b28624e61..ef990aa01 100644
--- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
+++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSHandler.java
@@ -125,7 +125,6 @@ public class BRMSHandler implements BackUpHandler{
ArrayList<PolicyConfig> brmsPolicies = addedPolicies(notification);
Boolean successFlag = false;
for(int i=0; !successFlag && i< bRMSPush.URLListSize(); i++){
- successFlag = false;
if(i!=0 && !successFlag){
for(PolicyConfig policyConfig: brmsPolicies){
logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName());
@@ -148,7 +147,7 @@ public class BRMSHandler implements BackUpHandler{
* Executed when a policy is added to PDP.
*/
private ArrayList<PolicyConfig> addedPolicies(PDPNotification notification) {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> result = new ArrayList<>();
for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
logger.info("policyName : " + updatedPolicy.getPolicyName());
logger.info("policyVersion :" + updatedPolicy.getVersionNo());
diff --git a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
index 7e9b64c33..1fbd2aa08 100644
--- a/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/openecomp/policy/brmsInterface/BRMSPush.java
@@ -110,7 +110,7 @@ public class BRMSPush {
private static final String DEFAULT_VERSION = "1.1.0-SNAPSHOT";
private static final String DEPENDENCY_FILE = "dependency.json";
- private static Map<String, String> modifiedGroups = new HashMap<String, String>();
+ private static Map<String, String> modifiedGroups = new HashMap<>();
private static IntegrityMonitor im;
private static BackUpMonitor bm;
private static String resourceName = null;
@@ -131,8 +131,8 @@ public class BRMSPush {
private Long dmaapDelay = Long.parseLong("5000");
private String notificationType = null;
private ArrayList<ControllerPOJO> controllers;
- private HashMap<String, ArrayList<Object>> groupMap = new HashMap<String, ArrayList<Object>>();
- private Map<String, String> policyMap = new HashMap<String,String>();
+ private HashMap<String, ArrayList<Object>> groupMap = new HashMap<>();
+ private Map<String, String> policyMap = new HashMap<>();
private String brmsdependencyversion;
private EntityManager em;
private boolean syncFlag = false;
@@ -206,7 +206,7 @@ public class BRMSPush {
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryURL property is missing from the property file ");
}
if(repURL.contains(",")){
- repURLs = new ArrayList<String>(Arrays.asList(repURL.trim().split(",")));
+ repURLs = new ArrayList<>(Arrays.asList(repURL.trim().split(",")));
}else{
repURLs = new ArrayList<>();
repURLs.add(repURL);
@@ -258,9 +258,9 @@ public class BRMSPush {
pubTopic = pubTopic.trim();
if(dmaapServers.contains(",")) {
- dmaapList = new ArrayList<String>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
+ dmaapList = new ArrayList<>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
} else {
- dmaapList = new ArrayList<String>();
+ dmaapList = new ArrayList<>();
dmaapList.add(dmaapServers);
}
@@ -322,8 +322,8 @@ public class BRMSPush {
* Will Initialize the variables required for BRMSPush.
*/
public void initiate(boolean flag) {
- modifiedGroups = new HashMap<String, String>();
- controllers = new ArrayList<ControllerPOJO>();
+ modifiedGroups = new HashMap<>();
+ controllers = new ArrayList<>();
try {
bm.updateNotification();
} catch (Exception e) {
@@ -346,7 +346,7 @@ public class BRMSPush {
if(!responseAttributes.isEmpty()){
// Pick selected Value
String userControllerName = null;
- ArrayList<PEDependency> userDependencies = new ArrayList<PEDependency>();
+ ArrayList<PEDependency> userDependencies = new ArrayList<>();
for(String key: responseAttributes.keySet()){
if(key.equals(policyKeyID)){
selectedName = responseAttributes.get(key);
@@ -421,7 +421,7 @@ public class BRMSPush {
dependency.setArtifactId(brmsGroupInfo.getArtifactId());
dependency.setGroupId(brmsGroupInfo.getGroupId());
dependency.setVersion(brmsGroupInfo.getVersion());
- ArrayList<Object> values = new ArrayList<Object>();
+ ArrayList<Object> values = new ArrayList<>();
values.add(dependency);
groupMap.put(brmsGroupInfo.getControllerName(), values);
}
@@ -756,7 +756,7 @@ public class BRMSPush {
ControllerPOJO controllerPOJO = new ControllerPOJO();
controllerPOJO.setName(controllerName);
controllerPOJO.setOperation(operation);
- HashMap<String, String> drools = new HashMap<String, String>();
+ HashMap<String, String> drools = new HashMap<>();
drools.put("groupId", getGroupID(controllerName));
drools.put("artifactId", getArtifactID(controllerName));
drools.put("version", getVersion(controllerName));
@@ -776,7 +776,7 @@ public class BRMSPush {
ControllerPOJO controllerPOJO = new ControllerPOJO();
controllerPOJO.setName(controllerName);
controllerPOJO.setOperation("lock");
- List<ControllerPOJO> controllers = new ArrayList<ControllerPOJO>();
+ List<ControllerPOJO> controllers = new ArrayList<>();
controllers.add(controllerPOJO);
sendNotification(controllers);
}
@@ -841,7 +841,7 @@ public class BRMSPush {
distributionManagement.setRepository(repository);
model.setDistributionManagement(distributionManagement);
// Dependency Management goes here.
- List<Dependency> dependencyList= new ArrayList<Dependency>();
+ List<Dependency> dependencyList= new ArrayList<>();
if(groupMap.get(name).size()>1){
@SuppressWarnings("unchecked")
ArrayList<PEDependency> dependencies = (ArrayList<PEDependency>) groupMap.get(name).get(1);
@@ -880,7 +880,7 @@ public class BRMSPush {
if(dependencyInfo.getDependencies().containsKey(controllerName)){
controller = controllerName;
}
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> dependencyList = new ArrayList<>();
for(PEDependency dependency: dependencyInfo.getDependencies().get(controller)){
dependencyList.add(dependency.getDependency());
}
@@ -897,7 +897,7 @@ public class BRMSPush {
// Default Dependency Section. Can be changed as required.
public List<Dependency> defaultDependencies(String controllerName) {
- List<Dependency> dependencyList = new ArrayList<Dependency>();
+ List<Dependency> dependencyList = new ArrayList<>();
String version= StringEscapeUtils.escapeJava(brmsdependencyversion);
Dependency demoDependency = new Dependency();
@@ -977,7 +977,7 @@ public class BRMSPush {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file ");
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + "groupNames property is missing or empty from the property file ");
}
- groupMap = new HashMap<String, ArrayList<Object>>();
+ groupMap = new HashMap<>();
for(int counter=0; counter < groupNames.length ;counter++){
String name = groupNames[counter];
String groupID = config.getProperty(name+".groupID");
@@ -999,7 +999,7 @@ public class BRMSPush {
}
private void addToGroup(String name, PEDependency dependency) {
- ArrayList<Object> values = new ArrayList<Object>();
+ ArrayList<Object> values = new ArrayList<>();
values.add(dependency);
groupMap.put(name, values);
EntityTransaction et = em.getTransaction();
diff --git a/BRMSGateway/src/main/resources/logback.xml b/BRMSGateway/src/main/resources/logback.xml
index 2c67db9cb..2cae6c8f2 100644
--- a/BRMSGateway/src/main/resources/logback.xml
+++ b/BRMSGateway/src/main/resources/logback.xml
@@ -205,7 +205,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/ECOMP-ASDC/pom.xml b/ECOMP-ASDC/pom.xml
new file mode 100644
index 000000000..10531f3e9
--- /dev/null
+++ b/ECOMP-ASDC/pom.xml
@@ -0,0 +1,37 @@
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP Policy Engine
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>asdc</artifactId>
+ <parent>
+ <groupId>org.openecomp.policy.engine</groupId>
+ <artifactId>PolicyEngineSuite</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Resource.java b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Resource.java
new file mode 100644
index 000000000..af57afa00
--- /dev/null
+++ b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Resource.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.asdc;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+public class Resource implements Serializable {
+
+ private static final long serialVersionUID = -913729158733348027L;
+
+ private UUID resourceUUID;
+ private UUID resourceInvariantUUID;
+ private String resourceName;
+ private String resourceVersion;
+ private ResourceType resourceType;
+
+ public Resource() {
+ //Empty Constructor
+ }
+
+ public Resource(Resource resource) {
+ this.resourceUUID = resource.resourceUUID;
+ this.resourceInvariantUUID = resource.resourceInvariantUUID;
+ this.resourceName = resource.resourceName;
+ this.resourceVersion = resource.resourceVersion;
+ this.resourceType = resource.resourceType;
+ }
+
+ public Resource(UUID uuid) {
+ this.resourceUUID = uuid;
+ }
+
+ public Resource(String name, ResourceType type) {
+ this.resourceName = name;
+ this.resourceType = type;
+ }
+
+ public Resource(UUID uuid, UUID invariantUUID, String name, String version, ResourceType type) {
+ this.resourceUUID = uuid;
+ this.resourceInvariantUUID = invariantUUID;
+ this.resourceName = name;
+ this.resourceVersion = version;
+ this.resourceType = type;
+ }
+
+ public UUID getResourceUUID() {
+ return resourceUUID;
+ }
+
+ public void setResourceUUID(UUID resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ public UUID getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
+
+ public void setResourceInvariantUUID(UUID resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ public String toString() {
+ return "Resource [resourceUUID=" + resourceUUID + ", resourceInvariantUUID=" + resourceInvariantUUID
+ + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType="
+ + resourceType + "]";
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode());
+ result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
+ result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
+ result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode());
+ result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Resource other = (Resource) obj;
+ if (resourceInvariantUUID == null) {
+ if (other.resourceInvariantUUID != null)
+ return false;
+ } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID))
+ return false;
+ if (resourceName == null) {
+ if (other.resourceName != null)
+ return false;
+ } else if (!resourceName.equals(other.resourceName))
+ return false;
+ if (resourceType == null) {
+ if (other.resourceType != null)
+ return false;
+ } else if (!resourceType.equals(other.resourceType))
+ return false;
+ if (resourceUUID == null) {
+ if (other.resourceUUID != null)
+ return false;
+ } else if (!resourceUUID.equals(other.resourceUUID))
+ return false;
+ if (resourceVersion == null) {
+ if (other.resourceVersion != null)
+ return false;
+ } else if (!resourceVersion.equals(other.resourceVersion))
+ return false;
+ return true;
+ }
+
+}
diff --git a/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceInstance.java b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceInstance.java
new file mode 100644
index 000000000..40d48d9f0
--- /dev/null
+++ b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceInstance.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.asdc;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+public class ResourceInstance implements Serializable {
+ private static final long serialVersionUID = -5506162340393802424L;
+
+ private String resourceInstanceName;
+ private String resourceName;
+ private UUID resourceInvariantUUID;
+ private String resourceVersion;
+ private ResourceType resourceType;
+ private UUID resourceUUID;
+
+ public ResourceInstance() {
+ //Empty Constructor
+ }
+
+ public ResourceInstance(ResourceInstance instance) {
+ if (instance == null) {
+ return;
+ }
+ this.resourceInstanceName = instance.resourceInstanceName;
+ this.resourceName = instance.resourceName;
+ this.resourceInvariantUUID = instance.resourceInvariantUUID;
+ this.resourceVersion = instance.resourceVersion;
+ this.resourceType = instance.resourceType;
+ this.resourceUUID = instance.resourceUUID;
+ }
+
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public UUID getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
+
+ public void setResourceInvariantUUID(UUID resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public UUID getResourceUUID() {
+ return resourceUUID;
+ }
+
+ public void setResourceUUID(UUID resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ @Override
+ public String toString() {
+ return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
+ + ", resourceInvariantUUID=" + resourceInvariantUUID + ", resourceVersion=" + resourceVersion
+ + ", resourceType=" + resourceType + ", resourceUUID=" + resourceUUID + "]";
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
+ result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode());
+ result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
+ result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
+ result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode());
+ result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ResourceInstance other = (ResourceInstance) obj;
+ if (resourceInstanceName == null) {
+ if (other.resourceInstanceName != null)
+ return false;
+ } else if (!resourceInstanceName.equals(other.resourceInstanceName))
+ return false;
+ if (resourceInvariantUUID == null) {
+ if (other.resourceInvariantUUID != null)
+ return false;
+ } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID))
+ return false;
+ if (resourceName == null) {
+ if (other.resourceName != null)
+ return false;
+ } else if (!resourceName.equals(other.resourceName))
+ return false;
+ if (resourceType != other.resourceType)
+ return false;
+ if (resourceUUID == null) {
+ if (other.resourceUUID != null)
+ return false;
+ } else if (!resourceUUID.equals(other.resourceUUID))
+ return false;
+ if (resourceVersion == null) {
+ if (other.resourceVersion != null)
+ return false;
+ } else if (!resourceVersion.equals(other.resourceVersion))
+ return false;
+ return true;
+ }
+
+}
diff --git a/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceType.java b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceType.java
new file mode 100644
index 000000000..426b3907c
--- /dev/null
+++ b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ResourceType.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.asdc;
+
+public enum ResourceType {
+ VF("VF"),
+ VFC("VFC"),
+ VL("VL"),
+ CP("CP")
+ ;
+
+ private String type;
+
+ private ResourceType(String type) {
+ this.type = type;
+ }
+
+ public String toString() {
+ return this.type;
+ }
+
+}
diff --git a/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Service.java b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Service.java
new file mode 100644
index 000000000..b7b5d3cb5
--- /dev/null
+++ b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/Service.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.asdc;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+public class Service implements Serializable {
+
+ private static final long serialVersionUID = -1249276698549996806L;
+
+ private UUID serviceUUID;
+ private UUID serviceInvariantUUID;
+ private String serviceName;
+ private String serviceVersion;
+
+ public Service() {
+ //Empty Constructor
+ }
+
+ public Service(UUID uuid) {
+ this.serviceUUID = uuid;
+ }
+
+ public Service(String name) {
+ this.serviceName = name;
+ }
+
+ public Service(UUID uuid, UUID invariantUUID, String name, String version) {
+ this.serviceUUID = uuid;
+ this.serviceInvariantUUID = invariantUUID;
+ this.serviceName = name;
+ this.serviceVersion = version;
+ }
+
+ public Service(Service service) {
+ this.serviceUUID = service.serviceUUID;
+ this.serviceInvariantUUID = service.serviceInvariantUUID;
+ this.serviceName = service.serviceName;
+ this.serviceVersion = service.serviceVersion;
+ }
+
+ public UUID getServiceUUID() {
+ return serviceUUID;
+ }
+
+ public void setServiceUUID(UUID serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+ public UUID getServiceInvariantUUID() {
+ return serviceInvariantUUID;
+ }
+
+ public void setServiceInvariantUUID(UUID serviceInvariantUUID) {
+ this.serviceInvariantUUID = serviceInvariantUUID;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceVersion() {
+ return serviceVersion;
+ }
+
+ public void setServiceVersion(String serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ }
+
+ @Override
+ public String toString() {
+ return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID
+ + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]";
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode());
+ result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
+ result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
+ result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Service other = (Service) obj;
+ if (serviceInvariantUUID == null) {
+ if (other.serviceInvariantUUID != null)
+ return false;
+ } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID))
+ return false;
+ if (serviceName == null) {
+ if (other.serviceName != null)
+ return false;
+ } else if (!serviceName.equals(other.serviceName))
+ return false;
+ if (serviceUUID == null) {
+ if (other.serviceUUID != null)
+ return false;
+ } else if (!serviceUUID.equals(other.serviceUUID))
+ return false;
+ if (serviceVersion == null) {
+ if (other.serviceVersion != null)
+ return false;
+ } else if (!serviceVersion.equals(other.serviceVersion))
+ return false;
+ return true;
+ }
+
+}
diff --git a/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ServiceInstance.java b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ServiceInstance.java
new file mode 100644
index 000000000..40a08fd93
--- /dev/null
+++ b/ECOMP-ASDC/src/main/java/org/openecomp/policy/asdc/ServiceInstance.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.asdc;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+public class ServiceInstance implements Serializable {
+ private static final long serialVersionUID = 6285260780966679625L;
+
+ private UUID personaModelUUID;
+ private UUID serviceUUID;
+ private UUID serviceInstanceUUID;
+ private UUID widgetModelUUID;
+ private String widgetModelVersion;
+ private String serviceName;
+ private String serviceInstanceName;
+
+ public ServiceInstance() {
+ //Empty Constructor
+ }
+
+ public ServiceInstance(ServiceInstance instance) {
+ if (instance == null) {
+ return;
+ }
+ this.personaModelUUID = instance.personaModelUUID;
+ this.serviceUUID = instance.serviceUUID;
+ this.serviceInstanceUUID = instance.serviceInstanceUUID;
+ this.widgetModelUUID = instance.widgetModelUUID;
+ this.widgetModelVersion = instance.widgetModelVersion;
+ this.serviceName = instance.serviceName;
+ this.serviceInstanceName = instance.serviceInstanceName;
+ }
+
+ public UUID getPersonaModelUUID() {
+ return personaModelUUID;
+ }
+
+ public void setPersonaModelUUID(UUID personaModelUUID) {
+ this.personaModelUUID = personaModelUUID;
+ }
+
+ public UUID getServiceUUID() {
+ return serviceUUID;
+ }
+
+ public void setServiceUUID(UUID serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+ public UUID getServiceInstanceUUID() {
+ return serviceInstanceUUID;
+ }
+
+ public void setServiceInstanceUUID(UUID serviceInstanceUUID) {
+ this.serviceInstanceUUID = serviceInstanceUUID;
+ }
+
+ public UUID getWidgetModelUUID() {
+ return widgetModelUUID;
+ }
+
+ public void setWidgetModelUUID(UUID widgetModelUUID) {
+ this.widgetModelUUID = widgetModelUUID;
+ }
+
+ public String getWidgetModelVersion() {
+ return widgetModelVersion;
+ }
+
+ public void setWidgetModelVersion(String widgetModelVersion) {
+ this.widgetModelVersion = widgetModelVersion;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID
+ + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID
+ + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName
+ + ", serviceInstanceName=" + serviceInstanceName + "]";
+ }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode());
+ result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode());
+ result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode());
+ result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
+ result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
+ result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode());
+ result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServiceInstance other = (ServiceInstance) obj;
+ if (personaModelUUID == null) {
+ if (other.personaModelUUID != null)
+ return false;
+ } else if (!personaModelUUID.equals(other.personaModelUUID))
+ return false;
+ if (serviceInstanceName == null) {
+ if (other.serviceInstanceName != null)
+ return false;
+ } else if (!serviceInstanceName.equals(other.serviceInstanceName))
+ return false;
+ if (serviceInstanceUUID == null) {
+ if (other.serviceInstanceUUID != null)
+ return false;
+ } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID))
+ return false;
+ if (serviceName == null) {
+ if (other.serviceName != null)
+ return false;
+ } else if (!serviceName.equals(other.serviceName))
+ return false;
+ if (serviceUUID == null) {
+ if (other.serviceUUID != null)
+ return false;
+ } else if (!serviceUUID.equals(other.serviceUUID))
+ return false;
+ if (widgetModelUUID == null) {
+ if (other.widgetModelUUID != null)
+ return false;
+ } else if (!widgetModelUUID.equals(other.widgetModelUUID))
+ return false;
+ if (widgetModelVersion == null) {
+ if (other.widgetModelVersion != null)
+ return false;
+ } else if (!widgetModelVersion.equals(other.widgetModelVersion))
+ return false;
+ return true;
+ }
+
+}
diff --git a/ECOMP-ASDC/src/main/resources/definitions.yaml b/ECOMP-ASDC/src/main/resources/definitions.yaml
new file mode 100644
index 000000000..6fb1f7cfa
--- /dev/null
+++ b/ECOMP-ASDC/src/main/resources/definitions.yaml
@@ -0,0 +1,76 @@
+Service:
+ type: Object
+ properties:
+ serviceUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ serviceInvariantUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ serviceName:
+ type: string
+ serviceVersion:
+ type: string
+Resource:
+ type: Object
+ properties:
+ resourceUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ resourceInvariantUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ resourceName:
+ type: string
+ resourceVersion:
+ type: string
+ resourceType:
+ type: string
+ valid_values:
+ - VF
+ - VFC
+ - CP
+ - VL
+ServiceInstance:
+ type: Object
+ properties:
+ personaModelUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ serviceUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ serviceInstanceUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ widgetModelUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ widgetModelVersion:
+ type: string
+ serviceName:
+ type: string
+ serviceInstanceName:
+ type: string
+ResourceInstance:
+ type: object
+ properties:
+ resourceInstanceName:
+ type: string
+ resourceName:
+ type: string
+ resourceInvariantUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ resourceVersion:
+ type: string
+ resourceType:
+ type: string
+ valid_values:
+ - VF
+ - VFC
+ - CP
+ - VL
+ resourceUUID:
+ type: string
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
diff --git a/ECOMP-ControlloopPolicy/pom.xml b/ECOMP-ControlloopPolicy/pom.xml
index 18b2c5ded..870ba148f 100644
--- a/ECOMP-ControlloopPolicy/pom.xml
+++ b/ECOMP-ControlloopPolicy/pom.xml
@@ -1,3 +1,22 @@
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP Policy Engine
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -9,6 +28,11 @@
</parent>
<dependencies>
<dependency>
+ <groupId>org.openecomp.policy.engine</groupId>
+ <artifactId>asdc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
@@ -29,5 +53,10 @@
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.policy.common</groupId>
+ <artifactId>ECOMP-Logging</artifactId>
+ <version>${common-modules.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/CompilerException.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/CompilerException.java
index 7c124d5fd..78f30570c 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/CompilerException.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/CompilerException.java
@@ -25,6 +25,7 @@ public class CompilerException extends Exception {
private static final long serialVersionUID = -7262217239867898601L;
public CompilerException() {
+ //Empty Constructor
}
public CompilerException(String message) {
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompiler.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompiler.java
index fca229242..799371a2a 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompiler.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompiler.java
@@ -21,15 +21,19 @@
package org.openecomp.policy.controlloop.compiler;
import java.io.InputStream;
+import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.jgrapht.DirectedGraph;
import org.jgrapht.graph.ClassBasedEdgeFactory;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.DirectedMultigraph;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.controlloop.policy.ControlLoop;
import org.openecomp.policy.controlloop.policy.ControlLoopPolicy;
import org.openecomp.policy.controlloop.policy.FinalResult;
@@ -43,16 +47,18 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class ControlLoopCompiler {
+ private static Logger LOGGER = FlexLogger.getLogger(ControlLoopCompiler.class.getName());
public static ControlLoopPolicy compile(ControlLoopPolicy policy, ControlLoopCompilerCallback callback) throws CompilerException {
//
// Ensure the control loop is sane
//
- validateControlLoop(policy.controlLoop, callback);
+ validateControlLoop(policy.getControlLoop(), callback);
//
// Validate the policies
//
validatePolicies(policy, callback);
+
return policy;
}
@@ -69,25 +75,18 @@ public class ControlLoopCompiler {
}
private static void validateControlLoop(ControlLoop controlLoop, ControlLoopCompilerCallback callback) throws CompilerException {
- if (controlLoop == null) {
- if (callback != null) {
- callback.onError("controlLoop cannot be null");
- }
+ if (controlLoop == null && callback != null) {
+ callback.onError("controlLoop cannot be null");
}
- if (controlLoop.controlLoopName == null | controlLoop.controlLoopName.length() < 1) {
- if (callback != null) {
- callback.onError("Missing controlLoopName");
- }
+ if ((controlLoop.getControlLoopName() == null || controlLoop.getControlLoopName().length() < 1) && callback != null) {
+ callback.onError("Missing controlLoopName");
}
- if (! controlLoop.version.contentEquals(ControlLoop.VERSION)) {
- if (callback != null) {
- callback.onError("Unsupported version for this compiler");
- }
+ if ((!controlLoop.getVersion().contentEquals(ControlLoop.getVERSION())) && callback != null) {
+ callback.onError("Unsupported version for this compiler");
}
- if (controlLoop.trigger_policy == null || controlLoop.trigger_policy.length() < 1) {
+ if (controlLoop.getTrigger_policy() == null || controlLoop.getTrigger_policy().length() < 1) {
throw new CompilerException("trigger_policy is not valid");
}
- //
}
private static void validatePolicies(ControlLoopPolicy policy, ControlLoopCompilerCallback callback) throws CompilerException {
@@ -97,29 +96,27 @@ public class ControlLoopCompiler {
//
// verify controlLoop overall timeout should be no less than the sum of operational policy timeouts
//
- if (policy.policies == null) {
+ if (policy.getPolicies() == null) {
callback.onWarning("controlLoop is an open loop.");
}
else{
int sum = 0;
- for (Policy operPolicy : policy.policies) {
- sum += operPolicy.timeout.intValue();
+ for (Policy operPolicy : policy.getPolicies()) {
+ sum += operPolicy.getTimeout().intValue();
}
- if (policy.controlLoop.timeout.intValue() < sum) {
- if (callback != null) {
- callback.onError("controlLoop overall timeout is less than the sum of operational policy timeouts.");
- }
+ if (policy.getControlLoop().getTimeout().intValue() < sum && callback != null) {
+ callback.onError("controlLoop overall timeout is less than the sum of operational policy timeouts.");
}
//
// For this version we can use a directed multigraph, in the future we may not be able to
//
- DirectedGraph<NodeWrapper, LabeledEdge> graph = new DirectedMultigraph<NodeWrapper, LabeledEdge>(new ClassBasedEdgeFactory<NodeWrapper, LabeledEdge>(LabeledEdge.class));
+ DirectedGraph<NodeWrapper, LabeledEdge> graph = new DirectedMultigraph<>(new ClassBasedEdgeFactory<NodeWrapper, LabeledEdge>(LabeledEdge.class));
//
// Check to see if the trigger Event is for OpenLoop, we do so by
// attempting to create a FinalResult object from it. If its a policy id, this should
// return null.
//
- FinalResult triggerResult = FinalResult.toResult(policy.controlLoop.trigger_policy);
+ FinalResult triggerResult = FinalResult.toResult(policy.getControlLoop().getTrigger_policy());
TriggerNodeWrapper triggerNode;
//
// Did this turn into a FinalResult object?
@@ -134,10 +131,8 @@ public class ControlLoopCompiler {
//
// They really shouldn't have any policies attached.
//
- if (policy.policies != null || policy.policies.size() > 0) {
- if (callback != null) {
- callback.onWarning("Open Loop policy contains policies. The policies will never be invoked.");
- }
+ if ((policy.getPolicies() != null || policy.getPolicies().isEmpty())&& callback != null ) {
+ callback.onWarning("Open Loop policy contains policies. The policies will never be invoked.");
}
return;
//
@@ -145,7 +140,7 @@ public class ControlLoopCompiler {
//
// Ok, not a FinalResult object so let's assume that it is a Policy. Which it should be.
//
- triggerNode = new TriggerNodeWrapper(policy.controlLoop.controlLoopName);
+ triggerNode = new TriggerNodeWrapper(policy.getControlLoop().getControlLoopName());
}
//
// Add in the trigger node
@@ -169,132 +164,12 @@ public class ControlLoopCompiler {
//
// Work through the policies and add them in as nodes.
//
- Map<Policy, PolicyNodeWrapper> mapNodes = new HashMap<Policy, PolicyNodeWrapper>();
- for (Policy operPolicy : policy.policies) {
- //
- // Check the policy id and make sure its sane
- //
- boolean okToAdd = true;
- if (operPolicy.id == null || operPolicy.id.length() < 1) {
- if (callback != null) {
- callback.onError("Operational Policy has an bad ID");
- }
- okToAdd = false;
- }
- //
- // Check if they decided to make the ID a result object
- //
- if (PolicyResult.toResult(operPolicy.id) != null) {
- if (callback != null) {
- callback.onError("Policy id is set to a PolicyResult " + operPolicy.id);
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.id) != null) {
- if (callback != null) {
- callback.onError("Policy id is set to a FinalResult " + operPolicy.id);
- }
- okToAdd = false;
- }
- //
- // Check that the actor/recipe/target are valid
- //
- if (operPolicy.actor == null) {
- if (callback != null) {
- callback.onError("Policy actor is null");
- }
- okToAdd = false;
- }
- //
- // Construct a list for all valid actors
- //
- ImmutableList<String> actors = ImmutableList.of("APPC", "AOTS", "MSO", "SDNO", "SDNR", "AAI");
- //
- if (operPolicy.actor != null && (!actors.contains(operPolicy.actor)) ) {
- if (callback != null) {
- callback.onError("Policy actor is invalid");
- }
- okToAdd = false;
- }
- if (operPolicy.recipe == null) {
- if (callback != null) {
- callback.onError("Policy recipe is null");
- }
- okToAdd = false;
- }
- //
- // TODO:
- // NOTE: We need a way to find the acceptable recipe values (either Enum or a database that has these)
- //
- ImmutableMap<String, List<String>> recipes = new ImmutableMap.Builder<String, List<String>>()
- .put("APPC", ImmutableList.of("Restart", "Rebuild", "Migrate", "ModifyConfig"))
- .put("AOTS", ImmutableList.of("checkMaintenanceWindow", "checkENodeBTicketHours", "checkEquipmentStatus", "checkEimStatus", "checkEquipmentMaintenance"))
- .put("MSO", ImmutableList.of("VF Module Create"))
- .put("SDNO", ImmutableList.of("health-diagnostic-type", "health-diagnostic", "health-diagnostic-history", "health-diagnostic-commands", "health-diagnostic-aes"))
- .put("SDNR", ImmutableList.of("Restart", "Reboot"))
- .build();
- //
- if (operPolicy.recipe != null && (!recipes.getOrDefault(operPolicy.actor, Collections.emptyList()).contains(operPolicy.recipe))) {
- if (callback != null) {
- callback.onError("Policy recipe is invalid");
- }
- okToAdd = false;
- }
- if (operPolicy.target == null) {
- if (callback != null) {
- callback.onError("Policy target is null");
- }
- okToAdd = false;
- }
- if (operPolicy.target != null && operPolicy.target.type != TargetType.VM && operPolicy.target.type != TargetType.VFC && operPolicy.target.type != TargetType.PNF) {
- if (callback != null) {
- callback.onError("Policy target is invalid");
- }
- okToAdd = false;
- }
- //
- // Check that policy results are connected to either default final * or another policy
- //
- if (FinalResult.toResult(operPolicy.success) != null && operPolicy.success != FinalResult.FINAL_SUCCESS.toString()) {
- if (callback != null) {
- callback.onError("Policy success is neither another policy nor FINAL_SUCCESS");
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.failure) != null && operPolicy.failure != FinalResult.FINAL_FAILURE.toString()) {
- if (callback != null) {
- callback.onError("Policy failure is neither another policy nor FINAL_FAILURE");
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.failure_retries) != null && operPolicy.failure_retries != FinalResult.FINAL_FAILURE_RETRIES.toString()) {
- if (callback != null) {
- callback.onError("Policy failure retries is neither another policy nor FINAL_FAILURE_RETRIES");
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.failure_timeout) != null && operPolicy.failure_timeout != FinalResult.FINAL_FAILURE_TIMEOUT.toString()) {
- if (callback != null) {
- callback.onError("Policy failure timeout is neither another policy nor FINAL_FAILURE_TIMEOUT");
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.failure_exception) != null && operPolicy.failure_exception != FinalResult.FINAL_FAILURE_EXCEPTION.toString()) {
- if (callback != null) {
- callback.onError("Policy failure exception is neither another policy nor FINAL_FAILURE_EXCEPTION");
- }
- okToAdd = false;
- }
- if (FinalResult.toResult(operPolicy.failure_guard) != null && operPolicy.failure_guard != FinalResult.FINAL_FAILURE_GUARD.toString()) {
- if (callback != null) {
- callback.onError("Policy failure guard is neither another policy nor FINAL_FAILURE_GUARD");
- }
- okToAdd = false;
- }
+ Map<Policy, PolicyNodeWrapper> mapNodes = new HashMap<>();
+ for (Policy operPolicy : policy.getPolicies()) {
//
// Is it still ok to add?
//
- if (okToAdd == false) {
+ if (!okToAdd(operPolicy, callback)) {
//
// Do not add it in
//
@@ -310,7 +185,7 @@ public class ControlLoopCompiler {
//
// Is this the trigger policy?
//
- if (operPolicy.id.equals(policy.controlLoop.trigger_policy)) {
+ if (operPolicy.getId().equals(policy.getControlLoop().getTrigger_policy())) {
//
// Yes add an edge from our trigger event node to this policy
//
@@ -320,7 +195,7 @@ public class ControlLoopCompiler {
//
// last sweep to connect remaining edges for policy results
//
- for (Policy operPolicy : policy.policies) {
+ for (Policy operPolicy : policy.getPolicies()) {
PolicyNodeWrapper node = mapNodes.get(operPolicy);
//
// Just ensure this has something
@@ -328,62 +203,62 @@ public class ControlLoopCompiler {
if (node == null) {
continue;
}
- if (FinalResult.isResult(operPolicy.success, FinalResult.FINAL_SUCCESS)) {
+ if (FinalResult.isResult(operPolicy.getSuccess(), FinalResult.FINAL_SUCCESS)) {
graph.addEdge(node, finalSuccess, new LabeledEdge(node, finalSuccess, new FinalResultEdgeWrapper(FinalResult.FINAL_SUCCESS)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.success);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getSuccess());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " success is connected to unknown policy " + operPolicy.success);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " success is connected to unknown policy " + operPolicy.getSuccess());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.SUCCESS)));
}
}
- if (FinalResult.isResult(operPolicy.failure, FinalResult.FINAL_FAILURE)) {
+ if (FinalResult.isResult(operPolicy.getFailure(), FinalResult.FINAL_FAILURE)) {
graph.addEdge(node, finalFailure, new LabeledEdge(node, finalFailure, new FinalResultEdgeWrapper(FinalResult.FINAL_FAILURE)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.failure);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getFailure());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " failure is connected to unknown policy " + operPolicy.failure);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " failure is connected to unknown policy " + operPolicy.getFailure());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.FAILURE)));
}
}
- if (FinalResult.isResult(operPolicy.failure_timeout, FinalResult.FINAL_FAILURE_TIMEOUT)) {
+ if (FinalResult.isResult(operPolicy.getFailure_timeout(), FinalResult.FINAL_FAILURE_TIMEOUT)) {
graph.addEdge(node, finalFailureTimeout, new LabeledEdge(node, finalFailureTimeout, new FinalResultEdgeWrapper(FinalResult.FINAL_FAILURE_TIMEOUT)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.failure_timeout);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getFailure_timeout());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " failure_timeout is connected to unknown policy " + operPolicy.failure_timeout);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " failure_timeout is connected to unknown policy " + operPolicy.getFailure_timeout());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.FAILURE_TIMEOUT)));
}
}
- if (FinalResult.isResult(operPolicy.failure_retries, FinalResult.FINAL_FAILURE_RETRIES)) {
+ if (FinalResult.isResult(operPolicy.getFailure_retries(), FinalResult.FINAL_FAILURE_RETRIES)) {
graph.addEdge(node, finalFailureRetries, new LabeledEdge(node, finalFailureRetries, new FinalResultEdgeWrapper(FinalResult.FINAL_FAILURE_RETRIES)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.failure_retries);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getFailure_retries());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " failure_retries is connected to unknown policy " + operPolicy.failure_retries);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " failure_retries is connected to unknown policy " + operPolicy.getFailure_retries());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.FAILURE_RETRIES)));
}
}
- if (FinalResult.isResult(operPolicy.failure_exception, FinalResult.FINAL_FAILURE_EXCEPTION)) {
+ if (FinalResult.isResult(operPolicy.getFailure_exception(), FinalResult.FINAL_FAILURE_EXCEPTION)) {
graph.addEdge(node, finalFailureException, new LabeledEdge(node, finalFailureException, new FinalResultEdgeWrapper(FinalResult.FINAL_FAILURE_EXCEPTION)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.failure_exception);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getFailure_exception());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " failure_exception is connected to unknown policy " + operPolicy.failure_exception);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " failure_exception is connected to unknown policy " + operPolicy.getFailure_exception());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.FAILURE_EXCEPTION)));
}
}
- if (FinalResult.isResult(operPolicy.failure_guard, FinalResult.FINAL_FAILURE_GUARD)) {
+ if (FinalResult.isResult(operPolicy.getFailure_guard(), FinalResult.FINAL_FAILURE_GUARD)) {
graph.addEdge(node, finalFailureGuard, new LabeledEdge(node, finalFailureGuard, new FinalResultEdgeWrapper(FinalResult.FINAL_FAILURE_GUARD)));
} else {
- PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.failure_guard);
+ PolicyNodeWrapper toNode = findPolicyNode(mapNodes, operPolicy.getFailure_guard());
if (toNode == null) {
- throw new CompilerException("Operation Policy " + operPolicy.id + " failure_guard is connected to unknown policy " + operPolicy.failure_guard);
+ throw new CompilerException("Operation Policy " + operPolicy.getId() + " failure_guard is connected to unknown policy " + operPolicy.getFailure_guard());
} else {
graph.addEdge(node, toNode, new LabeledEdge(node, toNode, new PolicyResultEdgeWrapper(PolicyResult.FAILURE_GUARD)));
}
@@ -394,7 +269,7 @@ public class ControlLoopCompiler {
//
for (NodeWrapper node : graph.vertexSet()) {
if (node instanceof TriggerNodeWrapper) {
- System.out.println("Trigger Node " + node.toString());
+ LOGGER.info("Trigger Node " + node.toString());
if (graph.inDegreeOf(node) > 0 ) {
//
// Really should NEVER get here unless someone messed up the code above.
@@ -408,7 +283,7 @@ public class ControlLoopCompiler {
throw new CompilerException("The event trigger should only go to ONE node");
}
} else if (node instanceof FinalResultNodeWrapper) {
- System.out.println("FinalResult Node " + node.toString());
+ LOGGER.info("FinalResult Node " + node.toString());
//
// FinalResult nodes should NEVER have an out edge
//
@@ -416,7 +291,7 @@ public class ControlLoopCompiler {
throw new CompilerException("FinalResult nodes should never have any out edges.");
}
} else if (node instanceof PolicyNodeWrapper) {
- System.out.println("Policy Node " + node.toString());
+ LOGGER.info("Policy Node " + node.toString());
//
// All Policy Nodes should have the 5 out degrees defined.
//
@@ -424,38 +299,159 @@ public class ControlLoopCompiler {
throw new CompilerException("Policy node should ALWAYS have 6 out degrees.");
}
//
- // Chenfei: All Policy Nodes should have at least 1 in degrees
+ // All Policy Nodes should have at least 1 in degrees
//
- if (graph.inDegreeOf(node) == 0) {
- if (callback != null) {
- callback.onWarning("Policy " + node.getID() + " is not reachable.");
- }
+ if (graph.inDegreeOf(node) == 0 && callback != null) {
+ callback.onWarning("Policy " + node.getID() + " is not reachable.");
}
}
for (LabeledEdge edge : graph.outgoingEdgesOf(node)){
- System.out.println(edge.from.getID() + " invokes " + edge.to.getID() + " upon " + edge.edge.getID());
+ LOGGER.info(edge.from.getID() + " invokes " + edge.to.getID() + " upon " + edge.edge.getID());
}
}
}
}
+ private static boolean okToAdd(Policy operPolicy, ControlLoopCompilerCallback callback) {
+ //
+ // Check the policy id and make sure its sane
+ //
+ boolean okToAdd = true;
+ if (operPolicy.getId() == null || operPolicy.getId().length() < 1) {
+ if (callback != null) {
+ callback.onError("Operational Policy has an bad ID");
+ }
+ okToAdd = false;
+ }
+ //
+ // Check if they decided to make the ID a result object
+ //
+ if (PolicyResult.toResult(operPolicy.getId()) != null) {
+ if (callback != null) {
+ callback.onError("Policy id is set to a PolicyResult " + operPolicy.getId());
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getId()) != null) {
+ if (callback != null) {
+ callback.onError("Policy id is set to a FinalResult " + operPolicy.getId());
+ }
+ okToAdd = false;
+ }
+ //
+ // Check that the actor/recipe/target are valid
+ //
+ if (operPolicy.getActor() == null) {
+ if (callback != null) {
+ callback.onError("Policy actor is null");
+ }
+ okToAdd = false;
+ }
+ //
+ // Construct a list for all valid actors
+ //
+ ImmutableList<String> actors = ImmutableList.of("APPC", "AOTS", "MSO", "SDNO", "SDNR", "AAI");
+ //
+ if (operPolicy.getActor() != null && (!actors.contains(operPolicy.getActor())) ) {
+ if (callback != null) {
+ callback.onError("Policy actor is invalid");
+ }
+ okToAdd = false;
+ }
+ if (operPolicy.getRecipe() == null) {
+ if (callback != null) {
+ callback.onError("Policy recipe is null");
+ }
+ okToAdd = false;
+ }
+ //
+ // NOTE: We need a way to find the acceptable recipe values (either Enum or a database that has these)
+ //
+ ImmutableMap<String, List<String>> recipes = new ImmutableMap.Builder<String, List<String>>()
+ .put("APPC", ImmutableList.of("Restart", "Rebuild", "Migrate", "ModifyConfig"))
+ .put("AOTS", ImmutableList.of("checkMaintenanceWindow", "checkENodeBTicketHours", "checkEquipmentStatus", "checkEimStatus", "checkEquipmentMaintenance"))
+ .put("MSO", ImmutableList.of("VF Module Create"))
+ .put("SDNO", ImmutableList.of("health-diagnostic-type", "health-diagnostic", "health-diagnostic-history", "health-diagnostic-commands", "health-diagnostic-aes"))
+ .put("SDNR", ImmutableList.of("Restart", "Reboot"))
+ .build();
+ //
+ if (operPolicy.getRecipe() != null && (!recipes.getOrDefault(operPolicy.getActor(), Collections.emptyList()).contains(operPolicy.getRecipe()))) {
+ if (callback != null) {
+ callback.onError("Policy recipe is invalid");
+ }
+ okToAdd = false;
+ }
+ if (operPolicy.getTarget() == null) {
+ if (callback != null) {
+ callback.onError("Policy target is null");
+ }
+ okToAdd = false;
+ }
+ if (operPolicy.getTarget() != null && operPolicy.getTarget().getType() != TargetType.VM && operPolicy.getTarget().getType() != TargetType.VFC && operPolicy.getTarget().getType() != TargetType.PNF) {
+ if (callback != null) {
+ callback.onError("Policy target is invalid");
+ }
+ okToAdd = false;
+ }
+ //
+ // Check that policy results are connected to either default final * or another policy
+ //
+ if (FinalResult.toResult(operPolicy.getSuccess()) != null && operPolicy.getSuccess() != FinalResult.FINAL_SUCCESS.toString()) {
+ if (callback != null) {
+ callback.onError("Policy success is neither another policy nor FINAL_SUCCESS");
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getFailure()) != null && operPolicy.getFailure() != FinalResult.FINAL_FAILURE.toString()) {
+ if (callback != null) {
+ callback.onError("Policy failure is neither another policy nor FINAL_FAILURE");
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getFailure_retries()) != null && operPolicy.getFailure_retries() != FinalResult.FINAL_FAILURE_RETRIES.toString()) {
+ if (callback != null) {
+ callback.onError("Policy failure retries is neither another policy nor FINAL_FAILURE_RETRIES");
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getFailure_timeout()) != null && operPolicy.getFailure_timeout() != FinalResult.FINAL_FAILURE_TIMEOUT.toString()) {
+ if (callback != null) {
+ callback.onError("Policy failure timeout is neither another policy nor FINAL_FAILURE_TIMEOUT");
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getFailure_exception()) != null && operPolicy.getFailure_exception() != FinalResult.FINAL_FAILURE_EXCEPTION.toString()) {
+ if (callback != null) {
+ callback.onError("Policy failure exception is neither another policy nor FINAL_FAILURE_EXCEPTION");
+ }
+ okToAdd = false;
+ }
+ if (FinalResult.toResult(operPolicy.getFailure_guard()) != null && operPolicy.getFailure_guard() != FinalResult.FINAL_FAILURE_GUARD.toString()) {
+ if (callback != null) {
+ callback.onError("Policy failure guard is neither another policy nor FINAL_FAILURE_GUARD");
+ }
+ okToAdd = false;
+ }
+ return okToAdd;
+ }
+
private static PolicyNodeWrapper findPolicyNode(Map<Policy, PolicyNodeWrapper> mapNodes, String id) {
- for (Policy key : mapNodes.keySet()) {
- if (key.id.equals(id)) {
- return mapNodes.get(key);
+ for (Entry<Policy, PolicyNodeWrapper> entry : mapNodes.entrySet()) {
+ if (entry.getKey().getId().equals(id)) {
+ return entry.getValue();
}
}
return null;
}
-
- private interface NodeWrapper {
-
+
+ @FunctionalInterface
+ private interface NodeWrapper extends Serializable{
public String getID();
-
}
private static class TriggerNodeWrapper implements NodeWrapper {
- public String closedLoopControlName;
+ private static final long serialVersionUID = -187644087811478349L;
+ private String closedLoopControlName;
public TriggerNodeWrapper(String closedLoopControlName) {
this.closedLoopControlName = closedLoopControlName;
@@ -474,8 +470,8 @@ public class ControlLoopCompiler {
}
private static class FinalResultNodeWrapper implements NodeWrapper {
-
- public FinalResult result;
+ private static final long serialVersionUID = 8540008796302474613L;
+ private FinalResult result;
public FinalResultNodeWrapper(FinalResult result) {
this.result = result;
@@ -493,8 +489,8 @@ public class ControlLoopCompiler {
}
private static class PolicyNodeWrapper implements NodeWrapper {
-
- public Policy policy;
+ private static final long serialVersionUID = 8170162175653823082L;
+ private Policy policy;
public PolicyNodeWrapper(Policy operPolicy) {
this.policy = operPolicy;
@@ -507,18 +503,18 @@ public class ControlLoopCompiler {
@Override
public String getID() {
- return policy.id;
+ return policy.getId();
}
}
- private interface EdgeWrapper {
-
+ @FunctionalInterface
+ private interface EdgeWrapper extends Serializable{
public String getID();
}
private static class TriggerEdgeWrapper implements EdgeWrapper {
-
+ private static final long serialVersionUID = 2678151552623278863L;
private String trigger;
public TriggerEdgeWrapper(String trigger) {
@@ -538,7 +534,8 @@ public class ControlLoopCompiler {
}
private static class PolicyResultEdgeWrapper implements EdgeWrapper {
- public PolicyResult policyResult;
+ private static final long serialVersionUID = 6078569477021558310L;
+ private PolicyResult policyResult;
public PolicyResultEdgeWrapper(PolicyResult policyResult) {
super();
@@ -559,8 +556,8 @@ public class ControlLoopCompiler {
}
private static class FinalResultEdgeWrapper implements EdgeWrapper {
-
- public FinalResult finalResult;
+ private static final long serialVersionUID = -1486381946896779840L;
+ private FinalResult finalResult;
public FinalResultEdgeWrapper(FinalResult result) {
this.finalResult = result;
}
@@ -578,10 +575,6 @@ public class ControlLoopCompiler {
private static class LabeledEdge extends DefaultEdge {
-
- /**
- *
- */
private static final long serialVersionUID = 579384429573385524L;
private NodeWrapper from;
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java
index a40bc9d53..aa2bbfd8a 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/guard/compiler/ControlLoopGuardCompiler.java
@@ -36,21 +36,25 @@ import org.yaml.snakeyaml.constructor.Constructor;
public class ControlLoopGuardCompiler {
- public static ControlLoopGuard compile(ControlLoopGuard CLGuard, ControlLoopCompilerCallback callback) throws CompilerException {
+ private ControlLoopGuardCompiler(){
+ // Private Constructor
+ }
+
+ public static ControlLoopGuard compile(ControlLoopGuard cLGuard, ControlLoopCompilerCallback callback) throws CompilerException {
//
// Ensure ControlLoopGuard has at least one guard policies
//
- validateControlLoopGuard(CLGuard, callback);
+ validateControlLoopGuard(cLGuard, callback);
//
// Ensure each guard policy has at least one constraints and all guard policies are unique
//
- validateGuardPolicies(CLGuard.guards, callback);
+ validateGuardPolicies(cLGuard.getGuards(), callback);
//
// Ensure constraints for each guard policy are unique
//
- validateConstraints(CLGuard.guards, callback);
+ validateConstraints(cLGuard.getGuards(), callback);
- return CLGuard;
+ return cLGuard;
}
public static ControlLoopGuard compile(InputStream yamlSpecification, ControlLoopCompilerCallback callback) throws CompilerException {
@@ -65,26 +69,22 @@ public class ControlLoopGuardCompiler {
return ControlLoopGuardCompiler.compile((ControlLoopGuard) obj, callback);
}
- private static void validateControlLoopGuard(ControlLoopGuard CLGuard, ControlLoopCompilerCallback callback) throws CompilerException {
- if (CLGuard == null) {
+ private static void validateControlLoopGuard(ControlLoopGuard cLGuard, ControlLoopCompilerCallback callback) throws CompilerException {
+ if (cLGuard == null) {
if (callback != null) {
callback.onError("ControlLoop Guard cannot be null");
}
throw new CompilerException("ControlLoop Guard cannot be null");
}
- if (CLGuard.guard == null) {
- if (callback != null) {
- callback.onError("Guard version cannot be null");
- }
+ if (cLGuard.getGuard() == null && callback != null) {
+ callback.onError("Guard version cannot be null");
}
- if (CLGuard.guards == null) {
- if (callback != null) {
- callback.onError("ControlLoop Guard should have at least one guard policies");
- }
- } else if (CLGuard.guards.size() < 1) {
+ if (cLGuard.getGuards() == null) {
if (callback != null) {
callback.onError("ControlLoop Guard should have at least one guard policies");
}
+ } else if (cLGuard.getGuards().isEmpty() && callback != null) {
+ callback.onError("ControlLoop Guard should have at least one guard policies");
}
}
@@ -98,21 +98,19 @@ public class ControlLoopGuardCompiler {
//
// Ensure all guard policies are unique
//
- Set<GuardPolicy> newSet = new HashSet<GuardPolicy>(policies);
- if (newSet.size() != policies.size()) {
- if (callback != null) {
- callback.onWarning("There are duplicate guard policies");
- }
+ Set<GuardPolicy> newSet = new HashSet<>(policies);
+ if (newSet.size() != policies.size() && callback != null) {
+ callback.onWarning("There are duplicate guard policies");
}
//
// Ensure each guard policy has at least one constraints
//
for (GuardPolicy policy : policies) {
- if (policy.limit_constraints == null || policy.limit_constraints.size() < 1) {
+ if (policy.getLimit_constraints() == null || policy.getLimit_constraints().isEmpty()) {
if (callback != null) {
- callback.onError("Guard policy " + policy.name + " does not have any limit constraint");
+ callback.onError("Guard policy " + policy.getName() + " does not have any limit constraint");
}
- throw new CompilerException("Guard policy " + policy.name + " does not have any limit constraint");
+ throw new CompilerException("Guard policy " + policy.getName() + " does not have any limit constraint");
}
}
}
@@ -125,11 +123,9 @@ public class ControlLoopGuardCompiler {
throw new CompilerException("Guard policies should not be null");
}
for (GuardPolicy policy : policies) {
- Set<Constraint> newSet = new HashSet<Constraint>(policy.limit_constraints);
- if (newSet.size() != policy.limit_constraints.size()) {
- if (callback != null) {
- callback.onWarning("Guard policy " + policy.name + " has duplicate limit constraints");
- }
+ Set<Constraint> newSet = new HashSet<>(policy.getLimit_constraints());
+ if (newSet.size() != policy.getLimit_constraints().size() && callback != null) {
+ callback.onWarning("Guard policy " + policy.getName() + " has duplicate limit constraints");
}
}
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoop.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoop.java
index fa144156e..ec25ab3db 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoop.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoop.java
@@ -20,30 +20,110 @@
package org.openecomp.policy.controlloop.policy;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.openecomp.policy.asdc.Resource;
+import org.openecomp.policy.asdc.Service;
+
public class ControlLoop {
- public static String VERSION = "2.0.0";
+ private static String VERSION = "2.0.0";
- public String controlLoopName;
- public final String version = VERSION;
- public String trigger_policy = FinalResult.FINAL_OPENLOOP.toString();
- public Integer timeout;
- public Boolean abatement = false;
+ private String controlLoopName;
+ private String version = VERSION;
+ private List<Service> services;
+ private List<Resource> resources;
+ private String trigger_policy = FinalResult.FINAL_OPENLOOP.toString();
+ private Integer timeout;
+ private Boolean abatement = false;
public ControlLoop() {
-
+ // Empty Constructor.
+ }
+
+ public static String getVERSION(){
+ return ControlLoop.VERSION;
+ }
+
+ public String getControlLoopName() {
+ return controlLoopName;
+ }
+
+ public void setControlLoopName(String controlLoopName) {
+ this.controlLoopName = controlLoopName;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setServices(List<Service> services) {
+ this.services = services;
+ }
+
+ public List<Resource> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<Resource> resources) {
+ this.resources = resources;
+ }
+
+ public String getTrigger_policy() {
+ return trigger_policy;
+ }
+
+ public void setTrigger_policy(String trigger_policy) {
+ this.trigger_policy = trigger_policy;
+ }
+
+ public Integer getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(Integer timeout) {
+ this.timeout = timeout;
+ }
+
+ public Boolean getAbatement() {
+ return abatement;
+ }
+
+ public void setAbatement(Boolean abatement) {
+ this.abatement = abatement;
+ }
+
+ public String getVersion() {
+ return version;
}
+ public void setVersion(String version){
+ this.version = version;
+ }
+
public ControlLoop(ControlLoop controlLoop) {
this.controlLoopName = controlLoop.controlLoopName;
+ this.services = new LinkedList<>();
+ if (controlLoop.services != null) {
+ for (Service service : controlLoop.services) {
+ this.services.add(service);
+ }
+ }
+ this.resources = new LinkedList<>();
+ if (controlLoop.resources != null) {
+ for (Resource resource: controlLoop.resources) {
+ this.resources.add(resource);
+ }
+ }
this.trigger_policy = controlLoop.trigger_policy;
this.timeout = controlLoop.timeout;
this.abatement = controlLoop.abatement;
}
@Override
public String toString() {
- return "ControlLoop [controlLoopName=" + controlLoopName + ", version=" + version
- + ", trigger_policy=" + trigger_policy + ", timeout="
+ return "ControlLoop [controlLoopName=" + controlLoopName + ", version=" + version + ", services=" + services
+ + ", resources=" + resources + ", trigger_policy=" + trigger_policy + ", timeout="
+ timeout + ", abatement=" + abatement + "]";
}
@Override
@@ -51,6 +131,8 @@ public class ControlLoop {
final int prime = 31;
int result = 1;
result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
+ result = prime * result + ((resources == null) ? 0 : resources.hashCode());
+ result = prime * result + ((services == null) ? 0 : services.hashCode());
result = prime * result + ((timeout == null) ? 0 : timeout.hashCode());
result = prime * result + ((trigger_policy == null) ? 0 : trigger_policy.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
@@ -71,6 +153,16 @@ public class ControlLoop {
return false;
} else if (!controlLoopName.equals(other.controlLoopName))
return false;
+ if (resources == null) {
+ if (other.resources != null)
+ return false;
+ } else if (!resources.equals(other.resources))
+ return false;
+ if (services == null) {
+ if (other.services != null)
+ return false;
+ } else if (!services.equals(other.services))
+ return false;
if (timeout == null) {
if (other.timeout != null)
return false;
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicy.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicy.java
index f14229bce..82a9d964e 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicy.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicy.java
@@ -20,13 +20,29 @@
package org.openecomp.policy.controlloop.policy;
-import java.util.LinkedList;
+import java.util.List;
public class ControlLoopPolicy {
- public ControlLoop controlLoop;
+ private ControlLoop controlLoop;
- public LinkedList<Policy> policies;
+ private List<Policy> policies;
+
+ public ControlLoop getControlLoop() {
+ return controlLoop;
+ }
+
+ public void setControlLoop(ControlLoop controlLoop) {
+ this.controlLoop = controlLoop;
+ }
+
+ public List<Policy> getPolicies() {
+ return policies;
+ }
+
+ public void setPolicies(List<Policy> policies) {
+ this.policies = policies;
+ }
@Override
public String toString() {
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/FinalResult.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/FinalResult.java
index 86b174a85..f64e44939 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/FinalResult.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/FinalResult.java
@@ -87,7 +87,7 @@ public enum FinalResult {
if (toResult == null) {
return false;
}
- return (toResult.equals(finalResult));
+ return toResult.equals(finalResult);
}
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/OperationsAccumulateParams.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/OperationsAccumulateParams.java
index 6cf91ce05..b7424dd33 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/OperationsAccumulateParams.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/OperationsAccumulateParams.java
@@ -28,11 +28,11 @@ public class OperationsAccumulateParams implements Serializable {
*/
private static final long serialVersionUID = -3597358159130168247L;
- public String period;
- public Integer limit;
+ private String period;
+ private Integer limit;
public OperationsAccumulateParams() {
-
+ // Does Nothing
}
public OperationsAccumulateParams(OperationsAccumulateParams ops) {
@@ -45,6 +45,22 @@ public class OperationsAccumulateParams implements Serializable {
this.limit = limit;
}
+ public String getPeriod() {
+ return period;
+ }
+
+ public void setPeriod(String period) {
+ this.period = period;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
@Override
public String toString() {
return "OperationsAccumulateParams [period=" + period + ", limit=" + limit + "]";
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Policy.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Policy.java
index 0af1eab68..dcbc8937b 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Policy.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Policy.java
@@ -26,28 +26,156 @@ import java.util.UUID;
public class Policy {
- public String id = UUID.randomUUID().toString();
- public String name;
- public String description;
- public String actor;
- public String recipe;
- public Map<String, String> payload;
- public Target target;
- public OperationsAccumulateParams operationsAccumulateParams;
- public Integer retry = 0;
- public Integer timeout = 300;
- public String success = FinalResult.FINAL_SUCCESS.toString();
- public String failure = FinalResult.FINAL_FAILURE.toString();
- public String failure_retries = FinalResult.FINAL_FAILURE_RETRIES.toString();
- public String failure_timeout = FinalResult.FINAL_FAILURE_TIMEOUT.toString();
- public String failure_exception = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
- public String failure_guard = FinalResult.FINAL_FAILURE_GUARD.toString();
+ private String id = UUID.randomUUID().toString();
+ private String name;
+ private String description;
+ private String actor;
+ private String recipe;
+ private Map<String, String> payload;
+ private Target target;
+ private OperationsAccumulateParams operationsAccumulateParams;
+ private Integer retry = 0;
+ private Integer timeout = 300;
+ private String success = FinalResult.FINAL_SUCCESS.toString();
+ private String failure = FinalResult.FINAL_FAILURE.toString();
+ private String failure_retries = FinalResult.FINAL_FAILURE_RETRIES.toString();
+ private String failure_timeout = FinalResult.FINAL_FAILURE_TIMEOUT.toString();
+ private String failure_exception = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
+ private String failure_guard = FinalResult.FINAL_FAILURE_GUARD.toString();
public Policy() {
-
+ //Does Nothing Empty Constructor
}
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getActor() {
+ return actor;
+ }
+
+ public void setActor(String actor) {
+ this.actor = actor;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public Map<String, String> getPayload() {
+ return payload;
+ }
+
+ public void setPayload(Map<String, String> payload) {
+ this.payload = payload;
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+
+ public OperationsAccumulateParams getOperationsAccumulateParams() {
+ return operationsAccumulateParams;
+ }
+
+ public void setOperationsAccumulateParams(OperationsAccumulateParams operationsAccumulateParams) {
+ this.operationsAccumulateParams = operationsAccumulateParams;
+ }
+
+ public Integer getRetry() {
+ return retry;
+ }
+
+ public void setRetry(Integer retry) {
+ this.retry = retry;
+ }
+
+ public Integer getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(Integer timeout) {
+ this.timeout = timeout;
+ }
+
+ public String getSuccess() {
+ return success;
+ }
+
+ public void setSuccess(String success) {
+ this.success = success;
+ }
+
+ public String getFailure() {
+ return failure;
+ }
+
+ public void setFailure(String failure) {
+ this.failure = failure;
+ }
+
+ public String getFailure_retries() {
+ return failure_retries;
+ }
+
+ public void setFailure_retries(String failure_retries) {
+ this.failure_retries = failure_retries;
+ }
+
+ public String getFailure_timeout() {
+ return failure_timeout;
+ }
+
+ public void setFailure_timeout(String failure_timeout) {
+ this.failure_timeout = failure_timeout;
+ }
+
+ public String getFailure_exception() {
+ return failure_exception;
+ }
+
+ public void setFailure_exception(String failure_exception) {
+ this.failure_exception = failure_exception;
+ }
+
+ public String getFailure_guard() {
+ return failure_guard;
+ }
+
+ public void setFailure_guard(String failure_guard) {
+ this.failure_guard = failure_guard;
+ }
+
public Policy(String id) {
this.id = id;
}
@@ -58,7 +186,6 @@ public class Policy {
this.recipe = recipe;
this.target = target;
if (payload != null) {
-// this.payload = new LinkedList<Map<String, String>>();
this.payload = Collections.unmodifiableMap(payload);
}
}
@@ -82,8 +209,6 @@ public class Policy {
this.actor = policy.actor;
this.recipe = policy.recipe;
if (policy.payload != null) {
-// this.payload = new LinkedList<Map<String, String>>();
-// this.payload.addAll(policy.payload);
this.payload = Collections.unmodifiableMap(policy.payload);
}
this.target = policy.target;
@@ -99,26 +224,9 @@ public class Policy {
}
public boolean isValid() {
- try {
- if (id == null) {
- throw new NullPointerException();
- }
- if (name == null) {
- throw new NullPointerException();
- }
- if (actor == null) {
- throw new NullPointerException();
- }
- if (recipe == null) {
- throw new NullPointerException();
- }
- if (target == null) {
- throw new NullPointerException();
- }
- } catch (Exception e) {
+ if(id==null || name==null || actor==null|| recipe==null || target==null){
return false;
}
-
return true;
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/PolicyResult.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/PolicyResult.java
index cfcd624f3..7d0334125 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/PolicyResult.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/PolicyResult.java
@@ -52,6 +52,7 @@ public enum PolicyResult {
this.result = result;
}
+ @Override
public String toString() {
return this.result;
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Target.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Target.java
index 9bccf0feb..1625c2968 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Target.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/Target.java
@@ -28,13 +28,29 @@ public class Target implements Serializable {
*/
private static final long serialVersionUID = 2180988443264988319L;
- public String resourceID;
- public TargetType type;
+ private String resourceID;
+ private TargetType type;
public Target() {
-
+ //Does Nothing Empty Constructor
}
+ public String getResourceID() {
+ return resourceID;
+ }
+
+ public void setResourceID(String resourceID) {
+ this.resourceID = resourceID;
+ }
+
+ public TargetType getType() {
+ return type;
+ }
+
+ public void setType(TargetType type) {
+ this.type = type;
+ }
+
public Target(TargetType type) {
this.type = type;
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/TargetType.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/TargetType.java
index c5e4abce0..e43fa615e 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/TargetType.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/TargetType.java
@@ -25,14 +25,15 @@ public enum TargetType {
VFC("VFC")
;
- private String targetType;
+ private String target;
private TargetType(String targetType) {
- this.targetType = targetType;
+ this.target = targetType;
}
+ @Override
public String toString() {
- return this.targetType;
+ return this.target;
}
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/BuilderException.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/BuilderException.java
index a087463b9..273af85e3 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/BuilderException.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/BuilderException.java
@@ -17,17 +17,15 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.openecomp.policy.controlloop.policy.builder;
public class BuilderException extends Exception {
+ private static final long serialVersionUID = 610064813684337895L;
+
public BuilderException(String string) {
super(string);
}
- /**
- *
- */
- private static final long serialVersionUID = 610064813684337895L;
-
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
index fb10f292c..2fdb6d9df 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
@@ -22,6 +22,8 @@ package org.openecomp.policy.controlloop.policy.builder;
import java.util.Map;
+import org.openecomp.policy.asdc.Resource;
+import org.openecomp.policy.asdc.Service;
import org.openecomp.policy.controlloop.policy.ControlLoop;
import org.openecomp.policy.controlloop.policy.OperationsAccumulateParams;
import org.openecomp.policy.controlloop.policy.Policy;
@@ -32,6 +34,52 @@ import org.openecomp.policy.controlloop.policy.builder.impl.ControlLoopPolicyBui
public interface ControlLoopPolicyBuilder {
/**
+ * Adds one or more services to the ControlLoop
+ *
+ *
+ * @param service
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException;
+
+ /**
+ * @param services
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException;
+
+ /**
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder removeAllServices() throws BuilderException;
+
+ /**
+ * Adds one or more resources to the ControlLoop
+ *
+ *
+ * @param resource
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException;
+
+ /**
+ * @param resources
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException;
+
+ /**
+ * @return
+ * @throws BuilderException
+ */
+ public ControlLoopPolicyBuilder removeAllResources() throws BuilderException;
+
+ /**
* @param abatement
* @return
* @throws BuilderException
@@ -186,6 +234,9 @@ public interface ControlLoopPolicyBuilder {
*
*/
public static class Factory {
+ private Factory(){
+ // Private Constructor.
+ }
/**
* Builds a basic Control Loop with an overall timeout. Use this method if you wish to create an OpenLoop, or if you
@@ -197,12 +248,40 @@ public interface ControlLoopPolicyBuilder {
* @throws BuilderException
*/
public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout) throws BuilderException {
+ return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout);
+ }
+
+ /**
+ * Build a Control Loop for a resource and services associated with the resource.
+ *
+ * @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
+ * @param timeout - Overall timeout for the Closed Loop to execute.
+ * @param resource - Resource this closed loop is for. Should come from ASDC, but if not available use resourceName to distinguish.
+ * @param services - Zero or more services associated with this resource. Should come from ASDC, but if not available use serviceName to distinguish.
+ * @return ControlLoopPolicyBuilder object
+ * @throws BuilderException
+ */
+ public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Resource resource, Service... services) throws BuilderException {
- ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout);
+ ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, resource, services);
return builder;
- }
+ }
+ /**
+ * @param controlLoopName
+ * @param timeout
+ * @param service
+ * @param resources
+ * @return
+ * @throws BuilderException
+ */
+ public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Service service, Resource... resources) throws BuilderException {
+
+ ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, service, resources);
+
+ return builder;
+ }
}
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
index be34a0a24..523054dce 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
@@ -24,6 +24,8 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
+import org.openecomp.policy.asdc.Resource;
+import org.openecomp.policy.asdc.Service;
import org.openecomp.policy.controlloop.compiler.CompilerException;
import org.openecomp.policy.controlloop.compiler.ControlLoopCompiler;
import org.openecomp.policy.controlloop.compiler.ControlLoopCompilerCallback;
@@ -48,9 +50,89 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout) throws BuilderException {
policy = new ControlLoopPolicy();
- policy.controlLoop = new ControlLoop();
- policy.controlLoop.controlLoopName = controlLoopName;
- policy.controlLoop.timeout = timeout;
+ ControlLoop controlLoop = new ControlLoop();
+ controlLoop.setControlLoopName(controlLoopName);
+ controlLoop.setTimeout(timeout);
+ policy.setControlLoop(controlLoop);
+ }
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource, Service... services) throws BuilderException {
+ this(controlLoopName, timeout);
+ this.addResource(resource);
+ this.addService(services);
+ }
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service, Resource[] resources) throws BuilderException {
+ this(controlLoopName, timeout);
+ this.addService(service);
+ this.addResource(resources);
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException {
+ if (services == null) {
+ throw new BuilderException("Service must not be null");
+ }
+ for (Service service : services) {
+ if (service.getServiceUUID() == null) {
+ if (service.getServiceName() == null || service.getServiceName().length() < 1) {
+ throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
+ }
+ if(policy.getControlLoop().getServices()==null){
+ policy.getControlLoop().setServices(new LinkedList<>());
+ }
+ policy.getControlLoop().getServices().add(service);
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException {
+ if (services == null) {
+ throw new BuilderException("Service must not be null");
+ }
+ if (policy.getControlLoop().getServices() == null) {
+ throw new BuilderException("No existing services to remove");
+ }
+ for (Service service : services) {
+ if (service.getServiceUUID() == null) {
+ if (service.getServiceName() == null || service.getServiceName().length() < 1) {
+ throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
+ }
+ }
+ boolean removed = policy.getControlLoop().getServices().remove(service);
+ if (!removed) {
+ throw new BuilderException("Unknown service " + service.getServiceName());
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeAllServices() throws BuilderException {
+ policy.getControlLoop().getServices().clear();
+ return this;
+ }
+
+
+ @Override
+ public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException {
+ if (resources == null) {
+ throw new BuilderException("resources must not be null");
+ }
+ for (Resource resource : resources) {
+ if (resource.getResourceUUID() == null) {
+ if (resource.getResourceName() == null || resource.getResourceName().length() <= 0) {
+ throw new BuilderException("Invalid resource - need either resourceUUID or resourceName");
+ }
+ }
+ if(policy.getControlLoop().getResources()==null){
+ policy.getControlLoop().setResources(new LinkedList<>());
+ }
+ policy.getControlLoop().getResources().add(resource);
+ }
+ return this;
}
@Override
@@ -58,13 +140,13 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
if (abatement == null) {
throw new BuilderException("abatement must not be null");
}
- policy.controlLoop.abatement = abatement;
+ policy.getControlLoop().setAbatement(abatement);
return this;
}
@Override
public ControlLoopPolicyBuilder setTimeout(Integer timeout) {
- policy.controlLoop.timeout = timeout;
+ policy.getControlLoop().setTimeout(timeout);
return this;
}
@@ -74,7 +156,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
Policy trigger = new Policy(UUID.randomUUID().toString(), name, description, actor, payload, target, recipe, retries, timeout);
- policy.controlLoop.trigger_policy = trigger.id;
+ policy.getControlLoop().setTrigger_policy(trigger.getId());
this.addNewPolicy(trigger);
//
@@ -103,22 +185,22 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
for (PolicyResult result : results) {
switch (result) {
case FAILURE:
- existingPolicy.failure = newPolicy.id;
+ existingPolicy.setFailure(newPolicy.getId());
break;
case FAILURE_EXCEPTION:
- existingPolicy.failure_exception = newPolicy.id;
+ existingPolicy.setFailure_exception(newPolicy.getId());
break;
case FAILURE_RETRIES:
- existingPolicy.failure_retries = newPolicy.id;
+ existingPolicy.setFailure_retries(newPolicy.getId());
break;
case FAILURE_TIMEOUT:
- existingPolicy.failure_timeout = newPolicy.id;
+ existingPolicy.setFailure_timeout(newPolicy.getId());
break;
case FAILURE_GUARD:
- existingPolicy.failure_guard = newPolicy.id;
+ existingPolicy.setFailure_guard(newPolicy.getId());
break;
case SUCCESS:
- existingPolicy.success = newPolicy.id;
+ existingPolicy.setSuccess(newPolicy.getId());
break;
default:
throw new BuilderException("Invalid PolicyResult " + result);
@@ -127,7 +209,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// Add it to our list
//
- this.policy.policies.add(newPolicy);
+ this.policy.getPolicies().add(newPolicy);
//
// Return a policy to them
//
@@ -136,7 +218,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
- public ResultsImpl results = new ResultsImpl();
+ private ResultsImpl results = new ResultsImpl();
@Override
public boolean onWarning(String message) {
@@ -181,15 +263,15 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
private void addNewPolicy(Policy policy) {
- if (this.policy.policies == null) {
- this.policy.policies = new LinkedList<Policy>();
+ if (this.policy.getPolicies() == null) {
+ this.policy.setPolicies(new LinkedList<>());
}
- this.policy.policies.add(policy);
+ this.policy.getPolicies().add(policy);
}
private Policy findPolicy(String id) {
- for (Policy policy : this.policy.policies) {
- if (policy.id.equals(id)) {
+ for (Policy policy : this.policy.getPolicies()) {
+ if (policy.getId().equals(id)) {
return policy;
}
}
@@ -197,10 +279,38 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
@Override
+ public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException {
+ if (resources == null) {
+ throw new BuilderException("Resource must not be null");
+ }
+ if (policy.getControlLoop().getResources() == null) {
+ throw new BuilderException("No existing resources to remove");
+ }
+ for (Resource resource : resources) {
+ if (resource.getResourceUUID() == null) {
+ if (resource.getResourceName() == null || resource.getResourceName().length() < 1) {
+ throw new BuilderException("Invalid resource - need either a resourceUUID or resourceName");
+ }
+ }
+ boolean removed = policy.getControlLoop().getResources().remove(resource);
+ if (!removed) {
+ throw new BuilderException("Unknown resource " + resource.getResourceName());
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeAllResources() throws BuilderException {
+ policy.getControlLoop().getResources().clear();
+ return this;
+ }
+
+ @Override
public Integer calculateTimeout() {
int sum = 0;
- for (Policy policy : this.policy.policies) {
- sum += policy.timeout.intValue();
+ for (Policy policy : this.policy.getPolicies()) {
+ sum += policy.getTimeout().intValue();
}
return new Integer(sum);
}
@@ -215,14 +325,14 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
throw new BuilderException("Unknown policy " + id);
}
else {
- this.policy.controlLoop.trigger_policy = id;
+ this.policy.getControlLoop().setTrigger_policy(id);
}
- return new ControlLoop(this.policy.controlLoop);
+ return new ControlLoop(this.policy.getControlLoop());
}
@Override
public boolean isOpenLoop() {
- if (this.policy.controlLoop.trigger_policy.equals(FinalResult.FINAL_OPENLOOP.toString())) {
+ if (this.policy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString())) {
return true;
}
else {
@@ -232,18 +342,18 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
@Override
public Policy getTriggerPolicy() throws BuilderException {
- if (this.policy.controlLoop.trigger_policy.equals(FinalResult.FINAL_OPENLOOP.toString())) {
+ if (this.policy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString())) {
return null;
}
else {
- Policy trigger = new Policy(this.findPolicy(this.policy.controlLoop.trigger_policy));
+ Policy trigger = new Policy(this.findPolicy(this.policy.getControlLoop().getTrigger_policy()));
return trigger;
}
}
@Override
public ControlLoop getControlLoop() {
- ControlLoop loop = new ControlLoop(this.policy.controlLoop);
+ ControlLoop loop = new ControlLoop(this.policy.getControlLoop());
return loop;
}
@@ -266,22 +376,22 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
for (PolicyResult result : results) {
switch (result) {
case FAILURE:
- existingPolicy.failure = policyResultID;
+ existingPolicy.setFailure(policyResultID);
break;
case FAILURE_EXCEPTION:
- existingPolicy.failure_exception = policyResultID;
+ existingPolicy.setFailure_exception(policyResultID);
break;
case FAILURE_RETRIES:
- existingPolicy.failure_retries = policyResultID;
+ existingPolicy.setFailure_retries(policyResultID);
break;
case FAILURE_TIMEOUT:
- existingPolicy.failure_timeout = policyResultID;
+ existingPolicy.setFailure_timeout(policyResultID);
break;
case FAILURE_GUARD:
- existingPolicy.failure_guard = policyResultID;
+ existingPolicy.setFailure_guard(policyResultID);
break;
case SUCCESS:
- existingPolicy.success = policyResultID;
+ existingPolicy.setSuccess(policyResultID);
break;
default:
throw new BuilderException("Invalid PolicyResult " + result);
@@ -299,40 +409,40 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// Check if the policy to remove is trigger_policy
//
- if (this.policy.controlLoop.trigger_policy.equals(policyID)) {
- this.policy.controlLoop.trigger_policy = FinalResult.FINAL_OPENLOOP.toString();
+ if (this.policy.getControlLoop().getTrigger_policy().equals(policyID)) {
+ this.policy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
}
else {
//
// Update policies
//
- for (Policy policy : this.policy.policies) {
- int index = this.policy.policies.indexOf(policy);
- if (policy.success.equals(policyID)) {
- policy.success = FinalResult.FINAL_SUCCESS.toString();
+ for (Policy policy : this.policy.getPolicies()) {
+ int index = this.policy.getPolicies().indexOf(policy);
+ if (policy.getSuccess().equals(policyID)) {
+ policy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
}
- if (policy.failure.equals(policyID)) {
- policy.failure = FinalResult.FINAL_FAILURE.toString();
+ if (policy.getFailure().equals(policyID)) {
+ policy.setFailure(FinalResult.FINAL_FAILURE.toString());
}
- if (policy.failure_retries.equals(policyID)) {
- policy.failure_retries = FinalResult.FINAL_FAILURE_RETRIES.toString();
+ if (policy.getFailure_retries().equals(policyID)) {
+ policy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
}
- if (policy.failure_timeout.equals(policyID)) {
- policy.failure_timeout = FinalResult.FINAL_FAILURE_TIMEOUT.toString();
+ if (policy.getFailure_timeout().equals(policyID)) {
+ policy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
}
- if (policy.failure_exception.equals(policyID)) {
- policy.failure_exception = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
+ if (policy.getFailure_exception().equals(policyID)) {
+ policy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
}
- if (policy.failure_guard.equals(policyID)) {
- policy.failure_guard = FinalResult.FINAL_FAILURE_GUARD.toString();
+ if (policy.getFailure_guard().equals(policyID)) {
+ policy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
}
- this.policy.policies.set(index, policy);
+ this.policy.getPolicies().set(index, policy);
}
}
//
// remove the policy
//
- boolean removed = this.policy.policies.remove(existingPolicy);
+ boolean removed = this.policy.getPolicies().remove(existingPolicy);
return removed;
}
@@ -345,12 +455,12 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// reset policy results
//
- existingPolicy.success = FinalResult.FINAL_SUCCESS.toString();
- existingPolicy.failure = FinalResult.FINAL_FAILURE.toString();
- existingPolicy.failure_retries = FinalResult.FINAL_FAILURE_RETRIES.toString();
- existingPolicy.failure_timeout = FinalResult.FINAL_FAILURE_TIMEOUT.toString();
- existingPolicy.failure_exception = FinalResult.FINAL_FAILURE_EXCEPTION.toString();
- existingPolicy.failure_guard = FinalResult.FINAL_FAILURE_GUARD.toString();
+ existingPolicy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
+ existingPolicy.setFailure(FinalResult.FINAL_FAILURE.toString());
+ existingPolicy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
+ existingPolicy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
+ existingPolicy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
+ existingPolicy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
return new Policy(existingPolicy);
}
@@ -359,11 +469,11 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// Remove all existing operational policies
//
- this.policy.policies.clear();
+ this.policy.getPolicies().clear();
//
// Revert controlLoop back to an open loop
//
- this.policy.controlLoop.trigger_policy = FinalResult.FINAL_OPENLOOP.toString();
+ this.policy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
return this;
}
@@ -376,7 +486,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// Add operationsAccumulateParams to existingPolicy
//
- existingPolicy.operationsAccumulateParams = operationsAccumulateParams;
+ existingPolicy.setOperationsAccumulateParams(operationsAccumulateParams);
return new Policy(existingPolicy);
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ResultsImpl.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ResultsImpl.java
index f7941533c..9ab78566e 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ResultsImpl.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/impl/ResultsImpl.java
@@ -28,7 +28,7 @@ import org.openecomp.policy.controlloop.policy.builder.Results;
public class ResultsImpl implements Results {
private String specification;
- private List<Message> messages = new LinkedList<Message>();
+ private List<Message> messages = new LinkedList<>();
@Override
public List<Message> getMessages() {
@@ -42,7 +42,7 @@ public class ResultsImpl implements Results {
@Override
public boolean isValid() {
- return (this.specification != null);
+ return this.specification != null;
}
public void addMessage(Message message) {
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Constraint.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Constraint.java
index 7d7991787..85ddf066d 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Constraint.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Constraint.java
@@ -26,37 +26,62 @@ import java.util.Map;
public class Constraint {
- public Integer num;
- public String duration;
- public Map<String, String> time_in_range;
+ private Integer num;
+ private String duration;
+ private Map<String, String> time_in_range;
- public LinkedList<String> blacklist;
+ private List<String> blacklist;
public Constraint() {
-
+ // Do Nothing empty constructor.
}
+ public Integer getNum() {
+ return num;
+ }
+
+ public void setNum(Integer num) {
+ this.num = num;
+ }
+
+ public String getDuration() {
+ return duration;
+ }
+
+ public void setDuration(String duration) {
+ this.duration = duration;
+ }
+
+ public Map<String, String> getTime_in_range() {
+ return time_in_range;
+ }
+
+ public void setTime_in_range(Map<String, String> time_in_range) {
+ this.time_in_range = time_in_range;
+ }
+
+ public List<String> getBlacklist() {
+ return blacklist;
+ }
+
+ public void setBlacklist(List<String> blacklist) {
+ this.blacklist = blacklist;
+ }
+
public Constraint(Integer num, String duration) {
this.num = num;
this.duration = duration;
}
public Constraint(List<String> blacklist) {
- this.blacklist = new LinkedList<String>(blacklist);
+ this.blacklist = new LinkedList<>(blacklist);
}
- public Constraint(Integer num, String duration, Map<String, String> time_in_range) {
- this(num, duration);
- if (time_in_range != null) {
- this.time_in_range = Collections.unmodifiableMap(time_in_range);
- }
- }
-
public Constraint(Integer num, String duration, List<String> blacklist) {
this.num = num;
this.duration = duration;
- this.blacklist = new LinkedList<String>(blacklist);
+ this.blacklist = new LinkedList<>(blacklist);
}
public Constraint(Integer num, String duration, Map<String, String> time_in_range, List<String> blacklist) {
@@ -64,7 +89,7 @@ public class Constraint {
if (time_in_range != null) {
this.time_in_range = Collections.unmodifiableMap(time_in_range);
}
- this.blacklist = new LinkedList<String>(blacklist);
+ this.blacklist = new LinkedList<>(blacklist);
}
public Constraint(Constraint constraint) {
@@ -73,18 +98,14 @@ public class Constraint {
if (constraint.time_in_range != null) {
this.time_in_range = Collections.unmodifiableMap(constraint.time_in_range);
}
- this.blacklist = new LinkedList<String>(constraint.blacklist);
+ this.blacklist = new LinkedList<>(constraint.blacklist);
}
public boolean isValid() {
- try {
- if (num == null && duration != null) {
- throw new NullPointerException();
- }
- if (duration == null && num != null) {
- throw new NullPointerException();
- }
- } catch (Exception e) {
+ if (num == null && duration != null) {
+ return false;
+ }
+ if (duration == null && num != null) {
return false;
}
return true;
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuard.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuard.java
index 37fd431a0..cfc904823 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuard.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuard.java
@@ -20,20 +20,37 @@
package org.openecomp.policy.controlloop.policy.guard;
import java.util.LinkedList;
+import java.util.List;
public class ControlLoopGuard {
- public Guard guard;
+ private Guard guard;
- public LinkedList<GuardPolicy> guards;
+ private List<GuardPolicy> guards;
public ControlLoopGuard() {
-
+ //DO Nothing Empty Constructor
}
- public ControlLoopGuard(ControlLoopGuard CLGuard) {
+ public Guard getGuard() {
+ return guard;
+ }
+
+ public void setGuard(Guard guard) {
+ this.guard = guard;
+ }
+
+ public List<GuardPolicy> getGuards() {
+ return guards;
+ }
+
+ public void setGuards(List<GuardPolicy> guards) {
+ this.guards = guards;
+ }
+
+ public ControlLoopGuard(ControlLoopGuard cLGuard) {
this.guard = new Guard();
- this.guards = new LinkedList<GuardPolicy>(CLGuard.guards);
+ this.guards = new LinkedList<>(cLGuard.guards);
}
@Override
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Guard.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Guard.java
index f3e765107..ee0327c3d 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Guard.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/Guard.java
@@ -21,14 +21,22 @@ package org.openecomp.policy.controlloop.policy.guard;
public class Guard {
- public static String VERSION = "2.0.0";
+ private static final String DEFAULTVERSION = "2.0.0";
- public final String version = VERSION;
+ private String version = DEFAULTVERSION;
public Guard() {
-
+ //DO Nothing empty Constructor.
}
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
@Override
public String toString() {
return "Guard [version=" + version + "]";
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/GuardPolicy.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/GuardPolicy.java
index 0195fac17..7eb8af6d1 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/GuardPolicy.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/GuardPolicy.java
@@ -26,17 +26,65 @@ import java.util.UUID;
public class GuardPolicy {
- public String id = UUID.randomUUID().toString();
- public String name;
- public String description;
- public String actor;
- public String recipe;
- public LinkedList<Constraint> limit_constraints;
+ private String id = UUID.randomUUID().toString();
+ private String name;
+ private String description;
+ private String actor;
+ private String recipe;
+ private List<Constraint> limit_constraints;
public GuardPolicy() {
-
+ //Do Nothing Empty Constructor.
}
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getActor() {
+ return actor;
+ }
+
+ public void setActor(String actor) {
+ this.actor = actor;
+ }
+
+ public String getRecipe() {
+ return recipe;
+ }
+
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+
+ public List<Constraint> getLimit_constraints() {
+ return limit_constraints;
+ }
+
+ public void setLimit_constraints(List<Constraint> limit_constraints) {
+ this.limit_constraints = limit_constraints;
+ }
+
public GuardPolicy(String id) {
this.id = id;
}
@@ -82,20 +130,7 @@ public class GuardPolicy {
}
public boolean isValid() {
- try {
- if (id == null) {
- throw new NullPointerException();
- }
- if (name == null) {
- throw new NullPointerException();
- }
- if (actor == null) {
- throw new NullPointerException();
- }
- if (recipe == null) {
- throw new NullPointerException();
- }
- } catch (Exception e) {
+ if(id==null || name ==null|| actor==null|| recipe==null){
return false;
}
return true;
@@ -104,7 +139,7 @@ public class GuardPolicy {
@Override
public String toString() {
return "Policy [id=" + id + ", name=" + name + ", description=" + description + ", actor=" + actor + ", recipe="
- + recipe + ", limit_constraints=" + limit_constraints + "]";
+ + recipe + ", limitConstraints=" + limit_constraints + "]";
}
@Override
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java
index c09757db6..d55510709 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/ControlLoopGuardBuilder.java
@@ -113,6 +113,9 @@ public interface ControlLoopGuardBuilder {
*/
public static class Factory {
+ private Factory(){
+ //Do Nothing Private Constructor.
+ }
/**
* @param guard
* @return ControlLoopGuardBuilder object
@@ -120,9 +123,8 @@ public interface ControlLoopGuardBuilder {
*/
public static ControlLoopGuardBuilder buildControlLoopGuard (Guard guard) throws BuilderException {
- ControlLoopGuardBuilder builder = new ControlLoopGuardBuilderImpl(guard);
+ return new ControlLoopGuardBuilderImpl(guard);
- return builder;
}
}
}
diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java
index b119620e3..bd6a3e42f 100644
--- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java
+++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/guard/builder/impl/ControlLoopGuardBuilderImpl.java
@@ -40,11 +40,11 @@ import org.yaml.snakeyaml.Yaml;
public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
- private ControlLoopGuard CLGuard;
+ private ControlLoopGuard cLGuard;
public ControlLoopGuardBuilderImpl(Guard guard) {
- CLGuard = new ControlLoopGuard();
- CLGuard.guard = guard;
+ cLGuard = new ControlLoopGuard();
+ cLGuard.setGuard(guard);
}
@Override
@@ -56,10 +56,10 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
if (!policy.isValid()) {
throw new BuilderException("Invalid guard policy - some required fields are missing");
}
- if (CLGuard.guards == null) {
- CLGuard.guards = new LinkedList<GuardPolicy>();
+ if (cLGuard.getGuards() == null) {
+ cLGuard.setGuards(new LinkedList<>());
}
- CLGuard.guards.add(policy);
+ cLGuard.getGuards().add(policy);
}
return this;
}
@@ -69,16 +69,16 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
if (policies == null) {
throw new BuilderException("GuardPolicy must not be null");
}
- if (CLGuard.guards == null) {
+ if (cLGuard.getGuards() == null) {
throw new BuilderException("No existing guard policies to remove");
}
for (GuardPolicy policy : policies) {
if (!policy.isValid()) {
throw new BuilderException("Invalid guard policy - some required fields are missing");
}
- boolean removed = CLGuard.guards.remove(policy);
+ boolean removed = cLGuard.getGuards().remove(policy);
if (!removed) {
- throw new BuilderException("Unknown guard policy: " + policy.name);
+ throw new BuilderException("Unknown guard policy: " + policy.getName());
}
}
return this;
@@ -86,7 +86,7 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
@Override
public ControlLoopGuardBuilder removeAllGuardPolicies() throws BuilderException {
- CLGuard.guards.clear();
+ cLGuard.getGuards().clear();
return this;
}
@@ -98,29 +98,33 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
if (constraints == null) {
throw new BuilderException("Constraint much not be null");
}
+ if (!addLimitConstraints(id,constraints)) {
+ throw new BuilderException("No existing guard policy matching the id: " + id);
+ }
+ return this;
+ }
+
+ private boolean addLimitConstraints(String id, Constraint... constraints) throws BuilderException {
boolean exist = false;
- for (GuardPolicy policy: CLGuard.guards) {
+ for (GuardPolicy policy: cLGuard.getGuards()) {
//
// We could have only one guard policy matching the id
//
- if (policy.id.equals(id)) {
+ if (policy.getId().equals(id)) {
exist = true;
for (Constraint cons: constraints) {
if (!cons.isValid()) {
throw new BuilderException("Invalid guard constraint - some required fields are missing");
}
- if (policy.limit_constraints == null) {
- policy.limit_constraints = new LinkedList<Constraint>();
+ if (policy.getLimit_constraints() == null) {
+ policy.setLimit_constraints(new LinkedList<>());
}
- policy.limit_constraints.add(cons);
+ policy.getLimit_constraints().add(cons);
}
break;
}
}
- if (exist == false) {
- throw new BuilderException("No existing guard policy matching the id: " + id);
- }
- return this;
+ return exist;
}
@Override
@@ -131,18 +135,25 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
if (constraints == null) {
throw new BuilderException("Constraint much not be null");
}
+ if (!removeConstraints(id, constraints)) {
+ throw new BuilderException("No existing guard policy matching the id: " + id);
+ }
+ return this;
+ }
+
+ private boolean removeConstraints(String id, Constraint... constraints) throws BuilderException {
boolean exist = false;
- for (GuardPolicy policy: CLGuard.guards) {
+ for (GuardPolicy policy: cLGuard.getGuards()) {
//
// We could have only one guard policy matching the id
//
- if (policy.id.equals(id)) {
+ if (policy.getId().equals(id)) {
exist = true;
for (Constraint cons: constraints) {
if (!cons.isValid()) {
throw new BuilderException("Invalid guard constraint - some required fields are missing");
}
- boolean removed = policy.limit_constraints.remove(cons);
+ boolean removed = policy.getLimit_constraints().remove(cons);
if (!removed) {
throw new BuilderException("Unknown guard constraint: " + cons);
}
@@ -150,28 +161,25 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
break;
}
}
- if (exist == false) {
- throw new BuilderException("No existing guard policy matching the id: " + id);
- }
- return this;
+ return exist;
}
@Override
public ControlLoopGuardBuilder removeAllLimitConstraints(String id) throws BuilderException {
- if (CLGuard.guards == null || CLGuard.guards.isEmpty()) {
+ if (cLGuard.getGuards() == null || cLGuard.getGuards().isEmpty()) {
throw new BuilderException("No guard policies exist");
}
if (id == null) {
throw new BuilderException("The id of target guard policy must not be null");
}
boolean exist = false;
- for (GuardPolicy policy: CLGuard.guards) {
- if (policy.id.equals(id)) {
+ for (GuardPolicy policy: cLGuard.getGuards()) {
+ if (policy.getId().equals(id)) {
exist = true;
- policy.limit_constraints.clear();
+ policy.getLimit_constraints().clear();
}
}
- if (exist == false) {
+ if (!exist) {
throw new BuilderException("No existing guard policy matching the id: " + id);
}
return this;
@@ -180,7 +188,7 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
- public ResultsImpl results = new ResultsImpl();
+ private ResultsImpl results = new ResultsImpl();
@Override
public boolean onWarning(String message) {
@@ -197,8 +205,7 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
@Override
public ControlLoopGuard getControlLoopGuard() {
- ControlLoopGuard guard = new ControlLoopGuard(this.CLGuard);
- return guard;
+ return new ControlLoopGuard(this.cLGuard);
}
@@ -211,7 +218,7 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
options.setDefaultFlowStyle(FlowStyle.BLOCK);
options.setPrettyFlow(true);
Yaml yaml = new Yaml(options);
- String dumpedYaml = yaml.dump(CLGuard);
+ String dumpedYaml = yaml.dump(cLGuard);
//
// This is our callback class for our compiler
//
@@ -220,7 +227,7 @@ public class ControlLoopGuardBuilderImpl implements ControlLoopGuardBuilder {
// Compile it
//
try {
- ControlLoopGuardCompiler.compile(CLGuard, callback);
+ ControlLoopGuardCompiler.compile(cLGuard, callback);
} catch (CompilerException e) {
callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompilerTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompilerTest.java
new file mode 100644
index 000000000..d26d094c6
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopCompilerTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.compiler;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+
+public class ControlLoopCompilerTest {
+
+ @Test
+ public void testTest() {
+ try {
+ this.test("src/test/resources/v1.0.0/test.yaml");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testBad1() {
+ try {
+ this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testBad2() {
+ try {
+ this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad() {
+ try {
+ this.test("src/test/resources/v1.0.0/bad_policies_1.yaml");
+ } catch (Exception e) {
+ }
+ }
+
+ public void test(String testFile) throws Exception {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ ControlLoopCompiler.compile(is, null);
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java
new file mode 100644
index 000000000..1e035edf4
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/compiler/ControlLoopGuardCompilerTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.compiler;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+import org.openecomp.policy.controlloop.guard.compiler.ControlLoopGuardCompiler;
+
+public class ControlLoopGuardCompilerTest {
+
+ @Test
+ public void testTest1() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTest2() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml");
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testBad1() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/no_guard_policy.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad2() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad3() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/no_guard_constraint.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testBad4() {
+ try {
+ this.test("src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void test(String testFile) throws Exception {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ ControlLoopGuardCompiler.compile(is, null);
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
new file mode 100644
index 000000000..713f35787
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
@@ -0,0 +1,516 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.policy;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.openecomp.policy.asdc.Resource;
+import org.openecomp.policy.asdc.ResourceType;
+import org.openecomp.policy.asdc.Service;
+import org.openecomp.policy.controlloop.policy.builder.BuilderException;
+import org.openecomp.policy.controlloop.policy.builder.ControlLoopPolicyBuilder;
+import org.openecomp.policy.controlloop.policy.builder.Message;
+import org.openecomp.policy.controlloop.policy.builder.MessageLevel;
+import org.openecomp.policy.controlloop.policy.builder.Results;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.error.YAMLException;
+
+
+public class ControlLoopPolicyBuilderTest {
+
+ @Test
+ public void testControlLoop() {
+ try {
+ //
+ // Create a builder for our policy
+ //
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test add services
+ //
+ Service vSCP = new Service("vSCP");
+ Service vUSP = new Service("vUSP");
+ Service vTrinity = new Service("Trinity");
+ builder = builder.addService(vSCP, vUSP, vTrinity);
+ assertTrue(builder.getControlLoop().getServices().size() == 3);
+ //
+ // Test remove services
+ //
+ builder = builder.removeService(vSCP);
+ assertTrue(builder.getControlLoop().getServices().size() == 2);
+ builder = builder.removeAllServices();
+ assertTrue(builder.getControlLoop().getServices().size() == 0);
+ //
+ // Test add resources
+ //
+ Resource vCTS = new Resource("vCTS", ResourceType.VF);
+ Resource vCOM = new Resource("vCTS", ResourceType.VF);
+ Resource vRAR = new Resource("vCTS", ResourceType.VF);
+ builder = builder.addResource(vCTS, vCOM, vRAR);
+ assertTrue(builder.getControlLoop().getResources().size() == 3);
+ //
+ // Test remove resources
+ //
+ builder = builder.removeResource(vCTS);
+ assertTrue(builder.getControlLoop().getResources().size() == 2);
+ builder = builder.removeAllResources();
+ assertTrue(builder.getControlLoop().getResources().size() == 0);
+ //
+ // Test set abatement
+ //
+ assertFalse(builder.getControlLoop().getAbatement());
+ builder = builder.setAbatement(true);
+ assertTrue(builder.getControlLoop().getAbatement());
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTimeout() {
+ try {
+ //
+ // Create a builder for our policy
+ //
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test setTimeout
+ //
+ assertTrue(builder.getControlLoop().getTimeout() == 2400);
+ builder = builder.setTimeout(800);
+ assertTrue(builder.getControlLoop().getTimeout() == 800);
+ //
+ // Test calculateTimeout
+ //
+ Policy trigger = builder.setTriggerPolicy(
+ "Restart the VM",
+ "Upon getting the trigger event, restart the VM",
+ "APPC",
+ new Target(TargetType.VM),
+ "Restart",
+ null,
+ 2,
+ 300);
+ @SuppressWarnings("unused")
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
+ "Rebuild VM",
+ "If the restart fails, rebuild it",
+ "APPC",
+ new Target(TargetType.VM),
+ "Rebuild",
+ null,
+ 1,
+ 600,
+ trigger.getId(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ assertTrue(builder.calculateTimeout().equals(new Integer(300 + 600)));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testTriggerPolicyMethods() {
+ try {
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ //
+ // Test isOpenLoop
+ //
+ assertTrue(builder.isOpenLoop());
+ //
+ // Test set initial trigger policy
+ //
+ Policy triggerPolicy1 = builder.setTriggerPolicy(
+ "Restart the VM",
+ "Upon getting the trigger event, restart the VM",
+ "APPC",
+ new Target(TargetType.VM),
+ "Restart",
+ null,
+ 2,
+ 300);
+ assertTrue(builder.isOpenLoop() == false);
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(triggerPolicy1.getId()));
+ //
+ // Set trigger policy to a new policy
+ //
+ @SuppressWarnings("unused")
+ Policy triggerPolicy2 = builder.setTriggerPolicy(
+ "Rebuild the VM",
+ "Upon getting the trigger event, rebuild the VM",
+ "APPC",
+ new Target(TargetType.VM),
+ "Rebuild",
+ null,
+ 2,
+ 300);
+ //
+ // Test set trigger policy to another existing policy
+ //
+ @SuppressWarnings("unused")
+ ControlLoop cl = builder.setTriggerPolicy(triggerPolicy1.getId());
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(triggerPolicy1.getId()));
+ //
+ // Test get trigger policy
+ //
+ assertTrue(builder.getTriggerPolicy().equals(triggerPolicy1));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAddRemovePolicies() {
+ try {
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy = builder.setTriggerPolicy(
+ "Restart the VM",
+ "Upon getting the trigger event, restart the VM",
+ "APPC",
+ new Target(TargetType.VM),
+ "Restart",
+ null,
+ 2,
+ 300);
+ //
+ // Test create a policy and chain it to the results of trigger policy
+ //
+ Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult(
+ "Rebuild VM",
+ "If the restart fails, rebuild it.",
+ "APPC",
+ new Target(TargetType.VM),
+ "Rebuild",
+ null,
+ 1,
+ 600,
+ triggerPolicy.getId(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT,
+ PolicyResult.FAILURE_GUARD);
+ //
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy1.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy1.getId()));
+ //
+ // Test remove policy
+ //
+ boolean removed = builder.removePolicy(onRestartFailurePolicy1.getId());
+ assertTrue(removed);
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
+ //
+ // Create another policy and chain it to the results of trigger policy
+ //
+ Policy onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
+ "Rebuild VM",
+ "If the restart fails, rebuild it.",
+ "APPC",
+ new Target(TargetType.VM),
+ "Rebuild",
+ null,
+ 2,
+ 600,
+ triggerPolicy.getId(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ //
+ // Test reset policy results
+ //
+ triggerPolicy = builder.resetPolicyResults(triggerPolicy.getId());
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ //
+ // Test set the policy results to an existing operational policy
+ //
+ onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
+ onRestartFailurePolicy2.getId(),
+ triggerPolicy.getId(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy2.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy2.getId()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy2.getId()));
+
+ //
+ // Test remove all existing operational policies
+ //
+ builder = builder.removeAllPolicies();
+ assertTrue(builder.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString()));
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAddOperationsAccumulateParams() {
+ try {
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy = builder.setTriggerPolicy(
+ "Restart the eNodeB",
+ "Upon getting the trigger event, restart the eNodeB",
+ "SDNR",
+ new Target(TargetType.PNF),
+ "Restart",
+ null,
+ 2,
+ 300);
+ //
+ // Add the operationsAccumulateParams
+ //
+ triggerPolicy = builder.addOperationsAccumulateParams(triggerPolicy.getId(), new OperationsAccumulateParams("15m", 5));
+ assertNotNull(builder.getTriggerPolicy().getOperationsAccumulateParams());
+ assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getPeriod().equals("15m"));
+ assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getLimit() == 5);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+
+ @Test
+ public void testBuildSpecification() {
+ try {
+ //
+ // Create the builder
+ //
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
+ //
+ // Set the first invalid trigger policy
+ //
+ Policy policy1 = builder.setTriggerPolicy(
+ "Restart the VM",
+ "Upon getting the trigger event, restart the VM",
+ null,
+ null,
+ "Instantiate",
+ null,
+ 2,
+ 300);
+ Results results = builder.buildSpecification();
+ //
+ // Check that ERRORs are in results for invalid policy arguments
+ //
+ boolean invalid_actor = false;
+ boolean invalid_recipe = false;
+ boolean invalid_target = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Policy actor is null") && m.getLevel() == MessageLevel.ERROR) {
+ invalid_actor = true;
+ }
+ if (m.getMessage().equals("Policy recipe is invalid") && m.getLevel() == MessageLevel.ERROR) {
+ invalid_recipe = true;
+ }
+ if (m.getMessage().equals("Policy target is null") && m.getLevel() == MessageLevel.ERROR) {
+ invalid_target = true;
+ }
+ }
+ //
+ assertTrue(invalid_actor);
+ assertTrue(invalid_recipe);
+ assertTrue(invalid_target);
+ //
+ // Remove the invalid policy
+ //
+ //@SuppressWarnings("unused")
+ boolean removed = builder.removePolicy(policy1.getId());
+ assertTrue(removed);
+ assertTrue(builder.getTriggerPolicy() == null);
+ //
+ // Set a valid trigger policy
+ //
+ policy1 = builder.setTriggerPolicy(
+ "Rebuild VM",
+ "If the restart fails, rebuild it.",
+ "APPC",
+ new Target(TargetType.VM),
+ "Rebuild",
+ null,
+ 1,
+ 600);
+ //
+ // Set a second valid trigger policy
+ //
+ Policy policy2 = builder.setTriggerPolicy(
+ "Restart the VM",
+ "Upon getting the trigger event, restart the VM",
+ "APPC",
+ new Target(TargetType.VM),
+ "Restart",
+ null,
+ 2,
+ 300);
+ //
+ // Now, we have policy1 unreachable
+ //
+ results = builder.buildSpecification();
+ boolean unreachable = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Policy " + policy1.getId() + " is not reachable.") && m.getLevel() == MessageLevel.WARNING) {
+ unreachable = true;
+ break;
+ }
+ }
+ assertTrue(unreachable);
+ //
+ // Set policy1 for the failure results of policy2
+ //
+ policy1 = builder.setPolicyForPolicyResult(
+ policy1.getId(),
+ policy2.getId(),
+ PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT);
+ results = builder.buildSpecification();
+ boolean invalid_timeout = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("controlLoop overall timeout is less than the sum of operational policy timeouts.") && m.getLevel() == MessageLevel.ERROR) {
+ invalid_timeout = true;
+ break;
+ }
+ }
+ assertTrue(invalid_timeout);
+ //
+ // Remove policy2 (revert controlLoop back to open loop)
+ //
+ removed = builder.removePolicy(policy2.getId());
+ //
+ // ControlLoop is open loop now, but it still has policies (policy1)
+ //
+ results = builder.buildSpecification();
+ unreachable = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Open Loop policy contains policies. The policies will never be invoked.") && m.getLevel() == MessageLevel.WARNING) {
+ unreachable = true;
+ break;
+ }
+ }
+ assertTrue(unreachable);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+
+ @Test
+ public void test() {
+ this.test("src/test/resources/v1.0.0/policy_Test.yaml");
+ }
+
+ @Test
+ public void testEvilYaml() {
+ try (InputStream is = new FileInputStream(new File("src/test/resources/v1.0.0/test_evil.yaml"))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ yaml.load(is);
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (YAMLException e) {
+ //
+ // Should have this
+ //
+ }
+ }
+
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopPolicy);
+ ControlLoopPolicy policyTobuild = (ControlLoopPolicy) obj;
+ //
+ // Now we're going to try to use the builder to build this.
+ //
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
+ policyTobuild.getControlLoop().getControlLoopName(),
+ policyTobuild.getControlLoop().getTimeout());
+ //
+ // Add services
+ //
+ if (policyTobuild.getControlLoop().getServices() != null) {
+ builder = builder.addService(policyTobuild.getControlLoop().getServices().toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
+ }
+ //
+ // Add resources
+ //
+ if (policyTobuild.getControlLoop().getResources() != null) {
+ builder = builder.addResource(policyTobuild.getControlLoop().getResources().toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
+ }
+ //
+ // Add the policies and be sure to set the trigger policy
+ //
+ if (policyTobuild.getPolicies() != null) {
+ for (Policy policy : policyTobuild.getPolicies()) {
+ if (policy.getId() == policyTobuild.getControlLoop().getTrigger_policy()) {
+ builder.setTriggerPolicy(policy.getName(), policy.getDescription(), policy.getActor(), policy.getTarget(), policy.getRecipe(), null, policy.getRetry(), policy.getTimeout());
+ }
+ }
+ }
+
+ // Question : how to change policy ID and results by using builder ??
+
+ @SuppressWarnings("unused")
+ Results results = builder.buildSpecification();
+
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (BuilderException e) {
+ fail(e.getLocalizedMessage());
+ }
+
+ }
+
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyTest.java
new file mode 100644
index 000000000..15d327087
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/ControlLoopPolicyTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.policy;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.FlowStyle;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+
+public class ControlLoopPolicyTest {
+
+ @Test
+ public void test() {
+ this.test("src/test/resources/v1.0.0/policy_Test.yaml");
+ }
+
+ @Test
+ public void testMultipleService() {
+ this.test("src/test/resources/v1.0.0/policy_Test_MultipleService.yaml");
+ }
+
+ @Test
+ public void testOpenLoop() {
+ this.test("src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml");
+ }
+
+ @Test
+ public void testOpenECOMPvDNS() {
+ this.test("src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml");
+ }
+
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopPolicy);
+ dump(obj);
+ //
+ // Now dump it to a yaml string
+ //
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(FlowStyle.BLOCK);
+ options.setPrettyFlow(true);
+ yaml = new Yaml(options);
+ String dumpedYaml = yaml.dump(obj);
+ System.out.println(dumpedYaml);
+ //
+ // Read that string back into our java object
+ //
+ Object newObject = yaml.load(dumpedYaml);
+ dump(newObject);
+ assertNotNull(newObject);
+ assertTrue(newObject instanceof ControlLoopPolicy);
+ //
+ // Have to comment it out tentatively since it causes junit to fail.
+ // Seems we cannot use assertEquals here. Need advice.
+ //
+ //assertEquals(newObject, obj);
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ public void dump(Object obj) {
+ System.out.println("Dumping " + obj.getClass().getCanonicalName());
+ System.out.println(obj.toString());
+ }
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java
new file mode 100644
index 000000000..5df0266ec
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardBuilderTest.java
@@ -0,0 +1,193 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.policy.guard;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.policy.controlloop.policy.builder.BuilderException;
+import org.openecomp.policy.controlloop.policy.builder.Message;
+import org.openecomp.policy.controlloop.policy.builder.MessageLevel;
+import org.openecomp.policy.controlloop.policy.builder.Results;
+import org.openecomp.policy.controlloop.policy.guard.builder.ControlLoopGuardBuilder;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+public class ControlLoopGuardBuilderTest {
+
+ @Test
+ public void testControlLoopGuard() {
+ try {
+ //
+ // Create a builder
+ //
+ ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(new Guard());
+ //
+ // Assert there is no guard policies yet
+ //
+ Results results = builder.buildSpecification();
+ boolean no_guard_policies = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("ControlLoop Guard should have at least one guard policies") && m.getLevel() == MessageLevel.ERROR) {
+ no_guard_policies = true;
+ break;
+ }
+ }
+ assertTrue(no_guard_policies);
+ //
+ // Add a guard policy without limit constraint
+ //
+ GuardPolicy policy1 = new GuardPolicy("1111", "guardpolicy1", "guardpolicy1", "APPC", "restart");
+ builder = builder.addGuardPolicy(policy1);
+ //
+ // Assert there is no limit constraint associated with the only guard policy
+ //
+ results = builder.buildSpecification();
+ boolean no_constraint = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Guard policy guardpolicy1 does not have any limit constraint") && m.getLevel() == MessageLevel.ERROR) {
+ no_constraint = true;
+ break;
+ }
+ }
+ assertTrue(no_constraint);
+ //
+ // Add a constraint to policy1
+ //
+ Map<String, String> time_in_range = new HashMap<String, String>();
+ time_in_range.put("arg2", "PT5H");
+ time_in_range.put("arg3", "PT24H");
+ List<String> blacklist = new LinkedList<String>();
+ blacklist.add("eNodeB_common_id1");
+ blacklist.add("eNodeB_common_id2");
+ Constraint cons = new Constraint(5, "PT15M", time_in_range, blacklist);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Add a duplicate constraint to policy1
+ //
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Assert there are duplicate constraints associated with the only guard policy
+ //
+ results = builder.buildSpecification();
+ boolean duplicate_constraint = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("Guard policy guardpolicy1 has duplicate limit constraints") && m.getLevel() == MessageLevel.WARNING) {
+ duplicate_constraint = true;
+ break;
+ }
+ }
+ assertTrue(duplicate_constraint);
+ //
+ // Remove the duplicate constraint
+ //
+ builder = builder.removeLimitConstraint(policy1.getId(), cons);
+ //
+ // Add a duplicate guard policy
+ //
+ builder = builder.addGuardPolicy(policy1);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
+ //
+ // Assert there are duplicate guard policies
+ //
+ results = builder.buildSpecification();
+ boolean duplicate_guard_policy = false;
+ for (Message m : results.getMessages()) {
+ if (m.getMessage().equals("There are duplicate guard policies") && m.getLevel() == MessageLevel.WARNING) {
+ duplicate_guard_policy = true;
+ break;
+ }
+ }
+ assertTrue(duplicate_guard_policy);
+ //
+ // Remove the duplicate guard policy
+ //
+ builder = builder.removeGuardPolicy(policy1);
+ //
+ // Assert there are no Error/Warning message
+ //
+ results = builder.buildSpecification();
+ assertTrue(results.getMessages().size() == 1);
+ //
+ } catch (BuilderException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void test1() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml");
+ }
+
+ @Test
+ public void test2() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml");
+ }
+
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopGuard.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopGuard);
+ ControlLoopGuard guardTobuild = (ControlLoopGuard) obj;
+ //
+ // Now we're going to try to use the builder to build this.
+ //
+ ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(guardTobuild.getGuard());
+ //
+ // Add guard policy
+ //
+ if (guardTobuild.getGuards() != null) {
+ builder = builder.addGuardPolicy(guardTobuild.getGuards().toArray(new GuardPolicy[guardTobuild.getGuards().size()]));
+ }
+ //
+ // Build the specification
+ //
+ Results results = builder.buildSpecification();
+ //
+ // Print out the specification
+ //
+ System.out.println(results.getSpecification());
+ //
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ } catch (BuilderException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardTest.java b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardTest.java
new file mode 100644
index 000000000..a09fd2112
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/java/org/openecomp/policy/controlloop/policy/guard/ControlLoopGuardTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controlloop.policy.guard;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Test;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.FlowStyle;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
+
+
+public class ControlLoopGuardTest {
+
+ @Test
+ public void testGuardvDNS() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml");
+ }
+
+ @Test
+ public void testGuardvUSP() {
+ this.test("src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml");
+ }
+
+ public void test(String testFile) {
+ try (InputStream is = new FileInputStream(new File(testFile))) {
+ //
+ // Read the yaml into our Java Object
+ //
+ Yaml yaml = new Yaml(new Constructor(ControlLoopGuard.class));
+ Object obj = yaml.load(is);
+ assertNotNull(obj);
+ assertTrue(obj instanceof ControlLoopGuard);
+ dump(obj);
+ //
+ // Now dump it to a yaml string
+ //
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(FlowStyle.BLOCK);
+ options.setPrettyFlow(true);
+ yaml = new Yaml(options);
+ String dumpedYaml = yaml.dump(obj);
+ System.out.println(dumpedYaml);
+ //
+ // Read that string back into our java object
+ //
+ Object newObject = yaml.load(dumpedYaml);
+ dump(newObject);
+ assertNotNull(newObject);
+ assertTrue(newObject instanceof ControlLoopGuard);
+ //
+ // Have to comment it out tentatively since it causes junit to fail.
+ // Seems we cannot use assertEquals here. Need advice.
+ //
+ //assertEquals(newObject, obj);
+ } catch (FileNotFoundException e) {
+ fail(e.getLocalizedMessage());
+ } catch (IOException e) {
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ public void dump(Object obj) {
+ System.out.println("Dumping " + obj.getClass().getCanonicalName());
+ System.out.println(obj.toString());
+ }
+}
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_policies_1.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_policies_1.yaml
new file mode 100644
index 000000000..f6ad68425
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_policies_1.yaml
@@ -0,0 +1,25 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: FINAL_FAILURE
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_1.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_1.yaml
new file mode 100644
index 000000000..981229c4a
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_1.yaml
@@ -0,0 +1,95 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: FOO
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_2.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_2.yaml
new file mode 100644
index 000000000..1f9715b13
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/bad_trigger_2.yaml
@@ -0,0 +1,95 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: FINAL_SUCCESS
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml
new file mode 100644
index 000000000..7fd27fa97
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml
@@ -0,0 +1,12 @@
+controlLoop:
+ version: 1.0.0
+ controlLoopName: ControlLoop-Open-fac4ae3d-c3f5-4bab-8e54-0a8581ede132
+ services:
+ - serviceName: Service
+ resources:
+ - resourceType: VF
+ resourceName: Example
+ trigger_policy: final_openloop
+ timeout: 0
+
+policies:
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test.yaml
new file mode 100644
index 000000000..b89a725cf
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test.yaml
@@ -0,0 +1,95 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml
new file mode 100644
index 000000000..8ce707729
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml
@@ -0,0 +1,26 @@
+controlLoop:
+ version: 1.0.0
+ controlLoopName: ClosedLoop-FRWL-SIG-d925ed73-8231-4d02-9545-db4e101f88f8
+ services:
+ - serviceName: vSCP
+ - serviceName: vSBG
+ resources:
+ - resourceName: F5FW
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test.yaml
new file mode 100644
index 000000000..b89a725cf
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test.yaml
@@ -0,0 +1,95 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+ success: unique-policy-id-2-healthcheck-restart
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-2-healthcheck-restart
+ name: HealthCheck Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-3-rebuild
+ failure_timeout: unique-policy-id-3-rebuild
+ failure_retries: unique-policy-id-3-rebuild
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-3-rebuild
+ name: Rebuild Policy
+ description:
+ actor: APPC
+ recipe: Rebuild
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-4-healthcheck-rebuild
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-4-healthcheck-rebuild
+ name: HealthCheck the Rebuild Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: unique-policy-id-5-migrate
+ failure_timeout: unique-policy-id-5-migrate
+ failure_retries: unique-policy-id-5-migrate
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-5-migrate
+ name: Migrate Policy
+ description:
+ actor: APPC
+ recipe: Migrate
+ target: VM
+ retry: 0
+ timeout: 600
+ success: unique-policy-id-6-healthcheck-migrate
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+
+ - id: unique-policy-id-6-healthcheck-migrate
+ name: Healthcheck the Migrate Policy
+ description:
+ actor: APPC
+ recipe: HealthCheck
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test_evil.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test_evil.yaml
new file mode 100644
index 000000000..347e84e5e
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v1.0.0/test_evil.yaml
@@ -0,0 +1,25 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: MSO
+ recipe: Instantiate
+ target: VM
+ retry: 2
+ timeout: 300
+ success: final_failure_exception
+ failure: final_success
+ failure_timeout: final_success
+ failure_retries: final_success
+ failure_exception: final_failure_exception
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml
new file mode 100644
index 000000000..adb1ca171
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml
@@ -0,0 +1,21 @@
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ #
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H
+ #
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H \ No newline at end of file
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml
new file mode 100644
index 000000000..2d54e8517
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml
@@ -0,0 +1,27 @@
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H
+ #
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - num: 5
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H \ No newline at end of file
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml
new file mode 100644
index 000000000..6ab3d67fa
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_constraint.yaml
@@ -0,0 +1,11 @@
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ \ No newline at end of file
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_policy.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_policy.yaml
new file mode 100644
index 000000000..51f41d457
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/no_guard_policy.yaml
@@ -0,0 +1,2 @@
+guard:
+ version: 2.0.0
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml
new file mode 100644
index 000000000..797a7a81f
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml
@@ -0,0 +1,24 @@
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_vUSP_1
+ name: APPC 5 Restart
+ description:
+ We only allow 5 restarts over 15 minute window during the day time hours (i.e. avoid midnight to 5am)
+ actor: APPC
+ recipe: Restart
+ limit_constraints:
+ - num: 5
+ #
+ # https://www.w3.org/TR/xmlschema-2/#duration
+ #
+ duration: PT15M
+ #
+ # XACML function time-in-range
+ #
+ # Assumption is that the "current time" is the 1st argument
+ #
+ time_in_range:
+ arg2: PT5H
+ arg3: PT24H \ No newline at end of file
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml
new file mode 100644
index 000000000..414e814d3
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml
@@ -0,0 +1,15 @@
+guard:
+ version: 2.0.0
+
+guards:
+ - id: unique_guard_ONAP_vDNS_1
+ name: MSO Spinup
+ description: We only spin up 1 instance over a 10 minute window
+ actor: MSO
+ recipe: VF Module Create
+ limit_constraints:
+ - num: 1
+ #
+ # https://www.w3.org/TR/xmlschema-2/#duration
+ #
+ duration: PT10M
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml
new file mode 100644
index 000000000..f3e9bc4e4
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-59a2ee3fB58045feB5a1-template.yml
@@ -0,0 +1,1698 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+ UUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+ name: 59a2ee3f-b580-45fe-b5a1
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ resourceVendor: 185c637a-3885-463e-8fd0
+ resourceVendorRelease: '1.0'
+imports:
+- NeutronNet:
+ file: resource-Neutronnet-template.yml
+- NeutronPort:
+ file: resource-Neutronport-template.yml
+- 59a2ee3fB58045feB5a1.nodes.heat.vlb:
+ file: resource-59a2ee3fb58045feb5a1NodesHeatVlb-template.yml
+- 59a2ee3fB58045feB5a1.nodes.heat.vdns:
+ file: resource-59a2ee3fb58045feb5a1NodesHeatVdns-template.yml
+topology_template:
+ inputs:
+ vf_module_id:
+ type: string
+ description: The vLoadBalancer Module ID is provided by ECOMP
+ ecomp_private_subnet_id:
+ type: string
+ description: Private sub-network that connects ECOMP component and the VNF
+ repo_url_blob:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vlb_private_net_cidr:
+ type: string
+ description: The CIDR of the vLoadBalancer private network
+ vlb_private_net_id:
+ type: string
+ description: Private network that connects vLoadBalancer with vDNSs
+ public_net_id:
+ type: string
+ default: 00000000-0000-0000-0000-000000000000
+ description: Public network that enables remote connection to VNF
+ demo_artifacts_version:
+ type: string
+ description: Artifacts (jar, tar.gz) version used in demo vnfs
+ ecomp_private_net_id:
+ type: string
+ description: Private network that connects ECOMP component and the VNF
+ pub_key:
+ type: string
+ description: Public key to be installed on the compute instance
+ vlb_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components
+ key_name:
+ type: string
+ description: Public/Private key pair name
+ vdns_name_0:
+ type: string
+ description: Name of the vDNS
+ repo_url_artifacts:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vlb_name_0:
+ type: string
+ description: Name of the vLoadBalancer
+ vdns_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
+ vnf_id:
+ type: string
+ description: The VNF ID is provided by ECOMP
+ dcae_collector_ip:
+ type: string
+ description: IP address of the DCAE collector
+ vdns_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vDNS to communicate with ECOMP components
+ dcae_collector_port:
+ type: string
+ description: Port of the DCAE collector
+ vlb_image_name:
+ type: string
+ default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
+ description: Image to be used for compute instance
+ vlb_flavor_name:
+ type: string
+ default: 4 GB General Purpose v1
+ description: Type of instance (flavor) to be used
+ vlb_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
+ ecomp_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ node_templates:
+ vdns_private_1_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: ecomp_private_subnet_id
+ ip_address:
+ get_input: vdns_private_ip_1
+ network:
+ get_input: ecomp_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vdns_0
+ relationship: tosca.relationships.network.BindsTo
+ vlb_private_network:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: vlb_private_net_id
+ subnets:
+ vlb_private_subnet:
+ name:
+ get_input: vlb_private_net_id
+ cidr:
+ get_input: vlb_private_net_cidr
+ vlb_private_1_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: ecomp_private_subnet_id
+ ip_address:
+ get_input: vlb_private_ip_1
+ network:
+ get_input: ecomp_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vlb_0
+ relationship: tosca.relationships.network.BindsTo
+ vdns_0:
+ type: org.openecomp.resource.vfc.59a2ee3fB58045feB5a1.abstact.nodes.heat.vdns
+ metadata:
+ invariantUUID: ee585c30-127b-492e-b2c1-871dc61d1dde
+ UUID: d816cb01-b5d0-4bbb-b614-f7c3e230ab19
+ version: '1.0'
+ name: 59a2ee3fB58045feB5a1.nodes.heat.vdns
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vlb_flavor_name
+ image:
+ get_input: vlb_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vdns_name_0
+ vlb_private_0_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: vlb_private_network
+ ip_address:
+ get_input: vlb_private_ip_0
+ network: vlb_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: vlb_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vlb_0
+ relationship: tosca.relationships.network.BindsTo
+ vdns_private_0_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: vlb_private_net_id
+ ip_address:
+ get_input: vdns_private_ip_0
+ network:
+ get_input: vlb_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vdns_0
+ relationship: tosca.relationships.network.BindsTo
+ vlb_0:
+ type: org.openecomp.resource.vfc.59a2ee3fB58045feB5a1.abstact.nodes.heat.vlb
+ metadata:
+ invariantUUID: f7f1d745-cfb1-4aa9-83fc-31280d0ce513
+ UUID: 1821f13e-411f-4b29-87a5-ae935897b2e1
+ version: '1.0'
+ name: 59a2ee3fB58045feB5a1.nodes.heat.vlb
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vlb_flavor_name
+ image:
+ get_input: vlb_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vlb_name_0
+ groups:
+ base_vlb:
+ type: org.openecomp.groups.heat.HeatStack
+ members:
+ - vdns_private_1_port
+ - vlb_private_network
+ - vlb_private_1_port
+ - vdns_0
+ - vlb_private_0_port
+ - vdns_private_0_port
+ - vlb_0
+ metadata:
+ invariantUUID: 097f71b3-90a1-4064-bc83-f76bf30195fe
+ UUID: 4daf7600-0a06-4515-859a-c45ec11abd29
+ version: '1'
+ name: base_vlb
+ 59a2ee3fB58045feB5a1..dnsscaling..module-1:
+ type: org.openecomp.groups.VfModule
+ members:
+ - vdns_private_1_port
+ - vdns_0
+ - vdns_private_0_port
+ metadata:
+ vfModuleModelName: 59a2ee3fB58045feB5a1..dnsscaling..module-1
+ vfModuleModelInvariantUUID: 395d61a9-309b-4c0f-a442-ca47903e231e
+ vfModuleModelUUID: 40846490-abf4-4e1d-8f1a-2286968fa231
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Expansion
+ vf_module_description:
+ volume_group: false
+ 59a2ee3fB58045feB5a1..base_vlb..module-0:
+ type: org.openecomp.groups.VfModule
+ members:
+ - vdns_private_1_port
+ - vlb_private_network
+ - vlb_private_1_port
+ - vdns_0
+ - vlb_private_0_port
+ - vdns_private_0_port
+ - vlb_0
+ metadata:
+ vfModuleModelName: 59a2ee3fB58045feB5a1..base_vlb..module-0
+ vfModuleModelInvariantUUID: 5ae76f74-6324-4835-a86c-0c96d16afd38
+ vfModuleModelUUID: 17c4f752-a3da-4f3d-9cc5-1c4d28e5442d
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Base
+ vf_module_description:
+ volume_group: false
+ dnsscaling:
+ type: org.openecomp.groups.heat.HeatStack
+ members:
+ - vdns_private_1_port
+ - vdns_0
+ - vdns_private_0_port
+ metadata:
+ invariantUUID: 7c2971fa-9369-4fed-a449-a5e21c022f97
+ UUID: ae8c3b79-77d3-425a-8bab-6558007f8392
+ version: '1'
+ name: dnsscaling
+ substitution_mappings:
+ node_type: org.openecomp.resource.vf.59a2ee3fB58045feB5a1
+ capabilities:
+ vdns_0.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vdns_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vlb_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vlb_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_0.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vlb_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vlb_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vlb_0.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vlb_0.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vdns_0.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vdns_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vdns_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vlb_0.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vlb_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ requirements:
+ vdns_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vlb_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vdns_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vdns_private_0_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vdns_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vlb_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vlb_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vdns_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vdns_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml
new file mode 100644
index 000000000..3ce20b597
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/resource-Eace933104d443b496b8-template.yml
@@ -0,0 +1,2525 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+ UUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+ name: eace9331-04d4-43b4-96b8
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ resourceVendor: 31125954-23a0-4d41-95e5
+ resourceVendorRelease: '1.0'
+imports:
+- NeutronPort:
+ file: resource-Neutronport-template.yml
+- Eace933104d443b496b8.nodes.heat.vfw:
+ file: resource-Eace933104d443b496b8NodesHeatVfw-template.yml
+- Eace933104d443b496b8.nodes.heat.vpg:
+ file: resource-Eace933104d443b496b8NodesHeatVpg-template.yml
+- NeutronNet:
+ file: resource-Neutronnet-template.yml
+- Eace933104d443b496b8.nodes.heat.vsn:
+ file: resource-Eace933104d443b496b8NodesHeatVsn-template.yml
+topology_template:
+ inputs:
+ vf_module_id:
+ type: string
+ description: The vFirewall Module ID is provided by ECOMP
+ repo_url_blob:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ public_net_id:
+ type: string
+ default: 00000000-0000-0000-0000-000000000000
+ description: Public network that enables remote connection to VNF
+ vfw_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with the vSink
+ vfw_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator
+ vfw_private_ip_2:
+ type: string
+ description: Private IP address that is assigned to the vFirewall to communicate with ECOMP components
+ vfw_name_0:
+ type: string
+ description: Name of the vFirewall
+ vnf_id:
+ type: string
+ description: The VNF ID is provided by ECOMP
+ dcae_collector_ip:
+ type: string
+ description: IP address of the DCAE collector
+ dcae_collector_port:
+ type: string
+ description: Port of the DCAE collector
+ vpg_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vPacketGenerator to communicate with ECOMP components
+ vsn_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vSink to communicate with the vFirewall
+ vpg_name_0:
+ type: string
+ description: Name of the vPacketGenerator
+ vpg_private_ip_0:
+ type: string
+ description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall
+ vsn_private_ip_1:
+ type: string
+ description: Private IP address that is assigned to the vSink to communicate with ECOMP components
+ protected_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ ecomp_private_net_cidr:
+ type: string
+ description: The CIDR of the protected private network
+ unprotected_private_net_cidr:
+ type: string
+ description: The CIDR of the unprotected private network
+ ecomp_private_subnet_id:
+ type: string
+ description: Private sub-network that connects ECOMP component and the VNF
+ vsn_name_0:
+ type: string
+ description: Name of the vSink
+ unprotected_private_net_id:
+ type: string
+ description: Private network that connects vPacketGenerator with vFirewall
+ vfw_flavor_name:
+ type: string
+ default: 4 GB General Purpose v1
+ description: Type of instance (flavor) to be used
+ demo_artifacts_version:
+ type: string
+ description: Artifacts (jar, tar.gz) version used in demo vnfs
+ ecomp_private_net_id:
+ type: string
+ description: Private network that connects ECOMP component and the VNF
+ pub_key:
+ type: string
+ description: Public key to be installed on the compute instance
+ key_name:
+ type: string
+ description: Public/Private key pair name
+ repo_url_artifacts:
+ type: string
+ description: URL of the repository that hosts the demo packages
+ vfw_image_name:
+ type: string
+ default: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
+ description: Image to be used for compute instance
+ protected_private_net_id:
+ type: string
+ description: Private network that connects vFirewall with vSink
+ node_templates:
+ vfw_private_0_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: unprotected_private_network
+ ip_address:
+ get_input: vfw_private_ip_0
+ network: unprotected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: unprotected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vsn_private_1_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: ecomp_private_subnet_id
+ ip_address:
+ get_input: vsn_private_ip_1
+ network:
+ get_input: ecomp_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vsn_0
+ relationship: tosca.relationships.network.BindsTo
+ unprotected_private_network:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: unprotected_private_net_id
+ subnets:
+ unprotected_private_subnet:
+ cidr:
+ get_input: unprotected_private_net_cidr
+ vpg_private_1_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: ecomp_private_subnet_id
+ ip_address:
+ get_input: vpg_private_ip_1
+ network:
+ get_input: ecomp_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vpg_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_0:
+ type: org.openecomp.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vfw
+ metadata:
+ invariantUUID: 0129e34c-d9fa-442d-bb2c-f925d018000a
+ UUID: 7fa1f6c7-c6bd-4444-8db2-63334a5aed1b
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vfw
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vfw_name_0
+ vsn_0:
+ type: org.openecomp.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vsn
+ metadata:
+ invariantUUID: b19f6643-3db0-4d73-b280-94d6f21caa71
+ UUID: 6dca6eb9-330c-4090-a542-7aca5f446e21
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vsn
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vsn_name_0
+ vpg_private_0_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: unprotected_private_network
+ ip_address:
+ get_input: vpg_private_ip_0
+ network: unprotected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: unprotected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vpg_0
+ relationship: tosca.relationships.network.BindsTo
+ vsn_private_0_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: protected_private_network
+ ip_address:
+ get_input: vsn_private_ip_0
+ network: protected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: protected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vsn_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_private_1_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet: protected_private_network
+ ip_address:
+ get_input: vfw_private_ip_1
+ network: protected_private_network
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: protected_private_network
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vfw_private_2_port:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ metadata:
+ invariantUUID: 7feb77d3-dcc5-4826-8a78-0c9089814a45
+ UUID: 06bc8ea7-0f6a-489a-9f8f-c7253653b457
+ version: '1.0'
+ name: NeutronPort
+ description: Represents a logical entity that associates between Compute and Network normative types.
+ type: CP
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ fixed_ips:
+ - subnet:
+ get_input: ecomp_private_subnet_id
+ ip_address:
+ get_input: vfw_private_ip_2
+ network:
+ get_input: ecomp_private_net_id
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: vfw_0
+ relationship: tosca.relationships.network.BindsTo
+ vpg_0:
+ type: org.openecomp.resource.vfc.Eace933104d443b496b8.abstact.nodes.heat.vpg
+ metadata:
+ invariantUUID: 7654ae14-4e98-45bc-a8c0-2c43e1805bb4
+ UUID: 5267d6dd-f676-4f98-abec-6387ce6beaf2
+ version: '1.0'
+ name: Eace933104d443b496b8.nodes.heat.vpg
+ description: Not reusable inner VFC
+ type: VFC
+ category: Generic
+ subcategory: Abstract
+ properties:
+ key_name: UNSUPPORTED_RESOURCE_my_keypair
+ flavor:
+ get_input: vfw_flavor_name
+ image:
+ get_input: vfw_image_name
+ metadata:
+ vf_module_id:
+ get_input: vf_module_id
+ vnf_id:
+ get_input: vnf_id
+ user_data_format: RAW
+ name:
+ get_input: vpg_name_0
+ protected_private_network:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ metadata:
+ invariantUUID: 2870cc3a-d6cd-4423-b7f6-2d63619b0eeb
+ UUID: b7e764ba-17f9-4f0a-ad29-29877766ef21
+ version: '1.0'
+ name: NeutronNet
+ description: Represents a network service with optional subnets and advanced configurations.
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ properties:
+ network_name:
+ get_input: protected_private_net_id
+ subnets:
+ protected_private_subnet:
+ cidr:
+ get_input: protected_private_net_cidr
+ groups:
+ base_vfw:
+ type: org.openecomp.groups.heat.HeatStack
+ members:
+ - vfw_private_0_port
+ - vsn_private_1_port
+ - unprotected_private_network
+ - vpg_private_1_port
+ - vfw_0
+ - vsn_0
+ - vpg_private_0_port
+ - vsn_private_0_port
+ - vfw_private_1_port
+ - vfw_private_2_port
+ - vpg_0
+ - protected_private_network
+ metadata:
+ invariantUUID: 44b0c172-7b61-49b5-a68a-810042087e1f
+ UUID: 24cb02f0-1d72-441f-a327-22d80180deaa
+ version: '1'
+ name: base_vfw
+ Eace933104d443b496b8..base_vfw..module-0:
+ type: org.openecomp.groups.VfModule
+ members:
+ - vfw_private_0_port
+ - vsn_private_1_port
+ - unprotected_private_network
+ - vpg_private_1_port
+ - vfw_0
+ - vsn_0
+ - vpg_private_0_port
+ - vsn_private_0_port
+ - vfw_private_1_port
+ - vfw_private_2_port
+ - vpg_0
+ - protected_private_network
+ metadata:
+ vfModuleModelName: Eace933104d443b496b8..base_vfw..module-0
+ vfModuleModelInvariantUUID: 58c105fd-9c12-4fb7-8a3e-a5ec280183fb
+ vfModuleModelUUID: ab251d24-4001-4926-aa5c-c01736b36c68
+ vfModuleModelVersion: '1'
+ properties:
+ vf_module_type: Base
+ vf_module_description:
+ volume_group: false
+ substitution_mappings:
+ node_type: org.openecomp.resource.vf.Eace933104d443b496b8
+ capabilities:
+ vfw_0.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vfw_0.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ protected_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vsn_0.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ unprotected_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vpg_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vpg_0.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_2_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vfw_0.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ vsn_0.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vsn_0.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vsn_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_0.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ unprotected_private_network.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vfw_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_private_0_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_private_2_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ unprotected_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_0.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vpg_0.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ vsn_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ protected_private_network.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ vpg_0.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vsn_0.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ vfw_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ protected_private_network.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ vsn_0.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_0.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vsn_0.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vfw_private_1_port.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vfw_0.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_0.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ vpg_private_0_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ vpg_private_1_port.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ requirements:
+ vsn_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vfw_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vfw_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_1_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ vsn_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ protected_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_2_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_2_port.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ unprotected_private_network.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vsn_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_0.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ vsn_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_1_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vsn_0.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vpg_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ vfw_private_0_port.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml
new file mode 100644
index 000000000..b59c85269
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-57e66ea70ed645c7970f-template.yml
@@ -0,0 +1,677 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
+ UUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
+ name: 57e66ea7-0ed6-45c7-970f
+ description: catalog service description
+ type: Service
+ category: Network L1-3
+ serviceEcompNaming: false
+ serviceHoming: false
+imports:
+- eace9331-04d4-43b4-96b8:
+ file: resource-Eace933104d443b496b8-template.yml
+topology_template:
+ node_templates:
+ eace9331-04d4-43b4-96b8 1:
+ type: org.openecomp.resource.vf.Eace933104d443b496b8
+ metadata:
+ invariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+ UUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+ version: '1.0'
+ name: eace9331-04d4-43b4-96b8
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ substitution_mappings:
+ node_type: org.openecomp.service.57e66ea70ed645c7970f
+ capabilities:
+ eace9331-04d4-43b4-96b8 1.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ eace9331-04d4-43b4-96b8 1.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ eace9331-04d4-43b4-96b8 1.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ eace9331-04d4-43b4-96b8 1.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ eace9331-04d4-43b4-96b8 1.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ requirements:
+ eace9331-04d4-43b4-96b8 1.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ eace9331-04d4-43b4-96b8 1.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ eace9331-04d4-43b4-96b8 1.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml
new file mode 100644
index 000000000..302cacc0a
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/Demo-1.0.0-HeatTemplates/service-D473899264974dca9db9-template.yml
@@ -0,0 +1,677 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ invariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ UUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+ name: d4738992-6497-4dca-9db9
+ description: catalog service description
+ type: Service
+ category: Network L1-3
+ serviceEcompNaming: false
+ serviceHoming: false
+imports:
+- 59a2ee3f-b580-45fe-b5a1:
+ file: resource-59a2ee3fB58045feB5a1-template.yml
+topology_template:
+ node_templates:
+ 59a2ee3f-b580-45fe-b5a1 1:
+ type: org.openecomp.resource.vf.59a2ee3fB58045feB5a1
+ metadata:
+ invariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+ UUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+ version: '1.0'
+ name: 59a2ee3f-b580-45fe-b5a1
+ description: vendor software product
+ type: VF
+ category: Generic
+ subcategory: Abstract
+ substitution_mappings:
+ node_type: org.openecomp.service.D473899264974dca9db9
+ capabilities:
+ 59a2ee3f-b580-45fe-b5a1 1.memory.resident:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance on the physical machine
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.resident
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ port_name:
+ type: string
+ required: false
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ secure:
+ type: boolean
+ default: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.feature:
+ type: tosca.capabilities.Node
+ occurrences:
+ - 1
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.vcpus:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average disk latency
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ms
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: vcpus
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ properties:
+ num_cpus:
+ type: integer
+ required: false
+ disk_size:
+ type: scalar-unit.size
+ required: false
+ cpu_frequency:
+ type: scalar-unit.frequency
+ required: false
+ mem_size:
+ type: scalar-unit.size
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.memory.usage:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory.usage
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.instance:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ max_instances:
+ type: integer
+ default: 1
+ min_instances:
+ type: integer
+ default: 1
+ default_instances:
+ type: integer
+ 59a2ee3f-b580-45fe-b5a1 1.cpu_util:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Average CPU utilization
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: '%'
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu_util
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.instance:type:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Existence of instance <type> (OpenStack types)
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: instance
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: instance:type
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.cpu.delta:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used since previous datapoint
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Delta
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu.delta
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.memory:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: Volume of RAM allocated to the instance
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Gauge
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: MB
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: memory
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ 59a2ee3f-b580-45fe-b5a1 1.cpu:
+ type: org.openecomp.capabilities.metric.Ceilometer
+ description: CPU time used
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ initiator:
+ type: string
+ default: source
+ network_name:
+ type: string
+ default: PRIVATE
+ required: false
+ description:
+ type: string
+ description: Description of the metric
+ required: false
+ type:
+ type: string
+ default: Cumulative
+ description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc.
+ required: true
+ ports:
+ type: map
+ required: false
+ entry_schema:
+ type: PortSpec
+ secure:
+ type: boolean
+ default: false
+ port_name:
+ type: string
+ required: false
+ unit:
+ type: string
+ default: ns
+ description: Unit of the metric value
+ required: true
+ protocol:
+ type: string
+ default: tcp
+ port:
+ type: PortDef
+ required: false
+ name:
+ type: string
+ default: cpu
+ description: Ceilometer metric type name to monitor. (The name ceilometer is using)
+ required: true
+ category:
+ type: string
+ default: compute
+ description: Category of the metric, for an example, compute, disk, network, storage and etc.
+ required: false
+ url_path:
+ type: string
+ required: false
+ 59a2ee3f-b580-45fe-b5a1 1.os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ properties:
+ distribution:
+ type: string
+ required: false
+ type:
+ type: string
+ required: false
+ version:
+ type: version
+ required: false
+ architecture:
+ type: string
+ required: false
+ requirements:
+ 59a2ee3f-b580-45fe-b5a1 1.local_storage:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ 59a2ee3f-b580-45fe-b5a1 1.dependency:
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capability: tosca.capabilities.Node
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.DependsOn
+ 59a2ee3f-b580-45fe-b5a1 1.link:
+ occurrences:
+ - 1
+ - 1
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/pgstreams.json b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/pgstreams.json
new file mode 100644
index 000000000..4d118afa1
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/pgstreams.json
@@ -0,0 +1,26 @@
+{
+ "pg-streams": {
+ "pg-stream": [
+ {
+ "id": "fw_udp1",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp2",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp3",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp4",
+ "is-enabled": "true"
+ },
+ {
+ "id": "fw_udp5",
+ "is-enabled": "true"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml
new file mode 100644
index 000000000..5deb8f7ff
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml
@@ -0,0 +1,47 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ services:
+ - serviceName: d4738992-6497-4dca-9db9
+ serviceInvariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ serviceUUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+#
+# OPTIONAL to specify the exact resource VF and/or VFC(s)
+#
+# resources:
+# - resourceInvariantUUID: 4b8d4018-068b-4c33-b9bb-d980798e52c2
+# resourceUUID: d7d28881-b24d-4512-bfee-1e2eb335591f
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3f-b580-45fe-b5a1
+# resourceType: VF
+#
+# resources:
+# - resourceInvariantUUID: ee585c30-127b-492e-b2c1-871dc61d1dde
+# resourceUUID: d816cb01-b5d0-4bbb-b614-f7c3e230ab19
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3fB58045feB5a1.nodes.heat.vdns
+# resourceType: VFC
+# - resourceInvariantUUID: f7f1d745-cfb1-4aa9-83fc-31280d0ce513
+# resourceUUID: 1821f13e-411f-4b29-87a5-ae935897b2e1
+# resourceVersion: '1.0'
+# resourceName: 59a2ee3fB58045feB5a1.nodes.heat.vlb
+# resourceType: VFC
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-scale-up
+ name: Create a new VF Module
+ description:
+ actor: MSO
+ recipe: VF Module Create
+ target:
+ resourceID: 59a2ee3fB58045feB5a1.nodes.heat.vdns
+ retry: 0
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
diff --git a/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml
new file mode 100644
index 000000000..51597714c
--- /dev/null
+++ b/ECOMP-ControlloopPolicy/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml
@@ -0,0 +1,58 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ services:
+ - serviceInvariantUUID: 5cfe6f4a-41bc-4247-8674-ebd4b98e35cc
+ serviceUUID: 0f40bba5-986e-4b3c-803f-ddd1b7b25f24
+ serviceName: 57e66ea7-0ed6-45c7-970f
+#
+# OPTIONAL
+#
+# IF they want this CL restricted to a particular VFC(s)
+#
+#resources:
+# - resourceInvariantUUID: 06fe411e-d006-4ac3-8b0e-fb4f13cd78d3
+# resourceUUID: 172ce7c5-c2e4-4f8d-b66c-edb49e8e548a
+# resourceVersion: '1.0'
+# resourceName: eace9331-04d4-43b4-96b8
+# resourceType: VF
+
+# resources:
+# - resourceType: VFC
+# resourceInvariantUUID: b19f6643-3db0-4d73-b280-94d6f21caa71
+# resourceUUID: 6dca6eb9-330c-4090-a542-7aca5f446e21
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vsn
+# - resourceName: vFW
+# resourceType: VFC
+# resourceInvariantUUID: 0129e34c-d9fa-442d-bb2c-f925d018000a
+# resourceUUID: 7fa1f6c7-c6bd-4444-8db2-63334a5aed1b
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vfw
+# - resourceType: VFC
+# resourceInvariantUUID: 7654ae14-4e98-45bc-a8c0-2c43e1805bb4
+# resourceUUID: 5267d6dd-f676-4f98-abec-6387ce6beaf2
+# resourceVersion: '1.0'
+# resourceName: Eace933104d443b496b8.nodes.heat.vpg
+ trigger_policy: unique-policy-id-1-modifyConfig
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-modifyConfig
+ name: Change the Load Balancer
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ resourceID: Eace933104d443b496b8.nodes.heat.vpg
+ payload:
+ generic-vnf.vnf-id: {generic-vnf.vnf-id}
+ ref$: pgstreams.json
+ retry: 0
+ timeout: 300
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
diff --git a/ECOMP-PAP-REST/policyelk.properties b/ECOMP-PAP-REST/policyelk.properties
new file mode 100644
index 000000000..a42a83ca7
--- /dev/null
+++ b/ECOMP-PAP-REST/policyelk.properties
@@ -0,0 +1,30 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP Policy Engine
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+
+#Elk database url
+policy.elk.url=http://localhost:9200
+
+
+#Policy Database properties
+policy.database.driver=com.mysql.jdbc.Driver
+policy.database.url=jdbc:mysql://localhost:3306/ecomp_sdk?autoReconnect=true&useSSL=false
+policy.database.username=policy_user
+policy.database.password=policy_user \ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
index 4d872c32c..93fe33727 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
@@ -20,7 +20,6 @@
package org.openecomp.policy.pap.xacml.rest;
-import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
@@ -53,13 +52,12 @@ public class HibernateSession{
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
xacmlsessionFactory = configuration.configure("/hibernate.cfg.xml").buildSessionFactory(builder.build());
- } catch (Throwable ex) {
+ } catch (Exception ex) {
LOGGER.error("Exception Occured While Creating Hiberante Session Factory"+ex);
- throw new ExceptionInInitializerError(ex);
}
}
- public static Session getSessionFactory() throws HibernateException {
+ public static Session getSessionFactory(){
return xacmlsessionFactory.openSession();
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
index 1b5f85477..5e7e2436f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
@@ -1275,12 +1275,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
PolicyLogger.info("JSON request from PolicyEngine API: " + json);
// convert Object sent as JSON into local object
StdPDPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPDPPolicy.class);
- Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> policies = new HashSet<>();
if(policy!=null){
policies.add(policy);
}
//Get the current policies from the Group and Add the new one
- Set<PDPPolicy> currentPoliciesInGroup = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> currentPoliciesInGroup = new HashSet<>();
currentPoliciesInGroup = group.getPolicies();
//If the selected policy is in the group we must remove it because the name is default
Iterator<PDPPolicy> policyIterator = policies.iterator();
@@ -1296,7 +1296,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
//Update the PDP Group after removing old version of policy
- Set<PDPPolicy> updatedPoliciesInGroup = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> updatedPoliciesInGroup = new HashSet<>();
updatedPoliciesInGroup = group.getPolicies();
//need to remove the policy with default name from group
for (PDPPolicy updatedPolicy : currentPoliciesInGroup) {
@@ -1319,9 +1319,13 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
throw new PAPException(e.getMessage());
}
papEngine.updateGroup(group);
+ String policyId = "empty";
+ if(policy!=null){
+ policyId = policy.getId();
+ }
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
response.addHeader("operation", "push");
- response.addHeader("policyId", policy.getId());
+ response.addHeader("policyId", policyId);
response.addHeader("groupId", groupId);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Group '" + group.getId() + "' updated");
@@ -1992,7 +1996,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
moveToGroup = papEngine.getGroup(moveToGroupId);
}
// get list of PDPs in the group being deleted so we can notify them that they got changed
- Set<EcompPDP> movedPDPs = new HashSet<EcompPDP>();
+ Set<EcompPDP> movedPDPs = new HashSet<>();
movedPDPs.addAll(group.getEcompPdps());
// do the move/remove
try{
@@ -2049,7 +2053,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
*/
private class Heartbeat implements Runnable {
private PAPPolicyEngine papEngine;
- private Set<EcompPDP> pdps = new HashSet<EcompPDP>();
+ private Set<EcompPDP> pdps = new HashSet<>();
private int heartbeatInterval;
private int heartbeatTimeout;
@@ -2075,7 +2079,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
synchronized(this) {
this.isRunning = true;
}
- HashMap<String, URL> idToURLMap = new HashMap<String, URL>();
+ HashMap<String, URL> idToURLMap = new HashMap<>();
try {
while (this.isRunning()) {
// Wait the given time
@@ -2382,7 +2386,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
private class NotifyACThread implements Runnable {
public void run() {
- List<String> disconnectedACs = new ArrayList<String>();
+ List<String> disconnectedACs = new ArrayList<>();
// There should be no Concurrent exception here because the list is a CopyOnWriteArrayList.
// The "for each" loop uses the collection's iterator under the covers, so it should be correct.
for (String acURL : adminConsoleURLStringList) {
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
index aee2b3886..63fa04210 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
@@ -89,12 +89,12 @@ public class ActionPolicy extends Policy {
public static boolean isAttribute = false;
- List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldFunctionRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<String>();
+ List<String> dynamicLabelRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldFunctionRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<>();
- protected Map<String, String> dropDownMap = new HashMap<String, String>();
+ protected Map<String, String> dropDownMap = new HashMap<>();
public ActionPolicy() {
@@ -108,7 +108,7 @@ public class ActionPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
@@ -490,7 +490,7 @@ public class ActionPolicy extends Policy {
LOGGER.error("Exception Occured"+e);
}
Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
- Map<String, String> dropDownMap = new HashMap<String, String>();
+ Map<String, String> dropDownMap = new HashMap<>();
for (Datatype id : functionMap.keySet()) {
List<FunctionDefinition> functionDefinitions = (List<FunctionDefinition>) functionMap
.get(id);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
index 4d4859349..b9ed78ef6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
@@ -72,7 +72,7 @@ public class AutoPushPolicy {
* @param papEngine
*/
public Set<StdPDPGroup> checkGroupsToPush(String policyToCreateUpdate, PAPPolicyEngine papEngine) {
- Set<StdPDPGroup> changedGroups= new HashSet<StdPDPGroup>();
+ Set<StdPDPGroup> changedGroups= new HashSet<>();
// Check if the file has been modified. then re-load the properties file.
newModified = propFile.lastModified();
try {
@@ -135,7 +135,7 @@ public class AutoPushPolicy {
StdPDPPolicy policy = new StdPDPPolicy(policyId, true, policyName, null);
//Get the current policies from the Group and Add the new one
Set<PDPPolicy> currentPoliciesInGroup = pdpGroup.getPolicies();
- Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> policies = new HashSet<>();
if(policy!=null){
policies.add(policy);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
index 264602a1d..1281bd083 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
@@ -116,7 +116,7 @@ public class ClosedLoopPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
index cab76b9e5..0cf9c6546 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -236,7 +236,7 @@ public class ConfigPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
index 2f122647d..078ba1040 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
@@ -45,7 +45,7 @@ public class CreateBRMSRuleTemplate {
public CreateBRMSRuleTemplate() {}
public Map<String, String> addRule(String rule, String ruleName, String description, String userID) {
- Map<String,String> responseMap = new HashMap<String,String>();
+ Map<String,String> responseMap = new HashMap<>();
if(rule!=null && !PolicyUtils.brmsRawValidate(rule).contains("[ERR")){
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(ruleName, "ruleName", BRMSParamTemplate.class);
if(duplicateData!=null && !duplicateData.isEmpty()){
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
index 0aaf1b1d2..535b2edd3 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
@@ -40,6 +40,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -93,13 +94,14 @@ public class CreateBrmsParamPolicy extends Policy {
public String expandConfigBody(String ruleContents, Map<String, String> brmsParamBody) {
- Set<String> keySet= new HashSet<String>();
+ Set<String> keySet= new HashSet<>();
Map<String,String> copyMap=new HashMap<>();
copyMap.putAll(brmsParamBody);
copyMap.put("policyName", policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")));
copyMap.put("policyScope", policyAdapter.getDomainDir());
copyMap.put("policyVersion",policyAdapter.getHighestVersion().toString());
+ copyMap.put("unique", ("p"+policyName+UUID.randomUUID().toString()).replaceAll("[^A-Za-z0-9]", ""));
//Finding all the keys in the Map data-structure.
keySet= copyMap.keySet();
@@ -179,7 +181,7 @@ public class CreateBrmsParamPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
@@ -195,7 +197,7 @@ public class CreateBrmsParamPolicy extends Policy {
Boolean dbIsUpdated = true;
- successMap = new HashMap<String, String>();
+ successMap = new HashMap<>();
if (dbIsUpdated) {
successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());
} else {
@@ -253,7 +255,7 @@ public class CreateBrmsParamPolicy extends Policy {
}
protected Map<String, String> findType(String rule) {
- Map<String, String> mapFieldType= new HashMap<String,String>();
+ Map<String, String> mapFieldType= new HashMap<>();
if(rule!=null){
try {
String params = "";
@@ -658,7 +660,7 @@ public class CreateBrmsParamPolicy extends Policy {
// Adding Dependencies.
if(policyAdapter.getBrmsDependency()!=null){
BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
- ArrayList<String> dependencies = new ArrayList<String>();
+ ArrayList<String> dependencies = new ArrayList<>();
StringBuilder key = new StringBuilder();
for(String dependencyName: policyAdapter.getBrmsDependency()){
dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
index dfd647c6e..350bbc4ff 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
@@ -117,7 +117,7 @@ public class CreateBrmsRawPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
@@ -405,7 +405,7 @@ public class CreateBrmsRawPolicy extends Policy {
// Adding Dependencies.
if(policyAdapter.getBrmsDependency()!=null){
BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
- ArrayList<String> dependencies = new ArrayList<String>();
+ ArrayList<String> dependencies = new ArrayList<>();
StringBuilder key = new StringBuilder();
for(String dependencyName: policyAdapter.getBrmsDependency()){
dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
index dcb2a93d4..a16ab9a79 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
@@ -101,7 +101,7 @@ public class CreateClosedLoopPerformanceMetrics extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
index c1740ae30..30a95f901 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
@@ -58,7 +58,7 @@ import com.att.research.xacml.util.XACMLProperties;
public class CreateNewMicroSerivceModel {
private static final Logger logger = FlexLogger.getLogger(CreateNewMicroSerivceModel.class);
private MicroServiceModels newModel = null;
- private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
+ private HashMap<String,MSAttributeObject > classMap = new HashMap<>();
/*
* These are the parameters needed for DB access from the PAP
@@ -85,7 +85,7 @@ public class CreateNewMicroSerivceModel {
this.newModel.setUserCreatedBy(userInfo);
String cleanUpFile = null;
- HashMap<String, MSAttributeObject> tempMap = new HashMap<String, MSAttributeObject>();
+ HashMap<String, MSAttributeObject> tempMap = new HashMap<>();
//Need to delete the file
if (importFile.contains(".zip")){
extractFolder(randomID + ".zip");
@@ -118,7 +118,7 @@ public class CreateNewMicroSerivceModel {
private List<File> listModelFiles(String directoryName) {
File directory = new File(directoryName);
- List<File> resultList = new ArrayList<File>();
+ List<File> resultList = new ArrayList<>();
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
@@ -185,7 +185,7 @@ public class CreateNewMicroSerivceModel {
public Map<String, String> addValuesToNewModel() {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
MSAttributeObject mainClass = null;
ArrayList<String> dependency = null;
String subAttribute = null;
@@ -227,13 +227,13 @@ public class CreateNewMicroSerivceModel {
@SuppressWarnings("resource")
public Map<String, String> saveImportService(){
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
Connection con = null;
Statement st = null;
ResultSet rs = null;
String modelName = this.newModel.getModelName();
- String imported_by = "API";////////////////////////////////////////////
+ String imported_by = "API";
String version = this.newModel.getVersion();
String insertQuery = null;
int ID = 0;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
index e5a114ba8..8d2617ce2 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -88,13 +88,13 @@ public class DecisionPolicy extends Policy {
private static final String XACMLTEMPLATE = "Decision_GuardPolicyTemplate.xml";
- List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldComboRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
- List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<String>();
- List<String> dataTypeList = new LinkedList<String>();
+ List<String> dynamicLabelRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldComboRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<>();
+ List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<>();
+ List<String> dataTypeList = new LinkedList<>();
- protected Map<String, String> dropDownMap = new HashMap<String, String>();
+ protected Map<String, String> dropDownMap = new HashMap<>();
public DecisionPolicy() {
@@ -108,7 +108,7 @@ public class DecisionPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
@@ -153,7 +153,7 @@ public class DecisionPolicy extends Policy {
policyName = policyAdapter.getNewFileName();
if(policyAdapter.getRuleProvider().equals(GUARD_YAML)){
- Map<String, String> yamlParams = new HashMap<String, String>();
+ Map<String, String> yamlParams = new HashMap<>();
yamlParams.put("description", (policyAdapter.getPolicyDescription()!=null)? policyAdapter.getPolicyDescription(): "YAML Guard Policy");
String fileName = policyAdapter.getNewFileName();
String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
@@ -191,7 +191,7 @@ public class DecisionPolicy extends Policy {
Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes();
if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
- dynamicFieldComponentAttributes = new HashMap<String,String>();
+ dynamicFieldComponentAttributes = new HashMap<>();
}
// If there is any dynamic field attributes create the matches here
@@ -214,7 +214,7 @@ public class DecisionPolicy extends Policy {
//dynamicVariableList = policyAdapter.getDynamicVariableList();
if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
- dynamicFieldDecisionSettings = new HashMap<String,String>();
+ dynamicFieldDecisionSettings = new HashMap<>();
}
// settings are dynamic so check how many rows are added and add all
@@ -240,11 +240,12 @@ public class DecisionPolicy extends Policy {
ControlLoopGuardBuilder builder = ControlLoopGuardBuilder.Factory.buildControlLoopGuard(new Guard());
GuardPolicy policy1 = new GuardPolicy((policyAdapter.getUuid()!=null? policyAdapter.getUuid(): UUID.randomUUID().toString()) ,yamlParams.get("PolicyName"), yamlParams.get("description"), yamlParams.get("actor"), yamlParams.get("recipe"));
builder = builder.addGuardPolicy(policy1);
- Map<String, String> time_in_range = new HashMap<String, String>();
+ Map<String, String> time_in_range = new HashMap<>();
time_in_range.put("arg2", yamlParams.get("guardActiveStart"));
time_in_range.put("arg3", yamlParams.get("guardActiveEnd"));
- Constraint cons = new Constraint(Integer.parseInt(yamlParams.get("limit")), yamlParams.get("timeWindow"), time_in_range);
- builder = builder.addLimitConstraint(policy1.id, cons);
+ Constraint cons = new Constraint(Integer.parseInt(yamlParams.get("limit")), yamlParams.get("timeWindow"));
+ cons.setTime_in_range(time_in_range);
+ builder = builder.addLimitConstraint(policy1.getId(), cons);
// Build the specification
Results results = builder.buildSpecification();
// YAML TO XACML
@@ -257,12 +258,12 @@ public class DecisionPolicy extends Policy {
yamlSpecs.put("PolicyName", yamlParams.get("PolicyName"));
yamlSpecs.put("description", yamlParams.get("description"));
yamlSpecs.put("ECOMPName", yamlParams.get("ECOMPName"));
- yamlSpecs.put("actor", yamlGuardObject.guards.getFirst().actor);
- yamlSpecs.put("recipe", yamlGuardObject.guards.getFirst().recipe);
- yamlSpecs.put("limit", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().num.toString());
- yamlSpecs.put("timeWindow", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().duration);
- yamlSpecs.put("guardActiveStart", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().time_in_range.get("arg2"));
- yamlSpecs.put("guardActiveEnd", yamlGuardObject.guards.getFirst().limit_constraints.getFirst().time_in_range.get("arg3"));
+ yamlSpecs.put("actor", ((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getActor());
+ yamlSpecs.put("recipe", ((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getRecipe());
+ yamlSpecs.put("limit", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getNum().toString());
+ yamlSpecs.put("timeWindow", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getDuration());
+ yamlSpecs.put("guardActiveStart", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getTime_in_range().get("arg2"));
+ yamlSpecs.put("guardActiveEnd", ((LinkedList<Constraint>)((LinkedList<GuardPolicy>)yamlGuardObject.getGuards()).getFirst().getLimit_constraints()).getFirst().getTime_in_range().get("arg3"));
String xacmlPolicyContent = SafePolicyBuilder.generateXacmlGuard(xacmlTemplateContent,yamlSpecs);
// Convert the Policy into Stream input to Policy Adapter.
Object policy = XACMLPolicyScanner.readPolicy(new ByteArrayInputStream(xacmlPolicyContent.getBytes(StandardCharsets.UTF_8)));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
index 9e590732c..b4b1a410e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
@@ -138,7 +138,7 @@ public class FirewallConfigPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
index 736069d00..5fc4370e1 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
@@ -76,8 +76,8 @@ public class MicroServiceConfigPolicy extends Policy {
private static String papDbUrl = null;
private static String papDbUser = null;
private static String papDbPassword = null;
- private static Map<String, String> mapAttribute = new HashMap<String,String>();
- private static Map<String, String> matchMap = new HashMap<String,String>();
+ private static Map<String, String> mapAttribute = new HashMap<>();
+ private static Map<String, String> matchMap = new HashMap<>();
public MicroServiceConfigPolicy() {
super();
@@ -105,7 +105,7 @@ public class MicroServiceConfigPolicy extends Policy {
@Override
public Map<String, String> savePolicies() throws Exception {
- Map<String, String> successMap = new HashMap<String,String>();
+ Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
successMap.put("EXISTS", "This Policy already exist on the PAP");
return successMap;
@@ -188,7 +188,7 @@ public class MicroServiceConfigPolicy extends Policy {
matching = getValueFromDictionary(policyAdapter.getServiceType() + "-v" + jsonVersion);
}
- matchMap = new HashMap<String,String>();
+ matchMap = new HashMap<>();
if (matching != null && !matching.isEmpty()){
matchMap = Splitter.on(",").withKeyValueSeparator("=").split(matching);
if(policyAdapter.getJsonBody() != null){
@@ -372,9 +372,15 @@ public class MicroServiceConfigPolicy extends Policy {
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "MicroServiceModels", "Exception querying MicroServiceModels");
} finally {
try{
- if (con!=null) con.close();
- if (rs!=null) rs.close();
- if (st!=null) st.close();
+ if (con!=null){
+ con.close();
+ }
+ if (rs!=null){
+ rs.close();
+ }
+ if (st!=null){
+ st.close();
+ }
} catch (Exception ex){
LOGGER.error("Exception Occured While Closing the Database Connection"+ex);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
index 743883b01..48431fe93 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
@@ -118,7 +118,7 @@ public abstract class Policy {
public static String ACTION_HOME = null;
public static String CONFIG_URL = null;
- protected Map<String, String> performer = new HashMap<String, String>();
+ protected Map<String, String> performer = new HashMap<>();
private static String actionHome = null;
private static String configHome = null;
@@ -287,7 +287,7 @@ public abstract class Policy {
//create policy once all the validations are completed
protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
- Map<String, String> success = new HashMap<String, String>();
+ Map<String, String> success = new HashMap<>();
//
// Is the root a PolicySet or Policy?
//
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
index eaceb6575..51fcb3d09 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -213,7 +213,7 @@ public class PolicyDBDao {
*/
private List<?> getRemotePolicyDBDaoList(){
logger.debug("getRemotePolicyDBDaoList() as getRemotePolicyDBDaoList() called");
- List<?> policyDBDaoEntityList = new LinkedList<Object>();
+ List<?> policyDBDaoEntityList = new LinkedList<>();
EntityManager em = emf.createEntityManager();
startTransactionSynced(em, 1000);
try{
@@ -375,7 +375,6 @@ public class PolicyDBDao {
em.close();
} catch(Exception e2){
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "COULD NOT CREATE DATABASELOCK ROW. WILL TRY ONE MORE TIME");
- e2.printStackTrace();
}
em = null;
em = emf.createEntityManager();
@@ -446,7 +445,7 @@ public class PolicyDBDao {
}
public void notifyOthers(long entityId, String entityType, String newGroupId){
logger.debug("notifyOthers(long entityId, String entityType, long newGroupId) as notifyOthers("+entityId+","+entityType+","+newGroupId+") called");
- LinkedList<Thread> notifyThreads = new LinkedList<Thread>();
+ LinkedList<Thread> notifyThreads = new LinkedList<>();
//we're going to run notiftions in parellel threads to speed things up
for(Object obj : otherServers){
@@ -855,7 +854,7 @@ public class PolicyDBDao {
//this must always be true since we don't explicitly know when a delete is occuring
boolean didUpdate = true;
HashMap<String,PDPPolicy> currentPolicySet = new HashMap<String,PDPPolicy>(oldPdpGroup.getPolicies().size());
- HashSet<PDPPolicy> newPolicySet = new HashSet<PDPPolicy>();
+ HashSet<PDPPolicy> newPolicySet = new HashSet<>();
for(PDPPolicy pdpPolicy : oldPdpGroup.getPolicies()){
currentPolicySet.put(pdpPolicy.getId(), pdpPolicy);
}
@@ -1127,7 +1126,7 @@ public class PolicyDBDao {
Properties propertyFileProperties = new Properties();
String groupList = "";
String defaultGroup = "";
- HashSet<String> currentGroupPaths = new HashSet<String>();
+ HashSet<String> currentGroupPaths = new HashSet<>();
for(Object o : groups){
GroupEntity group = (GroupEntity)o;
Path groupPath = Paths.get(pdpsPath.toString(), group.getGroupId());
@@ -1663,7 +1662,7 @@ public class PolicyDBDao {
getPolicyEntitiesQuery.setParameter("deleted", false);
policyEntityList = getPolicyEntitiesQuery.getResultList();
} catch(Exception e){
- policyEntityList = new LinkedList<PolicyEntity>();
+ policyEntityList = new LinkedList<>();
}
for (PolicyEntity policy: policyEntityList){
@@ -1971,7 +1970,7 @@ public class PolicyDBDao {
}
String gitPath = getGitPath();
- ArrayList<String> gitPathParts = new ArrayList<String>();
+ ArrayList<String> gitPathParts = new ArrayList<>();
Iterator<?> gitPathIterator = Paths.get(gitPath).iterator();
while(gitPathIterator.hasNext()){
gitPathParts.add(gitPathIterator.next().toString());
@@ -2528,7 +2527,7 @@ public class PolicyDBDao {
getGroups.setParameter("pid", existingPolicy.getPolicyId());
groups = getGroups.getResultList();
}catch(Exception e){
- groups = new LinkedList<GroupEntity>();
+ groups = new LinkedList<>();
}
for(Object o : groups){
GroupEntity group = (GroupEntity)o;
@@ -3104,7 +3103,7 @@ public class PolicyDBDao {
PolicyLogger.error("We cannot get the group from the papEngine to delete policies");
} else {
- Set<String> newPolicySet = new HashSet<String>(group.getPolicies().size());
+ Set<String> newPolicySet = new HashSet<>(group.getPolicies().size());
//a multiple of n runtime is faster than n^2, so I am using a hashset to do the comparison
for(PDPPolicy pol: group.getPolicies()){
newPolicySet.add(pol.getId());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
index 1f9250383..65f0ede26 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
@@ -69,7 +69,7 @@ public class ActionPolicyDictionaryController {
@RequestMapping(value={"/get_ActionPolicyDictDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionEntitybyName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ActionPolicyDict.class, "attributeName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -84,7 +84,7 @@ public class ActionPolicyDictionaryController {
@RequestMapping(value={"/get_ActionPolicyDictData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionPolicyDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionPolicyDict.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
index 31f2e73db..eb03aa996 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
@@ -79,7 +79,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSParamDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSParamTemplate.class, "ruleName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -94,7 +94,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSParamDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSParamTemplate.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -233,7 +233,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSDependencyDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSDependency.class, "dependencyName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -248,7 +248,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSDependencyData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSDependencyDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -391,7 +391,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSControllerDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSController.class, "controllerName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -406,7 +406,7 @@ public class BRMSDictionaryController{
@RequestMapping(value={"/get_BRMSControllerData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getBRMSControllerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSController.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index 26d9a6535..9aab267d6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -76,7 +76,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -92,7 +92,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVSCLActionDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -111,7 +111,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, "vnftype")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -128,7 +128,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVNFTypeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -147,7 +147,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -162,7 +162,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPEPOptionsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -181,7 +181,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, "varbindName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -196,7 +196,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getVarbindDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -215,7 +215,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, "serviceName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -230,7 +230,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopServicesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopServiceDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -249,7 +249,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopSiteDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopSite.class, "siteName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -264,7 +264,7 @@ public class ClosedLoopDictionaryController{
@RequestMapping(value={"/get_ClosedLoopSiteData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getClosedLoopSiteDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index 60ed95a07..db3ebda44 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -69,7 +69,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_SettingsDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSettingsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DecisionSettings.class, "xacmlId")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -85,7 +85,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_SettingsDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSettingsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DecisionSettings.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
index aa05f5209..a64cdf77e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
@@ -70,7 +70,7 @@ public class DescriptiveDictionaryController {
@RequestMapping(value={"/get_DescriptiveScopeByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDescriptiveDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -85,7 +85,7 @@ public class DescriptiveDictionaryController {
@RequestMapping(value={"/get_DescriptiveScope"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDescriptiveDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
index c08bba6ca..49d841a6e 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
@@ -87,7 +87,7 @@ public class DictionaryController {
public void getAttributeDictionaryEntityDatabyAttributeName(HttpServletRequest request, HttpServletResponse response){
try{
System.out.println();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Attribute.class, "xacmlId")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -104,7 +104,7 @@ public class DictionaryController {
public void getAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
System.out.println();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Attribute.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -278,7 +278,7 @@ public class DictionaryController {
public void getEcompNameDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
LOGGER.info("get_EcompNameDataByName is called");
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(EcompName.class, "ecompName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -293,7 +293,7 @@ public class DictionaryController {
@RequestMapping(value={"/get_EcompNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(EcompName.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
index b04020270..bfccb984a 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
@@ -56,10 +56,10 @@ public class EnforcerDictionaryController {
@RequestMapping(value={"/get_EnforcerTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getEnforcerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
List<Object> list = commonClassDao.getData(EnforcingType.class);
- List<String> dictList = new ArrayList<String>();
+ List<String> dictList = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
EnforcingType dict = (EnforcingType) list.get(i);
dictList.add(dict.getEnforcingType());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
index a553d61db..6c9d713ef 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
@@ -87,7 +87,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PrefixListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPrefixListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PrefixList.class, "prefixListName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -102,7 +102,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PrefixListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPrefixListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PrefixList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -263,7 +263,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_PortListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPortListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("portListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PortList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -500,7 +500,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_AddressGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getAddressGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(AddressGroup.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -515,7 +515,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_AddressGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getAddressGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -671,10 +671,10 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ActionListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
List<Object> list = commonClassDao.getData(ActionList.class);
- List<String> dictList = new ArrayList<String>();
+ List<String> dictList = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
ActionList dict = (ActionList) list.get(i);
dictList.add(dict.getActionName());
@@ -692,7 +692,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ActionListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getActionListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("actionListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -821,7 +821,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -840,7 +840,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupServiceList.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -994,7 +994,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_SecurityZoneDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSecurityZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(SecurityZone.class, "zoneName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1009,7 +1009,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_SecurityZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSecurityZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1142,7 +1142,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ServiceList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1161,7 +1161,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ServiceListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getServiceListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ServiceList.class, "serviceName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1323,7 +1323,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Zone.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1340,7 +1340,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_ZoneDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Zone.class, "zoneName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1735,7 +1735,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_FWDictionaryListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getFWDictListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FirewallDictionaryList.class, "parentItemName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -1750,7 +1750,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_FWDictionaryListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getFWDictionaryListEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -2039,7 +2039,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_TagNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getTagNameEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTag.class, "fwTagName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -2054,7 +2054,7 @@ public class FirewallDictionaryController {
@RequestMapping(value={"/get_TagListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getTagDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FWTag.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
index 876f380d4..dce0dd613 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
@@ -82,7 +82,7 @@ public class MicroServiceDictionaryController {
private static String ERROR = "error";
private static String DICTIONARYDBQUERY = "dictionaryDBQuery";
private HashMap<String,MSAttributeObject > classMap;
- private List<String> modelList = new ArrayList<String>();
+ private List<String> modelList = new ArrayList<>();
@@ -93,7 +93,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_DCAEUUIDDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DCAEuuid.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -108,7 +108,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_DCAEUUIDData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -239,7 +239,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceConfigNameDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceConfigName.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -256,7 +256,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceConfigNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -387,7 +387,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceLocationDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -402,7 +402,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceLocationData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -533,7 +533,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceAttributeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceAttribute.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -548,7 +548,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceAttributeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceAttribute.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -679,7 +679,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceModels.class, "modelName")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -694,7 +694,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByVersionEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(request.getReader());
String modelName = null;
@@ -718,7 +718,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -737,9 +737,9 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataServiceVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityDataServiceVersion(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
- List<String> data = new ArrayList<String>();
+ List<String> data = new ArrayList<>();
List<Object> datas = commonClassDao.getData(MicroServiceModels.class);
for(int i = 0; i < datas.size(); i++){
MicroServiceModels msmodel = (MicroServiceModels) datas.get(i);
@@ -765,7 +765,7 @@ public class MicroServiceDictionaryController {
@RequestMapping(value={"/get_MicroServiceModelsDataByClass"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryClassEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("microServiceModelsDictionaryClassDatas", mapper.writeValueAsString(modelList));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -816,7 +816,7 @@ public class MicroServiceDictionaryController {
}
MSAttributeObject mainClass = null;
- classMap = new HashMap<String, MSAttributeObject>();
+ classMap = new HashMap<>();
JsonNode data = root.get("classMap");
ObjectMapper mapper1 = new ObjectMapper();
String data1 = data.toString().substring(1, data.toString().length()-1);
@@ -880,7 +880,7 @@ public class MicroServiceDictionaryController {
}
}
if(root.has("classMap")){
- classMap = new HashMap<String, MSAttributeObject>();
+ classMap = new HashMap<>();
JsonNode data = root.get("classMap");
ObjectMapper mapper1 = new ObjectMapper();
String data1 = data.toString().substring(1, data.toString().length()-1);
@@ -1024,8 +1024,8 @@ public class MicroServiceDictionaryController {
}
private ArrayList<String> getFullDependencyList(ArrayList<String> dependency) {
- ArrayList<String> returnList = new ArrayList<String>();
- ArrayList<String> workingList = new ArrayList<String>();
+ ArrayList<String> returnList = new ArrayList<>();
+ ArrayList<String> workingList = new ArrayList<>();
returnList.addAll(dependency);
for (String element : dependency ){
if (classMap.containsKey(element)){
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
index bfab03fa5..08635c157 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
@@ -75,7 +75,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_GroupPolicyScopeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getGroupPolicyScopeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupPolicyScopeList.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -90,7 +90,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_GroupPolicyScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getGroupPolicyScopeEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -176,7 +176,7 @@ public class PolicyScopeDictionaryController {
}
}
- ArrayList<String> valueList = new ArrayList<String>();
+ ArrayList<String> valueList = new ArrayList<>();
String list = null;
String resourceValue = groupData.getResource();
String typeValue = groupData.getType();
@@ -288,7 +288,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSClosedLoopDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSClosedLoopEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeClosedLoop.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -303,7 +303,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSClosedLoopData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSClosedLoopEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -440,7 +440,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSServiceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSServiceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeService.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -455,7 +455,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSServiceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSServiceEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -589,7 +589,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSTypeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeType.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -604,7 +604,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSTypeEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -744,7 +744,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSResourceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSResourceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeResource.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -759,7 +759,7 @@ public class PolicyScopeDictionaryController {
@RequestMapping(value={"/get_PSResourceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPSResourceEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeResource.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
index 6f8f3db8b..42dfb88fe 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
@@ -71,7 +71,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getRiskTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(RiskType.class, "name")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -86,7 +86,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(RiskType.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -229,7 +229,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getSafePolicyWarningEntityDataByName(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("safePolicyWarningDatas",
mapper.writeValueAsString(commonClassDao.getDataByColumn(SafePolicyWarning.class, "name")));
@@ -245,7 +245,7 @@ public class SafePolicyController {
org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public void getSafePolicyWarningeEntityData(HttpServletRequest request, HttpServletResponse response) {
try {
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("safePolicyWarningDatas",
mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class)));
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
index 256d75f4d..63c71e98f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -382,7 +382,7 @@ public class CommonClassDaoImpl implements CommonClassDao{
if(closedloopsdata!=null && !closedloopsdata.isEmpty()) {
LOGGER.info("ClosedLoops exist in the database, we need to delete them in our first step to buildCache().");
- for(int i=0; i > closedloopsdata.size(); i++) {
+ for(int i=0; i < closedloopsdata.size(); i++) {
ClosedLoops cl = closedloopsdata.get(i);
session.delete(cl);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
new file mode 100644
index 000000000..facc6e06f
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElasticSearchPolicyUpdate.java
@@ -0,0 +1,311 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+import com.google.gson.Gson;
+
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.client.http.JestHttpClient;
+import io.searchbox.core.Bulk;
+import io.searchbox.core.Bulk.Builder;
+import io.searchbox.core.BulkResult;
+import io.searchbox.core.Index;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
+
+
+
+/**
+ * This code will deals with parsing the XACML content on reading from
+ * database(PolicyEntity, ConfigurationDataEntity and ActionBodyEntity tables)
+ * and convert the data into json to do bulk operation on putting to elastic search database.
+ * Which is used to support Elastic Search in Policy Application GUI to search policies.
+ *
+ *
+ *
+ * properties should be configured in policyelk.properties
+ *
+ */
+public class ElasticSearchPolicyUpdate {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(ElasticSearchPolicyUpdate.class);
+ protected final static JestClientFactory jestFactory = new JestClientFactory();
+
+ public static void main(String[] args) {
+
+ String elkURL = null;
+ String databseUrl = null;
+ String userName = null;
+ String password = null;
+ String databaseDriver = null;
+
+ String propertyFile = System.getProperty("PROPERTY_FILE");
+ Properties config = new Properties();
+ Path file = Paths.get(propertyFile);
+ if(Files.notExists(file)){
+ LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString());
+ }else{
+ if(file.toString().endsWith(".properties")){
+ try {
+ InputStream in = new FileInputStream(file.toFile());
+ config.load(in);
+ elkURL = config.getProperty("policy.elk.url");
+ databseUrl = config.getProperty("policy.database.url");
+ userName = config.getProperty("policy.database.username");
+ password = config.getProperty("policy.database.password");
+ databaseDriver = config.getProperty("policy.database.driver");
+ if(elkURL == null || databseUrl == null || userName == null || password == null || databaseDriver == null){
+ LOGGER.error("One of the Property is null in policyelk.properties = elkurl:databaseurl:username:password:databasedriver "
+ + elkURL + ":"+ databseUrl + ":"+ userName + ":"+ password + ":"+ databaseDriver + ":");
+ }
+ } catch (Exception e) {
+ LOGGER.error("Config File doesn't Exist in the specified Path " + file.toString());
+ }
+ }
+ }
+
+ Builder bulk = null;
+
+ HttpClientConfig httpClientConfig = new HttpClientConfig.Builder(elkURL).multiThreaded(true).build();
+ jestFactory.setHttpClientConfig(httpClientConfig);
+ JestHttpClient client = (JestHttpClient) jestFactory.getObject();
+
+ Connection conn = null;
+ Statement stmt = null;
+
+ List<Index> listIndex = new ArrayList<Index>();
+
+ try {
+ Class.forName(databaseDriver);
+ conn = DriverManager.getConnection(databseUrl, userName, password);
+ stmt = conn.createStatement();
+
+ String policyEntityQuery = "Select * from PolicyEntity";
+ ResultSet result = stmt.executeQuery(policyEntityQuery);
+
+ while(result.next()){
+ StringBuilder policyDataString = new StringBuilder("{");
+ String scope = result.getString("scope");
+ String policyName = result.getString("policyName");
+ if(policyName != null){
+ policyDataString.append("\"policyName\":\""+scope+"."+policyName+"\",");
+ }
+ String description = result.getString("description");
+ if(description != null){
+ policyDataString.append("\"policyDescription\":\""+description+"\",");
+ }
+ Object policyData = result.getString("policydata");
+
+ if(scope != null){
+ policyDataString.append("\"scope\":\""+scope+"\",");
+ }
+ String actionbodyid = result.getString("actionbodyid");
+ String configurationdataid = result.getString("configurationdataid");
+
+
+ String policyWithScopeName = scope + "." + policyName;
+ String _type = null;
+
+ if(policyWithScopeName.contains(".Config_")){
+ policyDataString.append("\"policyType\":\"Config\",");
+ if(policyWithScopeName.contains(".Config_Fault_")){
+ _type = "closedloop";
+ policyDataString.append("\"configPolicyType\":\"ClosedLoop_Fault\",");
+ }else if(policyWithScopeName.contains(".Config_PM_")){
+ _type = "closedloop";
+ policyDataString.append("\"configPolicyType\":\"ClosedLoop_PM\",");
+ }else{
+ _type = "config";
+ policyDataString.append("\"configPolicyType\":\"Base\",");
+ }
+ }else if(policyWithScopeName.contains(".Action_")){
+ _type = "action";
+ policyDataString.append("\"policyType\":\"Action\",");
+ }else if(policyWithScopeName.contains(".Decision_")){
+ _type = "decision";
+ policyDataString.append("\"policyType\":\"Decision\",");
+ }
+
+ if(!"decision".equals(_type)){
+ if(configurationdataid != null){
+ String configEntityQuery = "Select * from ConfigurationDataEntity where configurationDataId = "+configurationdataid+"";
+ Statement configstmt = conn.createStatement();
+ ResultSet configResult = configstmt.executeQuery(configEntityQuery);
+ while(configResult.next()){
+ String configBody = configResult.getString("configbody");
+ String configType = configResult.getString("configtype");
+ if("JSON".equalsIgnoreCase(configType)){
+ policyDataString.append("\"jsonBodyData\":"+configBody+",\"configType\":\""+configType+"\",");
+ }else if("OTHER".equalsIgnoreCase(configType)){
+ if(configBody!=null){
+ configBody= configBody.replaceAll("\"", "");
+ policyDataString.append("\"jsonBodyData\":\""+configBody+"\",\"configType\":\""+configType+"\",");
+ }
+ }
+ }
+ configResult.close();
+ }
+
+ if(actionbodyid != null){
+ String actionEntityQuery = "Select * from ActionBodyEntity where actionBodyId = "+actionbodyid+"";
+ Statement actionstmt = conn.createStatement();
+ ResultSet actionResult = actionstmt.executeQuery(actionEntityQuery);
+ while(actionResult.next()){
+ String actionBody = actionResult.getString("actionbody");
+ policyDataString.append("\"jsonBodyData\":"+actionBody+",");
+ }
+ actionResult.close();
+ }
+ }
+
+ String _id = policyWithScopeName;
+
+ policyDataString.append(constructPolicyData(policyData, policyDataString));
+
+ String dataString = policyDataString.toString();
+ dataString = dataString.substring(0, dataString.length()-1);
+ dataString = dataString.trim().replace(System.getProperty("line.separator"), "") + "}";
+ dataString = dataString.replace("null", "\"\"");
+ dataString = dataString.replaceAll(" ", "").replaceAll("\n", "");
+
+ try{
+ Gson gson = new Gson();
+ gson.fromJson(dataString, Object.class);
+ }catch(Exception e){
+ continue;
+ }
+
+ if("config".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("config").id(_id).build());
+ }else if("closedloop".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("closedloop").id(_id).build());
+ }else if("action".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("action").id(_id).build());
+ }else if("decision".equals(_type)){
+ listIndex.add(new Index.Builder(dataString).index("policy").type("decision").id(_id).build());
+ }
+ }
+
+ result.close();
+ bulk = new Bulk.Builder();
+ for(int i =0; i < listIndex.size(); i++){
+ bulk.addAction(listIndex.get(i));
+ }
+ BulkResult searchResult = client.execute(bulk.build());
+ if(searchResult.isSucceeded()){
+ LOGGER.debug("Success");
+ }else{
+ LOGGER.error("Failure");
+ }
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured while performing database Operation for Elastic Search Policy Upgrade"+e);
+ }finally{
+ if(conn != null){
+ try {
+ conn.close();
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured while closing the connection"+e);
+ }
+ }
+ }
+ }
+
+ private static String constructPolicyData(Object policyData, StringBuilder policyDataString){
+ if(policyData instanceof PolicyType){
+ PolicyType policy = (PolicyType) policyData;
+ TargetType target = policy.getTarget();
+ if (target != null) {
+ // Under target we have AnyOFType
+ List<AnyOfType> anyOfList = target.getAnyOf();
+ if (anyOfList != null) {
+ Iterator<AnyOfType> iterAnyOf = anyOfList.iterator();
+ while (iterAnyOf.hasNext()) {
+ AnyOfType anyOf = iterAnyOf.next();
+ // Under AnyOFType we have AllOFType
+ List<AllOfType> allOfList = anyOf.getAllOf();
+ if (allOfList != null) {
+ Iterator<AllOfType> iterAllOf = allOfList.iterator();
+ while (iterAllOf.hasNext()) {
+ AllOfType allOf = iterAllOf.next();
+ // Under AllOFType we have Match
+ List<MatchType> matchList = allOf.getMatch();
+ if (matchList != null) {
+ Iterator<MatchType> iterMatch = matchList.iterator();
+ while (iterMatch.hasNext()) {
+ MatchType match = iterMatch.next();
+ //
+ // Under the match we have attribute value and
+ // attributeDesignator. So,finally down to the actual attribute.
+ //
+ AttributeValueType attributeValue = match.getAttributeValue();
+ String value = (String) attributeValue.getContent().get(0);
+ AttributeDesignatorType designator = match.getAttributeDesignator();
+ String attributeId = designator.getAttributeId();
+ // First match in the target is EcompName, so set that value.
+ if ("ECOMPName".equals(attributeId)) {
+ policyDataString.append("\"ecompName\":\""+value+"\",");
+ }
+ if ("RiskType".equals(attributeId)){
+ policyDataString.append("\"riskType\":\""+value+"\",");
+ }
+ if ("RiskLevel".equals(attributeId)){
+ policyDataString.append("\"riskLevel\":\""+value+"\",");
+ }
+ if ("guard".equals(attributeId)){
+ policyDataString.append("\"guard\":\""+value+"\",");
+ }
+ if ("ConfigName".equals(attributeId)){
+ policyDataString.append("\"configName\":\""+value+"\",");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return policyDataString.toString();
+ }
+
+} \ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
index 5508ddc69..75bd725f0 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
@@ -378,7 +378,7 @@ public class ElkConnectorImpl implements ElkConnector{
result = jestClient.execute(deleteRequest);
} catch (IllegalArgumentException | IOException e) {
LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ": delete:" +
- ((indexType != null) ? indexType.name() : "null") + ":" + policyData.getNewFileName() + ": " +
+ indexType + ": null" + ":" + policyData.getNewFileName() + ": " +
e.getMessage(), e);
throw new IllegalStateException(e);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
index 3a87a16ca..a18a2295a 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
@@ -198,8 +198,8 @@ public class PolicyElasticSearchController{
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
PolicyRestAdapter policyData = new PolicyRestAdapter();
PolicyElasticSearchController controller = new PolicyElasticSearchController();
- Map<String, String> searchKeyValue = new HashMap<String, String>();
- List<String> policyList = new ArrayList<String>();
+ Map<String, String> searchKeyValue = new HashMap<>();
+ List<String> policyList = new ArrayList<>();
if(request.getParameter("policyName") != null){
String policyName = request.getParameter("policyName");
policyData.setNewFileName(policyName);
@@ -340,7 +340,7 @@ public class PolicyElasticSearchController{
String dictionaryType = root.get("type").textValue();
Mode mode = Mode.valueOf(dictionaryType);
String value;
- List<String> policyList = new ArrayList<String>();
+ List<String> policyList = new ArrayList<>();
switch (mode){
case attribute :
Attribute attributedata = (Attribute)mapper.readValue(root.get("data").toString(), Attribute.class);
@@ -451,12 +451,12 @@ public class PolicyElasticSearchController{
//Search the Elk database
public List<String> searchElkDatabase(PolicyIndexType type, String key, String value){
PolicyElasticSearchController controller = new PolicyElasticSearchController();
- Map<String, String> searchKeyValue = new HashMap<String, String>();
+ Map<String, String> searchKeyValue = new HashMap<>();
if(!"pholder".equals(key)){
searchKeyValue.put(key, value);
}
- List<String> policyList = new ArrayList<String>();
+ List<String> policyList = new ArrayList<>();
JestResult policyResultList = controller.search(type, value, searchKeyValue);
if(policyResultList.isSucceeded()){
JsonArray resultObject = policyResultList.getJsonObject().get("hits").getAsJsonObject().get("hits").getAsJsonArray();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
index 15e1faa04..ff454ade9 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -123,7 +123,14 @@ public class DeleteHandler {
}else if(policyName.contains("Decision_")){
splitPolicyName = removeVersionExtension.replace(".Decision_", ":Decision_");
}
- split = splitPolicyName.split(":");
+ if(splitPolicyName != null){
+ split = splitPolicyName.split(":");
+ }else{
+ PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + "Failed to delete the policy. Please, provide the valid policyname.");
+ response.addHeader("error", "unknown");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+ return;
+ }
policyEntityQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName LIKE :pName and p.scope=:pScope");
}else if(policy.getDeleteCondition().equalsIgnoreCase("Current Version")) {
if(policyName.contains("Config_")){
@@ -249,7 +256,9 @@ public class DeleteHandler {
return;
} finally {
em.close();
- con.close();
+ if(con != null){
+ con.close();
+ }
}
if (policyVersionDeleted) {
@@ -290,12 +299,16 @@ public class DeleteHandler {
PolicyEntity policyEntity = (PolicyEntity) peData;
Statement st = null;
ResultSet rs = null;
- st = con.createStatement();
- rs = st.executeQuery("Select * from PolicyGroupEntity where policyid = '"+policyEntity.getPolicyId()+"'");
- boolean gEntityList = rs.next();
- rs.close();
- if(gEntityList){
- return true;
+ try{
+ st = con.createStatement();
+ rs = st.executeQuery("Select * from PolicyGroupEntity where policyid = '"+policyEntity.getPolicyId()+"'");
+ boolean gEntityList = rs.next();
+ rs.close();
+ if(gEntityList){
+ return true;
+ }
+ }finally{
+ st.close();
}
}
return false;
@@ -392,8 +405,8 @@ public class DeleteHandler {
} catch (PAPException e1) {
PolicyLogger.error("Exception occured While Deleting Policy From PDP Group"+e1);
}
- if (group == null || ! (group instanceof StdPDPGroup) || ! (group.getId().equals(existingGroup.getId()))) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup.getId() + " objectFromJSON="+group);
+ if (group == null || ! (group instanceof StdPDPGroup) || existingGroup == null || ! (group.getId().equals(existingGroup.getId()))) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup != null ? existingGroup.getId() : "null" + " objectFromJSON="+group);
loggingContext.transactionEnded();
PolicyLogger.audit("Transaction Failed - See Error.log");
response = "No Group";
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
index ae75ad24c..4624f74aa 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -139,7 +139,7 @@ public class SavePolicyHandler {
public void addErrorHeader(String key, String value){
if(ErrorHeaders==null){
- ErrorHeaders= new HashMap<String, String>();
+ ErrorHeaders= new HashMap<>();
}
ErrorHeaders.put(key, value);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
index 0482310ff..13a1801bd 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
@@ -177,7 +177,7 @@ public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements P
@Override
public Collection<?> getItemIds() {
- final Collection<Object> items = new ArrayList<Object>();
+ final Collection<Object> items = new ArrayList<>();
items.addAll(this.policies);
return Collections.unmodifiableCollection(items);
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
index 24e2f04d4..83d0991f5 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
@@ -77,7 +77,7 @@ public class RemoveGroupPolicy {
null);
// replace the original set of Policies with the set from the container (possibly modified by the user)
- Set<PDPPolicy> changedPolicies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> changedPolicies = new HashSet<>();
changedPolicies.addAll((Collection<PDPPolicy>) RemoveGroupPolicy.policyContainer.getItemIds());
updatedGroupObject.setPolicies(changedPolicies);
updatedGroupObject.setEcompPdps(this.group.getEcompPdps());
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
index 46d02d94e..c21164920 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
@@ -93,8 +93,8 @@ public class PolicyCreation extends AbstractPolicyCreation{
public ResponseEntity<String> savePolicy(@RequestBody PolicyRestAdapter policyData, HttpServletResponse response) throws Exception{
String body = null;
HttpStatus status = HttpStatus.BAD_REQUEST;
- Map<String, String> successMap = new HashMap<String, String>();
- Map<String, String> attributeMap = new HashMap<String, String>();
+ Map<String, String> successMap = new HashMap<>();
+ Map<String, String> attributeMap = new HashMap<>();
PolicyVersion policyVersionDao;
try {
@@ -161,7 +161,7 @@ public class PolicyCreation extends AbstractPolicyCreation{
highestVersion = policyVersion.getHigherVersion();
}
- if(highestVersion != 0){
+ if(highestVersion != 0 && policyVersion != null){
if(policyData.isEditPolicy){
version = highestVersion +1;
if(userId ==null){
@@ -239,7 +239,7 @@ public class PolicyCreation extends AbstractPolicyCreation{
}else if (policyConfigType.equalsIgnoreCase("BRMS_Param")) {
policyData.setEcompName("DROOLS");
policyData.setConfigName("BRMS_PARAM_RULE");
- Map<String, String> drlRuleAndUIParams = new HashMap<String, String>();
+ Map<String, String> drlRuleAndUIParams = new HashMap<>();
if(policyData.getApiflag() == null){
// If there is any dynamic field create the matches here
String key="templateName";
@@ -288,10 +288,10 @@ public class PolicyCreation extends AbstractPolicyCreation{
}
}else if(policyType.equalsIgnoreCase("Action")) {
if(policyData.getApiflag() == null){
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmCombo = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
if(policyData.getRuleAlgorithmschoices().size() > 0){
@@ -332,13 +332,13 @@ public class PolicyCreation extends AbstractPolicyCreation{
newPolicy = new ActionPolicy(policyData);
} else if (policyType.equalsIgnoreCase("Decision")) {
if(policyData.getApiflag() == null){
- Map<String, String> settingsMap = new HashMap<String, String>();
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
- List<Object> dynamicVariableList = new LinkedList<Object>();
- List<String> dataTypeList = new LinkedList<String>();
+ Map<String, String> settingsMap = new HashMap<>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmCombo = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
+ List<Object> dynamicVariableList = new LinkedList<>();
+ List<String> dataTypeList = new LinkedList<>();
if(policyData.getSettings().size() > 0){
for(Object settingsData : policyData.getSettings()){
@@ -383,7 +383,15 @@ public class PolicyCreation extends AbstractPolicyCreation{
newPolicy = new DecisionPolicy(policyData);
}
- newPolicy.prepareToSave();
+ if(newPolicy != null){
+ newPolicy.prepareToSave();
+ }else{
+ body = "error";
+ status = HttpStatus.INTERNAL_SERVER_ERROR;
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.addHeader("error", "error");
+ return new ResponseEntity<String>(body, status);
+ }
PolicyDBDaoTransaction policyDBDaoTransaction = null;
try{
@@ -461,9 +469,10 @@ public class PolicyCreation extends AbstractPolicyCreation{
response.addHeader("error", "error");
}
}catch(Exception e){
- policyDBDaoTransaction.rollbackTransaction();
+ if(policyDBDaoTransaction != null){
+ policyDBDaoTransaction.rollbackTransaction();
+ }
}
-
}
catch (Exception e){
LOGGER.error("Exception Occured"+e);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
index 39a0485e8..3ff279d8d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
@@ -45,7 +45,7 @@ public class ImportService {
String version = request.getParameter("version");
String serviceName = request.getParameter("serviceName");
String description = request.getParameter("description");
- Map<String, String> successMap = new HashMap<String, String>();
+ Map<String, String> successMap = new HashMap<>();
switch(importServiceCreation){
case "BRMSPARAM":
StringBuilder builder = new StringBuilder();
@@ -94,19 +94,30 @@ public class ImportService {
return;
}
}else{
+ InputStream inputStream = null;
+ FileOutputStream outputStream = null;
try {
- InputStream inputStream = request.getInputStream();
- FileOutputStream outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip");
+ inputStream = request.getInputStream();
+ outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip");
byte[] buffer = new byte[4096];
int bytesRead = -1 ;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead) ;
}
- outputStream.close() ;
- inputStream.close() ;
} catch (IOException e) {
PolicyLogger.error("Error in reading in Zip File from API call");
return;
+ }finally{
+ try {
+ if(inputStream != null){
+ inputStream.close();
+ }
+ if(outputStream != null){
+ outputStream.close();
+ }
+ } catch (IOException e) {
+ PolicyLogger.error("Exception Occured while closing the input/output stream"+e);
+ }
}
}
newMS = new CreateNewMicroSerivceModel(fileName, serviceName, "API", version, randomID);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
index 21a630125..97e53e8eb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
@@ -38,7 +38,7 @@ import com.att.research.xacml.api.pap.PDPPolicy;
public class MetricService {
public static void doGetPolicyMetrics(HttpServletRequest request, HttpServletResponse response) {
- Set<EcompPDPGroup> groups = new HashSet<EcompPDPGroup>();
+ Set<EcompPDPGroup> groups = new HashSet<>();
try {
//get the count of policies on the PDP
if(XACMLPapServlet.getPAPEngine()!=null){
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
index 397c30594..9a23beed3 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
@@ -159,8 +159,8 @@ public class JPAUtils {
}
private void buildFunctionMaps() throws ServletException {
- mapDatatype2Function = new HashMap<Datatype, List<FunctionDefinition>>();
- mapID2Function = new HashMap<String, FunctionDefinition>();
+ mapDatatype2Function = new HashMap<>();
+ mapID2Function = new HashMap<>();
EntityManager em = emf.createEntityManager();
Query getFunctionDefinitions = em.createNamedQuery("FunctionDefinition.findAll");
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
index 7b88569fe..c1a1907c0 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
@@ -109,7 +109,7 @@ public class CheckPDP {
throw new Exception("Cannot Load the Properties file", e);
}
// Read the Properties and Load the PDPs and encoding.
- pdpMap = new HashMap<String, String>();
+ pdpMap = new HashMap<>();
// Check the Keys for PDP_URLs
Collection<Object> unsorted = pdpProp.keySet();
List<String> sorted = new ArrayList(unsorted);
@@ -121,7 +121,7 @@ public class CheckPDP {
throw new Exception("Properties file doesn't have the PDP_URL parameter");
}
if (check_val.contains(";")) {
- List<String> pdp_default = new ArrayList<String>(Arrays.asList(check_val.split("\\s*;\\s*")));
+ List<String> pdp_default = new ArrayList<>(Arrays.asList(check_val.split("\\s*;\\s*")));
int pdpCount = 0;
while (pdpCount < pdp_default.size()) {
String pdpVal = pdp_default.get(pdpCount);
@@ -141,7 +141,7 @@ public class CheckPDP {
private static void readPDPParam(String pdpVal) throws Exception{
if(pdpVal.contains(",")){
- List<String> pdpValues = new ArrayList<String>(Arrays.asList(pdpVal.split("\\s*,\\s*")));
+ List<String> pdpValues = new ArrayList<>(Arrays.asList(pdpVal.split("\\s*,\\s*")));
if(pdpValues.size()==3){
// 1:2 will be UserID:Password
String userID = pdpValues.get(1);
diff --git a/ECOMP-PAP-REST/src/main/resources/logback.xml b/ECOMP-PAP-REST/src/main/resources/logback.xml
index b119a4e3b..d406431db 100644
--- a/ECOMP-PAP-REST/src/main/resources/logback.xml
+++ b/ECOMP-PAP-REST/src/main/resources/logback.xml
@@ -29,7 +29,7 @@
<!-- specify the component name
<ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
<property name="componentName" value="Policy"></property>
- <property name="subComponentName" value="XACML-PAP-REST"></property>
+ <property name="subComponentName" value="ECOMP-PAP-REST"></property>
<!-- log file names -->
<property name="errorLogName" value="error" />
@@ -206,7 +206,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
index 6ab3d3588..d3b5cbbea 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
@@ -181,8 +181,8 @@ public class DbAuditCompareEntriesTest {
dbAudit.writeAuditDebugLog(className, resourceName1, resourceName2, entry1, entry2);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -205,8 +205,8 @@ public class DbAuditCompareEntriesTest {
*/
entry2.setDesignated(true);
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -240,8 +240,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -264,8 +264,8 @@ public class DbAuditCompareEntriesTest {
entry2.setFlag("flag2");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -300,8 +300,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -324,8 +324,8 @@ public class DbAuditCompareEntriesTest {
entry2.setAdminState("unlocked");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -379,8 +379,8 @@ public class DbAuditCompareEntriesTest {
entry2.setFpcCount(321L);
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -414,8 +414,8 @@ public class DbAuditCompareEntriesTest {
// Clone the first entry
entry2 = SerializationUtils.clone(entry1);
- HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
- HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+ HashMap<Object, Object> myEntries = new HashMap<>();
+ HashMap<Object, Object> theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
@@ -436,8 +436,8 @@ public class DbAuditCompareEntriesTest {
entry2.setSite("site_1a");
- myEntries = new HashMap<Object, Object>();
- theirEntries = new HashMap<Object, Object>();
+ myEntries = new HashMap<>();
+ theirEntries = new HashMap<>();
myEntries.put("pdp1", entry1);
theirEntries.put("pdp1", entry2);
diff --git a/ECOMP-PAP-REST/xacml.pap.properties b/ECOMP-PAP-REST/xacml.pap.properties
index c25a81207..4f8c5a2ba 100644
--- a/ECOMP-PAP-REST/xacml.pap.properties
+++ b/ECOMP-PAP-REST/xacml.pap.properties
@@ -135,7 +135,7 @@ write_fpc_interval=5
site_name=site_1
#Node type. Can take values of: pdp-xacml, pdp-drools, pap, pap-admin, logparser, brms-gateway,
-#astra-gateway, elk-server and pypdp
+#astra-gateway, elk-server
node_type=pap
#Dependency groups are groups of resources upon which a node operational state is dependent upon (dependency_groups).
diff --git a/ECOMP-PAP-REST/xacml.pap.test.properties b/ECOMP-PAP-REST/xacml.pap.test.properties
index 5b77fb18c..fbeb5bd81 100644
--- a/ECOMP-PAP-REST/xacml.pap.test.properties
+++ b/ECOMP-PAP-REST/xacml.pap.test.properties
@@ -127,7 +127,7 @@ write_fpc_interval=5
site_name=site_1
#Node type. Can take values of: pdp-xacml, pdp-drools, pap, pap-admin, logparser, brms-gateway,
-#astra-gateway, elk-server and pypdp
+#astra-gateway, elk-server
node_type=pap
#Dependency groups are groups of resources upon which a node operational state is dependent upon (dependency_groups).
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/CreateUpdateConfigPolicyService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/CreateUpdateConfigPolicyService.java
index e26fae18a..850115f22 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/CreateUpdateConfigPolicyService.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/CreateUpdateConfigPolicyService.java
@@ -72,7 +72,7 @@ public class CreateUpdateConfigPolicyService {
policyParameters.setPolicyDescription(configPolicyAPIRequest.getPolicyDescription());
policyParameters.setEcompName(configPolicyAPIRequest.getEcompName());
policyParameters.setConfigName(configPolicyAPIRequest.getConfigName());
- Map<AttributeType, Map<String, String>> attributes = new HashMap<AttributeType, Map<String, String>>();
+ Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configPolicyAPIRequest.getConfigAttributes());
policyParameters.setAttributes(attributes);
policyParameters.setConfigBodyType(PolicyType.valueOf(configPolicyAPIRequest.getConfigType()));
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDecisionService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDecisionService.java
index 33f2d07d7..f70c3fb97 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDecisionService.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetDecisionService.java
@@ -161,7 +161,7 @@ public class GetDecisionService {
message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No eCOMPComponentName given : " + eCOMPComponentName;
return false;
}
- if (decisionAttributes == null && decisionAttributes.isEmpty()) {
+ if (decisionAttributes == null || decisionAttributes.isEmpty()) {
message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Decision Attributes Given. ";
return false;
}
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetMetricsService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetMetricsService.java
index 14812edfb..d390df864 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetMetricsService.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/GetMetricsService.java
@@ -81,11 +81,6 @@ public class GetMetricsService {
}
private void run() throws PolicyException {
- // Check Validation.
- /*
- * if(!getValidation()){ LOGGER.error(message); throw new
- * PolicyException(message); }
- */
// Get Result.
try {
status = HttpStatus.OK;
@@ -124,7 +119,7 @@ public class GetMetricsService {
} catch (JsonException | IllegalStateException e) {
message = XACMLErrorConstants.ERROR_DATA_ISSUE
- + " improper JSON object : " + json.toString();
+ + " improper JSON object : " + json != null ? json.toString() : "JSON is null";
LOGGER.error(message);
metricsResponse.setResponseMessage(message);
metricsResponse.setResponseCode(400);
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java
index 5aa3360ca..fe8c79409 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PAPServices.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
-import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
@@ -193,22 +192,26 @@ public class PAPServices {
// Read the Response
LOGGER.debug("connected to the PAP : " + getPAP());
LOGGER.debug("--- Response: ---");
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String key : headers.keySet()) {
- LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
- }
-
- try {
- response = checkResponse(connection, requestID);
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
- response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + e;
- throw new PolicyException(
- XACMLErrorConstants.ERROR_SYSTEM_ERROR
- + "Decoding the result ", e);
- }
- if (junit) {
- response = SUCCESS;
+ if(connection != null){
+ Map<String, List<String>> headers = connection.getHeaderFields();
+ for (String key : headers.keySet()) {
+ LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
+ }
+
+ try {
+ response = checkResponse(connection, requestID);
+ } catch (IOException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+ response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + e;
+ throw new PolicyException(
+ XACMLErrorConstants.ERROR_SYSTEM_ERROR
+ + "Decoding the result ", e);
+ }
+ if (junit) {
+ response = SUCCESS;
+ }
+ }else{
+ response = XACMLErrorConstants.ERROR_SYSTEM_ERROR + "connection is null";
}
return response;
} else {
@@ -266,11 +269,8 @@ public class PAPServices {
connection.setInstanceFollowRedirects(false);
connection.setDoOutput(true);
connection.setDoInput(true);
- // mb1915 - begin
- // mb1915 - set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
- // mb1915 - end
-
+
//DO the connect
connection.connect();
@@ -335,266 +335,6 @@ public class PAPServices {
return version;
}
- public StdPDPPolicy getGitPath(String policyScope, String filePrefix, String policyName, String activeVersion, String clientScope, UUID requestID, String id) throws PolicyException{
- String gitPath = null;
- Boolean isValid = false;
- String policyId= null;
- String description = null;
- String pushVersion = null;
- HttpURLConnection connection = null;
- String [] parameters = {"apiflag=gitPath", "policyScope="+policyScope, "filePrefix="+filePrefix,
- "policyName="+policyName, "activeVersion="+activeVersion};
- if (paps == null || paps.isEmpty()) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
- } catch (Exception e) {
- LOGGER.error(e.getMessage());
- }
- }else {
- int papsCount = 0;
- boolean connected = false;
- while (papsCount < paps.size()) {
- try {
- String fullURL = getPAP();
- if (parameters != null && parameters.length > 0) {
- String queryString = "";
- for (String p : parameters) {
- queryString += "&" + p;
- }
- fullURL += "?" + queryString.substring(1);
- }
-
- URL url = new URL (fullURL);
-
- //Open the connection
- connection = (HttpURLConnection)url.openConnection();
-
- // Setting Content-Type
- connection.setRequestProperty("Content-Type",
- "application/json");
-
- // Adding Authorization
- connection.setRequestProperty("Authorization", "Basic "
- +getPAPEncoding());
-
- connection.setRequestProperty("Environment", environment);
- connection.setRequestProperty("ClientScope", clientScope);
-
- //set the method and headers
- connection.setRequestMethod("GET");
- connection.setUseCaches(false);
- connection.setInstanceFollowRedirects(false);
- connection.setDoOutput(true);
- connection.setDoInput(true);
- // mb1915 - begin
- // mb1915 - set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
- connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
- // mb1915 - end
-
- //DO the connect
- connection.connect();
-
- // If Connected to PAP then break from the loop and continue with the Request
- if (connection.getResponseCode() > 0) {
- connected = true;
- break;
-
- } else {
- LOGGER.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
- }
- } catch (Exception e) {
- // This means that the PAP is not working
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
- rotatePAPList();
- }
- papsCount++;
- }
-
- if (connected) {
- //Read the Response
- LOGGER.debug("connected to the PAP : " + getPAP());
- LOGGER.debug("--- Response: ---");
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String key : headers.keySet()) {
- LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
- }
- try {
- if (connection.getResponseCode() == 200) {
- // Check for successful creation of policy
- gitPath = connection.getHeaderField("gitPath");
- policyId = connection.getHeaderField("policyId");
- description = connection.getHeaderField("description");
- pushVersion = connection.getHeaderField("version");
- isValid = Boolean.parseBoolean(connection.getHeaderField("isValid"));
-
- LOGGER.debug("GitPath from Header: " + gitPath);
- LOGGER.debug("policyId from Header: " + policyId);
- LOGGER.debug("description from Header: " + description);
- LOGGER.debug("version from Header: " + pushVersion);
- LOGGER.debug("isValid from Header: " + isValid);
-
- /*if (gitPath != null && !gitPath.equalsIgnoreCase("")) {
- return gitPath;
- }*/ if (gitPath == null || gitPath.trim().isEmpty()) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the gitPath from the PAP");
- }
- } else if (connection.getResponseCode() == 404) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "response code of the URL is "
- + connection.getResponseCode() + ". This indicates a problem with getting the gitPath from the PAP");
- } else {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "BAD REQUEST: Error occured while getting the gitPath from the PAP. The request may be incorrect.");
- }
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ", e);
- } catch (Exception e1) {
- LOGGER.error(e1.getMessage());
- }
- }
-
- } else {
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps);
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ");
- } catch (Exception e) {
- LOGGER.error(e.getMessage());
- }
- }
- }
- LOGGER.debug("Full gitPath policy xml file: " + gitPath);
- URI selectedURI = getSelectedURI(gitPath, clientScope, requestID);
- LOGGER.debug("The selectedURI is : " + selectedURI.toString());
- String name = filePrefix+policyName;
-
- StdPDPPolicy selectedPolicy;
- try {
- selectedPolicy = new StdPDPPolicy(id, true, name, selectedURI, isValid, policyId, description, pushVersion);
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+e.getMessage());
- throw new PolicyException(e);
- }
- return selectedPolicy;
- }
-
- private URI getSelectedURI(String gitPath, String clientScope, UUID requestID){
- URI selectedURI = null;
- HttpURLConnection connection = null;
- String [] parameters = {"apiflag=uri", "gitPath="+gitPath};
- if (paps == null || paps.isEmpty()) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "PAPs List is Empty.");
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"PAPs List is empty.");
- } catch (Exception e) {
- LOGGER.error(e.getMessage());
- }
- }else {
- int papsCount = 0;
- boolean connected = false;
- while (papsCount < paps.size()) {
- try {
- String fullURL = getPAP();
- if (parameters != null && parameters.length > 0) {
- String queryString = "";
- for (String p : parameters) {
- queryString += "&" + p;
- }
- fullURL += "?" + queryString.substring(1);
- }
-
- URL url = new URL (fullURL);
-
- //Open the connection
- connection = (HttpURLConnection)url.openConnection();
-
- // Setting Content-Type
- connection.setRequestProperty("Content-Type",
- "application/json");
-
- // Adding Authorization
- connection.setRequestProperty("Authorization", "Basic "
- + getPAPEncoding());
-
- connection.setRequestProperty("Environment", environment);
- connection.setRequestProperty("ClientScope", clientScope);
-
- //set the method and headers
- connection.setRequestMethod("GET");
- connection.setUseCaches(false);
- connection.setInstanceFollowRedirects(false);
- connection.setDoOutput(true);
- connection.setDoInput(true);
- // mb1915 - begin
- // mb1915 - set requestID in header properties to be used to send to PAP on the GET request so PAP won't generate another
- connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
- // mb1915 - end
-
- //DO the connect
- connection.connect();
- responseCode = connection.getResponseCode();
- // If Connected to PAP then break from the loop and continue with the Request
- if (connection.getResponseCode() > 0) {
- connected = true;
- break;
-
- } else {
- LOGGER.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error");
- }
- } catch (Exception e) {
- // This means that the PAP is not working
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP connection Error : " + e);
- rotatePAPList();
- }
- papsCount++;
- }
-
- if (connected) {
- //Read the Response
- LOGGER.debug("connected to the PAP : " + getPAP());
- LOGGER.debug("--- Response: ---");
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String key : headers.keySet()) {
- LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
- }
- try {
- if (connection.getResponseCode() == 200) {
- // Check for successful creation of policy
- String uri = connection.getHeaderField("selectedURI");
- LOGGER.debug("URI from Header: " + uri);
- if (uri != null && !uri.equalsIgnoreCase("")) {
- selectedURI = URI.create(uri);
- return selectedURI;
- } else {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the gitPath from the PAP");
- }
- } else if (connection.getResponseCode() == 404) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "response code of the URL is "
- + connection.getResponseCode() + ". This indicates a problem with getting the gitPath from the PAP");
- } else {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "BAD REQUEST: Error occured while getting the gitPath from the PAP. The request may be incorrect.");
- }
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ", e);
- } catch (Exception e1) {
- LOGGER.error(e1.getMessage());
- }
- }
-
- } else {
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get valid response from PAP(s) " + paps);
- try {
- throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE +"ERROR in connecting to the PAP ");
- } catch (Exception e) {
- LOGGER.error(e.getMessage());
- }
- }
- }
- return selectedURI;
- }
-
private String checkResponse(HttpURLConnection connection, UUID requestID) throws IOException {
String response = null;
if (responseCode == 200 || junit) {
@@ -879,20 +619,22 @@ public class PAPServices {
// Read the Response
LOGGER.debug("connected to the PAP : " + getPAP());
LOGGER.debug("--- Response: ---");
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String key : headers.keySet()) {
- LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
- }
- try {
- if(responseCode==202){
- StdPDPPolicy policy = (StdPDPPolicy) new ObjectInputStream(connection.getInputStream()).readObject();
- return policy;
+ if(connection != null){
+ Map<String, List<String>> headers = connection.getHeaderFields();
+ for (String key : headers.keySet()) {
+ LOGGER.debug("Header :" + key + " Value: " + headers.get(key));
}
- } catch (IOException | ClassNotFoundException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
- throw new PolicyException(
- XACMLErrorConstants.ERROR_SYSTEM_ERROR
- + "Decoding the result ", e);
+ try {
+ if(responseCode==202){
+ StdPDPPolicy policy = (StdPDPPolicy) new ObjectInputStream(connection.getInputStream()).readObject();
+ return policy;
+ }
+ } catch (IOException | ClassNotFoundException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
+ throw new PolicyException(
+ XACMLErrorConstants.ERROR_SYSTEM_ERROR
+ + "Decoding the result ", e);
+ }
}
return null;
} else {
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PDPServices.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PDPServices.java
index 4476b388b..a25c322a0 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PDPServices.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/PDPServices.java
@@ -114,9 +114,9 @@ public class PDPServices {
private Collection<PDPResponse> checkResponse(Response response) throws PolicyException{
String pdpConfigLocation = null;
- Collection<PDPResponse> combinedResult = new HashSet<PDPResponse>();
+ Collection<PDPResponse> combinedResult = new HashSet<>();
int priority = DEFAULT_PRIORITY;
- Map<Integer, PDPResponse> uniqueResult = new HashMap<Integer, PDPResponse>();
+ Map<Integer, PDPResponse> uniqueResult = new HashMap<>();
for (Result result : response.getResults()) {
if (!result.getDecision().equals(Decision.PERMIT)) {
LOGGER.debug("Decision not a Permit. " + result.getDecision().toString());
@@ -153,12 +153,12 @@ public class PDPServices {
String policyName = null;
String policyVersion = null;
match = new Matches();
- Map<String, String> matchingConditions = new HashMap<String, String>();
- Map<String, String> configAttributes = new HashMap<String, String>();
- Map<String, String> responseAttributes = new HashMap<String,String>();
- Map<String, String> actionTaken = new HashMap<String, String>();
+ Map<String, String> matchingConditions = new HashMap<>();
+ Map<String, String> configAttributes = new HashMap<>();
+ Map<String, String> responseAttributes = new HashMap<>();
+ Map<String, String> actionTaken = new HashMap<>();
PDPResponse pdpResponse = new PDPResponse();
- Map<String, String> adviseAttributes = new HashMap<String, String>();
+ Map<String, String> adviseAttributes = new HashMap<>();
for (AttributeAssignment attribute : advice.getAttributeAssignments()) {
adviseAttributes.put(attribute.getAttributeId().stringValue(), attribute.getAttributeValue().getValue().toString());
if (attribute.getAttributeValue().getValue().toString().equalsIgnoreCase("CONFIGURATION")) {
@@ -267,7 +267,7 @@ public class PDPServices {
// Obligation actions
// Action advised should be in obligations.
for (Obligation obligation : result.getObligations()) {
- Map<String, String> actionAdvised = new HashMap<String, String>();
+ Map<String, String> actionAdvised = new HashMap<>();
PDPResponse pdpResponse = new PDPResponse();
for (AttributeAssignment attribute : obligation.getAttributeAssignments()) {
actionAdvised.put(attribute.getAttributeId().stringValue(),
@@ -302,8 +302,9 @@ public class PDPServices {
if(pdpConfigLocation.contains("/")){
pdpConfigLocation = pdpConfigLocation.replace("/", File.separator);
}
+ InputStream inputStream = null;
try {
- InputStream inputStream = new FileInputStream(new File(pdpConfigLocation));
+ inputStream = new FileInputStream(new File(pdpConfigLocation));
try {
if (pdpConfigLocation.endsWith("json")) {
pdpResponse.setType(PolicyType.JSON);
@@ -335,7 +336,7 @@ public class PDPServices {
pdpResponse.setType(PolicyType.PROPERTIES);
Properties configProp = new Properties();
configProp.load(inputStream);
- Map<String, String> propVal = new HashMap<String, String>();
+ Map<String, String> propVal = new HashMap<>();
for(String name: configProp.stringPropertyNames()) {
propVal.put(name, configProp.getProperty(name));
}
@@ -365,6 +366,10 @@ public class PDPServices {
} catch (MalformedURLException e) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
throw new Exception(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error in ConfigURL", e);
+ }finally{
+ if(inputStream != null){
+ inputStream.close();
+ }
}
}
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/SendEventService.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/SendEventService.java
index 4659ead5c..412adfa86 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/SendEventService.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/api/services/SendEventService.java
@@ -102,7 +102,7 @@ public class SendEventService {
private Collection<PolicyResponse> eventResult(
Collection<PDPResponse> generateRequest) {
- Collection<PolicyResponse> result = new HashSet<PolicyResponse>();
+ Collection<PolicyResponse> result = new HashSet<>();
if (generateRequest == null) {
return null;
}
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java
index ed98e5420..e6122d324 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/config/PDPApiAuth.java
@@ -160,7 +160,7 @@ public class PDPApiAuth {
throw new PolicyEngineException(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"Cannot Load the Properties file", e);
}
// Read the Properties and Load the Clients and their scopes.
- clientMap = new HashMap<String, ArrayList<String>>();
+ clientMap = new HashMap<>();
//
for (Object propKey : clientProp.keySet()) {
String clientID = (String)propKey;
@@ -174,7 +174,7 @@ public class PDPApiAuth {
}
}
}
- if (clientMap == null || clientMap.isEmpty()) {
+ if (clientMap.isEmpty()) {
PolicyLogger.debug(XACMLErrorConstants.ERROR_PERMISSIONS + "No Clients ID , Client Key and Scopes are available. Cannot serve any Clients !!");
throw new PolicyEngineException("Empty Client file");
}
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/impl/XACMLPdpPolicyFinderFactory.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/impl/XACMLPdpPolicyFinderFactory.java
index 0e06b3b8b..0d6d12a63 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/impl/XACMLPdpPolicyFinderFactory.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/impl/XACMLPdpPolicyFinderFactory.java
@@ -167,7 +167,7 @@ public class XACMLPdpPolicyFinderFactory extends PolicyFinderFactory {
return null;
}
- List<PolicyDef> listPolicyDefs = new ArrayList<PolicyDef>();
+ List<PolicyDef> listPolicyDefs = new ArrayList<>();
for (String policyId : policyIdArray) {
PolicyDef policyDef = this.loadPolicyDef(policyId);
if (policyDef != null) {
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java
index 1acc18eb0..27d6b6f76 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java
@@ -97,7 +97,7 @@ public class ManualNotificationUpdateThread implements Runnable {
String consumerTopic = aURL.getHost() + aURL.getPort() + "UpdateRequest";
SendMessage(consumerTopic, "Starting-Topic");
- final LinkedList<String> urlList = new LinkedList<String> ();
+ final LinkedList<String> urlList = new LinkedList<> ();
for ( String u : clusterList.split ( "," ) ){
urlList.add ( u );
}
@@ -151,7 +151,7 @@ public class ManualNotificationUpdateThread implements Runnable {
String consumerTopic = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TOPIC).trim();
SendMessage(consumerTopic, "Starting-Topic");
- dmaapList = new ArrayList<String>();
+ dmaapList = new ArrayList<>();
for ( String u : dmaapServers.split ( "," ) ){
dmaapList.add ( u );
}
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationController.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationController.java
index 4c933776c..ed2fbd1f4 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationController.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationController.java
@@ -85,8 +85,8 @@ public class NotificationController {
boolean updated = false;
boolean removed = false;
Notification notification = new Notification();
- HashSet<Removed> removedPolicies = new HashSet<Removed>();
- HashSet<Updated> updatedPolicies = new HashSet<Updated>();
+ HashSet<Removed> removedPolicies = new HashSet<>();
+ HashSet<Updated> updatedPolicies = new HashSet<>();
if (oldStatus == null) {
oldStatus = newStatus;
@@ -229,7 +229,7 @@ public class NotificationController {
while (allOfs.hasNext()) {
AllOf allOf = allOfs.next();
Iterator<Match> matches = allOf.getMatches();
- HashMap<String, String> matchValues = new HashMap<String, String>();
+ HashMap<String, String> matchValues = new HashMap<>();
while (matches.hasNext()) {
Match match = matches.next();
LOGGER.info("Attribute Value is: "+ match.getAttributeValue().getValue().toString());
@@ -339,7 +339,7 @@ public class NotificationController {
if(updated && removed){
notification.setNotificationType(NotificationType.BOTH);
if(notification.getLoadedPolicies()!=null){
- HashSet<Updated> updatedPolicies = new HashSet<Updated>();
+ HashSet<Updated> updatedPolicies = new HashSet<>();
for(Updated oldUpdatedPolicy: notification.getLoadedPolicies()){
Updated updatePolicy = oldUpdatedPolicy;
if(notification.getRemovedPolicies()!=null){
diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationServer.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationServer.java
index cb1cf9f03..136f22268 100644
--- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationServer.java
+++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/notifications/NotificationServer.java
@@ -140,10 +140,8 @@ public class NotificationServer {
} catch (MalformedURLException e1) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error creating the UEB publisher" + e1.getMessage());
- e1.printStackTrace();
} catch (GeneralSecurityException e1) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error creating the UEB publisher" + e1.getMessage());
- e1.printStackTrace();
}
try {
@@ -189,7 +187,7 @@ public class NotificationServer {
if(dmaapServers.contains(",")) {
dmaapList = new ArrayList<String>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
} else {
- dmaapList = new ArrayList<String>();
+ dmaapList = new ArrayList<>();
dmaapList.add(dmaapServers);
}
diff --git a/ECOMP-PDP-REST/src/main/resources/logback.xml b/ECOMP-PDP-REST/src/main/resources/logback.xml
index 9c0e2ebce..df4d33f32 100644
--- a/ECOMP-PDP-REST/src/main/resources/logback.xml
+++ b/ECOMP-PDP-REST/src/main/resources/logback.xml
@@ -29,7 +29,7 @@
<!-- specify the component name
<ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
<property name="componentName" value="Policy"></property>
- <property name="subComponentName" value="XACML-PDP-REST"></property>
+ <property name="subComponentName" value="ECOMP-PDP-REST"></property>
<!-- log file names -->
<property name="errorLogName" value="error" />
@@ -205,7 +205,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java
index 7f302ffa8..581abbe08 100644
--- a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java
+++ b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java
@@ -56,7 +56,7 @@ import junit.framework.TestCase;
public class XACMLPdpServletTest extends TestCase{
private static Logger LOGGER = FlexLogger.getLogger(XACMLPdpServletTest.class);
- private List<String> headers = new ArrayList<String>();
+ private List<String> headers = new ArrayList<>();
private HttpServletRequest httpServletRequest;
private HttpServletResponse httpServletResponse;
@@ -110,7 +110,7 @@ public class XACMLPdpServletTest extends TestCase{
// when IntegrityMonitor.getInstance is called, return the mock object
PowerMockito.when(IntegrityMonitor.getInstance(Mockito.anyString(), Mockito.any(Properties.class))).thenReturn(im);
} catch (Exception e1) {
- e1.printStackTrace();
+ LOGGER.error("Exception Occured"+e1);
}
try {
diff --git a/ECOMP-PDP-REST/xacml.pdp.properties b/ECOMP-PDP-REST/xacml.pdp.properties
index f87d5404e..1193648bc 100644
--- a/ECOMP-PDP-REST/xacml.pdp.properties
+++ b/ECOMP-PDP-REST/xacml.pdp.properties
@@ -157,7 +157,7 @@ node_type=pdp_xacml
#Each group is a comma-separated list of resource names and groups are separated by a semicolon.
#A group may contain one or more members. Resource names must match the resource names defined
#in the respective servers' properties files
-dependency_groups=site_1.pdplp_1;site_1.pypdp_1;site_1.astragw_1;site_1.brmsgw_1
+dependency_groups=site_1.pdplp_1;site_1.astragw_1;site_1.brmsgw_1
# this can be DEVL, TEST, PROD
ENVIRONMENT=DEVL
diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java
index ed1664f55..2bcb903e8 100644
--- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java
+++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java
@@ -110,9 +110,9 @@ public class FindAction {
return newResponse;
}
- private Collection<Obligation> obligations = new ArrayList<Obligation>();
- private Map<String, String> matchValues = new HashMap<String, String>();
- private Map<String, String> headers = new HashMap<String, String>();
+ private Collection<Obligation> obligations = new ArrayList<>();
+ private Map<String, String> matchValues = new HashMap<>();
+ private Map<String, String> headers = new HashMap<>();
private boolean header = false;
private void search(StdMutableResponse stdResponse) {
@@ -124,7 +124,7 @@ public class FindAction {
int count = 0, uri = 0, PEP = 0;
header = false;
changeIt = false;
- Collection<AttributeAssignment> afterRemoveAssignments = new ArrayList<AttributeAssignment>();
+ Collection<AttributeAssignment> afterRemoveAssignments = new ArrayList<>();
Identifier oblId = new IdentifierImpl(obligation.getId().stringValue());
StdAttributeAssignment attributeURI = null;
for (AttributeAssignment attribute : obligation.getAttributeAssignments()) {
@@ -151,22 +151,7 @@ public class FindAction {
String papPath = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
papPath= papPath.replace("/pap", "");
matchValues.put("body",attribute.getAttributeValue().getValue().toString().replace("$URL", papPath));
- } /*
- * else if (attribute.getAttributeId().stringValue().
- * equalsIgnoreCase("type")){ requestAction.put("Type",
- * attribute.getAttributeValue().getValue().toString());
- * afterRemoveAssignments.add(attribute); } else
- * if(attribute
- * .getAttributeId().stringValue().equalsIgnoreCase
- * ("method")) { requestAction.put("Method",
- * attribute.getAttributeValue().getValue().toString());
- * afterRemoveAssignments.add(attribute); } else
- * if(attribute
- * .getAttributeId().stringValue().equalsIgnoreCase
- * ("body")) { requestAction.put("Body",
- * attribute.getAttributeValue().getValue().toString());
- * afterRemoveAssignments.add(attribute); }
- */else {
+ }else {
StdAttributeAssignment attributeObligation = new StdAttributeAssignment(attribute);
afterRemoveAssignments.add(attributeObligation);
}
@@ -174,7 +159,7 @@ public class FindAction {
if (count == 1 && uri == 1 && PEP == 0) {
// Remove Obligation and add Advice
changeIt = true;
- TakeAction(stdResponse, oblId, afterRemoveAssignments);
+ takeAction(stdResponse, oblId, afterRemoveAssignments);
} else if (PEP == 1 && count == 0) {
// Strip the PEPACTION if available
if (uri == 1) {
@@ -191,7 +176,7 @@ public class FindAction {
}
}
- private void TakeAction(StdMutableResponse stdResponse, Identifier advId,
+ private void takeAction(StdMutableResponse stdResponse, Identifier advId,
Collection<AttributeAssignment> afterRemoveAssignments) {
if (changeIt) {
LOGGER.info("the URL is :" + configURL);
@@ -199,24 +184,22 @@ public class FindAction {
callRest();
// Including the Results in an Advice
Identifier id = new IdentifierImpl(
- "com:att:labs:ecomp:policy:pdp:reply");
+ "org:openecomp:policy:pdp:reply");
Identifier statId = new IdentifierImpl(
- "com:att:labs:ecomp:policy:pdp:reply:status");
+ "org:openecomp:ecomp:policy:pdp:reply:status");
Identifier statCategory = new IdentifierImpl(
"urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject");
Identifier strId = new IdentifierImpl(
"http://www.w3.org/2001/XMLSchema#string");
Identifier resId = new IdentifierImpl(
- "com:att:labs:ecomp:policy:pdp:reply:resource");
+ "org:openecomp:ecomp:policy:pdp:reply:resource");
Identifier resCategory = new IdentifierImpl(
"urn:oasis:names:tc:xacml:3.0:attribute-category:resource");
Identifier urlId = new IdentifierImpl(
"http://www.w3.org/2001/XMLSchema#anyURI");
- // Collection<AttributeAssignment> attributes = new
- // ArrayList<AttributeAssignment>();
- AttributeValue<String> attributeStatusValue = new StdAttributeValue<String>(
+ AttributeValue<String> attributeStatusValue = new StdAttributeValue<>(
strId, status + response);
- AttributeValue<String> attributeResourceValue = new StdAttributeValue<String>(
+ AttributeValue<String> attributeResourceValue = new StdAttributeValue<>(
urlId, configURL);
StdAttributeAssignment attributeStatus = new StdAttributeAssignment(
statCategory, statId, "PDP", attributeStatusValue);
diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java
index d6d664ab6..202468feb 100644
--- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java
+++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java
@@ -34,12 +34,12 @@ import com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory;
import com.att.research.xacmlatt.pdp.std.StdFunctions;
public class EcompFunctionDefinitionFactory extends FunctionDefinitionFactory {
- private static Map<Identifier,FunctionDefinition> mapFunctionDefinitions = new HashMap<Identifier,FunctionDefinition>();
+ private static Map<Identifier,FunctionDefinition> mapFunctionDefinitions = new HashMap<>();
private static boolean needMapInit = true;
public static final Identifier ID_FUNCTION_CUSTOM_REGEXP_MATCH = new IdentifierImpl("org.openecomp.function.regex-match");
- private static final FunctionDefinition FD_CUSTOM_REGEXP_MATCH = new FunctionDefinitionCustomRegexpMatch<String>(ID_FUNCTION_CUSTOM_REGEXP_MATCH, DataTypes.DT_STRING);
+ private static final FunctionDefinition FD_CUSTOM_REGEXP_MATCH = new FunctionDefinitionCustomRegexpMatch<>(ID_FUNCTION_CUSTOM_REGEXP_MATCH, DataTypes.DT_STRING);
private static void register(FunctionDefinition functionDefinition) {
mapFunctionDefinitions.put(functionDefinition.getId(), functionDefinition);
diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/PolicyList.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/PolicyList.java
index d1a14d502..da9e69ebc 100644
--- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/PolicyList.java
+++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/PolicyList.java
@@ -28,7 +28,7 @@ import java.util.List;
*/
public class PolicyList {
- private static List<String> policyList = new ArrayList<String>();
+ private static List<String> policyList = new ArrayList<>();
public static List<String> getpolicyList(){
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionAccessPermittedTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionAccessPermittedTest.java
index bd86e50b1..a94c110d8 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionAccessPermittedTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionAccessPermittedTest.java
@@ -173,7 +173,7 @@ public class FunctionDefinitionAccessPermittedTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionArithmeticTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionArithmeticTest.java
index 79e4ea9ee..69e8744f7 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionArithmeticTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionArithmeticTest.java
@@ -52,7 +52,7 @@ public class FunctionDefinitionArithmeticTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
public void testInteger_add() {
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagIsInTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagIsInTest.java
index 8024b9e36..ecb870164 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagIsInTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagIsInTest.java
@@ -55,7 +55,7 @@ public class FunctionDefinitionBagIsInTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagOneAndOnlyTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagOneAndOnlyTest.java
index 8c129f843..e45dfb99c 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagOneAndOnlyTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagOneAndOnlyTest.java
@@ -54,7 +54,7 @@ public class FunctionDefinitionBagOneAndOnlyTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagSizeTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagSizeTest.java
index 4a536bced..7cb3e0488 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagSizeTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagSizeTest.java
@@ -54,7 +54,7 @@ public class FunctionDefinitionBagSizeTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagTest.java
index 5b99395a5..0f1a6009c 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionBagTest.java
@@ -57,7 +57,7 @@ public class FunctionDefinitionBagTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
FunctionArgumentAttributeValue attrInteger = null;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionComparisonTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionComparisonTest.java
index 0ea1a2c9d..9c3cc7faf 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionComparisonTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionComparisonTest.java
@@ -56,7 +56,7 @@ public class FunctionDefinitionComparisonTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
FunctionArgumentAttributeValue stringAttr1 = null;
FunctionArgumentAttributeValue stringAttr1a = null;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionDateTimeArithmeticTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionDateTimeArithmeticTest.java
index af3d7afa8..a4a6a425b 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionDateTimeArithmeticTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionDateTimeArithmeticTest.java
@@ -58,7 +58,7 @@ public class FunctionDefinitionDateTimeArithmeticTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
ExpressionResult res;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionEqualityTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionEqualityTest.java
index 86bfcd5c4..53762264c 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionEqualityTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionEqualityTest.java
@@ -79,7 +79,7 @@ public class FunctionDefinitionEqualityTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
FunctionArgumentAttributeValue stringAttr1 = null;
FunctionArgumentAttributeValue stringAttr2 = null;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHigherOrderBagTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHigherOrderBagTest.java
index 607259ab9..9e0c72ce0 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHigherOrderBagTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHigherOrderBagTest.java
@@ -56,7 +56,7 @@ public class FunctionDefinitionHigherOrderBagTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHomogeneousSimpleTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHomogeneousSimpleTest.java
index 6aee3383b..1e104a594 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHomogeneousSimpleTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionHomogeneousSimpleTest.java
@@ -88,8 +88,8 @@ public class FunctionDefinitionHomogeneousSimpleTest {
}
FunctionDefinitionEquality<String> fd = new FunctionDefinitionEquality<String>(XACML3.ID_FUNCTION_STRING_EQUAL, DataTypes.DT_STRING);
- List<String> convertedValues = new ArrayList<String>();
- List<FunctionArgument> listFunctionArguments = new ArrayList<FunctionArgument>();
+ List<String> convertedValues = new ArrayList<>();
+ List<FunctionArgument> listFunctionArguments = new ArrayList<>();
// test correct # of args, both of them strings
listFunctionArguments.add(stringAttr1);
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionLogicalTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionLogicalTest.java
index 615a8ecf1..7530e417b 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionLogicalTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionLogicalTest.java
@@ -51,7 +51,7 @@ public class FunctionDefinitionLogicalTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
// use the same args for each test
FunctionArgumentAttributeValue attrT = null;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionNumberTypeConversionTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionNumberTypeConversionTest.java
index 2b7dbf4e2..9b2a39424 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionNumberTypeConversionTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionNumberTypeConversionTest.java
@@ -52,7 +52,7 @@ public class FunctionDefinitionNumberTypeConversionTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
public void testDouble_to_integer() {
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionRegexpMatchTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionRegexpMatchTest.java
index 26cc46620..423c4db48 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionRegexpMatchTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionRegexpMatchTest.java
@@ -58,7 +58,7 @@ public class FunctionDefinitionRegexpMatchTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSetTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSetTest.java
index cbc71e78d..8e8497b0b 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSetTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSetTest.java
@@ -58,7 +58,7 @@ public class FunctionDefinitionSetTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSpecialMatchTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSpecialMatchTest.java
index 19d673624..f2e6bdb35 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSpecialMatchTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionSpecialMatchTest.java
@@ -55,7 +55,7 @@ public class FunctionDefinitionSpecialMatchTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
public void testX500NameMatch() {
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringConversionTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringConversionTest.java
index 1e3fd7e70..deca2b15f 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringConversionTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringConversionTest.java
@@ -70,7 +70,7 @@ public class FunctionDefinitionStringConversionTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
/**
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringEqualIgnoreCaseTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringEqualIgnoreCaseTest.java
index 6475e8d4a..65f92a9f0 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringEqualIgnoreCaseTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringEqualIgnoreCaseTest.java
@@ -56,7 +56,7 @@ public class FunctionDefinitionStringEqualIgnoreCaseTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
FunctionArgumentAttributeValue stringAttr1 = null;
FunctionArgumentAttributeValue stringAttr2 = null;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringFunctionsTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringFunctionsTest.java
index e80fb685d..7b556e3bc 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringFunctionsTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringFunctionsTest.java
@@ -53,7 +53,7 @@ public class FunctionDefinitionStringFunctionsTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
ExpressionResult res;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringNormalizeTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringNormalizeTest.java
index 61848f7ff..0de8a0f0b 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringNormalizeTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionStringNormalizeTest.java
@@ -51,7 +51,7 @@ public class FunctionDefinitionStringNormalizeTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@Test
public void testString_normalize_space() {
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionURIStringConcatenateTest.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionURIStringConcatenateTest.java
index 50a0fd315..8a864a1a0 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionURIStringConcatenateTest.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/FunctionDefinitionURIStringConcatenateTest.java
@@ -57,7 +57,7 @@ public class FunctionDefinitionURIStringConcatenateTest {
/*
* variables useful in the following tests
*/
- List<FunctionArgument> arguments = new ArrayList<FunctionArgument>();
+ List<FunctionArgument> arguments = new ArrayList<>();
@SuppressWarnings("deprecation")
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformancePIPEngine.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformancePIPEngine.java
index 84012c0d3..64085411f 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformancePIPEngine.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformancePIPEngine.java
@@ -70,8 +70,8 @@ public class ConformancePIPEngine implements ConfigurableEngine {
private String name;
private String description;
- private Map<String,PIPResponse> cache = new HashMap<String,PIPResponse>();
- private List<Attribute> listAttributes = new ArrayList<Attribute>();
+ private Map<String,PIPResponse> cache = new HashMap<>();
+ private List<Attribute> listAttributes = new ArrayList<>();
private DataTypeFactory dataTypeFactory;
public ConformancePIPEngine() {
@@ -182,7 +182,7 @@ public class ConformancePIPEngine implements ConfigurableEngine {
/*
* Iterate through the values and only return the ones that match the requested data type
*/
- List<AttributeValue<?>> matchingValues = new ArrayList<AttributeValue<?>>();
+ List<AttributeValue<?>> matchingValues = new ArrayList<>();
Iterator<AttributeValue<?>> iterAttributeValues = attributeMatch.getValues().iterator();
while (iterAttributeValues.hasNext()) {
AttributeValue<?> attributeValue = iterAttributeValues.next();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceRepository.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceRepository.java
index f58ca4e9a..edbfbbf62 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceRepository.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceRepository.java
@@ -40,8 +40,8 @@ import com.att.research.xacmlatt.pdp.std.StdPolicyFinderFactory;
* @version $Revision$
*/
public class ConformanceRepository {
- private List<File> rootPolicies = new ArrayList<File>();
- private List<File> referencedPolicies = new ArrayList<File>();
+ private List<File> rootPolicies = new ArrayList<>();
+ private List<File> referencedPolicies = new ArrayList<>();
private void setXACMLProperty(String propertyName, List<File> listFiles) {
Iterator<File> iterFiles = listFiles.iterator();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceScopeResolver.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceScopeResolver.java
index fe2bc15f2..76149869a 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceScopeResolver.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceScopeResolver.java
@@ -50,7 +50,7 @@ import com.att.research.xacml.std.datatypes.DataTypes;
*/
public class ConformanceScopeResolver implements ScopeResolver {
private Logger logger = FlexLogger.getLogger(ConformanceScopeResolver.class);
- private Map<URI, List<URI>> mapIdentifierToChildren = new HashMap<URI,List<URI>>();
+ private Map<URI, List<URI>> mapIdentifierToChildren = new HashMap<>();
public ConformanceScopeResolver() {
}
@@ -58,7 +58,7 @@ public class ConformanceScopeResolver implements ScopeResolver {
public void add(URI identifierRoot, URI identifierChild) {
List<URI> listChildrenRoot = this.mapIdentifierToChildren.get(identifierRoot);
if (listChildrenRoot == null) {
- listChildrenRoot = new ArrayList<URI>();
+ listChildrenRoot = new ArrayList<>();
this.mapIdentifierToChildren.put(identifierRoot, listChildrenRoot);
}
listChildrenRoot.add(identifierChild);
@@ -98,7 +98,7 @@ public class ConformanceScopeResolver implements ScopeResolver {
@Override
public ScopeResolverResult resolveScope(Attribute attributeResourceId, ScopeQualifier scopeQualifier) throws ScopeResolverException {
- List<Attribute> listAttributes = new ArrayList<Attribute>();
+ List<Attribute> listAttributes = new ArrayList<>();
switch(scopeQualifier) {
case CHILDREN:
listAttributes.add(attributeResourceId);
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceTestSet.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceTestSet.java
index 65e10a489..2df4dbc2f 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceTestSet.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ConformanceTestSet.java
@@ -45,7 +45,7 @@ import org.openecomp.policy.common.logging.flexlogger.Logger;
*/
public class ConformanceTestSet {
private static final Logger logger = FlexLogger.getLogger(ConformanceTestSet.class);
- private List<ConformanceTest> listConformanceTests = new ArrayList<ConformanceTest>();
+ private List<ConformanceTest> listConformanceTests = new ArrayList<>();
protected List<ConformanceTest> getListConformanceTests() {
return this.listConformanceTests;
@@ -127,7 +127,7 @@ public class ConformanceTestSet {
/*
* Sort the keyset and pull out the tests that have the required components
*/
- List<String> listTestNames = new ArrayList<String>();
+ List<String> listTestNames = new ArrayList<>();
listTestNames.addAll(mapConformanceTests.keySet());
Collections.sort(listTestNames);
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
index 90e4a9b34..f556bcc2e 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
@@ -35,7 +35,7 @@ import com.att.research.xacml.api.Result;
* @version $Revision: 1.1 $
*/
public class ResponseMatchResult {
- private List<ResultMatchResult> resultMatchResults = new ArrayList<ResultMatchResult>();
+ private List<ResultMatchResult> resultMatchResults = new ArrayList<>();
private boolean bAssociatedAdviceMatches = true;
private boolean bAttributesMatch = true;
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomDataTypeFactory.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomDataTypeFactory.java
index a677fb849..10f77666d 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomDataTypeFactory.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomDataTypeFactory.java
@@ -29,7 +29,7 @@ import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.std.datatypes.DataTypes;
public class CustomDataTypeFactory extends DataTypeFactory {
- private static final Map<Identifier,DataType<?>> mapIdentifiersToDataTypes = new HashMap<Identifier,DataType<?>>();
+ private static final Map<Identifier,DataType<?>> mapIdentifiersToDataTypes = new HashMap<>();
private static boolean mapNeedsInit = true;
public static final DataTypePrivateKey DT_PRIVATEKEY = DataTypePrivateKey.newInstance();
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomFunctionDefinitionFactory.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomFunctionDefinitionFactory.java
index c8f9bb787..80f130906 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomFunctionDefinitionFactory.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/CustomFunctionDefinitionFactory.java
@@ -35,7 +35,7 @@ import com.att.research.xacmlatt.pdp.std.StdFunctions;
import com.att.research.xacmlatt.pdp.std.functions.FunctionDefinitionBagOneAndOnly;
public class CustomFunctionDefinitionFactory extends FunctionDefinitionFactory {
- private static Map<Identifier,FunctionDefinition> mapFunctionDefinitions = new HashMap<Identifier,FunctionDefinition>();
+ private static Map<Identifier,FunctionDefinition> mapFunctionDefinitions = new HashMap<>();
private static boolean needMapInit = true;
public static final Identifier ID_FUNCTION_PRIVATEKEY_ONE_AND_ONLY = new IdentifierImpl("urn:com:att:research:xacml:custom:function:3.0:rsa:privatekey-one-and-only");
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestBase.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestBase.java
index 7e1928c41..a9b504dfd 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestBase.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestBase.java
@@ -109,7 +109,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
Path file;
InputStream is;
BufferedReader reader;
- List<StdMutableAttribute> attributes = new ArrayList<StdMutableAttribute>();
+ List<StdMutableAttribute> attributes = new ArrayList<>();
public Generator(Path path) {
this.file = path;
@@ -193,7 +193,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
protected URL restURL = null;
protected int loop = 1;
protected PDPEngine engine = null;
- protected List<Generator> generators = new ArrayList<Generator>();
+ protected List<Generator> generators = new ArrayList<>();
protected static DataTypeFactory dataTypeFactory = null;
private long permits = 0;
@@ -649,7 +649,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
//
// Copy the request attributes
//
- List<StdMutableRequestAttributes> attributes = new ArrayList<StdMutableRequestAttributes>();
+ List<StdMutableRequestAttributes> attributes = new ArrayList<>();
for (RequestAttributes a : request.getRequestAttributes()) {
attributes.add(new StdMutableRequestAttributes(a));
}
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestCustom.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestCustom.java
index 4d6ecb714..84d8226be 100644
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestCustom.java
+++ b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/custom/TestCustom.java
@@ -214,7 +214,7 @@ public class TestCustom extends TestBase {
//
// Copy the request attributes
//
- List<StdMutableRequestAttributes> attributes = new ArrayList<StdMutableRequestAttributes>();
+ List<StdMutableRequestAttributes> attributes = new ArrayList<>();
for (RequestAttributes a : oldRequest.getRequestAttributes()) {
attributes.add(new StdMutableRequestAttributes(a));
}
diff --git a/ECOMP-PDP/src/test/resources/logback.xml b/ECOMP-PDP/src/test/resources/logback.xml
index e51ac17e1..ea027dcbb 100644
--- a/ECOMP-PDP/src/test/resources/logback.xml
+++ b/ECOMP-PDP/src/test/resources/logback.xml
@@ -29,7 +29,7 @@
<!-- specify the component name
<ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
<property name="componentName" value="Policy"></property>
- <property name="subComponentName" value="XACML-PDP"></property>
+ <property name="subComponentName" value="ECOMP-PDP"></property>
<!-- log file names -->
<property name="errorLogName" value="error" />
@@ -205,7 +205,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java
index 115ed1410..9d9ce64e1 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java
@@ -40,12 +40,16 @@ public class AddressGroupJson {
}
public boolean equals(Object obj){
- if(obj != null){
- AddressGroupJson servGroupobj=(AddressGroupJson) obj;
- if(this.getName().equals(servGroupobj.getName())){
- return true;
- }
+ if(obj == null){
+ return false;
}
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
+ AddressGroupJson servGroupobj=(AddressGroupJson) obj;
+ if(this.getName().equals(servGroupobj.getName())){
+ return true;
+ }
return false;
}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/IdMap.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/IdMap.java
new file mode 100644
index 000000000..6efb53a0b
--- /dev/null
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/IdMap.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.rest.adapter;
+
+
+public class IdMap {
+
+ protected String astraId;
+ protected String vendorId;
+
+ public String getAstraId() {
+ return astraId;
+ }
+ public void setAstraId(String astraId) {
+ this.astraId = astraId;
+ }
+ public String getVendorId() {
+ return vendorId;
+ }
+ public void setVendorId(String vendorId) {
+ this.vendorId = vendorId;
+ }
+
+} \ No newline at end of file
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java
index 6b368d331..1dca60cbc 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java
@@ -39,15 +39,19 @@ public class ServiceGroupJson {
this.name = value;
}
- public boolean equals(Object obj)
- {
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
ServiceGroupJson servGroupobj=(ServiceGroupJson) obj;
- if(this.getName().equals(servGroupobj.getName()))
- {
- return true;
- }
- return false;
- }
+ if(this.getName().equals(servGroupobj.getName())){
+ return true;
+ }
+ return false;
+ }
public int hashCode() {
return Integer.valueOf(name.charAt(0)+(name.charAt(1)));
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java
index 532de1f9d..46aa2b55c 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java
@@ -40,11 +40,15 @@ public class ServiceListJson {
}
public boolean equals(Object obj){
- if(obj != null){
- ServiceListJson servobj=(ServiceListJson) obj;
- if(this.getName().equals(servobj.getName())){
- return true;
- }
+ if(obj == null){
+ return false;
+ }
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
+ ServiceListJson servobj=(ServiceListJson) obj;
+ if(this.getName().equals(servobj.getName())){
+ return true;
}
return false;
}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java
index 26853d360..ca7c0dcae 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java
@@ -29,19 +29,19 @@ import java.util.Set;
public class TermCollector {
- String serviceTypeId;
- String configName;
- DeployNowJson deploymentOption;
- String securityZoneId;
-
- protected Set<Object> serviceGroups;
- protected Set<Object> addressGroups;
- protected List<Term> firewallRuleList;
-
- private String primaryParentZoneId;
-
- protected List<Tags> ruleToTag;
-
+ private String serviceTypeId;
+ private String configName;
+ private DeployNowJson deploymentOption;
+ private String securityZoneId;
+ private String vendorServiceId;
+ private VendorSpecificData vendorSpecificData= new VendorSpecificData();
+
+ protected Set<Object> serviceGroups;
+ protected Set<Object> addressGroups;
+ protected List<Term> firewallRuleList;
+
+ protected List<Tags> ruleToTag;
+
public List<Tags> getRuleToTag() {
return ruleToTag;
}
@@ -51,91 +51,95 @@ public class TermCollector {
}
//SecurityTypeId
- public String getServiceTypeId() {
- return serviceTypeId;
- }
-
- public void setServiceTypeId(String serviceTypeId) {
- this.serviceTypeId = serviceTypeId;
- }
-
- //ConfigName
- public String getConfigName() {
- return configName;
- }
-
- public void setConfigName(String configName) {
- this.configName = configName;
- }
-
- //DeploymentControl
- public DeployNowJson getDeploymentOption() {
- return deploymentOption;
- }
-
- public void setDeploymentOption(DeployNowJson deploymentOption) {
- this.deploymentOption = deploymentOption;
- }
-
- //SecurityZoneId
- public String getSecurityZoneId() {
- return securityZoneId;
- }
- public void setSecurityZoneId(String securityZoneId) {
- this.securityZoneId = securityZoneId;
- }
-
-
- //ServiceGroup
- public Set<Object> getServiceGroups() {
- if(serviceGroups==null)
- {
- serviceGroups= new HashSet<Object>();
- }
- return this.serviceGroups;
- }
-
- public void setServiceGroups(Set<Object> servListArray) {
+ public String getServiceTypeId() {
+ return serviceTypeId;
+ }
+
+ public void setServiceTypeId(String serviceTypeId) {
+ this.serviceTypeId = serviceTypeId;
+ }
+
+ //ConfigName
+ public String getConfigName() {
+ return configName;
+ }
+
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ //DeploymentControl
+ public DeployNowJson getDeploymentOption() {
+ return deploymentOption;
+ }
+
+ public void setDeploymentOption(DeployNowJson deploymentOption) {
+ this.deploymentOption = deploymentOption;
+ }
+
+ //SecurityZoneId
+ public String getSecurityZoneId() {
+ return securityZoneId;
+ }
+ public void setSecurityZoneId(String securityZoneId) {
+ this.securityZoneId = securityZoneId;
+ }
+
+
+ //ServiceGroup
+ public Set<Object> getServiceGroups() {
+ if(serviceGroups==null)
+ {
+ serviceGroups= new HashSet<Object>();
+ }
+ return this.serviceGroups;
+ }
+
+ public void setServiceGroups(Set<Object> servListArray) {
this.serviceGroups = servListArray;
}
- //AddressGroup
- public Set<Object> getAddressGroups() {
- if(addressGroups==null)
- {
- addressGroups= new HashSet<Object>();
- }
- return this.addressGroups;
- }
-
- public void setAddressGroups(Set<Object> addressGroups) {
- this.addressGroups = addressGroups;
- }
-
- //FirewallRuleList
- public List<Term> getFirewallRuleList() {
-
- if(firewallRuleList==null)
- {
- firewallRuleList= new ArrayList<Term>();
- }
- return this.firewallRuleList;
- }
-
- public void setFirewallRuleList(List<Term> firewallRuleList) {
- this.firewallRuleList = firewallRuleList;
- }
-
-
- //primaryParentZoneId
- public String getPrimaryParentZoneId() {
- return primaryParentZoneId;
- }
-
- public void setPrimaryParentZoneId(String primaryParentZoneId) {
- this.primaryParentZoneId = primaryParentZoneId;
- }
-
-
+ //AddressGroup
+ public Set<Object> getAddressGroups() {
+ if(addressGroups==null)
+ {
+ addressGroups= new HashSet<Object>();
+ }
+ return this.addressGroups;
+ }
+
+ public void setAddressGroups(Set<Object> addressGroups) {
+ this.addressGroups = addressGroups;
+ }
+
+ //FirewallRuleList
+ public List<Term> getFirewallRuleList() {
+
+ if(firewallRuleList==null)
+ {
+ firewallRuleList= new ArrayList<Term>();
+ }
+ return this.firewallRuleList;
+ }
+
+ public void setFirewallRuleList(List<Term> firewallRuleList) {
+ this.firewallRuleList = firewallRuleList;
+ }
+ //vendorServiceId
+ public String getVendorServiceId() {
+ return vendorServiceId;
+ }
+
+ public void setVendorServiceId(String vendorServiceId) {
+ this.vendorServiceId = vendorServiceId;
+ }
+
+ public VendorSpecificData getVendorSpecificData() {
+ return vendorSpecificData;
+ }
+
+ public void setVendorSpecificData(VendorSpecificData vendorSpecificData) {
+ this.vendorSpecificData = vendorSpecificData;
+ }
}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/VendorSpecificData.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/VendorSpecificData.java
new file mode 100644
index 000000000..c8ca8e95d
--- /dev/null
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/VendorSpecificData.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.rest.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class VendorSpecificData {
+
+ private List<IdMap> idMap= new ArrayList<IdMap>();
+
+ public List<IdMap> getIdMap() {
+ return idMap;
+ }
+
+ public void setIdMap(List<IdMap> idMap) {
+ this.idMap = idMap;
+ }
+
+}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
index 184b4f80b..6badfa9a9 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
@@ -99,7 +99,7 @@ public class Attribute implements Serializable {
//bi-directional many-to-one association to ConstraintValue
@OneToMany(mappedBy="attribute", orphanRemoval=true, cascade=CascadeType.REMOVE)
@JsonIgnore
- private Set<ConstraintValue> constraintValues = new HashSet<ConstraintValue>();
+ private Set<ConstraintValue> constraintValues = new HashSet<>();
//bi-directional many-to-one association to Category
@ManyToOne
@@ -259,7 +259,7 @@ public class Attribute implements Serializable {
public ConstraintValue addConstraintValue(ConstraintValue constraintValue) {
if (this.constraintValues == null) {
- this.constraintValues = new HashSet<ConstraintValue>();
+ this.constraintValues = new HashSet<>();
}
this.constraintValues.add(constraintValue);
constraintValue.setAttribute(this);
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Obadvice.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Obadvice.java
index f26fc9d95..494092029 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Obadvice.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Obadvice.java
@@ -75,7 +75,7 @@ public class Obadvice implements Serializable {
//bi-directional one-to-many association to Attribute Assignment
@OneToMany(mappedBy="obadvice", orphanRemoval=true, cascade=CascadeType.REMOVE)
- private Set<ObadviceExpression> obadviceExpressions = new HashSet<ObadviceExpression>(2);
+ private Set<ObadviceExpression> obadviceExpressions = new HashSet<>(2);
@Column(name="created_by", nullable=false, length=255)
private String createdBy;
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java
index 07f1b3bbc..70a0e845f 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java
@@ -112,7 +112,7 @@ public class PIPConfiguration implements Serializable {
//bi-directional many-to-one association to PIPConfigParam
@OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
- private Set<PIPConfigParam> pipconfigParams = new HashSet<PIPConfigParam>();
+ private Set<PIPConfigParam> pipconfigParams = new HashSet<>();
//bi-directional many-to-one association to PIPType
@ManyToOne
@@ -121,7 +121,7 @@ public class PIPConfiguration implements Serializable {
//bi-directional many-to-one association to PIPResolver
@OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
- private Set<PIPResolver> pipresolvers = new HashSet<PIPResolver>();
+ private Set<PIPResolver> pipresolvers = new HashSet<>();
public PIPConfiguration() {
}
@@ -344,7 +344,7 @@ public class PIPConfiguration implements Serializable {
@Transient
public static Collection<PIPConfiguration> importPIPConfigurations(Properties properties) {
- Collection<PIPConfiguration> configurations = new ArrayList<PIPConfiguration>();
+ Collection<PIPConfiguration> configurations = new ArrayList<>();
String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES);
if (engines == null || engines.isEmpty()) {
return configurations;
@@ -452,7 +452,7 @@ public class PIPConfiguration implements Serializable {
if (prefix.endsWith(".") == false) {
prefix = prefix + ".";
}
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
map.put(prefix + "classname", this.classname);
map.put(prefix + "name", this.name);
if (this.description != null) {
@@ -466,7 +466,7 @@ public class PIPConfiguration implements Serializable {
map.put(prefix + param.getParamName(), param.getParamValue());
}
- List<String> ids = new ArrayList<String>();
+ List<String> ids = new ArrayList<>();
Iterator<PIPResolver> iter = this.pipresolvers.iterator();
while (iter.hasNext()) {
PIPResolver resolver = iter.next();
@@ -508,7 +508,7 @@ public class PIPConfiguration implements Serializable {
props.setProperty(prefix + param.getParamName(), param.getParamValue());
}
- List<String> ids = new ArrayList<String>();
+ List<String> ids = new ArrayList<>();
Iterator<PIPResolver> iter = this.pipresolvers.iterator();
while (iter.hasNext()) {
PIPResolver resolver = iter.next();
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPResolver.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPResolver.java
index 634ff3e63..618c1a4ea 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPResolver.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPResolver.java
@@ -103,7 +103,7 @@ public class PIPResolver implements Serializable {
//bi-directional many-to-one association to PIPResolverParam
@OneToMany(mappedBy="pipresolver", orphanRemoval=true, cascade=CascadeType.REMOVE)
- private Set<PIPResolverParam> pipresolverParams = new HashSet<PIPResolverParam>();
+ private Set<PIPResolverParam> pipresolverParams = new HashSet<>();
public PIPResolver() {
}
@@ -274,7 +274,7 @@ public class PIPResolver implements Serializable {
@Transient
public static Collection<PIPResolver> importResolvers(String prefix, String list, Properties properties, String user) throws PIPException {
- Collection<PIPResolver> resolvers = new ArrayList<PIPResolver>();
+ Collection<PIPResolver> resolvers = new ArrayList<>();
for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) {
resolvers.add(new PIPResolver(prefix + "." + id, properties, user));
}
@@ -316,7 +316,7 @@ public class PIPResolver implements Serializable {
@Transient
public Map<String, String> getConfiguration(String prefix) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
if (prefix.endsWith(".") == false) {
prefix = prefix + ".";
}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java
index a04f77e7e..adf1fae8c 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java
@@ -26,12 +26,12 @@ import java.util.Map;
public class MSAttributeObject {
private String className;
- private HashMap<String, String> attribute = new HashMap<String, String>();
- private HashMap<String, String> refAttribute = new HashMap<String, String>();
- private HashMap<String, Object> subClass = new HashMap<String, Object>();
+ private HashMap<String, String> attribute = new HashMap<>();
+ private HashMap<String, String> refAttribute = new HashMap<>();
+ private HashMap<String, Object> subClass = new HashMap<>();
private String dependency;
- private HashMap<String, String> enumType = new HashMap<String, String>();
- private HashMap<String, String> matchingSet = new HashMap<String, String>();
+ private HashMap<String, String> enumType = new HashMap<>();
+ private HashMap<String, String> matchingSet = new HashMap<>();
private boolean policyTempalate;
public Map<String, String> getRefAttribute() {
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java
index 057d8544e..670657ae3 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java
@@ -63,9 +63,9 @@ public class MSModelUtils {
private static final Log logger = LogFactory.getLog(MSModelUtils.class);
- private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
- private HashMap<String, String> enumMap = new HashMap<String, String>();
- private HashMap<String, String> matchingClass = new HashMap<String, String>();
+ private HashMap<String,MSAttributeObject > classMap = new HashMap<>();
+ private HashMap<String, String> enumMap = new HashMap<>();
+ private HashMap<String, String> matchingClass = new HashMap<>();
private String configuration = "configuration";
private String dictionary = "dictionary";
private String ecomp = "";
@@ -126,7 +126,7 @@ public class MSModelUtils {
}
private void CheckForMatchingClass() {
- HashMap<String, String> tempAttribute = new HashMap<String, String>();
+ HashMap<String, String> tempAttribute = new HashMap<>();
for (Entry<String, String> set : matchingClass.entrySet()){
String key = set.getKey();
@@ -193,7 +193,7 @@ public class MSModelUtils {
private HashMap<String, String> getEEnum(EObject obj) {
List<String> valueList = new ArrayList<>();
- HashMap<String, String> returnMap = new HashMap<String, String>();
+ HashMap<String, String> returnMap = new HashMap<>();
EEnum eenum = (EEnum)obj;
String name = eenum.getName();
@@ -208,7 +208,7 @@ public class MSModelUtils {
}
public void getAttributes(String className, String dependency, EPackage root) {
- List<String> dpendList = null;
+ List<String> dpendList = new ArrayList<>();
if (dependency!=null){
dpendList = new ArrayList<String>(Arrays.asList(dependency.split(",")));
}
@@ -233,7 +233,7 @@ public class MSModelUtils {
TreeIterator<EObject> treeItr = root.eAllContents();
boolean requiredAttribute = false;
boolean requiredMatchAttribute = false;
- HashMap<String, String> annotationSet = new HashMap<String, String>();
+ HashMap<String, String> annotationSet = new HashMap<>();
String matching = null;
String range = null;
String dictionary = null;
@@ -360,7 +360,7 @@ public class MSModelUtils {
TreeIterator<EObject> treeItr = root.eAllContents();
boolean requiredAttribute = false;
- HashMap<String, String> refAttribute = new HashMap<String, String>();
+ HashMap<String, String> refAttribute = new HashMap<>();
int rollingCount = 0;
int processClass = 0;
boolean annotation = false;
@@ -505,7 +505,7 @@ public class MSModelUtils {
TreeIterator<EObject> treeItr = root.eAllContents();
boolean requiredAttribute = false;
- HashMap<String, String> refAttribute = new HashMap<String, String>();
+ HashMap<String, String> refAttribute = new HashMap<>();
boolean annotation = false;
boolean dictionaryTest = false;
String defaultValue = null;
@@ -579,8 +579,8 @@ public class MSModelUtils {
}
public Map<String, String> buildSubList(HashMap<String, String> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className){
- Map<String, String> missingValues = new HashMap<String, String>();
- Map<String, String> workingMap = new HashMap<String, String>();
+ Map<String, String> missingValues = new HashMap<>();
+ Map<String, String> workingMap = new HashMap<>();
boolean enumType;
for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){
@@ -606,7 +606,7 @@ public class MSModelUtils {
public Map<String, HashMap<String, String>> recursiveReference(HashMap<String, MSAttributeObject> classMap, String className){
- Map<String, HashMap<String, String>> returnObject = new HashMap<String, HashMap<String, String>>();
+ Map<String, HashMap<String, String>> returnObject = new HashMap<>();
HashMap<String, String> returnClass = getRefclass(classMap, className);
returnObject.put(className, returnClass);
for (Entry<String, String> reAttribute :returnClass.entrySet()){
@@ -624,7 +624,7 @@ public class MSModelUtils {
public String createJson(HashMap<String, Object> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className) {
boolean enumType;
- Map<String, HashMap<String, String>> myObject = new HashMap<String, HashMap<String, String>>();
+ Map<String, HashMap<String, String>> myObject = new HashMap<>();
for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){
String value = map.getValue().split(":")[0];
if (value!=null){
@@ -645,7 +645,7 @@ public class MSModelUtils {
}
public HashMap<String, String> getRefclass(HashMap<String, MSAttributeObject> classMap, String className){
- HashMap<String, String> missingValues = new HashMap<String, String>();
+ HashMap<String, String> missingValues = new HashMap<>();
if (classMap.get(className).getAttribute()!=null || !classMap.get(className).getAttribute().isEmpty()){
missingValues.putAll(classMap.get(className).getAttribute());
@@ -660,7 +660,7 @@ public class MSModelUtils {
public String createSubAttributes(ArrayList<String> dependency, HashMap<String, MSAttributeObject> classMap, String modelName) {
- HashMap <String, Object> workingMap = new HashMap<String,Object>();
+ HashMap <String, Object> workingMap = new HashMap<>();
MSAttributeObject tempObject = new MSAttributeObject();
if (dependency!=null){
if (dependency.size()==0){
@@ -680,8 +680,8 @@ public class MSModelUtils {
}
public ArrayList<String> getFullDependencyList(ArrayList<String> dependency, HashMap<String,MSAttributeObject > classMap) {
- ArrayList<String> returnList = new ArrayList<String>();
- ArrayList<String> workingList = new ArrayList<String>();
+ ArrayList<String> returnList = new ArrayList<>();
+ ArrayList<String> workingList = new ArrayList<>();
returnList.addAll(dependency);
for (String element : dependency ){
if (classMap.containsKey(element)){
diff --git a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
index 9745f9689..e0a11cbc8 100644
--- a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
+++ b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
@@ -99,7 +99,7 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
* @return List of String, size 1
*/
public List<String> addTileDefinitions() {
- List<String> definitions = new ArrayList<String>();
+ List<String> definitions = new ArrayList<>();
definitions.add("/WEB-INF/defs/definitions.xml");
return definitions;
}
diff --git a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/Register.java b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/Register.java
index e5d30e5b2..d710c41fc 100644
--- a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/Register.java
+++ b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/Register.java
@@ -36,7 +36,7 @@ public class Register implements Registerable {
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
- private List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
+ private List<Trigger> scheduleTriggers = new ArrayList<>();
Trigger trigger[] = new Trigger[1];
@Autowired
diff --git a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
index b3f6cbebc..af2bca592 100644
--- a/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
+++ b/ECOMP-SDK-APP/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
@@ -47,7 +47,7 @@ public class RegistryAdapter {
registry.registerTriggers();
- List<Trigger> allTriggers = new ArrayList<Trigger>();
+ List<Trigger> allTriggers = new ArrayList<>();
List<Trigger> coreTriggers = addCoreTriggers();
final Trigger[] extTriggerArray = registry.getTriggers();
diff --git a/ECOMP-SDK-APP/xacml.admin.properties b/ECOMP-SDK-APP/xacml.admin.properties
index 3d498365b..a626d300e 100644
--- a/ECOMP-SDK-APP/xacml.admin.properties
+++ b/ECOMP-SDK-APP/xacml.admin.properties
@@ -169,7 +169,7 @@ xacml.rest.admin.resource.name=site_1.admin_1
#The site name for the Admin
site_name=site_1
-#Has to be one of pdp_xacml, pdp_drools, pap, pap_admin, logparser, brms_gateway, astra_gateway, elk_server, pypdp
+#Has to be one of pdp_xacml, pdp_drools, pap, pap_admin, logparser, brms_gateway, astra_gateway, elk_server
node_type=pap_admin
# The (optional) period of time in seconds between executions of the integrity audit.
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
index 951f89110..83ff56ebf 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
@@ -155,7 +155,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
this.groups = this.readProperties(this.repository, properties);
} catch (IOException e) {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to load properties file");
- this.groups = new HashSet<StdPDPGroup>();
+ this.groups = new HashSet<>();
}
//
// Initialize the default group
@@ -377,7 +377,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Add the default PIP configuration.
String list = props.getProperty(XACMLProperties.PROP_PIP_ENGINES);
if (list != null && list.length() > 0) {
- Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ Set<PDPPIPConfig> pipConfigs = new HashSet<>();
for (String pipID : list.split("[,]")) {
StdPDPPIPConfig config = new StdPDPPIPConfig(pipID, props);
if (config.isConfigured()) {
@@ -561,7 +561,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
private Set<StdPDPGroup> readProperties(Path repository, Properties properties) throws PAPException {
- Set<StdPDPGroup> groups = new HashSet<StdPDPGroup>();
+ Set<StdPDPGroup> groups = new HashSet<>();
//
// See if there is a groups property
//
@@ -616,7 +616,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
// Iterate our groups
//
- List<String> ids = new ArrayList<String>();
+ List<String> ids = new ArrayList<>();
for (PDPGroup group : this.groups) {
ids.add(group.getId());
properties.setProperty(group.getId() + ".name", (group.getName() == null ? "" : group.getName()));
@@ -624,7 +624,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
// Iterate its PDPs
//
- List<String> pdps = new ArrayList<String>();
+ List<String> pdps = new ArrayList<>();
for (PDP pdp : group.getPdps()) {
pdps.add(pdp.getId());
properties.setProperty(pdp.getId() + ".name", (pdp.getName() == null ? "" : pdp.getName()));
@@ -717,7 +717,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
if (group.getPdps().size() == 1) {
pdpList = group.getPdps().iterator().next().getId();
} else if (group.getPdps().size() > 1) {
- Set<String> ids = new HashSet<String>();
+ Set<String> ids = new HashSet<>();
for (PDP pdp : group.getPdps()) {
ids.add(pdp.getId());
}
@@ -792,7 +792,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
@Override
public Set<EcompPDPGroup> getEcompPDPGroups() throws PAPException {
- final Set<EcompPDPGroup> grps = new HashSet<EcompPDPGroup>();
+ final Set<EcompPDPGroup> grps = new HashSet<>();
for (EcompPDPGroup g : this.groups) {
grps.add(g);
}
@@ -978,7 +978,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
}
// The movePDP function will modify the set of PDPs in the group.
// To avoid concurrent modification exceptions we need to duplicate the list before calling that function.
- List<EcompPDP> pdpList = new ArrayList<EcompPDP>();
+ List<EcompPDP> pdpList = new ArrayList<>();
for (EcompPDP pdp : pdps) {
pdpList.add(pdp);
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
index 0606daa79..61ba86b8a 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
@@ -35,9 +35,9 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private String policyDescription = null;
private String ecompName = null;
private String configName = null;
- private Map<String, String> dyanamicFieldConfigAttributes = new HashMap<String, String>();
- private Map<String, String> dropDownMap = new HashMap<String, String>();
- private Map<String, String> dynamicSettingsMap = new HashMap<String, String>();
+ private Map<String, String> dyanamicFieldConfigAttributes = new HashMap<>();
+ private Map<String, String> dropDownMap = new HashMap<>();
+ private Map<String, String> dynamicSettingsMap = new HashMap<>();
private List<String> dynamicRuleAlgorithmLabels;
private List<String> dynamicRuleAlgorithmCombo;
private List<String> dynamicRuleAlgorithmField1;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDP.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDP.java
index b8fb59b60..7e3c1e61a 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDP.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDP.java
@@ -47,9 +47,9 @@ public class StdPDP extends StdPDPItemSetChangeNotifier implements EcompPDP, Com
private PDPStatus status = new StdPDPStatus();
- private Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> policies = new HashSet<>();
- private Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> pipConfigs = new HashSet<>();
public StdPDP() {
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
index 1a52dcb73..b28c04e29 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
@@ -72,13 +72,13 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
private StdPDPGroupStatus status = new StdPDPGroupStatus(Status.UNKNOWN);
- private Set<EcompPDP> pdps = new HashSet<EcompPDP>();
+ private Set<EcompPDP> pdps = new HashSet<>();
- private Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> policies = new HashSet<>();
- private Set<PDPPolicy> selectedPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> selectedPolicies = new HashSet<>();
- private Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> pipConfigs = new HashSet<>();
private String operation;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroupStatus.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroupStatus.java
index dcb1f8fe0..6b248bf69 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroupStatus.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroupStatus.java
@@ -33,29 +33,29 @@ public class StdPDPGroupStatus implements PDPGroupStatus {
private Status status = Status.UNKNOWN;
- private Set<String> loadErrors = new HashSet<String>();
+ private Set<String> loadErrors = new HashSet<>();
- private Set<String> loadWarnings = new HashSet<String>();
+ private Set<String> loadWarnings = new HashSet<>();
- private Set<PDPPolicy> loadedPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> loadedPolicies = new HashSet<>();
- private Set<PDPPolicy> failedPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> failedPolicies = new HashSet<>();
- private Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<>();
- private Set<PDPPIPConfig> failedPIPConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> failedPIPConfigs = new HashSet<>();
- private Set<PDP> inSynchPDPs = new HashSet<PDP>();
+ private Set<PDP> inSynchPDPs = new HashSet<>();
- private Set<PDP> outOfSynchPDPs = new HashSet<PDP>();
+ private Set<PDP> outOfSynchPDPs = new HashSet<>();
- private Set<PDP> failedPDPs = new HashSet<PDP>();
+ private Set<PDP> failedPDPs = new HashSet<>();
- private Set<PDP> updatingPDPs = new HashSet<PDP>();
+ private Set<PDP> updatingPDPs = new HashSet<>();
- private Set<PDP> lastUpdateFailedPDPs = new HashSet<PDP>();
+ private Set<PDP> lastUpdateFailedPDPs = new HashSet<>();
- private Set<PDP> unknownPDPs = new HashSet<PDP>();
+ private Set<PDP> unknownPDPs = new HashSet<>();
// Constructor needed for JSON deserialization
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
index 909f64620..3a609fe07 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
@@ -42,7 +42,7 @@ public class StdPDPPIPConfig implements PDPPIPConfig, Serializable {
private String classname;
- private Map<String,String> config = new HashMap<String, String>();
+ private Map<String,String> config = new HashMap<>();
public StdPDPPIPConfig() {
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPStatus.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPStatus.java
index dc297657a..ddb799964 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPStatus.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPStatus.java
@@ -34,19 +34,19 @@ public class StdPDPStatus implements Serializable, PDPStatus {
private Status status = Status.UNKNOWN;
- private Set<String> loadErrors = new HashSet<String>();
+ private Set<String> loadErrors = new HashSet<>();
- private Set<String> loadWarnings = new HashSet<String>();
+ private Set<String> loadWarnings = new HashSet<>();
- private Set<PDPPolicy> loadedPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> loadedPolicies = new HashSet<>();
- private Set<PDPPolicy> loadedRootPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> loadedRootPolicies = new HashSet<>();
- private Set<PDPPolicy> failedPolicies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> failedPolicies = new HashSet<>();
- private Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> loadedPIPConfigs = new HashSet<>();
- private Set<PDPPIPConfig> failedPIPConfigs = new HashSet<PDPPIPConfig>();
+ private Set<PDPPIPConfig> failedPIPConfigs = new HashSet<>();
public StdPDPStatus() {
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
index 581009d18..e8f9bfcb7 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
@@ -76,7 +76,7 @@ public class AAFEngine extends StdConfigurableEngine {
private static final PIPRequest PIP_REQUEST_INSTANCE = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_INSTANCE"), XACML3.ID_DATATYPE_STRING);
private static final PIPRequest PIP_REQUEST_ACTION = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_ACTION"), XACML3.ID_DATATYPE_STRING);
- private static final List<PIPRequest> mapRequiredAttributes = new ArrayList<PIPRequest>();
+ private static final List<PIPRequest> mapRequiredAttributes = new ArrayList<>();
static{
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_UID));
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_PASS));
@@ -85,7 +85,7 @@ public class AAFEngine extends StdConfigurableEngine {
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_ACTION));
}
- private static final Map<PIPRequest, String> mapSupportedAttributes = new HashMap<PIPRequest, String>();
+ private static final Map<PIPRequest, String> mapSupportedAttributes = new HashMap<>();
static{
mapSupportedAttributes.put(new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, AAF_RESPONSE_ID, XACML3.ID_DATATYPE_STRING), "response");
mapSupportedAttributes.put(new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, AAF_RESULT_ID, XACML3.ID_DATATYPE_BOOLEAN), "result");
@@ -251,7 +251,7 @@ public class AAFEngine extends StdConfigurableEngine {
@Override
public Collection<PIPRequest> attributesRequired() {
- List<PIPRequest> attributes = new ArrayList<PIPRequest>();
+ List<PIPRequest> attributes = new ArrayList<>();
for (PIPRequest attribute: mapRequiredAttributes) {
attributes.add(new StdPIPRequest(attribute));
}
@@ -260,7 +260,7 @@ public class AAFEngine extends StdConfigurableEngine {
@Override
public Collection<PIPRequest> attributesProvided() {
- List<PIPRequest> attributes = new ArrayList<PIPRequest>();
+ List<PIPRequest> attributes = new ArrayList<>();
for (PIPRequest attribute : mapSupportedAttributes.keySet()) {
attributes.add(new StdPIPRequest(attribute));
}
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/TestBase.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/TestBase.java
index ef87b6796..3f2469bfd 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/TestBase.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/TestBase.java
@@ -109,7 +109,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
Path file;
InputStream is;
BufferedReader reader;
- List<StdMutableAttribute> attributes = new ArrayList<StdMutableAttribute>();
+ List<StdMutableAttribute> attributes = new ArrayList<>();
public Generator(Path path) {
this.file = path;
@@ -193,7 +193,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
protected URL restURL = null;
protected int loop = 1;
protected PDPEngine engine = null;
- protected List<Generator> generators = new ArrayList<Generator>();
+ protected List<Generator> generators = new ArrayList<>();
protected static DataTypeFactory dataTypeFactory = null;
private long permits = 0;
@@ -649,7 +649,7 @@ public class TestBase extends SimpleFileVisitor<Path> {
//
// Copy the request attributes
//
- List<StdMutableRequestAttributes> attributes = new ArrayList<StdMutableRequestAttributes>();
+ List<StdMutableRequestAttributes> attributes = new ArrayList<>();
for (RequestAttributes a : request.getRequestAttributes()) {
attributes.add(new StdMutableRequestAttributes(a));
}
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseConformanceTest.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseConformanceTest.java
index e3c3b218a..735fa4602 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseConformanceTest.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseConformanceTest.java
@@ -320,7 +320,7 @@ public class ResponseConformanceTest {
//
private List<File> getRequestsInDirectory(File directory) {
- List<File> fileList = new ArrayList<File>();
+ List<File> fileList = new ArrayList<>();
File[] fileArray = directory.listFiles();
for (File f : fileArray) {
diff --git a/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
index 73266603b..8c6df28b0 100644
--- a/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
+++ b/LogParser/src/main/java/org/openecomp/xacml/parser/ParseLog.java
@@ -144,7 +144,7 @@ public class ParseLog {
public static int countLines(String filename) throws IOException {
LineNumberReader reader = new LineNumberReader(new FileReader(filename));
int cnt = 0;
- while ((reader.readLine()) != null) {}
+ while ((reader.readLine()) != null);
cnt = reader.getLineNumber();
reader.close();
return cnt;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
index aa8a227d3..a3f4ada0a 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
@@ -115,7 +115,7 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyManagerServlet.policyNames = policyNames;
}
- private static List<String> serviceTypeNamesList = new ArrayList<String>();
+ private static List<String> serviceTypeNamesList = new ArrayList<>();
private List<Object> policyData;
public static List<String> getServiceTypeNamesList() {
@@ -142,20 +142,26 @@ public class PolicyManagerServlet extends HttpServlet {
String location = closedLoopJsonLocation.toString();
try {
inputStream = new FileInputStream(location);
+ if (location.endsWith("json")) {
+ JsonReader jsonReader = null;
+ jsonReader = Json.createReader(inputStream);
+ policyNames = jsonReader.readArray();
+ serviceTypeNamesList = new ArrayList<>();
+ for (int i = 0; i < policyNames.size(); i++) {
+ javax.json.JsonObject policyName = policyNames.getJsonObject(i);
+ String name = policyName.getJsonString("serviceTypePolicyName").getString();
+ serviceTypeNamesList.add(name);
+ }
+ jsonReader.close();
+ }
} catch (FileNotFoundException e) {
LOGGER.error("Exception Occured while initializing the JSONConfig file"+e);
- }
- if (location.endsWith("json")) {
- JsonReader jsonReader = null;
- jsonReader = Json.createReader(inputStream);
- policyNames = jsonReader.readArray();
- serviceTypeNamesList = new ArrayList<String>();
- for (int i = 0; i < policyNames.size(); i++) {
- javax.json.JsonObject policyName = policyNames.getJsonObject(i);
- String name = policyName.getJsonString("serviceTypePolicyName").getString();
- serviceTypeNamesList.add(name);
+ }finally{
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured while closing the File InputStream"+e);
}
- jsonReader.close();
}
}
@@ -185,6 +191,7 @@ public class PolicyManagerServlet extends HttpServlet {
out.print(responseJsonObject);
out.flush();
} catch (Exception x) {
+ LOGGER.error("Exception Occured"+x);
response.sendError(HttpStatus.SC_INTERNAL_SERVER_ERROR, x.getMessage());
}
}
@@ -193,7 +200,7 @@ public class PolicyManagerServlet extends HttpServlet {
private void uploadFile(HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
String newFile;
- Map<String, InputStream> files = new HashMap<String, InputStream>();
+ Map<String, InputStream> files = new HashMap<>();
List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
for (FileItem item : items) {
@@ -218,7 +225,7 @@ public class PolicyManagerServlet extends HttpServlet {
JSONObject responseJsonObject = null;
responseJsonObject = this.success();
- response.setContentType("application/json");
+ response.setContentType(CONTENTTYPE);
PrintWriter out = response.getWriter();
out.print(responseJsonObject);
out.flush();
@@ -286,7 +293,7 @@ public class PolicyManagerServlet extends HttpServlet {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While doing File Operation" + e);
responseJsonObject = error(e.getMessage());
}
- response.setContentType("application/json");
+ response.setContentType(CONTENTTYPE);
PrintWriter out = response.getWriter();
out.print(responseJsonObject);
out.flush();
@@ -295,20 +302,20 @@ public class PolicyManagerServlet extends HttpServlet {
private JSONObject searchPolicyList(JSONObject params, HttpServletRequest request) {
Set<String> scopes = null;
List<String> roles = null;
- policyData = new ArrayList<Object>();
+ policyData = new ArrayList<>();
JSONArray policyList = null;
if(params.has("policyList")){
policyList = (JSONArray) params.get("policyList");
}
PolicyController controller = new PolicyController();
- List<JSONObject> resultList = new ArrayList<JSONObject>();
+ List<JSONObject> resultList = new ArrayList<>();
try {
//Get the Login Id of the User from Request
String userId = UserUtils.getUserSession(request).getOrgUserId();
//Check if the Role and Scope Size are Null get the values from db.
List<Object> userRoles = PolicyController.getRoles(userId);
- roles = new ArrayList<String>();
- scopes = new HashSet<String>();
+ roles = new ArrayList<>();
+ scopes = new HashSet<>();
for(Object role: userRoles){
Roles userRole = (Roles) role;
roles.add(userRole.getRole());
@@ -352,7 +359,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
}else{
- if (roles.contains("super-admin") || roles.contains("super-editor") || roles.contains("super-guest") ){
+ if (roles.contains(SUPERADMIN) || roles.contains(SUPEREDITOR) || roles.contains(SUPERGUEST) ){
policyData = controller.getData(PolicyVersion.class);
}else{
List<Object> filterdatas = controller.getData(PolicyVersion.class);
@@ -494,7 +501,9 @@ public class PolicyManagerServlet extends HttpServlet {
} catch (IOException e) {
LOGGER.error("Exception Occured while Describing the Policy"+e);
}finally{
- temp.delete();
+ if(temp != null){
+ temp.delete();
+ }
}
}else{
return error("Error Occured while Describing the Policy");
@@ -512,8 +521,8 @@ public class PolicyManagerServlet extends HttpServlet {
String userId = UserUtils.getUserSession(request).getOrgUserId();
//Check if the Role and Scope Size are Null get the values from db.
List<Object> userRoles = PolicyController.getRoles(userId);
- roles = new ArrayList<String>();
- scopes = new HashSet<String>();
+ roles = new ArrayList<>();
+ scopes = new HashSet<>();
for(Object role: userRoles){
Roles userRole = (Roles) role;
roles.add(userRole.getRole());
@@ -534,7 +543,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
- List<JSONObject> resultList = new ArrayList<JSONObject>();
+ List<JSONObject> resultList = new ArrayList<>();
boolean onlyFolders = params.getBoolean("onlyFolders");
String path = params.getString("path");
if(path.contains("..xml")){
@@ -680,7 +689,7 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyController controller = new PolicyController();
UserInfo userInfo = (UserInfo) controller.getEntityItem(UserInfo.class, "userLoginId", loginId);
if(userInfo == null){
- return "super-admin";
+ return SUPERADMIN;
}
return userInfo.getUserName();
}
@@ -688,13 +697,19 @@ public class PolicyManagerServlet extends HttpServlet {
//Rename Policy
private JSONObject rename(JSONObject params, HttpServletRequest request) throws ServletException {
try {
+ boolean isActive = false;
+ List<String> policyActiveInPDP = new ArrayList<>();
+ Set<String> scopeOfPolicyActiveInPDP = new HashSet<>();
String userId = UserUtils.getUserSession(request).getOrgUserId();
String oldPath = params.getString("path");
String newPath = params.getString("newPath");
oldPath = oldPath.substring(oldPath.indexOf("/")+1);
newPath = newPath.substring(newPath.indexOf("/")+1);
if(oldPath.endsWith(".xml")){
- policyRename(oldPath, newPath, userId);
+ JSONObject result = policyRename(oldPath, newPath, userId);
+ if(!(Boolean)(result.getJSONObject("result").get("success"))){
+ return result;
+ }
}else{
String scopeName = oldPath;
String newScopeName = newPath;
@@ -715,18 +730,36 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyVersion activeVersion = (PolicyVersion) object;
String policyOldPath = activeVersion.getPolicyName().replace(File.separator, "/") + "." + activeVersion.getActiveVersion() + ".xml";
String policyNewPath = policyOldPath.replace(oldPath, newPath);
- policyRename(policyOldPath, policyNewPath, userId);
+ JSONObject result = policyRename(policyOldPath, policyNewPath, userId);
+ if(!(Boolean)(result.getJSONObject("result").get("success"))){
+ isActive = true;
+ policyActiveInPDP.add(policyOldPath);
+ String scope = policyOldPath.substring(0, policyOldPath.lastIndexOf("/"));
+ scopeOfPolicyActiveInPDP.add(scope.replace("/", File.separator));
+ }
+ }
+ boolean rename = false;
+ if(activePolicies.size() != policyActiveInPDP.size()){
+ rename = true;
}
- for(Object object : scopesList){
- PolicyEditorScopes editorScopeEntity = (PolicyEditorScopes) object;
- if(scopeName.contains("\\\\\\\\")){
- scopeName = scopeName.replace("\\\\\\\\", File.separator);
- newScopeName = newScopeName.replace("\\\\\\\\", File.separator);
+
+ UserInfo userInfo = new UserInfo();
+ userInfo.setUserLoginId(userId);
+ if(policyActiveInPDP.size() == 0){
+ renameScope(scopesList, scopeName, newScopeName, controller);
+ }else if(rename){
+ renameScope(scopesList, scopeName, newScopeName, controller);
+ for(String scope : scopeOfPolicyActiveInPDP){
+ PolicyEditorScopes editorScopeEntity = new PolicyEditorScopes();
+ editorScopeEntity.setScopeName(scope.replace("\\", "\\\\\\\\"));
+ editorScopeEntity.setUserCreatedBy(userInfo);
+ editorScopeEntity.setUserModifiedBy(userInfo);
+ controller.saveData(editorScopeEntity);
}
- String scope = editorScopeEntity.getScopeName().replace(scopeName, newScopeName);
- editorScopeEntity.setScopeName(scope);
- controller.updateData(editorScopeEntity);
}
+ if(isActive){
+ return error("The Following policies rename failed. Since they are active in PDP Groups" +policyActiveInPDP);
+ }
}
return success();
} catch (Exception e) {
@@ -735,11 +768,24 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
+ private void renameScope(List<Object> scopesList, String scopeName, String newScopeName, PolicyController controller){
+ for(Object object : scopesList){
+ PolicyEditorScopes editorScopeEntity = (PolicyEditorScopes) object;
+ if(scopeName.contains("\\\\\\\\")){
+ scopeName = scopeName.replace("\\\\\\\\", File.separator);
+ newScopeName = newScopeName.replace("\\\\\\\\", File.separator);
+ }
+ String scope = editorScopeEntity.getScopeName().replace(scopeName, newScopeName);
+ editorScopeEntity.setScopeName(scope);
+ controller.updateData(editorScopeEntity);
+ }
+ }
+
private JSONObject policyRename(String oldPath, String newPath, String userId) throws ServletException {
try {
PolicyEntity entity = null;
PolicyController controller = new PolicyController();
-
+
String policyVersionName = newPath.replace(".xml", "");
String policyName = policyVersionName.substring(0, policyVersionName.lastIndexOf(".")).replace("/", File.separator);
@@ -767,51 +813,42 @@ public class PolicyManagerServlet extends HttpServlet {
oldPolicyCheck = oldPolicyCheck.replace(".Decision_", ":Decision_");
}
String[] oldPolicySplit = oldPolicyCheck.split(":");
-
+
//Check PolicyEntity table with newPolicy Name
String policyEntityquery = "FROM PolicyEntity where policyName = '"+newPolicySplit[1]+"' and scope ='"+newPolicySplit[0]+"'";
- System.out.println(policyEntityquery);
List<Object> queryData = controller.getDataByQuery(policyEntityquery);
if(!queryData.isEmpty()){
entity = (PolicyEntity) queryData.get(0);
+ return error("Policy rename failed. Since, the policy with same name already exists.");
}
-
- if(entity != null){
- //if a policy exists with new name check if it is deleted or not
- if(entity.isDeleted()){
- //Check Policy Group Entity table if policy has been pushed or not
- String query = "from PolicyGroupEntity where policyid = '"+entity.getPolicyId()+"'";
- List<Object> object = controller.getDataByQuery(query);
- if(object.isEmpty()){
- //if PolicyGroupEntity data is empty delete the entry from database
- controller.deleteData(entity);
- //Query the Policy Entity with oldPolicy Name
- String oldpolicyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
- System.out.println(oldpolicyEntityquery);
- List<Object> oldEntityData = controller.getDataByQuery(oldpolicyEntityquery);
- if(!oldEntityData.isEmpty()){
- entity = (PolicyEntity) oldEntityData.get(0);
- }
- checkOldPolicyEntryAndUpdate(entity, newPolicySplit[0], newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], policyName, newpolicyName, oldpolicyName, userId);
+
+ //Query the Policy Entity with oldPolicy Name
+ String policyEntityCheck = oldPolicySplit[1].substring(0, oldPolicySplit[1].indexOf("."));
+ String oldpolicyEntityquery = "FROM PolicyEntity where policyName like '"+policyEntityCheck+"%' and scope ='"+oldPolicySplit[0]+"'";
+ List<Object> oldEntityData = controller.getDataByQuery(oldpolicyEntityquery);
+ if(!oldEntityData.isEmpty()){
+ String groupQuery = "FROM PolicyGroupEntity where (";
+ for(int i=0; i<oldEntityData.size(); i++){
+ entity = (PolicyEntity) oldEntityData.get(i);
+ if(i == 0){
+ groupQuery = groupQuery + "policyid =" + entity.getPolicyId();
}else{
- return error("Policy rename failed due to policy with new name existing in PDP Group.");
+ groupQuery = groupQuery + " or policyid =" + entity.getPolicyId();
}
- }else{
- return error("Policy rename failed due to same name existing.");
}
- }else{
- //Query the Policy Entity with oldPolicy Name
- String policyEntityCheck = oldPolicySplit[1].substring(0, oldPolicySplit[1].indexOf("."));
- String oldpolicyEntityquery = "FROM PolicyEntity where policyName like '"+policyEntityCheck+"%' and scope ='"+oldPolicySplit[0]+"'";
- List<Object> oldEntityData = controller.getDataByQuery(oldpolicyEntityquery);
- if(!oldEntityData.isEmpty()){
- for(int i=0; i<oldEntityData.size(); i++){
- entity = (PolicyEntity) oldEntityData.get(i);
- checkOldPolicyEntryAndUpdate(entity, newPolicySplit[0] , newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], policyName, newpolicyName, oldpolicyName, userId);
- }
+ groupQuery = groupQuery + ")";
+ List<Object> groupEntityData = controller.getDataByQuery(groupQuery);
+ if(groupEntityData.size() > 0){
+ return error("Policy rename failed. Since the policy or its version is active in PDP Groups.");
}
+ for(int i=0; i<oldEntityData.size(); i++){
+ entity = (PolicyEntity) oldEntityData.get(i);
+ checkOldPolicyEntryAndUpdate(entity, newPolicySplit[0] , newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], policyName, newpolicyName, oldpolicyName, userId);
+ }
+ }else{
+ return error("Policy rename failed due to policy not able to retrieve from database. Please, contact super-admin.");
}
-
+
return success();
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured While Renaming Policy"+e);
@@ -822,60 +859,54 @@ public class PolicyManagerServlet extends HttpServlet {
private JSONObject checkOldPolicyEntryAndUpdate(PolicyEntity entity, String newScope, String removenewPolicyExtension, String oldScope, String removeoldPolicyExtension,
String policyName, String newpolicyName, String oldpolicyName, String userId) throws ServletException{
try {
- ConfigurationDataEntity configEntity;
- ActionBodyEntity actionEntity;
+ ConfigurationDataEntity configEntity = entity.getConfigurationData();
+ ActionBodyEntity actionEntity = entity.getActionBodyEntity();
PolicyController controller = new PolicyController();
- configEntity = entity.getConfigurationData();
- actionEntity = entity.getActionBodyEntity();
- if(entity != null){
- //Check Policy Group Entity table if policy has been pushed or not
- String query = "from PolicyGroupEntity where policyid = '"+entity.getPolicyId()+"'";
- List<Object> object = controller.getDataByQuery(query);
- if(object.isEmpty()){
- String oldPolicyNameWithoutExtension = removeoldPolicyExtension;
- String newPolicyNameWithoutExtension = removenewPolicyExtension;
- if(removeoldPolicyExtension.endsWith(".xml")){
- oldPolicyNameWithoutExtension = oldPolicyNameWithoutExtension.substring(0, oldPolicyNameWithoutExtension.indexOf("."));
- newPolicyNameWithoutExtension = newPolicyNameWithoutExtension.substring(0, newPolicyNameWithoutExtension.indexOf("."));
- }
- entity.setPolicyName(entity.getPolicyName().replace(oldPolicyNameWithoutExtension, newPolicyNameWithoutExtension));
- entity.setPolicyData(entity.getPolicyData().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
- entity.setScope(newScope);
- entity.setModifiedBy(userId);
- if(newpolicyName.contains("Config_")){
- configEntity.setConfigurationName(configEntity.getConfigurationName().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
- controller.updateData(configEntity);
- }else if(newpolicyName.contains("Action_")){
- actionEntity.setActionBody(actionEntity.getActionBody().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
- controller.updateData(actionEntity);
- }
- controller.updateData(entity);
- }else{
- //Mark as Deleted in PolicyEntiy table
- entity.setDeleted(true);
- controller.updateData(entity);
- //Mark as Deleted in ConfigurationDataEntity table
- configEntity.setDeleted(true);
- controller.updateData(configEntity);
- //Mark as Deleted in ActionDataEntity table
- actionEntity.setDeleted(true);
- controller.updateData(actionEntity);
- //Clone New Copy
- cloneRecord(newpolicyName, oldScope, removeoldPolicyExtension, newScope, removenewPolicyExtension, entity, userId);
- }
- PolicyVersion versionEntity = (PolicyVersion) controller.getEntityItem(PolicyVersion.class, "policyName", oldpolicyName);
- versionEntity.setPolicyName(policyName);
- versionEntity.setModifiedBy(userId);
- controller.updateData(versionEntity);
- String movePolicyCheck = policyName.substring(policyName.lastIndexOf(File.separator)+1);
- String moveOldPolicyCheck = oldpolicyName.substring(oldpolicyName.lastIndexOf(File.separator)+1);
- if(movePolicyCheck.equals(moveOldPolicyCheck)){
- controller.watchPolicyFunction(versionEntity, oldpolicyName, "Move");
- }else{
- controller.watchPolicyFunction(versionEntity, oldpolicyName, "Rename");
+ String oldPolicyNameWithoutExtension = removeoldPolicyExtension;
+ String newPolicyNameWithoutExtension = removenewPolicyExtension;
+ if(removeoldPolicyExtension.endsWith(".xml")){
+ oldPolicyNameWithoutExtension = oldPolicyNameWithoutExtension.substring(0, oldPolicyNameWithoutExtension.indexOf("."));
+ newPolicyNameWithoutExtension = newPolicyNameWithoutExtension.substring(0, newPolicyNameWithoutExtension.indexOf("."));
+ }
+ entity.setPolicyName(entity.getPolicyName().replace(oldPolicyNameWithoutExtension, newPolicyNameWithoutExtension));
+ entity.setPolicyData(entity.getPolicyData().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
+ entity.setScope(newScope);
+ entity.setModifiedBy(userId);
+ if(newpolicyName.contains("Config_")){
+ String oldConfigurationName = configEntity.getConfigurationName();
+ configEntity.setConfigurationName(configEntity.getConfigurationName().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
+ controller.updateData(configEntity);
+ String newConfigurationName = configEntity.getConfigurationName();
+ File file = new File(PolicyController.configHome + File.separator + oldConfigurationName);
+ if(file.exists()){
+ File renamefile = new File(PolicyController.configHome + File.separator + newConfigurationName);
+ file.renameTo(renamefile);
+ }
+ }else if(newpolicyName.contains("Action_")){
+ String oldConfigurationName = actionEntity.getActionBodyName();
+ actionEntity.setActionBody(actionEntity.getActionBody().replace(oldScope +"."+oldPolicyNameWithoutExtension, newScope+"."+newPolicyNameWithoutExtension));
+ controller.updateData(actionEntity);
+ String newConfigurationName = actionEntity.getActionBodyName();
+ File file = new File(PolicyController.actionHome + File.separator + oldConfigurationName);
+ if(file.exists()){
+ File renamefile = new File(PolicyController.actionHome + File.separator + newConfigurationName);
+ file.renameTo(renamefile);
}
}
+ controller.updateData(entity);
+
+ PolicyVersion versionEntity = (PolicyVersion) controller.getEntityItem(PolicyVersion.class, "policyName", oldpolicyName);
+ versionEntity.setPolicyName(policyName);
+ versionEntity.setModifiedBy(userId);
+ controller.updateData(versionEntity);
+ String movePolicyCheck = policyName.substring(policyName.lastIndexOf(File.separator)+1);
+ String moveOldPolicyCheck = oldpolicyName.substring(oldpolicyName.lastIndexOf(File.separator)+1);
+ if(movePolicyCheck.equals(moveOldPolicyCheck)){
+ controller.watchPolicyFunction(versionEntity, oldpolicyName, "Move");
+ }else{
+ controller.watchPolicyFunction(versionEntity, oldpolicyName, "Rename");
+ }
return success();
} catch (Exception e) {
LOGGER.error("Exception Occured"+e);
@@ -970,7 +1001,6 @@ public class PolicyManagerServlet extends HttpServlet {
//Check PolicyEntity table with newPolicy Name
String policyEntityquery = "FROM PolicyEntity where policyName = '"+newPolicySplit[1]+"' and scope ='"+newPolicySplit[0]+"'";
- System.out.println(policyEntityquery);
List<Object> queryData = controller.getDataByQuery(policyEntityquery);
if(!queryData.isEmpty()){
entity = (PolicyEntity) queryData.get(0);
@@ -986,7 +1016,6 @@ public class PolicyManagerServlet extends HttpServlet {
controller.deleteData(entity);
//Query the Policy Entity with oldPolicy Name
policyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
- System.out.println(policyEntityquery);
queryData = controller.getDataByQuery(policyEntityquery);
if(!queryData.isEmpty()){
entity = (PolicyEntity) queryData.get(0);
@@ -1004,7 +1033,6 @@ public class PolicyManagerServlet extends HttpServlet {
}else{
//Query the Policy Entity with oldPolicy Name
policyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
- System.out.println(policyEntityquery);
queryData = controller.getDataByQuery(policyEntityquery);
if(!queryData.isEmpty()){
entity = (PolicyEntity) queryData.get(0);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
index 3aee634fd..5d8460bf6 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
@@ -63,7 +63,6 @@ public class PolicyNotificationMail{
return mailSender;
}
- @SuppressWarnings("resource")
public void sendMail(PolicyVersion entityItem, String policyName, String mode, CommonClassDao policyNotificationDao) throws MessagingException {
String from = PolicyController.smtpUsername;
String to = "";
@@ -71,37 +70,37 @@ public class PolicyNotificationMail{
String message = "";
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
- if(mode.equalsIgnoreCase("EditPolicy")){
+ if("EditPolicy".equalsIgnoreCase(mode)){
subject = "Policy has been Updated : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been Updated" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n' + "Active Version : " +entityItem.getActiveVersion()
+ '\n' + '\n' + "Modified By : " +entityItem.getModifiedBy() + '\n' + "Modified Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("Rename")){
+ if("Rename".equalsIgnoreCase(mode)){
subject = "Policy has been Renamed : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been Renamed" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n' + "Active Version : " +entityItem.getActiveVersion()
+ '\n' + '\n' + "Renamed By : " +entityItem.getModifiedBy() + '\n' + "Renamed Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("DeleteAll")){
+ if("DeleteAll".equalsIgnoreCase(mode)){
subject = "Policy has been Deleted : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been Deleted with All Versions" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n'
+ '\n' + '\n' + "Deleted By : " +entityItem.getModifiedBy() + '\n' + "Deleted Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("DeleteOne")){
+ if("DeleteOne".equalsIgnoreCase(mode)){
subject = "Policy has been Deleted : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been Deleted" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n' +"Policy Version : " +entityItem.getActiveVersion()
+ '\n' + '\n' + "Deleted By : " +entityItem.getModifiedBy() + '\n' + "Deleted Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("DeleteScope")){
+ if("DeleteScope".equalsIgnoreCase(mode)){
subject = "Scope has been Deleted : "+entityItem.getPolicyName();
message = "The Scope Which you are watching in " + PolicyController.smtpApplicationName + " has been Deleted" + '\n' + '\n' + '\n'+ "Scope + Scope Name : " + policyName + '\n'
+ '\n' + '\n' + "Deleted By : " +entityItem.getModifiedBy() + '\n' + "Deleted Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("SwitchVersion")){
+ if("SwitchVersion".equalsIgnoreCase(mode)){
subject = "Policy has been SwitchedVersion : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been SwitchedVersion" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n' + "Active Version : " +entityItem.getActiveVersion()
+ '\n' + '\n' + "Switched By : " +entityItem.getModifiedBy() + '\n' + "Switched Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
- if(mode.equalsIgnoreCase("Move")){
+ if("Move".equalsIgnoreCase(mode)){
subject = "Policy has been Moved to Other Scope : "+entityItem.getPolicyName();
message = "The Policy Which you are watching in " + PolicyController.smtpApplicationName + " has been Moved to Other Scope" + '\n' + '\n' + '\n'+ "Scope + Policy Name : " + policyName + '\n' + "Active Version : " +entityItem.getActiveVersion()
+ '\n' + '\n' + "Moved By : " +entityItem.getModifiedBy() + '\n' + "Moved Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
@@ -141,23 +140,26 @@ public class PolicyNotificationMail{
sendFlag = true;
}
if(sendFlag){
- to = list.getLoginIds()+"@"+PolicyController.smtpEmailExtension;
- to = to.trim();
- AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
- ctx.register(PolicyNotificationMail.class);
- ctx.refresh();
- JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class);
- MimeMessage mimeMessage = mailSender.createMimeMessage();
- MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage);
+ AnnotationConfigApplicationContext ctx = null;
try {
+ to = list.getLoginIds()+"@"+PolicyController.smtpEmailExtension;
+ to = to.trim();
+ ctx = new AnnotationConfigApplicationContext();
+ ctx.register(PolicyNotificationMail.class);
+ ctx.refresh();
+ JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class);
+ MimeMessage mimeMessage = mailSender.createMimeMessage();
+ MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage);
mailMsg.setFrom(new InternetAddress(from, "Policy Notification System"));
+ mailMsg.setTo(to);
+ mailMsg.setSubject(subject);
+ mailMsg.setText(message);
+ mailSender.send(mimeMessage);
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Exception Occured in Policy Notification" +e);
+ }finally{
+ ctx.close();
}
- mailMsg.setTo(to);
- mailMsg.setSubject(subject);
- mailMsg.setText(message);
- mailSender.send(mimeMessage);
}
}
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
index 75e3d0b8a..4f0710b3e 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
@@ -246,7 +246,7 @@ public class PolicyRestController extends RestrictedBaseController{
String newFile = file.toString();
uri = uri +"&dictionaryName="+newFile;
} catch (Exception e2) {
- e2.printStackTrace();
+ LOGGER.error("Exception Occured while calling PAP with import dictionary request"+e2);
}
}
@@ -270,7 +270,7 @@ public class PolicyRestController extends RestrictedBaseController{
try {
root = mapper.readTree(request.getReader());
}catch (Exception e1) {
- e1.printStackTrace();
+ LOGGER.error("Exception Occured while calling PAP"+e1);
}
ObjectMapper mapper1 = new ObjectMapper();
@@ -281,7 +281,7 @@ public class PolicyRestController extends RestrictedBaseController{
Object content = new ByteArrayInputStream(json.getBytes());
- if (content != null && (content instanceof InputStream)) {
+ if (content instanceof InputStream) {
// send current configuration
try (OutputStream os = connection.getOutputStream()) {
int count = IOUtils.copy((InputStream) content, os);
@@ -300,7 +300,9 @@ public class PolicyRestController extends RestrictedBaseController{
boundary = "===" + System.currentTimeMillis() + "===";
connection.setRequestProperty("Content-Type","multipart/form-data; boundary=" + boundary);
try (OutputStream os = connection.getOutputStream()) {
- IOUtils.copy((InputStream) item.getInputStream(), os);
+ if(item != null){
+ IOUtils.copy((InputStream) item.getInputStream(), os);
+ }
}
}
}
@@ -385,7 +387,7 @@ public class PolicyRestController extends RestrictedBaseController{
String uri = request.getRequestURI();
String body = callPAP(request, response, "POST", uri.replaceFirst("/", "").trim());
if(body.contains("CouldNotConnectException")){
- List<String> data = new ArrayList<String>();
+ List<String> data = new ArrayList<>();
data.add("Elastic Search Server is down");
resultList = data;
}else{
@@ -411,7 +413,7 @@ public class PolicyRestController extends RestrictedBaseController{
try{
resultList = json.get("policyresult");
}catch(Exception e){
- List<String> data = new ArrayList<String>();
+ List<String> data = new ArrayList<>();
data.add("Elastic Search Server is down");
resultList = data;
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyUserInfoController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyUserInfoController.java
index a170b34aa..4e6201880 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyUserInfoController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyUserInfoController.java
@@ -48,7 +48,7 @@ public class PolicyUserInfoController extends RestrictedBaseController{
JsonMessage msg = null;
try {
String userId = UserUtils.getUserSession(request).getOrgUserId();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("userid", userId);
msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/RESTfulPAPEngine.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/RESTfulPAPEngine.java
index d9fe9fa11..6c970ad59 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/RESTfulPAPEngine.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/RESTfulPAPEngine.java
@@ -438,7 +438,7 @@ public class RESTfulPAPEngine extends StdPDPItemSetChangeNotifier implements PAP
LOGGER.info("Success. We have a return object.");
String isValidData = connection.getHeaderField("isValidData");
String isSuccess = connection.getHeaderField("successMapKey");
- Map<String, String> successMap = new HashMap<String, String>();
+ Map<String, String> successMap = new HashMap<>();
if (isValidData != null && isValidData.equalsIgnoreCase("true")){
LOGGER.info("Policy Data is valid.");
return true;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/HumanPolicyComponent.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/HumanPolicyComponent.java
index c80ccd6a6..f788fb673 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/HumanPolicyComponent.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/HumanPolicyComponent.java
@@ -121,12 +121,9 @@ public class HumanPolicyComponent{
JSONObject result = new JSONObject();
result.put("html", html);
return result;
- //ByteArrayInputStream is = new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8));
} catch (IllegalArgumentException e) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "cannot build html area por policy", e);
- /*AdminNotification.warn("An error has occurred. Cannot describe this policy: " +
- e.getMessage());*/
}
return null;
}
@@ -179,7 +176,7 @@ class HtmlProcessor extends SimpleCallback {
private static Map<String, String> function2human;
static {
- function2human = new HashMap<String, String>();
+ function2human = new HashMap<>();
function2human.put(HumanPolicyComponent.FUNCTION_STRING_EQUAL, "equal");
function2human.put(HumanPolicyComponent.FUNCTION_STRING_EQUAL_IGNORE, "equal");
function2human.put(HumanPolicyComponent.FUNCTION_STRING_ONE_AND_ONLY, "one-and-only");
@@ -189,7 +186,7 @@ class HtmlProcessor extends SimpleCallback {
private static Map<String, String> combiningAlgo2human;
static {
- combiningAlgo2human = new HashMap<String, String>();
+ combiningAlgo2human = new HashMap<>();
combiningAlgo2human.put("deny-overrides", "to deny if any $placeholder$ below evaluates to <i>deny</i>");
combiningAlgo2human.put("permit-overrides", "to permit if any $placeholder$ below evaluates to <i>permit</i>");
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
index 6e40c2be2..f5cc5d0fa 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/components/PolicyImportWindow.java
@@ -86,11 +86,11 @@ public class PolicyImportWindow{
try {
extractFile = new TarArchiveInputStream (new FileInputStream(this.newfile.toFile()));
} catch (FileNotFoundException e1) {
- e1.printStackTrace();
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Exception while Importing Polcies"+e1);
}
//Create a loop to read every single entry in TAR file
try {
- while ((entry = extractFile.getNextTarEntry()) != null) {
+ while (extractFile!=null && (entry = extractFile.getNextTarEntry()) != null) {
this.superadmin = true;
try{
copyFileToLocation(extractFile, entry, xacmlFiles, null, superadmin);
@@ -100,6 +100,14 @@ public class PolicyImportWindow{
}
} catch (IOException e) {
LOGGER.error("Exception Occured"+e);
+ }finally{
+ try {
+ if(extractFile != null){
+ extractFile.close();
+ }
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured"+e);
+ }
}
}
@@ -149,7 +157,9 @@ public class PolicyImportWindow{
// Close Output Stream
try {
- outputFile.close();
+ if(outputFile != null){
+ outputFile.close();
+ }
} catch (IOException e) {
LOGGER.info("IOException:" +e);
LOGGER.error("Exception Occured"+e);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
index b3db51df4..9f7659d15 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
@@ -26,16 +26,19 @@ package org.openecomp.policy.conf;
* */
import java.util.Properties;
-import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.controller.PolicyController;
import org.openecomp.policy.rest.jpa.SystemLogDB;
@SuppressWarnings("deprecation")
public class HibernateSession{
+ private static final Logger LOGGER = FlexLogger.getLogger(HibernateSession.class);
+
private static SessionFactory logSessionFactory;
static {
@@ -49,11 +52,11 @@ public class HibernateSession{
prop.setProperty("show_sql", "false");
logSessionFactory = new Configuration().addPackage("org.openecomp.policy.*").addProperties(prop)
.addAnnotatedClass(SystemLogDB.class).buildSessionFactory();
- } catch (Throwable ex) {
- throw new ExceptionInInitializerError(ex);
+ } catch (Exception ex) {
+ LOGGER.error("Exception Occured while creating Log database Hibernate session"+ex);
}
}
- public static Session getSession() throws HibernateException {
+ public static Session getSession(){
return logSessionFactory.openSession();
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
index b0bbaf9cf..2c68df65f 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
@@ -63,12 +63,12 @@ public class ActionPolicyController extends RestrictedBaseController{
private ArrayList<Object> attributeList;
protected LinkedList<Integer> ruleAlgoirthmTracker;
public static final String PERFORMER_ATTRIBUTEID = "performer";
- protected Map<String, String> performer = new HashMap<String, String>();
+ protected Map<String, String> performer = new HashMap<>();
private ArrayList<Object> ruleAlgorithmList;
public void prePopulateActionPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- attributeList = new ArrayList<Object>();
- ruleAlgorithmList = new ArrayList<Object>();
+ attributeList = new ArrayList<>();
+ ruleAlgorithmList = new ArrayList<>();
performer.put("PDP", "PDPAction");
performer.put("PEP", "PEPAction");
@@ -116,7 +116,7 @@ public class ActionPolicyController extends RestrictedBaseController{
String attributeId = designator.getAttributeId();
// Component attributes are saved under Target here we are fetching them back.
// One row is default so we are not adding dynamic component at index 0.
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
attribute.put("key", attributeId);
attribute.put("value", value);
attributeList.add(attribute);
@@ -137,7 +137,7 @@ public class ActionPolicyController extends RestrictedBaseController{
if (condition != null) {
int index = 0;
ApplyType actionApply = (ApplyType) condition.getExpression().getValue();
- ruleAlgoirthmTracker = new LinkedList<Integer>();
+ ruleAlgoirthmTracker = new LinkedList<>();
// Populating Rule Algorithms starting from compound.
prePopulateCompoundRuleAlgorithm(index, actionApply);
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AdminTabController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AdminTabController.java
index 46fb2bbfe..6824101df 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AdminTabController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AdminTabController.java
@@ -57,7 +57,7 @@ public class AdminTabController extends RestrictedBaseController{
@RequestMapping(value={"/get_LockDownData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getAdminTabEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("lockdowndata", mapper.writeValueAsString(commonClassDao.getData(GlobalRoleSettings.class)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AutoPushController.java
index 8751d735c..17e8f89f2 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AutoPushController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/AutoPushController.java
@@ -108,11 +108,11 @@ public class AutoPushController extends RestrictedBaseController{
List<String> roles = null;
data = new ArrayList<Object>();
String userId = UserUtils.getUserSession(request).getOrgUserId();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
List<Object> userRoles = PolicyController.getRoles(userId);
- roles = new ArrayList<String>();
- scopes = new HashSet<String>();
+ roles = new ArrayList<>();
+ scopes = new HashSet<>();
for(Object role: userRoles){
Roles userRole = (Roles) role;
roles.add(userRole.getRole());
@@ -161,8 +161,8 @@ public class AutoPushController extends RestrictedBaseController{
@RequestMapping(value={"/auto_Push/PushPolicyToPDP.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
public ModelAndView PushPolicyToPDPGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
try {
- ArrayList<Object> selectedPDPS = new ArrayList<Object>();
- ArrayList<String> selectedPoliciesInUI = new ArrayList<String>();
+ ArrayList<Object> selectedPDPS = new ArrayList<>();
+ ArrayList<String> selectedPoliciesInUI = new ArrayList<>();
this.groups.addAll(PolicyController.getPapEngine().getEcompPDPGroups());
ObjectMapper mapper = new ObjectMapper();
this.container = new PDPGroupContainer(PolicyController.getPapEngine());
@@ -185,8 +185,8 @@ public class AutoPushController extends RestrictedBaseController{
}
for (Object pdpDestinationGroupId : selectedPDPS) {
- Set<PDPPolicy> currentPoliciesInGroup = new HashSet<PDPPolicy>();
- Set<PDPPolicy> selectedPolicies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> currentPoliciesInGroup = new HashSet<>();
+ Set<PDPPolicy> selectedPolicies = new HashSet<>();
for (String policyId : selectedPoliciesInUI) {
logger.debug("Handlepolicies..." + pdpDestinationGroupId + policyId);
@@ -329,7 +329,7 @@ public class AutoPushController extends RestrictedBaseController{
String data = removePolicyData.get(i).toString();
AutoPushController.policyContainer.removeItem(data);
}
- Set<PDPPolicy> changedPolicies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> changedPolicies = new HashSet<>();
changedPolicies.addAll((Collection<PDPPolicy>) AutoPushController.policyContainer.getItemIds());
StdPDPGroup updatedGroupObject = new StdPDPGroup(group.getId(), group.isDefaultGroup(), group.getName(), group.getDescription(),null);
updatedGroupObject.setPolicies(changedPolicies);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
index 265b7b7b2..daab6e378 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
@@ -88,7 +88,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
@RequestMapping(value={"/policyController/getBRMSTemplateData.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
public ModelAndView getBRMSParamPolicyRuleData(HttpServletRequest request, HttpServletResponse response) throws Exception{
- dynamicLayoutMap = new HashMap<String, String>();
+ dynamicLayoutMap = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
@@ -211,8 +211,8 @@ public class CreateBRMSParamController extends RestrictedBaseController {
@SuppressWarnings("unchecked")
public void prePopulateBRMSParamPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- attributeList = new ArrayList<Object>();
- dynamicLayoutMap = new HashMap<String, String>();
+ attributeList = new ArrayList<>();
+ dynamicLayoutMap = new HashMap<>();
if (policyAdapter.getPolicyData() instanceof PolicyType) {
PolicyType policy = (PolicyType) policyAdapter.getPolicyData();
policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
@@ -235,7 +235,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
for( AdviceExpressionType adviceExpression: expressionTypes.getAdviceExpression()){
for(AttributeAssignmentExpressionType attributeAssignment: adviceExpression.getAttributeAssignmentExpression()){
if(attributeAssignment.getAttributeId().startsWith("key:")){
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
String key = attributeAssignment.getAttributeId().replace("key:", "");
attribute.put("key", key);
JAXBElement<AttributeValueType> attributevalue = (JAXBElement<AttributeValueType>) attributeAssignment.getExpression();
@@ -258,7 +258,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
// Get the target data under policy.
policyAdapter.setDynamicLayoutMap(dynamicLayoutMap);
if(policyAdapter.getDynamicLayoutMap().size() > 0){
- LinkedHashMap<String,String> drlRule = new LinkedHashMap<String, String>();
+ LinkedHashMap<String,String> drlRule = new LinkedHashMap<>();
for(Object keyValue: policyAdapter.getDynamicLayoutMap().keySet()){
drlRule.put(keyValue.toString(), policyAdapter.getDynamicLayoutMap().get(keyValue).toString());
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
index b31f70297..67945e1b9 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
@@ -80,7 +80,7 @@ public class CreateBRMSRawController{
for( AdviceExpressionType adviceExpression: expressionTypes.getAdviceExpression()){
for(AttributeAssignmentExpressionType attributeAssignment: adviceExpression.getAttributeAssignmentExpression()){
if(attributeAssignment.getAttributeId().startsWith("key:")){
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
String key = attributeAssignment.getAttributeId().replace("key:", "");
attribute.put("key", key);
JAXBElement<AttributeValueType> attributevalue = (JAXBElement<AttributeValueType>) attributeAssignment.getExpression();
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
index d2a2845e8..ccecf5d7f 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
@@ -83,11 +83,11 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
ClosedLoopGridJSONData policyJsonData = mapper.readValue(root.get("policyData").get("policy").toString(), ClosedLoopGridJSONData.class);
ClosedLoopFaultBody jsonBody = mapper.readValue(root.get("policyData").get("policy").get("jsonBodyData").toString(), ClosedLoopFaultBody.class);
- ArrayList<Object> trapSignatureDatas = new ArrayList<Object>();
+ ArrayList<Object> trapSignatureDatas = new ArrayList<>();
if(trapDatas.getTrap1() != null){
trapSignatureDatas.add(trapDatas);
}
- ArrayList<Object> faultSignatureDatas = new ArrayList<Object>();
+ ArrayList<Object> faultSignatureDatas = new ArrayList<>();
if(faultDatas.getTrap1() != null){
faultSignatureDatas.add(faultDatas);
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
index ce6531f38..c3daf6d94 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
@@ -101,23 +101,23 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
@Controller
@RequestMapping("/")
public class CreateDcaeMicroServiceController extends RestrictedBaseController {
- private static final Logger logger = FlexLogger.getLogger(CreateDcaeMicroServiceController.class);
+ private static final Logger LOGGER = FlexLogger.getLogger(CreateDcaeMicroServiceController.class);
private static CommonClassDao commonClassDao;
private MicroServiceModels newModel;
private String newFile;
private String directory;
- private List<String> modelList = new ArrayList<String>();
- private List<String> dirDependencyList = new ArrayList<String>();
- private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
+ private List<String> modelList = new ArrayList<>();
+ private List<String> dirDependencyList = new ArrayList<>();
+ private HashMap<String,MSAttributeObject > classMap = new HashMap<>();
//Tosca Model related Datastructure.
String referenceAttributes;
String attributeString;
String listConstraints;
String subAttributeString;
- HashMap<String, Object> retmap = new HashMap<String, Object>();
- Set<String> uniqueKeys= new HashSet<String>();
- Set<String> uniqueDataKeys= new HashSet<String>();
+ HashMap<String, Object> retmap = new HashMap<>();
+ Set<String> uniqueKeys= new HashSet<>();
+ Set<String> uniqueDataKeys= new HashSet<>();
@Autowired
private CreateDcaeMicroServiceController(CommonClassDao commonClassDao){
@@ -128,8 +128,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
protected PolicyRestAdapter policyAdapter = null;
private int priorityCount;
- private Map<String, String> attributesListRefMap = new HashMap<String, String>();
- private Map<String, LinkedList<String>> arrayTextList = new HashMap<String, LinkedList<String>>();
+ private Map<String, String> attributesListRefMap = new HashMap<>();
+ private Map<String, LinkedList<String>> arrayTextList = new HashMap<>();
public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData, JsonNode root) {
@@ -138,7 +138,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
jsonContent = decodeContent(root.get("policyJSON")).toString();
constructJson(policyData, jsonContent);
}catch(Exception e){
- logger.error("Error while decoding microservice content");
+ LOGGER.error("Error while decoding microservice content");
}
return policyData;
@@ -202,9 +202,9 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
try {
json = om.writeValueAsString(microServiceObject);
} catch (JsonProcessingException e) {
- logger.error("Error writing out the object");
+ LOGGER.error("Error writing out the object");
}
- logger.info(json);
+ LOGGER.info(json);
String cleanJson = cleanUPJson(json);
cleanJson = removeNullAttributes(cleanJson);
policyAdapter.setJsonBody(cleanJson);
@@ -232,7 +232,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
cleanJson = returnNode.toString();
}
} catch (IOException e) {
- logger.error("Error writing out the JsonNode");
+ LOGGER.error("Error writing out the JsonNode");
}
return cleanJson;
}
@@ -268,14 +268,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
try {
is = new FileInputStream(newConfiguration);
} catch (FileNotFoundException e) {
- logger.error(e);
+ LOGGER.error(e);
}
Yaml yaml = new Yaml();
@SuppressWarnings("unchecked")
Map<Object, Object> yamlMap = (Map<Object, Object>) yaml.load(is);
StringBuilder sb = new StringBuilder();
- Map<String, String> settings = new HashMap<String, String>();
+ Map<String, String> settings = new HashMap<>();
if (yamlMap == null) {
return settings;
}
@@ -348,12 +348,11 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
public void parseTosca (String fileName){
- Map<String,String> map= new HashMap<String, String>();
+ Map<String,String> map= new HashMap<>();
try {
map=load(fileName);
for(String key:map.keySet()){
- if(key.contains("policy.nodes.Root"))
- {
+ if(key.contains("policy.nodes.Root")){
continue;
}
else if(key.contains("policy.nodes")){
@@ -369,21 +368,11 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
String subNodeString= key.substring(indexForPolicyNode+12, key.length());
stringBetweenDotsForDataFields(subNodeString,map.get(key));
- Iterator<String> itr= uniqueDataKeys.iterator();
- while(itr.hasNext()){
- logger.info(itr.next());
- }
}
}
- String attributeIndividualString="";
String userDefinedIndividualString="";
- String referenceIndividualAttributes="";
-
- String attributeString="";
String userDefinedString="";
- String referenceAttributes="";
- String listConstraints="";
for(String uniqueDataKey: uniqueDataKeys){
String[] uniqueDataKeySplit= uniqueDataKey.split("%");
@@ -405,7 +394,6 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
}
}
-
}
if(userDefinedString!=""){
userDefinedString=userDefinedString+","+userDefinedIndividualString;
@@ -414,9 +402,9 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
userDefinedIndividualString="";
}
- logger.info("userDefinedString :"+userDefinedString);
+ LOGGER.info("userDefinedString :"+userDefinedString);
- HashMap<String,ArrayList<String>> mapKey= new HashMap<String,ArrayList<String>>();
+ HashMap<String,ArrayList<String>> mapKeyUserdefined= new HashMap<>();
String secondPartString="";
String firstPartString="";
for(String value: userDefinedString.split(",")){
@@ -424,30 +412,27 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
secondPartString=splitWithEquals[0].substring(splitWithEquals[0].indexOf("%")+1);
firstPartString=splitWithEquals[0].substring(0, splitWithEquals[0].indexOf("%"));
ArrayList<String> list;
- if(mapKey.containsKey(firstPartString)){
- list = mapKey.get(firstPartString);
+ if(mapKeyUserdefined.containsKey(firstPartString)){
+ list = mapKeyUserdefined.get(firstPartString);
list.add(secondPartString+"<"+splitWithEquals[1]);
} else {
list = new ArrayList<String>();
list.add(secondPartString+"<"+splitWithEquals[1]);
- mapKey.put(firstPartString, list);
+ mapKeyUserdefined.put(firstPartString, list);
}
}
JSONObject mainObject= new JSONObject();;
JSONObject json;
- for(String s: mapKey.keySet()){
+ for(String s: mapKeyUserdefined.keySet()){
json= new JSONObject();
- List<String> value=mapKey.get(s);
+ List<String> value=mapKeyUserdefined.get(s);
for(String listValue:value){
String[] splitValue=listValue.split("<");
json.put(splitValue[0], splitValue[1]);
}
mainObject.put(s,json);
}
-
- logger.info(mainObject);
-
Iterator<String> keysItr = mainObject.keys();
while(keysItr.hasNext()) {
String key = keysItr.next();
@@ -455,138 +440,116 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
retmap.put(key, value);
}
- for(String str:retmap.keySet()){
- logger.info(str+":"+retmap.get(str));
- }
+ LOGGER.info("#############################################################################");
+ LOGGER.info(mainObject);
+ LOGGER.info("###############################################################################");
- String typeValueFromKey="";
- boolean userDefinedDataType=false;
- boolean isList=false;
+ HashMap<String,HashMap<String,String>> mapKey= new HashMap<>();
for(String uniqueKey: uniqueKeys){
- List<String> constraints= new ArrayList<String>();
- logger.info("====================");
- attributeIndividualString=attributeIndividualString+uniqueKey+"=";
- attributeIndividualString=attributeIndividualString+"#A:defaultValue-#B:required-#C:MANY-false";
+ HashMap<String,String> hm;
- logger.info("UniqueStrings: "+uniqueKey);
for(String key:map.keySet()){
- if(key.contains("policy.nodes.Root")||
- key.contains("policy.data"))
- {
- continue;
- }
- else if(key.contains("policy.nodes")){
- if(key.contains(uniqueKey)){
- int p=key.lastIndexOf(".");
- String firstLastOccurance=key.substring(0,p);
- int p1=firstLastOccurance.lastIndexOf(".");
- String secondLastOccurance= firstLastOccurance.substring(p1+1,firstLastOccurance.length());
- if(secondLastOccurance.equals(uniqueKey)){
- String checkTypeString= firstLastOccurance+".type";
- typeValueFromKey= map.get(checkTypeString);
- }//Its a list.
- else if (key.contains("entry_schema")){
- if(key.contains("constraints")){
- constraints.add(map.get(key));
- }
- if(key.contains("type")){
- isList=true;
- String value= map.get(key);
- if(! (value.contains("string")) ||
- (value.contains("integer")) ||
- (value.contains("boolean")) )
- {
- if(!key.contains("valid_values")){
- String trimValue=value.substring(value.lastIndexOf(".")+1);
- referenceIndividualAttributes=referenceIndividualAttributes+uniqueKey+"="+trimValue+":MANY-true";
- attributeIndividualString="";
- }
-
- }
- }
- }
-
- if(!(typeValueFromKey.equals("string")||
- typeValueFromKey.equals("integer") ||
- typeValueFromKey.equals("boolean")))
- {
- if(typeValueFromKey.equals("list")){
- isList=true;
- userDefinedDataType=false;
- }
- else{
- userDefinedDataType=true;
- }
- }
- if(userDefinedDataType==false && isList==false){
- if(key.contains("default")){
- attributeIndividualString=attributeIndividualString.replace("#B", map.get(key));
- }
- else if(key.contains("required")){
- attributeIndividualString=attributeIndividualString.replace("#C", map.get(key));
+ if(key.contains(uniqueKey)){
+ if(mapKey.containsKey(uniqueKey)){
+ hm = mapKey.get(uniqueKey);
+ String keyStr= key.substring(key.lastIndexOf(".")+1);
+ String valueStr= map.get(key);
+ if(keyStr.equals("type")){
+ if(!key.contains("entry_schema")){
+ hm.put(keyStr,valueStr);
}
- else if(key.contains("type")){
- String typeValue= map.get(key);
- attributeIndividualString=attributeIndividualString.replace("#A", typeValue);
- }
+ }else{
+ hm.put(keyStr,valueStr);
}
- else if(userDefinedDataType==true){
- String checkTypeAndUpdate=key.substring(p+1);
- if(checkTypeAndUpdate.equals("type")){
- String value=map.get(key);
- String trimValue=value.substring(value.lastIndexOf(".")+1);
- referenceIndividualAttributes=referenceIndividualAttributes+uniqueKey+"="+trimValue+":MANY-false";
+ } else {
+ hm = new HashMap<>();
+ String keyStr= key.substring(key.lastIndexOf(".")+1);
+ String valueStr= map.get(key);
+ if(keyStr.equals("type")){
+ if(!key.contains("entry_schema")){
+ hm.put(keyStr,valueStr);
}
- attributeIndividualString="";
+ }else{
+ hm.put(keyStr,valueStr);
}
+ mapKey.put(uniqueKey, hm);
}
}
}
+ }
+ StringBuilder attributeStringBuilder= new StringBuilder();
+ StringBuilder referenceStringBuilder= new StringBuilder();
+ StringBuilder listBuffer= new StringBuilder();
+
+ List<String> constraints= new ArrayList<>();
+ for(String keySetString: mapKey.keySet()){
+ HashMap<String,String> keyValues=mapKey.get(keySetString);
+ if(keyValues.get("type").equalsIgnoreCase("string")|| keyValues.get("type").equalsIgnoreCase("integer")){
+ StringBuilder attributeIndividualStringBuilder= new StringBuilder();
+ attributeIndividualStringBuilder.append(keySetString+"=");
+ attributeIndividualStringBuilder.append(keyValues.get("type")+":defaultValue-");
+ attributeIndividualStringBuilder.append(keyValues.get("default")+":required-");
+ attributeIndividualStringBuilder.append(keyValues.get("required")+":MANY-false");
+ attributeStringBuilder.append(attributeIndividualStringBuilder+",");
+ }
+ else if(keyValues.get("type").equalsIgnoreCase("list")){
+ //List Datatype
+ Set<String> keys= keyValues.keySet();
+ Iterator<String> itr=keys.iterator();
+ while(itr.hasNext()){
+ String key= itr.next().toString();
+ if((!key.equals("type"))){
+ String value= keyValues.get(key);
+ //The "." in the value determines if its a string or a user defined type.
+ if (!value.contains(".")){
+ //This is string
+ constraints.add(keyValues.get(key));
+ }else{
+ //This is user defined string
+ String trimValue=value.substring(value.lastIndexOf(".")+1);
+ StringBuilder referenceIndividualStringBuilder= new StringBuilder();
+ referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-true");
+ referenceStringBuilder.append(referenceIndividualStringBuilder+",");
+ }
+ }
+ }
+ }else{
+ //User defined Datatype.
+ String value=keyValues.get("type");
+ String trimValue=value.substring(value.lastIndexOf(".")+1);
+ StringBuilder referenceIndividualStringBuilder= new StringBuilder();
+ referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-false");
+ referenceStringBuilder.append(referenceIndividualStringBuilder+",");
+ }
if(constraints!=null &&constraints.isEmpty()==false){
//List handling.
- listConstraints=uniqueKey.toUpperCase()+"=[";
- isList=true;
+ listBuffer.append(keySetString.toUpperCase()+"=[");
for(String str:constraints){
- listConstraints=listConstraints+str+",";
+ listBuffer.append(str+",");
}
- listConstraints+="],";
- logger.info(listConstraints);
- attributeIndividualString="";
- referenceIndividualAttributes=referenceIndividualAttributes+uniqueKey+"="+uniqueKey.toUpperCase()+":MANY-false";
- constraints=null;
+ listBuffer.append("]#");
+ LOGGER.info(listBuffer);
- }
- if(userDefinedDataType==false && isList==false){
- if(attributeString!=""){
- attributeString=attributeString+","+attributeIndividualString;
- }else{
- attributeString=attributeString+attributeIndividualString;
- }
- }
- if(isList==true || userDefinedDataType==true){
- if(referenceAttributes!=""){
- referenceAttributes=referenceAttributes+","+referenceIndividualAttributes;
- }else{
- referenceAttributes=referenceAttributes+referenceIndividualAttributes;
- }
- logger.info("ReferenceAttributes: "+referenceAttributes);
- }
- logger.info("AttributeString: "+ attributeString);
- logger.info("ListConstraints is: "+listConstraints);
+ StringBuilder referenceIndividualStringBuilder= new StringBuilder();
+ referenceIndividualStringBuilder.append(keySetString+"="+keySetString.toUpperCase()+":MANY-false");
+ referenceStringBuilder.append(referenceIndividualStringBuilder+",");
+ constraints.clear();
+ }
+ }
- attributeIndividualString="";
- referenceIndividualAttributes="";
- userDefinedDataType=false;
- isList=false;
+ LOGGER.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
+ LOGGER.info("Whole attribute String is:"+attributeStringBuilder);
+ LOGGER.info("Whole reference String is:"+referenceStringBuilder);
+ LOGGER.info("List String is:"+listBuffer);
+ LOGGER.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
+ this.listConstraints=listBuffer.toString();
+ this.referenceAttributes=referenceStringBuilder.toString();
+ this.attributeString=attributeStringBuilder.toString();
- }
- this.listConstraints=listConstraints;
- this.referenceAttributes=referenceAttributes;
- this.attributeString=attributeString;
} catch (IOException e) {
- logger.error(e);
+ LOGGER.error(e);
}
}
@@ -611,7 +574,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
private JSONObject decodeContent(JsonNode jsonNode){
Iterator<JsonNode> jsonElements = jsonNode.elements();
Iterator<String> jsonKeys = jsonNode.fieldNames();
- Map<String,String> element = new TreeMap<String,String>();
+ Map<String,String> element = new TreeMap<>();
while(jsonElements.hasNext() && jsonKeys.hasNext()){
element.put(jsonKeys.next(), jsonElements.next().toString());
}
@@ -634,7 +597,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
presKey = key;
}
// first check if we are different from old.
- logger.info(key+"\n");
+ LOGGER.info(key+"\n");
if(jsonArray!=null && jsonArray.length()>0 && key.contains("@") && !key.contains(".") && oldValue!=null){
if(!oldValue.equals(key.substring(0,key.indexOf("@")))){
jsonResult.put(oldValue, jsonArray);
@@ -664,7 +627,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
isArray = true;
jsonArray = new JSONArray();
}
- if(arryKey.equals(nodeKey.substring(0,nodeKey.indexOf("@")))){
+ if(jsonArray != null && arryKey.equals(nodeKey.substring(0,nodeKey.indexOf("@")))){
jsonArray.put(decodeContent(node));
}
if(key.contains("@") && !arryKey.equals(key.substring(0,nodeKey.indexOf("@")))){
@@ -696,7 +659,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
isArray = true;
jsonArray = new JSONArray();
}
- if(arryKey.equals(nodeKey.substring(0,nodeKey.indexOf("@")))){
+ if(jsonArray != null && arryKey.equals(nodeKey.substring(0,nodeKey.indexOf("@")))){
jsonArray.put(decodeContent(node));
}
jsonResult.put(arryKey, jsonArray);
@@ -811,8 +774,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
@SuppressWarnings({ "unchecked", "rawtypes" })
private String createMicroSeriveJson(MicroServiceModels returnModel) {
- Map<String, String> attributeMap = new HashMap<String, String>();
- Map<String, String> refAttributeMap = new HashMap<String, String>();
+ Map<String, String> attributeMap = new HashMap<>();
+ Map<String, String> refAttributeMap = new HashMap<>();
String attribute = returnModel.getAttributes();
if(attribute != null){
attribute = attribute.trim();
@@ -882,7 +845,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
@SuppressWarnings("unchecked")
private JSONObject recursiveReference(String name, Map<String,String> subAttributeMap, String enumAttribute) {
JSONObject object = new JSONObject();
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
Object returnClass = subAttributeMap.get(name);
map = (Map<String, String>) returnClass;
JSONArray array = new JSONArray();
@@ -935,7 +898,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
private Set<String> getVersionList(String name) {
MicroServiceModels workingModel = new MicroServiceModels();
- Set<String> list = new HashSet<String>();
+ Set<String> list = new HashSet<>();
List<Object> microServiceModelsData = commonClassDao.getDataById(MicroServiceModels.class, "modelName", name);
for (int i = 0; i < microServiceModelsData.size(); i++) {
workingModel = (MicroServiceModels) microServiceModelsData.get(i);
@@ -972,9 +935,9 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
@RequestMapping(value={"/get_DCAEPriorityValues"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getDCAEPriorityValuesData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
- List<String> priorityList = new ArrayList<String>();
+ List<String> priorityList = new ArrayList<>();
priorityCount = 10;
for (int i = 1; i < priorityCount; i++) {
priorityList.add(String.valueOf(i));
@@ -985,7 +948,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error(e);
+ LOGGER.error(e);
}
}
@@ -1079,7 +1042,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
public static Map<String, String> convert(String str, String split) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
for(final String entry : str.split(split)) {
String[] parts = entry.split("=");
map.put(parts[0], parts[1]);
@@ -1106,14 +1069,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
policyAdapter.setServiceType(msBody.getService());
}
if(msBody.getContent() != null){
- LinkedHashMap<String, Object> data = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> data = new LinkedHashMap<>();
LinkedHashMap<String, ?> map = (LinkedHashMap<String, ?>) msBody.getContent();
readRecursivlyJSONContent(map, data);
policyAdapter.setRuleData(data);
}
} catch (Exception e) {
- logger.error(e);
+ LOGGER.error(e);
}
}
@@ -1124,7 +1087,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
Object key = iterator.next();
Object value = map.get(key);
if(value instanceof LinkedHashMap<?, ?>){
- LinkedHashMap<String, Object> secondObjec = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> secondObjec = new LinkedHashMap<>();
readRecursivlyJSONContent((LinkedHashMap<String, ?>) value, secondObjec);
for(String objKey: secondObjec.keySet()){
data.put(key+"." +objKey, secondObjec.get(objKey));
@@ -1134,7 +1097,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
for(int i = 0; i < jsonArrayVal.size(); i++){
Object arrayvalue = jsonArrayVal.get(i);
if(arrayvalue instanceof LinkedHashMap<?, ?>){
- LinkedHashMap<String, Object> newData = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> newData = new LinkedHashMap<>();
readRecursivlyJSONContent((LinkedHashMap<String, ?>) arrayvalue, newData);
for(String objKey: newData.keySet()){
data.put(key+"@"+i+"." +objKey, newData.get(objKey));
@@ -1171,7 +1134,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
//Convert the map values and set into JSON body
public Map<String, String> convertMap(Map<String, String> attributesMap, Map<String, String> attributesRefMap) {
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
String temp = null;
String key;
String value;
@@ -1236,12 +1199,12 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
}catch(Exception e){
- logger.error("Upload error : " + e);
+ LOGGER.error("Upload error : " + e);
}
}
}
- List<File> fileList = new ArrayList<File>();;
+ List<File> fileList = new ArrayList<>();;
this.directory = "model";
if (zip){
extractFolder(this.newFile);
@@ -1256,7 +1219,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(yml==false){
modelType="xmi";
//Process Main Model file first
- classMap = new HashMap<String,MSAttributeObject>();
+ classMap = new HashMap<>();
for (File file : fileList) {
if(!file.isDirectory() && file.getName().endsWith(".xmi")){
retreiveDependency(file.toString(), true);
@@ -1274,25 +1237,30 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
MSAttributeObject msAttributes= new MSAttributeObject();
msAttributes.setClassName(className);
- HashMap<String, String> returnAttributeList =new HashMap<String, String>();
+ HashMap<String, String> returnAttributeList =new HashMap<>();
returnAttributeList.put(className, this.attributeString);
msAttributes.setAttribute(returnAttributeList);
msAttributes.setSubClass(this.retmap);
- HashMap<String, String> returnReferenceList =new HashMap<String, String>();
+ HashMap<String, String> returnReferenceList =new HashMap<>();
//String[] referenceArray=this.referenceAttributes.split("=");
returnReferenceList.put(className, this.referenceAttributes);
msAttributes.setRefAttribute(returnReferenceList);
if(this.listConstraints!=""){
- HashMap<String, String> enumList =new HashMap<String, String>();
- String[] listArray=this.listConstraints.split("=");
- enumList.put(listArray[0], listArray[1]);
+ HashMap<String, String> enumList =new HashMap<>();
+ String[] listArray=this.listConstraints.split("#");
+ for(String str:listArray){
+ String[] strArr= str.split("=");
+ if(strArr.length>1){
+ enumList.put(strArr[0], strArr[1]);
+ }
+ }
msAttributes.setEnumType(enumList);
}
- classMap=new HashMap<String,MSAttributeObject>();
+ classMap=new HashMap<>();
classMap.put(className, msAttributes);
}
@@ -1319,7 +1287,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
int BUFFER = 2048;
File file = new File(zipFile);
- ZipFile zip;
+ ZipFile zip = null;
try {
zip = new ZipFile(file);
String newPath = "model" + File.separator + zipFile.substring(0, zipFile.length() - 4);
@@ -1357,19 +1325,26 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
}
} catch (IOException e) {
- logger.error("Failed to unzip model file " + zipFile);
+ LOGGER.error("Failed to unzip model file " + zipFile);
+ }finally{
+ try {
+ if(zip != null)
+ zip.close();
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured While closing zipfile " + e);
+ }
}
}
private void retreiveDependency(String workingFile, Boolean modelClass) {
MSModelUtils utils = new MSModelUtils(PolicyController.msEcompName, PolicyController.msPolicyName);
- HashMap<String, MSAttributeObject> tempMap = new HashMap<String, MSAttributeObject>();
+ HashMap<String, MSAttributeObject> tempMap = new HashMap<>();
tempMap = utils.processEpackage(workingFile, MODEL_TYPE.XMI);
classMap.putAll(tempMap);
- logger.info(tempMap);
+ LOGGER.info(tempMap);
return;
@@ -1377,7 +1352,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
private List<File> listModelFiles(String directoryName) {
File directory = new File(directoryName);
- List<File> resultList = new ArrayList<File>();
+ List<File> resultList = new ArrayList<>();
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
@@ -1395,7 +1370,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
try {
FileUtils.forceDelete(new File(path));
} catch (IOException e) {
- logger.error("Failed to delete folder " + path);
+ LOGGER.error("Failed to delete folder " + path);
}
}
}
@@ -1409,7 +1384,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
private List<String> createList() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (Entry<String, MSAttributeObject> cMap : classMap.entrySet()){
if (cMap.getValue().isPolicyTempalate()){
list.add(cMap.getKey());
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
index 1326aba7d..4aea6370b 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
@@ -41,6 +41,7 @@ import org.openecomp.policy.rest.adapter.AddressGroupJson;
import org.openecomp.policy.rest.adapter.AddressJson;
import org.openecomp.policy.rest.adapter.AddressMembers;
import org.openecomp.policy.rest.adapter.DeployNowJson;
+import org.openecomp.policy.rest.adapter.IdMap;
import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
import org.openecomp.policy.rest.adapter.PrefixIPList;
import org.openecomp.policy.rest.adapter.ServiceGroupJson;
@@ -51,6 +52,7 @@ import org.openecomp.policy.rest.adapter.TagDefines;
import org.openecomp.policy.rest.adapter.Tags;
import org.openecomp.policy.rest.adapter.Term;
import org.openecomp.policy.rest.adapter.TermCollector;
+import org.openecomp.policy.rest.adapter.VendorSpecificData;
import org.openecomp.policy.rest.dao.CommonClassDao;
import org.openecomp.policy.rest.jpa.AddressGroup;
import org.openecomp.policy.rest.jpa.FWTagPicker;
@@ -94,8 +96,8 @@ public class CreateFirewallController extends RestrictedBaseController {
private List<String> tagCollectorList;
private String jsonBody;
- List<String> expandablePrefixIPList = new ArrayList<String>();
- List<String> expandableServicesList= new ArrayList<String>();
+ List<String> expandablePrefixIPList = new ArrayList<>();
+ List<String> expandableServicesList= new ArrayList<>();
@Autowired
private CreateFirewallController(CommonClassDao commonClassDao){
CreateFirewallController.commonClassDao = commonClassDao;
@@ -122,9 +124,8 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
jsonBody = constructJson(policyData);
- if (jsonBody != null || jsonBody.equalsIgnoreCase("")) {
+ if (jsonBody != null && !jsonBody.equalsIgnoreCase("")) {
policyData.setJsonBody(jsonBody);
-
} else {
policyData.setJsonBody("{}");
}
@@ -136,7 +137,7 @@ public class CreateFirewallController extends RestrictedBaseController {
private List<String> mapping(String expandableList) {
String value = new String();
String desc = new String();
- List <String> valueDesc= new ArrayList<String>();
+ List <String> valueDesc= new ArrayList<>();
List<Object> prefixListData = commonClassDao.getData(PrefixList.class);
for (int i = 0; i< prefixListData.size(); i++) {
PrefixList prefixList = (PrefixList) prefixListData.get(i);
@@ -190,7 +191,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
public void prePopulateFWPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- attributeList = new ArrayList<Object>();
+ attributeList = new ArrayList<>();
if (policyAdapter.getPolicyData() instanceof PolicyType) {
Object policyData = policyAdapter.getPolicyData();
PolicyType policy = (PolicyType) policyData;
@@ -232,14 +233,15 @@ public class CreateFirewallController extends RestrictedBaseController {
}
Map<String, String> termTagMap=null;
-
- for(int i=0;i<tc1.getFirewallRuleList().size();i++){
- termTagMap = new HashMap<String, String>();
- String ruleName= tc1.getFirewallRuleList().get(i).getRuleName();
- String tagPickerName=tc1.getRuleToTag().get(i).getTagPickerName();
- termTagMap.put("key", ruleName);
- termTagMap.put("value", tagPickerName);
- attributeList.add(termTagMap);
+ if(tc1 != null){
+ for(int i=0;i<tc1.getFirewallRuleList().size();i++){
+ termTagMap = new HashMap<String, String>();
+ String ruleName= tc1.getFirewallRuleList().get(i).getRuleName();
+ String tagPickerName=tc1.getRuleToTag().get(i).getTagPickerName();
+ termTagMap.put("key", ruleName);
+ termTagMap.put("value", tagPickerName);
+ attributeList.add(termTagMap);
+ }
}
policyAdapter.setAttributes(attributeList);
// Get the target data under policy.
@@ -317,7 +319,7 @@ public class CreateFirewallController extends RestrictedBaseController {
@RequestMapping(value={"/policyController/ViewFWPolicyRule.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
public ModelAndView setFWViewRule(HttpServletRequest request, HttpServletResponse response) throws Exception{
try {
- termCollectorList = new ArrayList<String>();
+ termCollectorList = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
@@ -336,7 +338,7 @@ public class CreateFirewallController extends RestrictedBaseController {
String ruleSrcPort=null;
String ruleDestPort=null;
String ruleAction=null;
- List <String> valueDesc= new ArrayList<String>();
+ List <String> valueDesc= new ArrayList<>();
StringBuffer displayString = new StringBuffer();
for (String id : termCollectorList) {
List<Object> tmList = commonClassDao.getDataById(TermList.class, "termName", id);
@@ -497,14 +499,14 @@ public class CreateFirewallController extends RestrictedBaseController {
String json = null;
- List<String> expandableList = new ArrayList<String>();
+ List<String> expandableList = new ArrayList<>();
TermList jpaTermList;
TermCollector tc = new TermCollector();
SecurityZone jpaSecurityZone;
- List<Term> termList = new ArrayList<Term>();
+ List<Term> termList = new ArrayList<>();
Tags tags=null;
- List<Tags>tagsList= new ArrayList<Tags>();
+ List<Tags>tagsList= new ArrayList<>();
TagDefines tagDefine= new TagDefines();
List<TagDefines> tagList=null;
@@ -519,7 +521,7 @@ public class CreateFirewallController extends RestrictedBaseController {
FWTagPicker jpaTagPickerList=(FWTagPicker) tagListData.get(tagCounter);
if (jpaTagPickerList.getTagPickerName().equals(tag) ){
String tagValues=jpaTagPickerList.getTagValues();
- tagList= new ArrayList<TagDefines>();
+ tagList= new ArrayList<>();
for(String val:tagValues.split("#")) {
int index=val.indexOf(":");
String keyToStore=val.substring(0,index);
@@ -561,46 +563,46 @@ public class CreateFirewallController extends RestrictedBaseController {
ruleFromZone=jpaTermList.getFromZone();
if ((ruleFromZone != null) && (!ruleFromZone.isEmpty())){
- fromZone_map = new HashMap<Integer, String>();
+ fromZone_map = new HashMap<>();
fromZone_map.put(tl, ruleFromZone);
}
ruleToZone=jpaTermList.getToZone();
if ((ruleToZone != null) && (!ruleToZone.isEmpty())){
- toZone_map = new HashMap<Integer, String>();
+ toZone_map = new HashMap<>();
toZone_map.put(tl, ruleToZone);
}
ruleSrcPrefixList=jpaTermList.getSrcIPList();
if ((ruleSrcPrefixList != null) && (!ruleSrcPrefixList.isEmpty())){
- srcIP_map = new HashMap<Integer, String>();
+ srcIP_map = new HashMap<>();
srcIP_map.put(tl, ruleSrcPrefixList);
}
ruleDestPrefixList= jpaTermList.getDestIPList();
if ((ruleDestPrefixList != null) && (!ruleDestPrefixList.isEmpty())){
- destIP_map = new HashMap<Integer, String>();
+ destIP_map = new HashMap<>();
destIP_map.put(tl, ruleDestPrefixList);
}
ruleSrcPort=jpaTermList.getSrcPortList();
if (ruleSrcPort != null && (!ruleSrcPort.isEmpty())){
- srcPort_map = new HashMap<Integer, String>();
+ srcPort_map = new HashMap<>();
srcPort_map.put(tl, ruleSrcPort);
}
ruleDestPort= jpaTermList.getDestPortList();
if (ruleDestPort!= null && (!jpaTermList.getDestPortList().isEmpty())){
- destPort_map = new HashMap<Integer, String>();
+ destPort_map = new HashMap<>();
destPort_map.put(tl, ruleDestPort);
}
ruleAction=jpaTermList.getAction();
if (( ruleAction!= null) && (!ruleAction.isEmpty())){
- action_map = new HashMap<Integer, String>();
+ action_map = new HashMap<>();
action_map.put(tl, ruleAction);
}
}
@@ -616,7 +618,7 @@ public class CreateFirewallController extends RestrictedBaseController {
//FromZone arrays
if(fromZone_map!=null){
- List<String> fromZone= new ArrayList<String>();
+ List<String> fromZone= new ArrayList<>();
for(String fromZoneStr:fromZone_map.get(tl).split(",") ){
fromZone.add(fromZoneStr);
}
@@ -625,7 +627,7 @@ public class CreateFirewallController extends RestrictedBaseController {
//ToZone arrays
if(toZone_map!=null){
- List<String> toZone= new ArrayList<String>();
+ List<String> toZone= new ArrayList<>();
for(String toZoneStr:toZone_map.get(tl).split(",") ){
toZone.add(toZoneStr);
}
@@ -634,7 +636,7 @@ public class CreateFirewallController extends RestrictedBaseController {
//Destination Services.
if(destPort_map!=null){
- Set<ServicesJson> destServicesJsonList= new HashSet<ServicesJson>();
+ Set<ServicesJson> destServicesJsonList= new HashSet<>();
for(String destServices:destPort_map.get(tl).split(",") ){
ServicesJson destServicesJson= new ServicesJson();
destServicesJson.setType("REFERENCE");
@@ -665,7 +667,7 @@ public class CreateFirewallController extends RestrictedBaseController {
if(srcIP_map!=null){
//Source List
- List<AddressJson> sourceListArrayJson= new ArrayList<AddressJson>();
+ List<AddressJson> sourceListArrayJson= new ArrayList<>();
for(String srcList:srcIP_map.get(tl).split(",") ){
AddressJson srcListJson= new AddressJson();
if(srcList.equals("ANY")){
@@ -686,7 +688,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
if(destIP_map!=null){
//Destination List
- List<AddressJson> destListArrayJson= new ArrayList<AddressJson>();
+ List<AddressJson> destListArrayJson= new ArrayList<>();
for(String destList:destIP_map.get(tl).split(",")){
AddressJson destListJson= new AddressJson();
if(destList.equals("ANY")){
@@ -727,25 +729,32 @@ public class CreateFirewallController extends RestrictedBaseController {
jpaSecurityZone = (SecurityZone) securityZoneData.get(j);
if (jpaSecurityZone.getZoneName().equals(policyData.getSecurityZone())){
tc.setSecurityZoneId(jpaSecurityZone.getZoneValue());
- //setParentSecurityZone(jpaSecurityZone.getZoneValue());//For storing the securityZone IDs to the DB
+ IdMap idMapInstance= new IdMap();
+ idMapInstance.setAstraId(jpaSecurityZone.getZoneValue());
+ idMapInstance.setVendorId("deviceGroup:dev");
+
+ List<IdMap> idMap = new ArrayList<IdMap>();
+ idMap.add(idMapInstance);
+
+ VendorSpecificData vendorStructure= new VendorSpecificData();
+ vendorStructure.setIdMap(idMap);
+ tc.setVendorSpecificData(vendorStructure);
break;
}
}
tc.setServiceTypeId("/v0/firewall/pan");
tc.setConfigName(policyData.getConfigName());
+ tc.setVendorServiceId("vipr");
- //Astra is rejecting the packet when it sees a new JSON field, so removing it for now.
- //tc.setTemplateVersion(XACMLProperties.getProperty(XACMLRestProperties.TemplateVersion_FW));
-
DeployNowJson deployNow= new DeployNowJson();
deployNow.setDeployNow(false);
tc.setDeploymentOption(deployNow);
- Set<ServiceListJson> servListArray = new HashSet<ServiceListJson>();
- Set<ServiceGroupJson> servGroupArray= new HashSet<ServiceGroupJson>();
- Set<AddressGroupJson> addrGroupArray= new HashSet<AddressGroupJson>();
+ Set<ServiceListJson> servListArray = new HashSet<>();
+ Set<ServiceGroupJson> servGroupArray= new HashSet<>();
+ Set<AddressGroupJson> addrGroupArray= new HashSet<>();
ServiceGroupJson targetSg= null;
AddressGroupJson addressSg=null;
@@ -801,7 +810,7 @@ public class CreateFirewallController extends RestrictedBaseController {
String name=sg.getGroupName();
//Removing the "Group_" prepending string before packing the JSON
targetSg.setName(name.substring(6,name.length()));
- List<ServiceMembers> servMembersList= new ArrayList<ServiceMembers>();
+ List<ServiceMembers> servMembersList= new ArrayList<>();
for(String groupString: sg.getServiceList().split(",")){
ServiceMembers serviceMembers= new ServiceMembers();
@@ -828,13 +837,13 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
- Set<PrefixIPList> prefixIPList = new HashSet<PrefixIPList>();
+ Set<PrefixIPList> prefixIPList = new HashSet<>();
for(String prefixList:expandablePrefixIPList){
for(String prefixIP: prefixList.split(",")){
if((!prefixIP.startsWith("Group_"))){
if(!prefixIP.equals("ANY")){
- List<AddressMembers> addMembersList= new ArrayList<AddressMembers>();
- List<String> valueDesc= new ArrayList<String>();
+ List<AddressMembers> addMembersList= new ArrayList<>();
+ List<String> valueDesc= new ArrayList<>();
PrefixIPList targetAddressList = new PrefixIPList();
AddressMembers addressMembers= new AddressMembers();
targetAddressList.setName(prefixIP);
@@ -866,9 +875,9 @@ public class CreateFirewallController extends RestrictedBaseController {
//Removing the "Group_" prepending string before packing the JSON
addressSg.setName(name.substring(6,name.length()));
- List<AddressMembers> addrMembersList= new ArrayList<AddressMembers>();
+ List<AddressMembers> addrMembersList= new ArrayList<>();
for(String groupString: ag.getPrefixList().split(",")){
- List<String> valueDesc= new ArrayList<String>();
+ List<String> valueDesc= new ArrayList<>();
AddressMembers addressMembers= new AddressMembers();
valueDesc= mapping (groupString);
if(valueDesc.size() > 0){
@@ -886,7 +895,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
- Set<Object> serviceGroup= new HashSet<Object>();
+ Set<Object> serviceGroup= new HashSet<>();
for(Object obj1:servGroupArray){
serviceGroup.add(obj1);
@@ -896,7 +905,7 @@ public class CreateFirewallController extends RestrictedBaseController {
serviceGroup.add(obj);
}
- Set<Object> addressGroup= new HashSet<Object>();
+ Set<Object> addressGroup= new HashSet<>();
for(Object addObj:prefixIPList){
addressGroup.add(addObj);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreatePolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreatePolicyController.java
index bca63eb0f..5049d2652 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreatePolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreatePolicyController.java
@@ -67,7 +67,7 @@ public class CreatePolicyController extends RestrictedBaseController{
}
public void prePopulateBaseConfigPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- attributeList = new ArrayList<Object>();
+ attributeList = new ArrayList<>();
if (policyAdapter.getPolicyData() instanceof PolicyType) {
Object policyData = policyAdapter.getPolicyData();
PolicyType policy = (PolicyType) policyData;
@@ -136,7 +136,7 @@ public class CreatePolicyController extends RestrictedBaseController{
// After Ecomp and Config it is optional to have attributes, so
// check weather dynamic values or there or not.
if (index >= 7) {
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
attribute.put("key", attributeId);
attribute.put("value", value);
attributeList.add(attribute);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
index 7ba1e847c..707a65d62 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
@@ -91,7 +91,7 @@ public class DashboardController extends RestrictedBaseController{
@RequestMapping(value={"/get_DashboardLoggingData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("availableLoggingDatas", mapper.writeValueAsString(systemDAO.getLoggingData()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -106,7 +106,7 @@ public class DashboardController extends RestrictedBaseController{
@RequestMapping(value={"/get_DashboardSystemAlertData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSystemAlertData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("systemAlertsTableDatas", mapper.writeValueAsString(systemDAO.getSystemAlertData()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -121,7 +121,7 @@ public class DashboardController extends RestrictedBaseController{
@RequestMapping(value={"/get_DashboardPAPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPAPStatusData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
addPAPToTable();
@@ -138,7 +138,7 @@ public class DashboardController extends RestrictedBaseController{
@RequestMapping(value={"/get_DashboardPDPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPDPStatusData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine());
@@ -156,7 +156,7 @@ public class DashboardController extends RestrictedBaseController{
@RequestMapping(value={"/get_DashboardPolicyActivityData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyActivityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine());
@@ -175,7 +175,7 @@ public class DashboardController extends RestrictedBaseController{
* Add the PAP information to the PAP Table
*/
public void addPAPToTable(){
- papStatusData = new ArrayList<Object>();
+ papStatusData = new ArrayList<>();
String papStatus = null;
try {
Set<EcompPDPGroup> groups = PolicyController.getPapEngine().getEcompPDPGroups();
@@ -205,7 +205,7 @@ public class DashboardController extends RestrictedBaseController{
*/
public void addPDPToTable(){
pdpCount = 0;
- pdpStatusData = new ArrayList<Object>();
+ pdpStatusData = new ArrayList<>();
long naCount;
long denyCount = 0;
long permitCount = 0;
@@ -305,7 +305,7 @@ public class DashboardController extends RestrictedBaseController{
* Add the information to the Policy Table
*/
private void addPolicyToTable() {
- policyActivityData = new ArrayList<Object>();
+ policyActivityData = new ArrayList<>();
int i = 1;
String policyID = null;
int policyFireCount = 0;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
index 82fc24b40..2fecd7eea 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
@@ -68,9 +68,9 @@ public class DecisionPolicyController extends RestrictedBaseController {
@SuppressWarnings("unchecked")
public void prePopulateDecisionPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- attributeList = new ArrayList<Object>();
- decisionList = new ArrayList<Object>();
- ruleAlgorithmList = new ArrayList<Object>();
+ attributeList = new ArrayList<>();
+ decisionList = new ArrayList<>();
+ ruleAlgorithmList = new ArrayList<>();
if (policyAdapter.getPolicyData() instanceof PolicyType) {
Object policyData = policyAdapter.getPolicyData();
PolicyType policy = (PolicyType) policyData;
@@ -121,7 +121,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
// Component attributes are saved under Target here we are fetching them back.
// One row is default so we are not adding dynamic component at index 0.
if (index >= 1) {
- Map<String, String> attribute = new HashMap<String, String>();
+ Map<String, String> attribute = new HashMap<>();
attribute.put("key", attributeId);
attribute.put("value", value);
attributeList.add(attribute);
@@ -165,7 +165,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
if (condition != null) {
ApplyType decisionApply = (ApplyType) condition.getExpression().getValue();
decisionApply = (ApplyType) decisionApply.getExpression().get(0).getValue();
- ruleAlgoirthmTracker = new LinkedList<Integer>();
+ ruleAlgoirthmTracker = new LinkedList<>();
if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals("GUARD_YAML")){
YAMLParams yamlParams = new YAMLParams();
for(int i=0; i<attributeList.size() ; i++){
@@ -201,7 +201,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
}
private void prePopulateDecisionRuleAlgorithms(int index, ApplyType decisionApply, List<JAXBElement<?>> jaxbDecisionTypes) {
- Map<String, String> ruleMap = new HashMap<String, String>();
+ Map<String, String> ruleMap = new HashMap<>();
ruleMap.put("id", "A" + (index +1));
Map<String, String> dropDownMap = PolicyController.getDropDownMap();
for (String key : dropDownMap.keySet()) {
@@ -262,7 +262,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
if (logger.isDebugEnabled()) {
logger.debug("Prepopulating Compound rule algorithm: " + index);
}
- Map<String, String> rule = new HashMap<String, String>();
+ Map<String, String> rule = new HashMap<>();
for (String key : PolicyController.getDropDownMap().keySet()) {
String keyValue = PolicyController.getDropDownMap().get(key);
if (keyValue.equals(decisionApply.getFunctionId())) {
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
index 87b32206e..80820c129 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
@@ -26,6 +26,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -71,13 +72,13 @@ public class PDPController extends RestrictedBaseController {
synchronized(this.groups) {
this.groups.clear();
try {
- Set<PDPPolicy> filteredPolicies = new HashSet<PDPPolicy>();
+ Set<PDPPolicy> filteredPolicies = new HashSet<>();
Set<String> scopes = null;
List<String> roles = null;
String userId = UserUtils.getUserSession(request).getOrgUserId();
List<Object> userRoles = PolicyController.getRoles(userId);
- roles = new ArrayList<String>();
- scopes = new HashSet<String>();
+ roles = new ArrayList<>();
+ scopes = new HashSet<>();
for(Object role: userRoles){
Roles userRole = (Roles) role;
roles.add(userRole.getRole());
@@ -98,8 +99,11 @@ public class PDPController extends RestrictedBaseController {
if(!userRoles.isEmpty()){
if(!scopes.isEmpty()){
this.groups.addAll(PolicyController.getPapEngine().getEcompPDPGroups());
+ List<EcompPDPGroup> tempGroups = new ArrayList<EcompPDPGroup>();
if(!groups.isEmpty()){
- for(EcompPDPGroup group : groups){
+ Iterator<EcompPDPGroup> pdpGroup = groups.iterator();
+ while(pdpGroup.hasNext()){
+ EcompPDPGroup group = pdpGroup.next();
Set<PDPPolicy> policies = group.getPolicies();
for(PDPPolicy policy : policies){
for(String scope : scopes){
@@ -117,11 +121,13 @@ public class PDPController extends RestrictedBaseController {
}
}
}
- groups.remove(group);
+ pdpGroup.remove();
StdPDPGroup newGroup = (StdPDPGroup) group;
newGroup.setPolicies(filteredPolicies);
- groups.add(newGroup);
- }
+ tempGroups.add(newGroup);
+ }
+ groups.clear();
+ groups = tempGroups;
}
}
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyController.java
index a9eb40b4f..42e4483ca 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyController.java
@@ -85,7 +85,7 @@ public class PolicyController extends RestrictedBaseController {
public static String logTableLimit;
public static String systemAlertTableLimit;
- protected static Map<String, String> dropDownMap = new HashMap<String, String>();
+ protected static Map<String, String> dropDownMap = new HashMap<>();
public static Map<String, String> getDropDownMap() {
return dropDownMap;
}
@@ -134,6 +134,10 @@ public class PolicyController extends RestrictedBaseController {
//MicroService Model Properties
public static String msEcompName;
public static String msPolicyName;
+
+ //WebApp directories
+ public static String configHome;
+ public static String actionHome;
@Autowired
private PolicyController(CommonClassDao commonClassDao){
@@ -179,6 +183,9 @@ public class PolicyController extends RestrictedBaseController {
//Micro Service Properties
msEcompName=prop.getProperty("xacml.policy.msEcompName");
msPolicyName=prop.getProperty("xacml.policy.msPolicyName");
+ //WebApp directories
+ configHome = prop.getProperty("xacml.rest.config.webapps") + "Config";
+ actionHome = prop.getProperty("xacml.rest.config.webapps") + "Action";
//Get the Property Values for Dashboard tab Limit
try{
logTableLimit = prop.getProperty("xacml.ecomp.dashboard.logTableLimit");
@@ -231,8 +238,8 @@ public class PolicyController extends RestrictedBaseController {
}
private static void buildFunctionMaps() {
- mapDatatype2Function = new HashMap<Datatype, List<FunctionDefinition>>();
- mapID2Function = new HashMap<String, FunctionDefinition>();
+ mapDatatype2Function = new HashMap<>();
+ mapID2Function = new HashMap<>();
List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
for (int i = 0; i < functiondefinitions.size(); i ++) {
FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
@@ -247,7 +254,7 @@ public class PolicyController extends RestrictedBaseController {
@RequestMapping(value={"/get_FunctionDefinitionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("functionDefinitionDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -267,7 +274,7 @@ public class PolicyController extends RestrictedBaseController {
}
public static Map<String, Roles> getUserRoles(String userId) {
- Map<String, Roles> scopes = new HashMap<String, Roles>();
+ Map<String, Roles> scopes = new HashMap<>();
List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
if (roles != null && roles.size() > 0) {
for (Object role : roles) {
@@ -295,7 +302,7 @@ public class PolicyController extends RestrictedBaseController {
public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response){
try{
String userId = UserUtils.getUserSession(request).getOrgUserId();
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -320,7 +327,7 @@ public class PolicyController extends RestrictedBaseController {
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Exception Occured while loading PAP"+e);
}
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
return new ModelAndView("policy_Editor","model", model);
}
@@ -404,7 +411,7 @@ public class PolicyController extends RestrictedBaseController {
String[] splitDBCheckName = dbCheckName.split(":");
String query = "FROM PolicyEntity where policyName like'"+splitDBCheckName[1]+"%' and scope ='"+splitDBCheckName[0]+"'";
List<Object> policyEntity = commonClassDao.getDataByQuery(query);
- List<String> av = new ArrayList<String>();
+ List<String> av = new ArrayList<>();
for(Object entity : policyEntity){
PolicyEntity pEntity = (PolicyEntity) entity;
String removeExtension = pEntity.getPolicyName().replace(".xml", "");
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
index b6899e041..68a65fc5e 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
@@ -101,7 +101,7 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
public void ExportPolicy(HttpServletRequest request, HttpServletResponse response) throws Exception{
try{
String file = null;
- selectedPolicy = new ArrayList<String>();
+ selectedPolicy = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
@@ -196,8 +196,8 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
//Check if the Role and Scope Size are Null get the values from db.
List<Object> userRoles = PolicyController.getRoles(userId);
- roles = new ArrayList<String>();
- scopes = new HashSet<String>();
+ roles = new ArrayList<>();
+ scopes = new HashSet<>();
for(Object role: userRoles){
Roles userRole = (Roles) role;
roles.add(userRole.getRole());
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyRolesController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyRolesController.java
index 9a4f52dbb..219342063 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyRolesController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyRolesController.java
@@ -65,7 +65,7 @@ public class PolicyRolesController extends RestrictedBaseController{
@RequestMapping(value={"/get_RolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyRolesEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("rolesDatas", mapper.writeValueAsString(commonClassDao.getUserRoles()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -117,8 +117,8 @@ public class PolicyRolesController extends RestrictedBaseController{
@RequestMapping(value={"/get_PolicyRolesScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyScopesEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- scopelist = new ArrayList<String>();
- Map<String, Object> model = new HashMap<String, Object>();
+ scopelist = new ArrayList<>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
List<String> scopesData = commonClassDao.getDataByColumn(PolicyEditorScopes.class, "scopeName");
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
index d9d0fc97b..ff91e9381 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
@@ -90,8 +90,8 @@ public class PolicyValidationController extends RestrictedBaseController {
private Pattern pattern;
private Matcher matcher;
- private static Map<String, String> rangeMap = new HashMap<String,String>();
- private static Map<String, String> mapAttribute = new HashMap<String,String>();
+ private static Map<String, String> rangeMap = new HashMap<>();
+ private static Map<String, String> mapAttribute = new HashMap<>();
private static final String EMAIL_PATTERN =
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
@@ -642,14 +642,24 @@ public class PolicyValidationController extends RestrictedBaseController {
// Validation for json.
protected static boolean isJSONValid(String data) {
+ InputStream stream = null;
+ JsonReader jsonReader = null;
try {
new JSONObject(data);
- InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
- JsonReader jsonReader = Json.createReader(stream);
- System.out.println("Json Value is: " + jsonReader.read().toString() );
+ stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
+ jsonReader = Json.createReader(stream);
} catch (Exception e) {
LOGGER.error("Exception Occured"+e);
return false;
+ }finally{
+ try {
+ if(stream != null && jsonReader != null){
+ jsonReader.close();
+ stream.close();
+ }
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured while closing the input stream"+e);
+ }
}
return true;
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/daoImp/CommonClassDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/daoImp/CommonClassDaoImpl.java
index 9cb41eeab..477850a11 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/daoImp/CommonClassDaoImpl.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/daoImp/CommonClassDaoImpl.java
@@ -353,7 +353,7 @@ public class CommonClassDaoImpl implements CommonClassDao{
try {
Criteria cr = session.createCriteria(className);
Disjunction disjunction = Restrictions.disjunction();
- List<Conjunction> conjunctionList = new ArrayList<Conjunction>();
+ List<Conjunction> conjunctionList = new ArrayList<>();
String[] columNames = columnName.split(":");
for(int i =0; i < data.size(); i++){
String[] entiySplit = data.get(i).split(":");
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPGroupContainer.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPGroupContainer.java
index 9d001b3ab..a0b47bb7d 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPGroupContainer.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPGroupContainer.java
@@ -208,7 +208,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
@Override
public Collection<?> getItemIds() {
- final Collection<Object> items = new ArrayList<Object>();
+ final Collection<Object> items = new ArrayList<>();
items.addAll(this.groups);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("getItemIds: " + items);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPPolicyContainer.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPPolicyContainer.java
index 353a903be..372a416c6 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPPolicyContainer.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/PDPPolicyContainer.java
@@ -177,7 +177,7 @@ public class PDPPolicyContainer extends PolicyItemSetChangeNotifier implements P
@Override
public Collection<?> getItemIds() {
- final Collection<Object> items = new ArrayList<Object>();
+ final Collection<Object> items = new ArrayList<>();
items.addAll(this.policies);
return Collections.unmodifiableCollection(items);
}
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/b2b-angular.css b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/b2b-angular.css
index 284a8d4dc..a894691ca 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/b2b-angular.css
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/b2b-angular.css
@@ -685,4 +685,233 @@
top: 4px;
right: 3px;
height: 16px;
- width: 16px; } \ No newline at end of file
+ width: 16px; }
+
+.b2b-header-tabs .icon-primary-att-globe {
+ color: #0568ae;
+ font-size: 34px; }
+
+.b2b-header-tabs .globe-text {
+ margin-left: 20px;
+ font-size: 2rem; }
+
+.b2b-header-tabs .header__items {
+ width: 980px;
+ margin: 0 auto;
+ display: block;
+ list-style: none;
+ border-spacing: 30px 0;
+ padding: 3px 0px 0px 0px; }
+
+.b2b-header-tabs .header__item {
+ display: inline-block;
+ text-align: left;
+ width: auto;
+ font-size: 14px;
+ font-family: "Omnes-ECOMP-W02", Arial;
+ cursor: pointer;
+ padding: 0 15px 4px 15px;
+ /*margin-top:-3px;*/
+ color: #fff; }
+
+.b2b-header-tabs .header__item.b2b-headermenu {
+ padding: 0; }
+
+.b2b-header-tabs .header__item.b2b-headermenu a.menu__item {
+ color: #fff;
+ text-decoration: none;
+ display: inline-block;
+ padding: 8px 15px 12px 15px;
+ font-size: 16px; }
+
+.b2b-header-tabs .header__item.active {
+ background-color: #fff;
+ border-radius: 2px;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0; }
+
+.b2b-header-tabs .header__item.active a.menu__item {
+ color: #0578ae; }
+
+.b2b-header-tabs li:focus {
+ outline: 2px solid #0578ae; }
+
+/** profile pop Over **/
+.b2b-header-tabs .header__item.profile {
+ position: relative;
+ float: right; }
+
+/** Secondary Menu **/
+.b2b-header-tabs .header__item .header-secondary-wrapper, .b2b-header-tabs .header__item .header-tertiary-wrapper {
+ background-color: #fff;
+ position: absolute;
+ width: 100%;
+ left: 0;
+ top: 42px;
+ border-bottom: solid 1px #ccc;
+ -webkit-box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.16);
+ -moz-box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.16);
+ box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.16);
+ display: none;
+ z-index: 111; }
+
+.b2b-header-tabs .header-secondary, .b2b-header-tabs .header-tertiary {
+ background-color: #fff;
+ width: 980px;
+ margin: 0 auto; }
+
+.b2b-header-tabs .header__item.active .header-secondary-wrapper,
+.b2b-header-tabs .header-secondary .header-subitem.active .header-tertiary-wrapper {
+ display: block; }
+
+.b2b-header-tabs .header-secondary .header-subitem {
+ display: inline-block;
+ width: auto;
+ margin: 0 15px; }
+
+.b2b-header-tabs .header-secondary .header-subitem a.menu__item {
+ display: inline-block;
+ padding: 15px 0;
+ color: #333;
+ font-size: 14px; }
+
+.b2b-header-tabs .header-secondary .header-subitem a.menu__item:hover, .b2b-header-tabs .header-secondary .header-subitem a.menu__item:focus {
+ color: #0578ae; }
+
+.b2b-label-hide {
+ position: absolute;
+ clip: rect(1px, 1px, 1px, 1px); }
+
+/** Tertiary Level Menu **/
+.b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret:after,
+.b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret:before {
+ content: '';
+ border-left: 8px solid transparent;
+ border-right: 8px solid transparent;
+ position: absolute;
+ -webkit-transition: left .2s ease-out;
+ -moz-transition: left .2s ease-out;
+ transition: left .2s ease-out; }
+
+.b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret {
+ position: absolute;
+ z-index: 111;
+ top: 25px; }
+
+.b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret:after {
+ border-bottom: 8px solid #fff;
+ top: 10px; }
+
+.b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret:before {
+ border-bottom: 8px solid #ccc;
+ top: 9px; }
+
+/** Tertiary Level Menu **/
+.b2b-header-tabs .header-secondary .header-subitem.active .header-tertiary {
+ border-top: solid 1px #ccc; }
+
+.b2b-header-tabs .header-tertiary:after {
+ content: '';
+ clear: both;
+ display: block; }
+
+.b2b-header-tabs .header-tertiary li {
+ display: inline-block;
+ padding: 0;
+ float: left; }
+
+.b2b-header-tabs .header-tertiary li a {
+ color: #333;
+ display: block;
+ padding: 7px 15px;
+ max-width: 228px; }
+
+.b2b-header-tabs .header-tertiary li label {
+ text-align: left;
+ display: block;
+ font-size: 14px !important;
+ font-weight: bold;
+ color: #857B7B;
+ padding: 15px 0 0 15px; }
+
+/** Quarternary Level Menu **/
+.b2b-header-tabs .header-quarternary {
+ width: 100%;
+ float: left; }
+
+.b2b-header-tabs .header-quarternary li {
+ padding-left: 15px;
+ font-family: "Omnes-ECOMP-W02", Arial;
+ display: none; }
+
+.b2b-header-tabs .header-quarternary li.active {
+ display: block; }
+
+.b2b-header-tabs .header-quarternary li a {
+ color: #666666;
+ font-size: 14px;
+ padding: 0px 10px 10px 10px; }
+
+/** Skip Navigation**/
+.b2b-header-tabs .header__item.skip {
+ padding: 0;
+ display: inline-block;
+ cursor: default !important; }
+
+.b2b-header-tabs .header__item.skip a {
+ color: transparent;
+ font-size: 12px;
+ line-height: 15px;
+ text-decoration: none; }
+
+.b2b-header-tabs .header__item.skip a:focus {
+ color: #fff;
+ outline: 2px solid #0578ae; }
+
+/** Dropdown css inside Header ****/
+.b2b-header-tabs .selectWrap {
+ min-width: 150px; }
+
+.b2b-header-tabs .selectWrap button.awd-select, .b2b-header-tabs .selectWrap input.awd-select {
+ height: 36px;
+ line-height: 8px;
+ font-size: 1rem;
+ display: inline-block; }
+
+.b2b-header-tabs .selectWrap .awd-select-list {
+ background-color: #fff;
+ color: #333;
+ -webkit-transition: opacity .2s ease-out;
+ -moz-transition: opacity .2s ease-out;
+ transition: opacity .2s ease-out;
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176); }
+
+/*
+ * responsive header media queries
+ */
+@media screen and (max-width: 1100px) {
+ .b2b-header-tabs .globe-text {
+ display: none; }
+ .b2b-header-tabs .header__item.profile {
+ padding-left: 15px;
+ float: none; }
+ .b2b-header-tabs .header__items {
+ padding-top: 0px; } }
+
+@media screen and (max-width: 950px) {
+ .header__item.profile {
+ top: 20px; }
+ .b2b-header-tabs {
+ height: 90px; }
+ .selectWrap {
+ bottom: 15px; }
+ .b2b-header-tabs .header__items {
+ padding-top: 25px; }
+ .b2b-header-tabs .header__item .header-secondary-wrapper, .b2b-header-tabs .header__item .header-tertiary-wrapper {
+ top: 80px; }
+ .b2b-header-tabs .header-secondary .header-subitem.active i.menuCaret {
+ top: 35px; }
+ .b2b-header-tabs .header__item.b2b-headermenu a.menu__item {
+ padding-bottom: 30px; }
+ .b2b-header-tabs .header-secondary .header-subitem.active .header-tertiary {
+ margin-top: -28px; } } \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js
index 51909162a..db81da0e5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/attributeDictController.js
@@ -27,7 +27,7 @@ app.controller('editAttributeController' ,function ($scope, $modalInstance, mess
$scope.disableCd=true;
var headers = message.attributeDictionaryData.attributeValue;
var splitEqual = ',';
- if(headers != null){
+ if(headers != null && headers != ""){
if (headers.indexOf(splitEqual) >= 0) {
var splitValue = headers.split(splitEqual);
for(i = 0; i < splitValue.length; i++){
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
index 6ca9dfd93..0bfcd3c01 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
@@ -29,6 +29,7 @@ app.controller('actionPolicyController', ['$scope', 'PolicyAppService', 'policyN
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
index b37685739..323a9bfa0 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
@@ -29,6 +29,7 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
@@ -106,6 +107,8 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
}
};
+ $scope.showbrmsrule = true;
+
$scope.ShowRule = function(policy){
console.log(policy);
var uuu = "policyController/ViewBRMSParamPolicyRule.htm";
@@ -117,21 +120,10 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
contentType: 'application/json',
data: JSON.stringify(postData),
success : function(data){
+ $scope.showbrmsrule = false;
+ $scope.validateSuccess = true;
$scope.$apply(function(){
$scope.datarule = data.policyData;
- var modalInstance = $modal.open({
- backdrop: 'static', keyboard: false,
- templateUrl : 'app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html',
- controller: 'showrulecontroller',
- resolve: {
- message: function () {
- var message = {
- datas: $scope.datarule
- };
- return message;
- }
- }
- });
});
},
error : function(data){
@@ -140,6 +132,12 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
});
};
+ $scope.hideRule = function(){
+ $scope.showbrmsrule = true;
+ $scope.validateSuccess = false;
+ $scope.apply();
+ };
+
$scope.saveBrmsParamPolicy = function(policy){
if(policy.itemContent != undefined){
$scope.refreshCheck = true;
@@ -247,15 +245,4 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
var lastItem = $scope.temp.policy.attributes.length-1;
$scope.temp.policy.attributes.splice(lastItem);
};
-}]);
-
-app.controller('showrulecontroller' , function ($scope, $modalInstance, message){
- if(message.datas!=null){
- $scope.datarule=message.datas;
- }
-
- $scope.close = function() {
- $modalInstance.close();
- };
-
-}); \ No newline at end of file
+}]); \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
index 97f6d2997..ecf3dec30 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
@@ -29,6 +29,7 @@ angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window'
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
index 20287baf1..9dc7e9247 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
@@ -30,6 +30,7 @@ app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNav
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
index 11254742a..8f054edd1 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
@@ -29,6 +29,7 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
index 393780705..b74f1b39b 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
@@ -29,6 +29,7 @@ angular.module("abs").controller('clPMController', ['$scope', '$window', '$timeo
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
index b87299cbd..5e602ae12 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
@@ -30,6 +30,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index d0c72682b..ce27e04e0 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -29,6 +29,7 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
index 46b6711cd..2978a43fa 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
@@ -29,6 +29,7 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po
$scope.policyNavigator.refresh();
}
$scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
};
$scope.modal = function(id, hide) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html
index 2aa3b23d9..0e7a4b35d 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html
@@ -124,6 +124,14 @@
</div>
</div>
<div id="validate" style="width: 70%"></div>
+ <div ng-hide="showbrmsrule">
+ <div class="well">
+ <h2 class="font-showcase-font-name"> Rule Preview: </h2>
+ <div class="divider-container"><hr> </div>
+ <textarea type="text" style="width: 100%; height: 800px" ng-bind="datarule" ng-disabled="true"></textarea>
+ <button class="btn btn-default" herf="javascript:void(0)" ng-click="hideRule();">Hide Rule</button>
+ </div>
+ </div>
<br>
<div class="modal-footer">
<div>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html
deleted file mode 100644
index 2e6b593de..000000000
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSShowParamRuleModal.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<div class="modal fade" role="dialog">
-<div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-header">
- <h2 class="font-showcase-font-name"> Rule Preview: </h2>
- </div>
- <div class="divider-container"><hr> </div>
- <div>
- <textarea type="text" style="width: 800px; height: 800px;" ng-bind="datarule" ng-disabled="true"></textarea>
- </div>
- <div class="modal-footer">
- <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button>
- </div>
- </div>
-</div>
-</div> \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
index 6bd9587ef..754f95bb5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
@@ -67,7 +67,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Rename</button>
</div>
</form>
@@ -111,7 +111,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Move</button>
</div>
</form>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/search-main-table.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/search-main-table.html
new file mode 100644
index 000000000..e72992180
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/search-main-table.html
@@ -0,0 +1,74 @@
+<table class="table mb0 table-files">
+ <thead>
+ <tr>
+ <th>
+ <a href="" ng-click="order('model.name')">
+ Name
+ <span class="sortorder" ng-show="predicate[1] === 'model.name'" ng-class="{reverse:reverse}"></span>
+ </a>
+ </th>
+ <th class="hidden-sm hidden-xs">
+ <a href="" ng-click="order('model.version')">
+ Version
+ <span class="sortorder" ng-show="predicate[1] === 'model.version'" ng-class="{reverse:reverse}"></span>
+ </a>
+ </th>
+ <th class="hidden-sm hidden-xs">
+ <a href="" ng-click="order('model.date')">
+ Date
+ <span class="sortorder" ng-show="predicate[1] === 'model.date'" ng-class="{reverse:reverse}"></span>
+ </a>
+ </th>
+ <th class="hidden-sm hidden-xs">
+ <a href="" ng-click="order('model.createdBy')">
+ Created By
+ <span class="sortorder" ng-show="predicate[1] === 'model.createdBy'" ng-class="{reverse:reverse}"></span>
+ </a>
+ </th>
+ <th class="hidden-sm hidden-xs">
+ <a href="" ng-click="order('model.modifiedBy')">
+ Modified By
+ <span class="sortorder" ng-show="predicate[1] === 'model.modifiedBy'" ng-class="{reverse:reverse}"></span>
+ </a>
+ </th>
+ </tr>
+ </thead>
+ <tbody class="file-item">
+ <tr ng-show="policyNavigator.requesting">
+ <td colspan="5">
+ <div ng-include="config.tplPath + '/spinner.html'"></div>
+ </td>
+ </tr>
+ <tr ng-show="!policyNavigator.requesting && policyNavigator.fileList.length < 1 && !policyNavigator.error">
+ <td colspan="5">
+ No Policy's in Scope...
+ </td>
+ </tr>
+ <tr ng-show="!policyNavigator.requesting && policyNavigator.error">
+ <td colspan="5">
+ {{ policyNavigator.error }}
+ </td>
+ </tr>
+ <tr ng-repeat="item in policyNavigator.fileList | filter: {model:{name: query}} | orderBy:predicate:reverse" ng-show="!policyNavigator.requesting">
+ <td ng-right-click="touch(item)">
+ <a href="" ng-click="smartClick(item)" title="{{item.model.name}} ({{item.model.sizeKb()}}kb)">
+ <i class="glyphicon glyphicon-folder-close" ng-show="item.model.type === 'dir'"></i>
+ <i class="glyphicon glyphicon-file" ng-show="item.model.type === 'file'"></i>
+ {{item.model.name | strLimit : 64}}
+ </a>
+ </td>
+ <td class="hidden-xs">
+ {{item.model.version}}
+ </td>
+ <td class="hidden-sm hidden-xs">
+ {{item.model.date | formatDate }}
+ </td>
+ <td class="hidden-sm hidden-xs">
+ {{item.model.createdBy}}
+ </td>
+ <td class="hidden-sm hidden-xs">
+ {{item.model.modifiedBy}}
+ </td>
+ </tr>
+ </tbody>
+</table> \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_SearchFilter.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_SearchFilter.html
index a4fe1af49..c8072a312 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_SearchFilter.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_SearchFilter.html
@@ -27,7 +27,7 @@
<div>
<div class="row">
<div ng-include="config.tplPath + '/current-folder-breadcrumb.html'" ng-show="config.breadcrumb"></div>
- <div ng-include="config.tplPath + '/main-table.html'" class="main-navigation clearfix"></div>
+ <div ng-include="config.tplPath + '/search-main-table.html'" class="main-navigation clearfix"></div>
</div>
</div>
diff --git a/PolicyEngineAPI/pom.xml b/PolicyEngineAPI/pom.xml
index a0e66f17d..f0bffb5de 100644
--- a/PolicyEngineAPI/pom.xml
+++ b/PolicyEngineAPI/pom.xml
@@ -88,6 +88,11 @@
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
@@ -112,6 +117,14 @@
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.att.aft</groupId>
+ <artifactId>dme2</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.att.cadi</groupId>
+ <artifactId>cadi-aaf</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
index 4fad508f6..4e2c092c1 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyEngine.java
@@ -326,8 +326,8 @@ public class PolicyEngine{
/**
* Retrieves the count of policies on the PAP, PDP, and Policy Engine as a whole
*
- * @param parameters {@link com.att.labs.ecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
- * @return {@link com.att.labs.ecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
+ * @param parameters {@link org.openecomp.policy.api.MetricsRequestParameters} which represents the Parameters required to get the Policy Metrics
+ * @return {@link org.openecomp.policy.api.MetricsResponse} which consists of the response related to getMetrics Request.
* @throws PolicyException PolicyException related to the operation
*
* */
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
index 91d81d043..782187720 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/AutoClientUEB.java
@@ -22,7 +22,6 @@ package org.openecomp.policy.std;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.GeneralSecurityException;
import java.util.List;
import java.util.UUID;
@@ -127,11 +126,9 @@ public class AutoClientUEB implements Runnable {
CConsumer = builder.build();
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
- }
+ } catch (Exception e1) {
+ logger.error("Exception Occured" + e1);
+ }
while (this.isRunning() )
{
try {
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
index 0e30ada39..f4a218d66 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndDMAAP.java
@@ -60,7 +60,9 @@ public class ManualClientEndDMAAP {
} catch (Exception e) {
logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unable to create DMaaP Publisher: ", e);
}
- pub.close ();
+ if(pub != null){
+ pub.close ();
+ }
}
//NOTE: should be able to remove this for DMAAP since we will not be creating topics dynamically
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
index f2a6a96d8..287e5c851 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/ManualClientEndUEB.java
@@ -23,7 +23,6 @@ package org.openecomp.policy.std;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.GeneralSecurityException;
import java.util.List;
import org.json.JSONObject;
@@ -90,10 +89,8 @@ public class ManualClientEndUEB {
CambriaPublisher pub = null;
try {
pub = CambriaClientFactory.createSimplePublisher(null, UEBlist, pubTopic);
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
}
final JSONObject msg1 = new JSONObject ();
@@ -135,11 +132,9 @@ public class ManualClientEndUEB {
String id = "0";
try {
CConsumer = CambriaClientFactory.createConsumer ( null, uebURLList, topic + uniquID, "clientGroup", id, 15*1000, 1000 );
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (GeneralSecurityException e1) {
- e1.printStackTrace();
- }
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
+ }
int count = 1;
while (count < 4) {
publishMessage(topic + "UpdateRequest", uniquID, uebURLList);
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
index ac3c9e968..1459dd9d9 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/MatchStore.java
@@ -34,7 +34,7 @@ import org.openecomp.policy.std.StdRemovedPolicy;
import org.openecomp.policy.common.logging.flexlogger.*;
public class MatchStore {
- private static HashSet<Matches> matchStore = new HashSet<Matches>();
+ private static HashSet<Matches> matchStore = new HashSet<>();
private static Logger logger = FlexLogger.getLogger(MatchStore.class.getName());
public static HashSet<Matches> getMatchStore() {
@@ -115,7 +115,7 @@ public class MatchStore {
}
if(oldNotification.getRemovedPolicies()!=null && !oldNotification.getRemovedPolicies().isEmpty()){
// send all removed policies to client.
- Collection<StdRemovedPolicy> removedPolicies = new HashSet<StdRemovedPolicy>();
+ Collection<StdRemovedPolicy> removedPolicies = new HashSet<>();
StdRemovedPolicy newRemovedPolicy;
for(RemovedPolicy removedPolicy: oldNotification.getRemovedPolicies()){
newRemovedPolicy = new StdRemovedPolicy();
@@ -127,7 +127,7 @@ public class MatchStore {
removed = true;
}
if(oldNotification.getLoadedPolicies()!=null && !oldNotification.getLoadedPolicies().isEmpty()){
- Collection<StdLoadedPolicy> updatedPolicies = new HashSet<StdLoadedPolicy>();
+ Collection<StdLoadedPolicy> updatedPolicies = new HashSet<>();
StdLoadedPolicy newUpdatedPolicy;
for(LoadedPolicy updatedPolicy: oldNotification.getLoadedPolicies()){
// if it is config policies check their matches..
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
index a09391baf..196f89b3d 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/NotificationUnMarshal.java
@@ -39,7 +39,7 @@ public class NotificationUnMarshal {
notification = mapper.readValue(json, StdPDPNotification.class);
if(notification!=null){
if(notification.getLoadedPolicies()!=null){
- Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<StdLoadedPolicy>();
+ Collection<StdLoadedPolicy> stdLoadedPolicies = new ArrayList<>();
for(LoadedPolicy loadedPolicy: notification.getLoadedPolicies()){
StdLoadedPolicy stdLoadedPolicy = (StdLoadedPolicy) loadedPolicy;
if(notification.getRemovedPolicies()!=null){
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
index abe5ee767..5b10f3066 100644
--- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
+++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/std/StdPolicyEngine.java
@@ -97,9 +97,9 @@ import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.xml.sax.InputSource;
-import com.att.aft.dme2.internal.gson.Gson;
-import com.att.aft.dme2.internal.gson.GsonBuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
/**
* PolicyEngine Implementation class
@@ -565,7 +565,7 @@ public class StdPolicyEngine {
public Collection<PolicyConfig> getConfigImpl(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
String resource= "getConfig";
- ArrayList<PolicyConfig> response = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> response = new ArrayList<>();
String body = new String();
// Create Request.
try {
@@ -598,7 +598,7 @@ public class StdPolicyEngine {
}
private ArrayList<PolicyConfig> configResult(APIPolicyConfigResponse[] response) throws PolicyConfigException {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> result = new ArrayList<>();
if(response!=null && response.length>0){
for(APIPolicyConfigResponse policyConfigResponse: response){
StdPolicyConfig policyConfig = new StdPolicyConfig();
@@ -647,7 +647,7 @@ public class StdPolicyEngine {
private void setMatches(Map<String, String> matchingConditions) {
Matches match = new Matches();
- HashMap<String, String> configAttributes = new HashMap<String,String>();
+ HashMap<String, String> configAttributes = new HashMap<>();
try{
for(String key: matchingConditions.keySet()){
if(key.equalsIgnoreCase("ECOMPName")){
@@ -741,7 +741,7 @@ public class StdPolicyEngine {
}
public Collection<String> listConfigImpl(ConfigRequestParameters listRequestParameters) throws PolicyConfigException{
- Collection<String> policyList = new ArrayList<String>();
+ Collection<String> policyList = new ArrayList<>();
if (junit){
policyList.add("Policy Name: listConfigTest");
return policyList;
@@ -796,7 +796,7 @@ public class StdPolicyEngine {
}
private ArrayList<PolicyResponse> eventResult(StdPolicyResponse[] response) throws PolicyEventException{
- ArrayList<PolicyResponse> eventResult = new ArrayList<PolicyResponse>();
+ ArrayList<PolicyResponse> eventResult = new ArrayList<>();
if(response!=null && response.length>0){
for(StdPolicyResponse policyConfigResponse: response){
eventResult.add(policyConfigResponse);
@@ -860,7 +860,7 @@ public class StdPolicyEngine {
typeDefault = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_TYPE").split(",")));
notificationType = typeDefault;
} else {
- notificationType = new ArrayList<String>();
+ notificationType = new ArrayList<>();
notificationType.add(check_type);
}
}
@@ -873,7 +873,7 @@ public class StdPolicyEngine {
if(serverList.contains(",")) {
notificationURLList = new ArrayList<String>(Arrays.asList(serverList.split(",")));
} else {
- notificationURLList = new ArrayList<String>();
+ notificationURLList = new ArrayList<>();
notificationURLList.add(serverList);
}
}
@@ -911,8 +911,8 @@ public class StdPolicyEngine {
environment = Environment.DEVL.toString();
}
// Initializing the values.
- pdps = new ArrayList<String>();
- encoding = new ArrayList<String>();
+ pdps = new ArrayList<>();
+ encoding = new ArrayList<>();
// Check the Keys for PDP_URLs
Collection<Object> unsorted = prop.keySet();
@SuppressWarnings({ "rawtypes", "unchecked" })
diff --git a/PolicyEngineAPI/src/main/resources/logback.xml b/PolicyEngineAPI/src/main/resources/logback.xml
index 9e990ccd3..098db5a54 100644
--- a/PolicyEngineAPI/src/main/resources/logback.xml
+++ b/PolicyEngineAPI/src/main/resources/logback.xml
@@ -205,7 +205,7 @@
<maxIndex>9</maxIndex>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
+ <level>DEBUG</level>
</filter>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
diff --git a/PolicyEngineClient/config.properties b/PolicyEngineClient/config.properties
index 62099050e..12d7e3287 100644
--- a/PolicyEngineClient/config.properties
+++ b/PolicyEngineClient/config.properties
@@ -39,7 +39,7 @@ ENVIRONMENT=TEST
#PDP_URL2=http://localhost:8081/pdp/ , testpdp, alpha123
#NOTIFICATION_TYPE=ueb
#NOTIFICATION_UEB_SERVERS=
-#CLIENT_ID=PyPDPServer
+#CLIENT_ID=PDPServer
#CLIENT_KEY=test
@@ -50,5 +50,5 @@ ENVIRONMENT=TEST
#PAP_URL = http://localhost:9091/pap/, testpap, alpha123
#NOTIFICATION_TYPE=websocket
#NOTIFICATION_UEB_SERVERS=
-#CLIENT_ID=PyPDPServer
+#CLIENT_ID=PDPServer
#CLIENT_KEY=test
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
index 37d25f2b9..18de85bd4 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ActionPolicyClient.java
@@ -46,21 +46,21 @@ public class ActionPolicyClient {
//policyParameters.setPolicyScope("MikeAPItesting"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "UpdateTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmFunctions = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
//Example of a complex Rule algorithm
/* label field1 function field2
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
index 3d80fe2ef..790c8e893 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsParamPolicyClient.java
@@ -62,16 +62,13 @@ public class BrmsParamPolicyClient {
// Set description of the policy(Optional)
policyParameters.setPolicyDescription("This is a sample BRMS Param policy creation example");
- //Set Scope folder where the policy needs to be created(Mandatory)
- //policyParameters.setPolicyScope("Lakshman");
-
// Set BRMS Param Template Attributes(Mandatory)
- Map<String, String> ruleAttributes = new HashMap<String, String>();
+ Map<String, String> ruleAttributes = new HashMap<>();
ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary.
ruleAttributes.put("controller", "default"); // Set Rule to a PDP Controller, default is the controller name.
ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us.
ruleAttributes.put("value", "abcd"); // Template specific key and value set by us.
- Map<AttributeType, Map<String, String>> attributes = new HashMap<AttributeType, Map<String, String>>();
+ Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
attributes.put(AttributeType.RULE, ruleAttributes);
policyParameters.setAttributes(attributes);
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
index 478b7e96a..c144e1989 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/BrmsRawPolicyClient.java
@@ -66,10 +66,10 @@ public class BrmsRawPolicyClient {
try {
PolicyEngine policyEngine = new PolicyEngine("config.properties");
PolicyParameters policyParameters = new PolicyParameters();
- Map<String, String> attrib= new HashMap<String,String>();
+ Map<String, String> attrib= new HashMap<>();
attrib.put("cpu","80");
attrib.put("memory", "50");
- Map<AttributeType, Map<String, String>> attributes = new HashMap<AttributeType, Map<String, String>>();
+ Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
attributes.put(AttributeType.RULE, attrib);
// Set Policy Type
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
index dcaaaf188..a3903806c 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ConfigBasePolicyClient.java
@@ -50,12 +50,12 @@ public class ConfigBasePolicyClient{
//policyParameters.setPolicyScope("MikeConsole"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Config Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "SampleTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
policyParameters.setAttributes(attributes);
policyParameters.setRequestID(UUID.randomUUID());
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
index 6b0b02eee..428a2ca03 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/DecisionPolicyClient.java
@@ -47,27 +47,27 @@ public class DecisionPolicyClient {
//policyParameters.setPolicyScope("MikeAPItests"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
//Set the Component Attributes... These are Optional
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("Template", "UpdateTemplate");
configAttributes.put("controller", "default");
configAttributes.put("SamPoll", "30");
configAttributes.put("value", "abcd");
- Map<AttributeType, Map<String,String>> attributes = new HashMap<AttributeType, Map<String,String>>();
+ Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
attributes.put(AttributeType.MATCHING, configAttributes);
//Set the settings... These are Optional
- Map<String, String> settingsMap = new HashMap<String, String>();
+ Map<String, String> settingsMap = new HashMap<>();
settingsMap.put("server", "5");
attributes.put(AttributeType.SETTINGS, settingsMap);
policyParameters.setAttributes(attributes);
- List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmFunctions = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
- List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+ List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+ List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
//Example of a complex Rule algorithm using the settings in the Field1
/* label field1 function field2
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
index 6ca340efe..4298e8167 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
@@ -126,8 +126,8 @@ public class GeneralTestClient {
for (Object jsonObject : jsonObjectArray) {
totalTC++;
totalTCforFile++;
- ArrayList<String> expectedResult = new ArrayList<String>();
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> expectedResult = new ArrayList<>();
+ ArrayList<String> resultReceived = new ArrayList<>();
JSONObject testCase = (JSONObject) jsonObject;
// get a String from the JSON object
long id = (long) testCase.get("id");
@@ -155,7 +155,7 @@ public class GeneralTestClient {
.get("ECOMPName");
String configName = (String) testCase
.get("ConfigName");
- Map<String, String> configAttributes = new HashMap<String, String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("key", "value");
JSONArray configAttributesJSON = (JSONArray) testCase
.get("configAttributes");
@@ -191,7 +191,7 @@ public class GeneralTestClient {
break;
case "getAction":
- Map<String, String> eventAttributes = new HashMap<String, String>();
+ Map<String, String> eventAttributes = new HashMap<>();
eventAttributes.put("Key", "Value");
JSONArray eventAttributesJSON = (JSONArray) testCase
.get("eventAttributes");
@@ -228,7 +228,7 @@ public class GeneralTestClient {
case "getDecision":
eCOMPComponentName = (String) testCase
.get("ECOMPName");
- Map<String, String> decisionAttributes = new HashMap<String, String>();
+ Map<String, String> decisionAttributes = new HashMap<>();
decisionAttributes.put("Key", "Value");
JSONArray decisionAttributesJSON = (JSONArray) testCase
.get("decisionAttributes");
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
index b9fd15282..497ff84a1 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/ListConfigPoliciesClient.java
@@ -48,7 +48,7 @@ public class ListConfigPoliciesClient {
parameters.setEcompName(".*");
parameters.setConfigName(".*");
- Map<String, String> configAttributes = new HashMap<String,String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("java", "java");
configAttributes.put("peach", "Tar");
configAttributes.put("true", "false");
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
index eb6197041..d17f0c649 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/MainClient.java
@@ -53,15 +53,15 @@ public class MainClient {
PolicyEngine policyEngine;
try {
policyEngine = new PolicyEngine("config.properties");
- Map<String, String> configAttributes = new HashMap<String,String>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("java", "java");
configAttributes.put("peach", "Tar");
configAttributes.put("true", "false");
configAttributes.put("small", "testPass");
- Map<String, String> eventAttributes = new HashMap<String,String>();
+ Map<String, String> eventAttributes = new HashMap<>();
eventAttributes.put("true", "true");
eventAttributes.put("cpu", "91");
- Map<String, String> decisionAttributes = new HashMap<String,String>();
+ Map<String, String> decisionAttributes = new HashMap<>();
decisionAttributes.put("Key", "Value");
// Config Example
@@ -102,11 +102,11 @@ public class MainClient {
try {
System.in.read();
} catch (IOException e) {
- //
+ System.err.println("Exception Occured"+e);
}
} catch (PolicyEngineException e1) {
- e1.printStackTrace();
+ System.err.println("Exception Occured"+e1);
}
}
diff --git a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
index ecdb1666f..a56145214 100644
--- a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
+++ b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/PolicyEngineTestClient.java
@@ -71,7 +71,7 @@ public class PolicyEngineTestClient {
public static ArrayList<String> getConfig(PolicyEngine policyEngine,
String eCOMPComponentName, String configName,
Map<String, String> configAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
try {
UUID requestID = UUID.randomUUID();
Collection<PolicyConfig> policyConfigs;
@@ -114,7 +114,7 @@ public class PolicyEngineTestClient {
*/
public static ArrayList<String> getDecision(PolicyEngine policyEngine,
String eCOMPComponentName, Map<String, String> decisionAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
// Decision example
try {
UUID requestID = UUID.randomUUID();
@@ -139,7 +139,7 @@ public class PolicyEngineTestClient {
*/
public static ArrayList<String> getAction(PolicyEngine policyEngine,
Map<String, String> eventAttributes) {
- ArrayList<String> resultReceived = new ArrayList<String>();
+ ArrayList<String> resultReceived = new ArrayList<>();
try {
UUID requestID = UUID.randomUUID();
@SuppressWarnings("deprecation")
diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/std/NotificationStore.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/std/NotificationStore.java
index 1c5950c5d..2f3a72946 100644
--- a/PolicyEngineUtils/src/main/java/org/openecomp/policy/std/NotificationStore.java
+++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/std/NotificationStore.java
@@ -42,10 +42,10 @@ public class NotificationStore {
public static StdPDPNotification getDeltaNotification(StdPDPNotification newNotification){
StdPDPNotification notificationDelta = new StdPDPNotification();
- ArrayList<StdRemovedPolicy> removedDelta = new ArrayList<StdRemovedPolicy>();
- ArrayList<StdLoadedPolicy> updatedDelta = new ArrayList<StdLoadedPolicy>();
- Collection<StdLoadedPolicy> newUpdatedPolicies = new ArrayList<StdLoadedPolicy>();
- Collection<StdRemovedPolicy> newRemovedPolicies = new ArrayList<StdRemovedPolicy>();
+ ArrayList<StdRemovedPolicy> removedDelta = new ArrayList<>();
+ ArrayList<StdLoadedPolicy> updatedDelta = new ArrayList<>();
+ Collection<StdLoadedPolicy> newUpdatedPolicies = new ArrayList<>();
+ Collection<StdRemovedPolicy> newRemovedPolicies = new ArrayList<>();
Collection<LoadedPolicy> oldUpdatedLostPolicies = notificationRecord.getLoadedPolicies();
Collection<RemovedPolicy> oldRemovedPolicies = notificationRecord.getRemovedPolicies();
Collection<LoadedPolicy> oldUpdatedPolicies = notificationRecord.getLoadedPolicies();
@@ -168,14 +168,14 @@ public class NotificationStore {
}else{
// Check if there is anything new and update the record.
if(notificationRecord.getLoadedPolicies()!=null || notificationRecord.getRemovedPolicies()!=null){
- HashSet<StdRemovedPolicy> removedPolicies = new HashSet<StdRemovedPolicy>();
+ HashSet<StdRemovedPolicy> removedPolicies = new HashSet<>();
for(RemovedPolicy rPolicy: notificationRecord.getRemovedPolicies()){
StdRemovedPolicy sRPolicy = new StdRemovedPolicy();
sRPolicy.setPolicyName(rPolicy.getPolicyName());
sRPolicy.setVersionNo(rPolicy.getVersionNo());
removedPolicies.add(sRPolicy);
}
- HashSet<StdLoadedPolicy> updatedPolicies = new HashSet<StdLoadedPolicy>();
+ HashSet<StdLoadedPolicy> updatedPolicies = new HashSet<>();
for(LoadedPolicy uPolicy: notificationRecord.getLoadedPolicies()){
StdLoadedPolicy sUPolicy = new StdLoadedPolicy();
sUPolicy.setMatches(uPolicy.getMatches());
diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BackUpMonitor.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BackUpMonitor.java
index f041d105c..6f9082bc9 100644
--- a/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BackUpMonitor.java
+++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BackUpMonitor.java
@@ -226,7 +226,7 @@ public class BackUpMonitor {
em.flush();
}else{
// Check for other Master(s)
- ArrayList<BackUpMonitorEntity> masterEntities = new ArrayList<BackUpMonitorEntity>();
+ ArrayList<BackUpMonitorEntity> masterEntities = new ArrayList<>();
// Check for self.
BackUpMonitorEntity selfEntity = null;
// Check backup monitor entities.
@@ -310,7 +310,7 @@ public class BackUpMonitor {
}
}
}
- masterEntities = new ArrayList<BackUpMonitorEntity>();
+ masterEntities = new ArrayList<>();
masterEntities.add(masterEntity);
}
if(masterEntities.size()==1){
diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BusPublisher.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BusPublisher.java
index 9c9e54b47..fe3e4f6eb 100644
--- a/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BusPublisher.java
+++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/utils/BusPublisher.java
@@ -40,7 +40,7 @@ public interface BusPublisher {
String aafLogin,
String aafPassword) {
- ArrayList<String> dmaapServers = new ArrayList<String>();
+ ArrayList<String> dmaapServers = new ArrayList<>();
for (String server: servers) {
dmaapServers.add(server + ":3904");
}
diff --git a/PolicyEngineUtils/src/test/java/org/openecomp/policy/test/PolicyUtilsTest.java b/PolicyEngineUtils/src/test/java/org/openecomp/policy/test/PolicyUtilsTest.java
index c3f8bedb0..7dac55596 100644
--- a/PolicyEngineUtils/src/test/java/org/openecomp/policy/test/PolicyUtilsTest.java
+++ b/PolicyEngineUtils/src/test/java/org/openecomp/policy/test/PolicyUtilsTest.java
@@ -44,8 +44,8 @@ public class PolicyUtilsTest {
PolicyUtils policyUtils = new PolicyUtils();
StdPDPNotification notification = new StdPDPNotification();
notification.setNotificationType(NotificationType.BOTH);
- Collection<StdRemovedPolicy> removedPolicies = new ArrayList<StdRemovedPolicy>();
- Collection<StdLoadedPolicy> loadedPolicies = new ArrayList<StdLoadedPolicy>();
+ Collection<StdRemovedPolicy> removedPolicies = new ArrayList<>();
+ Collection<StdLoadedPolicy> loadedPolicies = new ArrayList<>();
StdRemovedPolicy removedPolicy = new StdRemovedPolicy();
StdLoadedPolicy updatedPolicy = new StdLoadedPolicy();
removedPolicy.setPolicyName("Test");
@@ -54,7 +54,7 @@ public class PolicyUtilsTest {
updatedPolicy.setPolicyName("Testing");
updatedPolicy.setVersionNo("1");
updatedPolicy.setUpdateType(UpdateType.NEW);
- Map<String, String> matches = new HashMap<String, String>();
+ Map<String, String> matches = new HashMap<>();
matches.put("key", "value");
updatedPolicy.setMatches(matches);
loadedPolicies.add(updatedPolicy);
diff --git a/packages/base/src/assembly/zip.xml b/packages/base/src/assembly/zip.xml
index 60731cb98..28ab2d7d7 100644
--- a/packages/base/src/assembly/zip.xml
+++ b/packages/base/src/assembly/zip.xml
@@ -45,12 +45,6 @@
<directoryMode>700</directoryMode>
</fileSet>
<fileSet>
- <directory>${project.build.directory}/pypdp/webapps</directory>
- <outputDirectory>install/servers/pypdp/webapps</outputDirectory>
- <fileMode>700</fileMode>
- <directoryMode>700</directoryMode>
- </fileSet>
- <fileSet>
<directory>${project.build.directory}/pdp/webapps</directory>
<outputDirectory>install/servers/pdp/webapps</outputDirectory>
<fileMode>700</fileMode>
diff --git a/packages/base/src/files/bin/backup.sh b/packages/base/src/files/bin/backup.sh
index 75cca7388..a40638cab 100644
--- a/packages/base/src/files/bin/backup.sh
+++ b/packages/base/src/files/bin/backup.sh
@@ -74,7 +74,6 @@ function backup() {
--exclude backup \
--exclude servers/pap/webapps/pap \
--exclude servers/pdp/webapps/pdp \
- --exclude servers/pypdp/webapps/PyPDPServer \
--exclude servers/console/webapps/policy \
${POLICY_HOME}/* \
${BACKUP_DIR}
diff --git a/packages/base/src/files/bin/policy.sh b/packages/base/src/files/bin/policy.sh
index 0b061a46e..a7500947a 100644
--- a/packages/base/src/files/bin/policy.sh
+++ b/packages/base/src/files/bin/policy.sh
@@ -104,10 +104,6 @@ function policy_status() {
component_status configs
fi
- if check_x_file "${POLICY_HOME}/etc/init.d/pypdp"; then
- component_status pypdp
- fi
-
if check_x_file "${POLICY_HOME}/etc/init.d/console"; then
component_status console
fi
@@ -147,10 +143,6 @@ function policy_start() {
component_start configs
fi
- if check_x_file "${POLICY_HOME}/etc/init.d/pypdp"; then
- component_start pypdp
- fi
-
if check_x_file "${POLICY_HOME}/etc/init.d/console"; then
component_start console
fi
@@ -195,10 +187,6 @@ function policy_stop() {
if check_x_file "${POLICY_HOME}/etc/init.d/console"; then
component_stop console
fi
-
- if check_x_file "${POLICY_HOME}/etc/init.d/pypdp"; then
- component_stop pypdp
- fi
if check_x_file "${POLICY_HOME}/etc/init.d/configs"; then
component_stop configs
diff --git a/packages/base/src/files/etc/cron.d/audit.cron b/packages/base/src/files/etc/cron.d/audit.cron
new file mode 100644
index 000000000..1e6bbee1b
--- /dev/null
+++ b/packages/base/src/files/etc/cron.d/audit.cron
@@ -0,0 +1 @@
+0 0 * * * . ${{POLICY_HOME}}/etc/profile.d/env.sh; elk.sh --audit < /dev/null > /dev/null 2>&1
diff --git a/packages/base/src/files/etc/cron.d/logrotate.cron b/packages/base/src/files/etc/cron.d/logrotate.cron
index aa78eed24..32301443b 100644
--- a/packages/base/src/files/etc/cron.d/logrotate.cron
+++ b/packages/base/src/files/etc/cron.d/logrotate.cron
@@ -1 +1 @@
-5 1 * * * /usr/sbin/logrotate -s ${{POLICY_HOME}}/var/logrotate.status ${{POLICY_HOME}}/etc/logrotate.d/monitor.conf
+5 1 * * * /usr/sbin/logrotate -s ${{POLICY_HOME}}/var/logrotate.status ${{POLICY_HOME}}/etc/logrotate.d/elk.conf ${{POLICY_HOME}}/etc/logrotate.d/monitor.conf
diff --git a/packages/base/src/files/etc/logrotate.d/elk.conf b/packages/base/src/files/etc/logrotate.d/elk.conf
new file mode 100644
index 000000000..3bc69b87e
--- /dev/null
+++ b/packages/base/src/files/etc/logrotate.d/elk.conf
@@ -0,0 +1,7 @@
+${{POLICY_HOME}}/logs/elk.log {
+ daily
+ rotate 10
+ compress
+ missingok
+ copytruncate
+}
diff --git a/packages/base/src/files/etc/monitor/monitor.cfg b/packages/base/src/files/etc/monitor/monitor.cfg
index 5314839e1..bc2642b64 100644
--- a/packages/base/src/files/etc/monitor/monitor.cfg
+++ b/packages/base/src/files/etc/monitor/monitor.cfg
@@ -1,5 +1,5 @@
# Line Format: component=status where
-# component=pap|pdp|pypdp|configs|console|paplp|pdplp and
+# component=pap|pdp|configs|console|elk|paplp|pdplp and
# status=on|off|uninstalled where
# on: component is to be monitored and should started
# off: component is to be monitored and should stopped
@@ -9,8 +9,8 @@
pap=uninstalled
pdp=uninstalled
configs=uninstalled
-pypdp=uninstalled
console=uninstalled
+elk=uninstalled
paplp=uninstalled
pdplp=uninstalled
brmsgw=uninstalled
diff --git a/packages/base/src/files/install/elk/bin/elk.sh b/packages/base/src/files/install/elk/bin/elk.sh
new file mode 100644
index 000000000..5011aa61e
--- /dev/null
+++ b/packages/base/src/files/install/elk/bin/elk.sh
@@ -0,0 +1,166 @@
+#!/bin/bash
+
+ELK_MAP_SUCCESS_RE="\"acknowledged\": *true"
+
+function usage() {
+ echo -n "syntax: $(basename $0) "
+ echo -n "[--debug] "
+ echo -n "([--audit] |"
+}
+
+function log() {
+ echo "$(date +"%Y-%m-%d_%H-%M-%S") $1" >> ${POLICY_HOME}/logs/elk.log
+ echo "$1"
+}
+
+function delete_index() {
+ if [[ $DEBUG == y ]]; then
+ echo "-- ${FUNCNAME[0]} $@ --"
+ set -x
+ fi
+
+ COMMAND="curl --silent -X DELETE http://localhost:9200/policy"
+ OUTPUT="$(${COMMAND} 2>&1)"
+ RC=$?
+
+ log "${RC}: ${COMMAND}"
+ log "${OUTPUT}"
+
+ if [[ ${RC} != 0 ]] || [[ ! ${OUTPUT} =~ ${ELK_MAP_SUCCESS_RE} ]]; then
+ log "WARNING: curl: delete /policy: ${RC}"
+ return 1
+ fi
+
+ log "OK: curl: delete /policy: ${OUTPUT}"
+ return 0
+}
+
+function create_index() {
+ if [[ $DEBUG == y ]]; then
+ echo "-- ${FUNCNAME[0]} $@ --"
+ set -x
+ fi
+
+ COMMAND="curl --silent -X PUT http://localhost:9200/policy"
+ OUTPUT="$(${COMMAND} 2>&1)"
+ RC=$?
+
+ log "${RC}: ${COMMAND}"
+ log "${OUTPUT}"
+
+ if [[ ${RC} != 0 ]] || [[ ! ${OUTPUT} =~ ${ELK_MAP_SUCCESS_RE} ]]; then
+ log "ERROR: curl: put /policy: ${RC}"
+ return 1
+ fi
+
+ log "OK: curl: put /policy."
+ return 0
+}
+
+function check_elk_status() {
+ if [[ $DEBUG == y ]]; then
+ echo "-- ${FUNCNAME[0]} $@ --"
+ set -x
+ fi
+
+ ${POLICY_HOME}/etc/init.d/elk status
+ if [[ $? != 0 ]]; then
+ log "ERROR: elk is down. Aborting .."
+ exit 1
+ fi
+}
+
+function check_elk_policy_index() {
+ if [[ $DEBUG == y ]]; then
+ echo "-- ${FUNCNAME[0]} $@ --"
+ set -x
+ fi
+
+ COMMAND="curl --silent -X GET http://localhost:9200/policy"
+ OUTPUT="$(${COMMAND} 2>&1)"
+ RC=$?
+
+ log "${RC}: ${COMMAND}"
+
+ if [[ ${RC} != 0 ]] || [[ ! ${OUTPUT} =~ policy ]]; then
+ log "ERROR: curl: get /policy: ${RC}"
+ return 1
+ fi
+
+ log "OK: curl: get /policy."
+ return 0
+}
+
+#The Script will update the policy data on querying from database as a bulk to Elastic Database
+function audit() {
+ if [[ $DEBUG == y ]]; then
+ echo "-- ${FUNCNAME[0]} $@ --"
+ set -x
+ fi
+
+ check_elk_status
+
+ if ! check_elk_policy_index; then
+ echo "policy index does not exist. So, Policy Index is created."
+ if ! create_index; then
+ echo "abort: policy index creation failed."
+ exit 1
+ fi
+ fi
+
+ $JAVA_HOME/bin/java -cp $POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/ECOMP-PAP-REST-*.jar:$POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/*: -DPROPERTY_FILE=$POLICY_HOME/servers/pap/bin/policyelk.properties org.openecomp.policy.pap.xacml.rest.elk.client.ElasticSearchPolicyUpdate
+}
+
+#########################################################################
+##
+## script execution body
+##
+#########################################################################
+
+DEBUG=n
+OPERATION=none
+
+until [[ -z "$1" ]]; do
+ case $1 in
+ -d|--debug|debug) DEBUG=y
+ set -x
+ ;;
+ -a|--audit|audit) OPERATION=audit
+ ;;
+ *) usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# operation validation
+case $OPERATION in
+ audit) ;;
+ *) echo "invalid operation (${OPERATION}).";
+ usage
+ exit 1
+ ;;
+esac
+
+if [[ -z ${POLICY_HOME} ]]; then
+ echo "error: POLICY_HOME is unset."
+ exit 1
+fi
+
+log "**** $OPERATION ****"
+
+if pidof -o %PPID -x $(basename $0) > /dev/null 2>&1; then
+ echo "WARNING: an $(basename $0) process is already running. Exiting."
+ exit 1
+fi
+
+case $OPERATION in
+ audit)
+ audit
+ ;;
+ *) echo "invalid operation (${OPERATION}).";
+ usage
+ exit 1
+ ;;
+esac \ No newline at end of file
diff --git a/packages/base/src/files/install/elk/config/elasticsearch.yml b/packages/base/src/files/install/elk/config/elasticsearch.yml
new file mode 100644
index 000000000..618f2a241
--- /dev/null
+++ b/packages/base/src/files/install/elk/config/elasticsearch.yml
@@ -0,0 +1,392 @@
+##################### Elasticsearch Configuration Example #####################
+
+# This file contains an overview of various configuration settings,
+# targeted at operations staff. Application developers should
+# consult the guide at <http://elasticsearch.org/guide>.
+#
+# The installation procedure is covered at
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
+#
+# Elasticsearch comes with reasonable defaults for most settings,
+# so you can try it out without bothering with configuration.
+#
+# Most of the time, these defaults are just fine for running a production
+# cluster. If you're fine-tuning your cluster, or wondering about the
+# effect of certain configuration option, please _do ask_ on the
+# mailing list or IRC channel [http://elasticsearch.org/community].
+
+# Any element in the configuration can be replaced with environment variables
+# by placing them in ${...} notation. For example:
+#
+#node.rack: ${RACK_ENV_VAR}
+
+# For information on supported formats and syntax for the config file, see
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html>
+
+
+################################### Cluster ###################################
+
+# Cluster name identifies your cluster for auto-discovery. If you're running
+# multiple clusters on the same network, make sure you're using unique names.
+#
+#cluster.name: elasticsearch
+cluster.name: ${{FQDN}}-policy-sa
+
+
+#################################### Node #####################################
+
+# Node names are generated dynamically on startup, so you're relieved
+# from configuring them manually. You can tie this node to a specific name:
+#
+#node.name: "Franz Kafka"
+node.name: "${{FQDN}}"
+
+# Every node can be configured to allow or deny being eligible as the master,
+# and to allow or deny to store the data.
+#
+# Allow this node to be eligible as a master node (enabled by default):
+#
+#node.master: true
+#
+# Allow this node to store data (enabled by default):
+#
+#node.data: true
+
+# You can exploit these settings to design advanced cluster topologies.
+#
+# 1. You want this node to never become a master node, only to hold data.
+# This will be the "workhorse" of your cluster.
+#
+#node.master: false
+#node.data: true
+#
+# 2. You want this node to only serve as a master: to not store any data and
+# to have free resources. This will be the "coordinator" of your cluster.
+#
+#node.master: true
+#node.data: false
+#
+# 3. You want this node to be neither master nor data node, but
+# to act as a "search load balancer" (fetching data from nodes,
+# aggregating results, etc.)
+#
+#node.master: false
+#node.data: false
+
+# Use the Cluster Health API [http://localhost:9200/_cluster/health], the
+# Node Info API [http://localhost:9200/_nodes] or GUI tools
+# such as <http://www.elasticsearch.org/overview/marvel/>,
+# <http://github.com/karmi/elasticsearch-paramedic>,
+# <http://github.com/lukas-vlcek/bigdesk> and
+# <http://mobz.github.com/elasticsearch-head> to inspect the cluster state.
+
+# A node can have generic attributes associated with it, which can later be used
+# for customized shard allocation filtering, or allocation awareness. An attribute
+# is a simple key value pair, similar to node.key: value, here is an example:
+#
+#node.rack: rack314
+
+# By default, multiple nodes are allowed to start from the same installation location
+# to disable it, set the following:
+node.max_local_storage_nodes: 1
+
+
+#################################### Index ####################################
+
+# You can set a number of options (such as shard/replica options, mapping
+# or analyzer definitions, translog settings, ...) for indices globally,
+# in this file.
+#
+# Note, that it makes more sense to configure index settings specifically for
+# a certain index, either when creating it or by using the index templates API.
+#
+# See <http://elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules.html> and
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html>
+# for more information.
+
+# Set the number of shards (splits) of an index (5 by default):
+#
+#index.number_of_shards: 5
+
+# Set the number of replicas (additional copies) of an index (1 by default):
+#
+#index.number_of_replicas: 1
+
+# Note, that for development on a local machine, with small indices, it usually
+# makes sense to "disable" the distributed features:
+#
+index.number_of_shards: 1
+index.number_of_replicas: 0
+
+# These settings directly affect the performance of index and search operations
+# in your cluster. Assuming you have enough machines to hold shards and
+# replicas, the rule of thumb is:
+#
+# 1. Having more *shards* enhances the _indexing_ performance and allows to
+# _distribute_ a big index across machines.
+# 2. Having more *replicas* enhances the _search_ performance and improves the
+# cluster _availability_.
+#
+# The "number_of_shards" is a one-time setting for an index.
+#
+# The "number_of_replicas" can be increased or decreased anytime,
+# by using the Index Update Settings API.
+#
+# Elasticsearch takes care about load balancing, relocating, gathering the
+# results from nodes, etc. Experiment with different settings to fine-tune
+# your setup.
+
+# Use the Index Status API (<http://localhost:9200/A/_status>) to inspect
+# the index status.
+
+
+#################################### Paths ####################################
+
+# Path to directory containing configuration (this file and logging.yml):
+#
+#path.conf: /path/to/conf
+
+# Path to directory where to store index data allocated for this node.
+#
+#path.data: /path/to/data
+#
+# Can optionally include more than one location, causing data to be striped across
+# the locations (a la RAID 0) on a file level, favouring locations with most free
+# space on creation. For example:
+#
+#path.data: /path/to/data1,/path/to/data2
+
+# Path to temporary files:
+#
+#path.work: /path/to/work
+
+# Path to log files:
+#
+#path.logs: /path/to/logs
+path.logs: ${{POLICY_HOME}}/logs
+
+# Path to where plugins are installed:
+#
+#path.plugins: /path/to/plugins
+
+
+#################################### Plugin ###################################
+
+# If a plugin listed here is not installed for current node, the node will not start.
+#
+#plugin.mandatory: mapper-attachments,lang-groovy
+
+
+################################### Memory ####################################
+
+# Elasticsearch performs poorly when JVM starts swapping: you should ensure that
+# it _never_ swaps.
+#
+# Set this property to true to lock the memory:
+#
+#bootstrap.mlockall: true
+
+# Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set
+# to the same value, and that the machine has enough memory to allocate
+# for Elasticsearch, leaving enough memory for the operating system itself.
+#
+# You should also make sure that the Elasticsearch process is allowed to lock
+# the memory, eg. by using `ulimit -l unlimited`.
+
+
+############################## Network And HTTP ###############################
+
+# Elasticsearch, by default, binds itself to the 0.0.0.0 address, and listens
+# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node
+# communication. (the range means that if the port is busy, it will automatically
+# try the next port).
+
+# Set the bind address specifically (IPv4 or IPv6):
+#
+#network.bind_host: 10.00.10.00
+
+# Set the address other nodes will use to communicate with this node. If not
+# set, it is automatically derived. It must point to an actual IP address.
+#
+#network.publish_host: 10.00.10.00
+
+# Set both 'bind_host' and 'publish_host':
+#
+#network.host: 10.00.10.00
+
+# Set a custom port for the node to node communication (9300 by default):
+#
+#transport.tcp.port: 9300
+
+# Enable compression for all communication between nodes (disabled by default):
+#
+#transport.tcp.compress: true
+
+# Set a custom port to listen for HTTP traffic:
+#
+#http.port: 9200
+
+# Set a custom allowed content length:
+#
+#http.max_content_length: 100mb
+
+# Disable HTTP completely:
+#
+#http.enabled: false
+
+
+################################### Gateway ###################################
+
+# The gateway allows for persisting the cluster state between full cluster
+# restarts. Every change to the state (such as adding an index) will be stored
+# in the gateway, and when the cluster starts up for the first time,
+# it will read its state from the gateway.
+
+# There are several types of gateway implementations. For more information, see
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-gateway.html>.
+
+# The default gateway type is the "local" gateway (recommended):
+#
+#gateway.type: local
+
+# Settings below control how and when to start the initial recovery process on
+# a full cluster restart (to reuse as much local data as possible when using shared
+# gateway).
+
+# Allow recovery process after N nodes in a cluster are up:
+#
+#gateway.recover_after_nodes: 1
+
+# Set the timeout to initiate the recovery process, once the N nodes
+# from previous setting are up (accepts time value):
+#
+#gateway.recover_after_time: 5m
+
+# Set how many nodes are expected in this cluster. Once these N nodes
+# are up (and recover_after_nodes is met), begin recovery process immediately
+# (without waiting for recover_after_time to expire):
+#
+#gateway.expected_nodes: 2
+
+
+############################# Recovery Throttling #############################
+
+# These settings allow to control the process of shards allocation between
+# nodes during initial recovery, replica allocation, rebalancing,
+# or when adding and removing nodes.
+
+# Set the number of concurrent recoveries happening on a node:
+#
+# 1. During the initial recovery
+#
+#cluster.routing.allocation.node_initial_primaries_recoveries: 4
+#
+# 2. During adding/removing nodes, rebalancing, etc
+#
+#cluster.routing.allocation.node_concurrent_recoveries: 2
+
+# Set to throttle throughput when recovering (eg. 100mb, by default 20mb):
+#
+#indices.recovery.max_bytes_per_sec: 20mb
+
+# Set to limit the number of open concurrent streams when
+# recovering a shard from a peer:
+#
+#indices.recovery.concurrent_streams: 5
+
+
+################################## Discovery ##################################
+
+# Discovery infrastructure ensures nodes can be found within a cluster
+# and master node is elected. Multicast discovery is the default.
+
+# Set to ensure a node sees N other master eligible nodes to be considered
+# operational within the cluster. This should be set to a quorum/majority of
+# the master-eligible nodes in the cluster.
+#
+#discovery.zen.minimum_master_nodes: 1
+
+# Set the time to wait for ping responses from other nodes when discovering.
+# Set this option to a higher value on a slow or congested network
+# to minimize discovery failures:
+#
+#discovery.zen.ping.timeout: 3s
+
+# For more information, see
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html>
+
+# Unicast discovery allows to explicitly control which nodes will be used
+# to discover the cluster. It can be used when multicast is not present,
+# or to restrict the cluster communication-wise.
+#
+# 1. Disable multicast discovery (enabled by default):
+#
+#discovery.zen.ping.multicast.enabled: false
+#
+# 2. Configure an initial list of master nodes in the cluster
+# to perform discovery when new nodes (master or data) are started:
+#
+#discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]
+
+# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
+#
+# You have to install the cloud-aws plugin for enabling the EC2 discovery.
+#
+# For more information, see
+# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html>
+#
+# See <http://elasticsearch.org/tutorials/elasticsearch-on-ec2/>
+# for a step-by-step tutorial.
+
+# GCE discovery allows to use Google Compute Engine API in order to perform discovery.
+#
+# You have to install the cloud-gce plugin for enabling the GCE discovery.
+#
+# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-gce>.
+
+# Azure discovery allows to use Azure API in order to perform discovery.
+#
+# You have to install the cloud-azure plugin for enabling the Azure discovery.
+#
+# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-azure>.
+
+################################## Slow Log ##################################
+
+# Shard level query and fetch threshold logging.
+
+#index.search.slowlog.threshold.query.warn: 10s
+#index.search.slowlog.threshold.query.info: 5s
+#index.search.slowlog.threshold.query.debug: 2s
+#index.search.slowlog.threshold.query.trace: 500ms
+
+#index.search.slowlog.threshold.fetch.warn: 1s
+#index.search.slowlog.threshold.fetch.info: 800ms
+#index.search.slowlog.threshold.fetch.debug: 500ms
+#index.search.slowlog.threshold.fetch.trace: 200ms
+
+#index.indexing.slowlog.threshold.index.warn: 10s
+#index.indexing.slowlog.threshold.index.info: 5s
+#index.indexing.slowlog.threshold.index.debug: 2s
+#index.indexing.slowlog.threshold.index.trace: 500ms
+
+################################## GC Logging ################################
+
+#monitor.jvm.gc.young.warn: 1000ms
+#monitor.jvm.gc.young.info: 700ms
+#monitor.jvm.gc.young.debug: 400ms
+
+#monitor.jvm.gc.old.warn: 10s
+#monitor.jvm.gc.old.info: 5s
+#monitor.jvm.gc.old.debug: 2s
+
+################################## Security ################################
+
+# Uncomment if you want to enable JSONP as a valid return transport on the
+# http server. With this enabled, it may pose a security risk, so disabling
+# it unless you need it is recommended (it is disabled by default).
+#
+#http.jsonp.enable: true
+
+discovery.zen.ping.multicast.enabled: false
+node.local: true
+action.auto_create_index: false
diff --git a/packages/base/src/files/install/elk/init.d/elkd b/packages/base/src/files/install/elk/init.d/elkd
new file mode 100644
index 000000000..539b4be3e
--- /dev/null
+++ b/packages/base/src/files/install/elk/init.d/elkd
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+ELK_BASE=${POLICY_HOME}/elk/
+ELK_RUNNING="^$JAVA_HOME/bin/java .* -cp.* org.elasticsearch.bootstrap.Elasticsearch$"
+COMPONENT=elk
+
+JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote"
+JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.port=${{ELK_JMX_PORT}}"
+JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
+JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
+
+RETVAL=0
+
+function update_monitor() {
+ COMPONENT=$1
+ STATUS=$2
+ if [[ -f ${POLICY_HOME}/etc/monitor/monitor.cfg ]]; then
+ /bin/sed -i.bak \
+ -e "s/^${COMPONENT}=.*/${COMPONENT}=${STATUS}/g" \
+ ${POLICY_HOME}/etc/monitor/monitor.cfg
+ fi
+}
+
+function stop() {
+ pkill -u ${POLICY_USER} -f "${ELK_RUNNING}" -TERM
+ RETVAL=$?
+ if [[ ${RETVAL} != 0 ]]; then
+ sleep 2
+ pkill -u ${POLICY_USER} -f "${ELK_RUNNING}" -KILL
+ RETVAL=$?
+ fi
+ update_monitor ${COMPONENT} off
+ sleep 1
+}
+
+function start() {
+ export JAVA_OPTS="${JAVA_OPTS} ${JMX_JAVA_OPTS}"
+ $POLICY_HOME/elk/bin/elasticsearch -d
+ RETVAL=$?
+ if [[ ${RETVAL} != 0 ]]; then
+ update_monitor ${COMPONENT} off
+ else
+ update_monitor ${COMPONENT} on
+ fi
+}
+
+# main
+
+case "$1" in
+ status)
+ pid=$(pgrep -f -u ${POLICY_USER} "${ELK_RUNNING}" 2> /dev/null)
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ echo "running with pid ${pid}"
+ else
+ echo "stopped"
+ fi
+ ;;
+ restart)
+ stop
+ sleep 2
+ start
+ ;;
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ *)
+ echo "error: invalid option $@"
+ RETVAL=1
+ ;;
+esac
+
+exit ${RETVAL} \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/brmsgw/client.properties b/packages/base/src/files/install/servers/brmsgw/client.properties
index 0b8dc258e..97156b66e 100644
--- a/packages/base/src/files/install/servers/brmsgw/client.properties
+++ b/packages/base/src/files/install/servers/brmsgw/client.properties
@@ -18,5 +18,4 @@
# ============LICENSE_END=========================================================
###
-python=test,MASTER
-PyPDPServer=test,MASTER \ No newline at end of file
+python=test,MASTER \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pdp/bin/client.properties b/packages/base/src/files/install/servers/pdp/bin/client.properties
new file mode 100644
index 000000000..97156b66e
--- /dev/null
+++ b/packages/base/src/files/install/servers/pdp/bin/client.properties
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP Policy Engine
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+python=test,MASTER \ No newline at end of file
diff --git a/packages/install/src/files/brmsgw.conf b/packages/install/src/files/brmsgw.conf
index 9f2252ca4..bff9a9cf6 100644
--- a/packages/install/src/files/brmsgw.conf
+++ b/packages/install/src/files/brmsgw.conf
@@ -37,6 +37,6 @@ VDNS_ARTIFACT_ID=policy-vDNS-rules
resource_name=brmsgw_1
node_type=brms_gateway
-CLIENT_ID=PyPDPServer
+CLIENT_ID=PDPServer
CLIENT_KEY=test
ENVIRONMENT=DEVL
diff --git a/packages/install/src/files/elk.conf b/packages/install/src/files/elk.conf
new file mode 100644
index 000000000..938954ce6
--- /dev/null
+++ b/packages/install/src/files/elk.conf
@@ -0,0 +1,3 @@
+# elasticsearch
+
+ELK_JMX_PORT=9995 \ No newline at end of file
diff --git a/packages/install/src/files/pdp.conf b/packages/install/src/files/pdp.conf
index 239f14989..95c130066 100644
--- a/packages/install/src/files/pdp.conf
+++ b/packages/install/src/files/pdp.conf
@@ -30,5 +30,5 @@ PDP_PAP_PDP_HTTP_PASSWORD=alpha123
node_type=pdp_xacml
resource_name=pdp_1
-dependency_groups=pdplp_1;pypdp_1;brmsgw_1
+dependency_groups=pdplp_1;brmsgw_1
diff --git a/packages/install/src/files/pypdp.conf b/packages/install/src/files/pypdp.conf
deleted file mode 100644
index 2117ff8ba..000000000
--- a/packages/install/src/files/pypdp.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-# pypdp component installation configuration parameters
-
-# tomcat specific parameters
-
-TOMCAT_JMX_PORT=9994
-TOMCAT_SHUTDOWN_PORT=8405
-SSL_HTTP_CONNECTOR_PORT=8480
-SSL_AJP_CONNECTOR_PORT=8384
-SSL_AJP_CONNECTOR_REDIRECT_PORT=8443
-
-TOMCAT_X_MS_MB=1024
-TOMCAT_X_MX_MB=1024
-
-# pypdp parameters
-
-PDP_URL=https://${{FQDN}}:8081/pdp/,testpdp,alpha123
-PAP_URL=https://${{FQDN}}:9091/pap/
-PYPDP_ID=testrest
-PYPDP_PASSWORD=alpha123
-
-node_type=pypdp
-# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase
-resource_name=pypdp_1
-
-CLIENT_FILE=client.properties
diff --git a/pom.xml b/pom.xml
index ecebaf5bd..baed9b165 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
<module>PolicyEngineUtils</module>
<module>ECOMP-XACML</module>
<module>ECOMP-REST</module>
+ <module>ECOMP-ASDC</module>
<module>ECOMP-ControlloopPolicy</module>
<module>PolicyEngineAPI</module>
<module>ECOMP-PDP</module>