From e0addf5b588a1244f9679becd90999dfcb4c3a94 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Tue, 25 Apr 2017 11:46:00 -0400 Subject: Policy 1707 commit to LF Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 --- .../Test/PDP_settings/test_PolicyEngine.xml | 595 +++++++++++++++++++++ .../Test/PDP_settings/xacml.pip.properties | 23 + .../Test/PDP_settings/xacml.policy.properties | 24 + .../Test/config_UEB_bad_type.properties | 28 + .../Test/config_UEB_badservers.properties | 28 + PolicyEngineAPI/Test/config_UEB_pass.properties | 28 + PolicyEngineAPI/Test/config_error.property | 3 + PolicyEngineAPI/Test/config_fail.properties | 23 + PolicyEngineAPI/Test/config_fail_URL.properties | 23 + PolicyEngineAPI/Test/config_pass.properties | 36 ++ .../Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt | 11 + PolicyEngineAPI/Test/test_PolicyEngine.xml | 595 +++++++++++++++++++++ 12 files changed, 1417 insertions(+) create mode 100644 PolicyEngineAPI/Test/PDP_settings/test_PolicyEngine.xml create mode 100644 PolicyEngineAPI/Test/PDP_settings/xacml.pip.properties create mode 100644 PolicyEngineAPI/Test/PDP_settings/xacml.policy.properties create mode 100644 PolicyEngineAPI/Test/config_UEB_bad_type.properties create mode 100644 PolicyEngineAPI/Test/config_UEB_badservers.properties create mode 100644 PolicyEngineAPI/Test/config_UEB_pass.properties create mode 100644 PolicyEngineAPI/Test/config_error.property create mode 100644 PolicyEngineAPI/Test/config_fail.properties create mode 100644 PolicyEngineAPI/Test/config_fail_URL.properties create mode 100644 PolicyEngineAPI/Test/config_pass.properties create mode 100644 PolicyEngineAPI/Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt create mode 100644 PolicyEngineAPI/Test/test_PolicyEngine.xml (limited to 'PolicyEngineAPI/Test') diff --git a/PolicyEngineAPI/Test/PDP_settings/test_PolicyEngine.xml b/PolicyEngineAPI/Test/PDP_settings/test_PolicyEngine.xml new file mode 100644 index 000000000..343ec7c55 --- /dev/null +++ b/PolicyEngineAPI/Test/PDP_settings/test_PolicyEngine.xml @@ -0,0 +1,595 @@ + + + + + Test Policies for the ProtoType PolicyEngineAPI + + + + Check if the CPU Utilization or Memory reach the threshold values. + + CPU + + + + 95 + + + Memory + + + + 95 + + + + + + Spinoff if the VM if CPU or memory value reaches the threshold + + CPU + + + + 90 + + + Memory + + + + 90 + + + + + Json Test + + + + + JSON + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_json.json + + + + + + Json + Config test + + + + + JSON + + + + JSONconfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_json.json + + + + + + XML test + + + + + XML + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_xml.xml + + + + + + XML + Config test + + + + + XML + + + + XMLConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_xml.xml + + + + + + Properties Test + + + + + Properties + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_prop.properties + + + + + + Properties + Config Test + + + + + Properties + + + + PropConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_prop.properties + + + + + + Other Test + + + + + Other + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_other.txt + + + + + + Other + Config Test + + + + + Other + + + + OtherConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://localhost:5443/config/test_other.txt + + + + + + JSON + Attributes + + + + + JSON + + + + JSONconfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://localhost:5443/config/test_json.json + + + + + + XML + Attributes + + + + + XML + + + + XMLConfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://localhost:5443/config/test_xml.xml + + + + + + Prop + Attributes + + + + + Properties + + + + PropConfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://localhost:5443/config/test_prop.properties + + + + + + Other + Attributes + + + + + Other + + + + Otherconfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://localhost:5443/config/test_other.txt + + + + + + + Permit to RESET VM if the values reach the threshold settings. + + + + + Restart + + + + + + + + Restart VM if this condition is met + + true + + + + + + Restart + + + + + + + + + Permit to SpinOff VM if the values reach the threshold settings. + + + + + SpinOff + + + + + + + + SpinOff VM if this condition is met + + true + + + + + + SpinOff + + + PDPAction + + + REST + + + + + + GET + + + http://localhost:8635/RESTjson/PDP/VM/$com.att.labs.ecomp.obligation.spinoff/$com.att.labs.ecomp.obligation.server + + + + + + Deny all the other requests. + + + diff --git a/PolicyEngineAPI/Test/PDP_settings/xacml.pip.properties b/PolicyEngineAPI/Test/PDP_settings/xacml.pip.properties new file mode 100644 index 000000000..e703811b7 --- /dev/null +++ b/PolicyEngineAPI/Test/PDP_settings/xacml.pip.properties @@ -0,0 +1,23 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# PIP Engine Definition +# +xacml.pip.engines= diff --git a/PolicyEngineAPI/Test/PDP_settings/xacml.policy.properties b/PolicyEngineAPI/Test/PDP_settings/xacml.policy.properties new file mode 100644 index 000000000..dd304bf90 --- /dev/null +++ b/PolicyEngineAPI/Test/PDP_settings/xacml.policy.properties @@ -0,0 +1,24 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +xacml.rootPolicies=useCase +useCase.file=config/test_PolicyEngine.xml diff --git a/PolicyEngineAPI/Test/config_UEB_bad_type.properties b/PolicyEngineAPI/Test/config_UEB_bad_type.properties new file mode 100644 index 000000000..146bb1bfd --- /dev/null +++ b/PolicyEngineAPI/Test/config_UEB_bad_type.properties @@ -0,0 +1,28 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PDP_URL=http://localhost:8082/pdp/, test, test +PAP_URL=http://localhost:8070/pap/, test, test +NOTIFICATION = ueb +NOTIFICATION_UEB_SERVERS=localhost.com +CLIENT_KEY=test +CLIENT_ID=test diff --git a/PolicyEngineAPI/Test/config_UEB_badservers.properties b/PolicyEngineAPI/Test/config_UEB_badservers.properties new file mode 100644 index 000000000..dca12f7c1 --- /dev/null +++ b/PolicyEngineAPI/Test/config_UEB_badservers.properties @@ -0,0 +1,28 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PDP_URL=http://localhost:8082/pdp/, test, test +PAP_URL=http://localhost:8070/pap/, test, test +NOTIFICATION_TYPE=ueb +NOTIFICATION_UEB=localhost.com +CLIENT_KEY=test +CLIENT_ID=test diff --git a/PolicyEngineAPI/Test/config_UEB_pass.properties b/PolicyEngineAPI/Test/config_UEB_pass.properties new file mode 100644 index 000000000..16da65f07 --- /dev/null +++ b/PolicyEngineAPI/Test/config_UEB_pass.properties @@ -0,0 +1,28 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PDP_URL=http://localhost:8092/pdp/, test, test +PAP_URL=http://localhost:8070/pap/, test, test +NOTIFICATION_TYPE=ueb +NOTIFICATION_UEB_SERVERS=localhost.com +CLIENT_KEY=test +CLIENT_ID=test diff --git a/PolicyEngineAPI/Test/config_error.property b/PolicyEngineAPI/Test/config_error.property new file mode 100644 index 000000000..1081e4d33 --- /dev/null +++ b/PolicyEngineAPI/Test/config_error.property @@ -0,0 +1,3 @@ +# Policies to load +# +PDP_URL=http://localhost:8080/pdp/ \ No newline at end of file diff --git a/PolicyEngineAPI/Test/config_fail.properties b/PolicyEngineAPI/Test/config_fail.properties new file mode 100644 index 000000000..5b8c15fb0 --- /dev/null +++ b/PolicyEngineAPI/Test/config_fail.properties @@ -0,0 +1,23 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PDP=http://localhost:8080/pdp/ diff --git a/PolicyEngineAPI/Test/config_fail_URL.properties b/PolicyEngineAPI/Test/config_fail_URL.properties new file mode 100644 index 000000000..7fe04f8a5 --- /dev/null +++ b/PolicyEngineAPI/Test/config_fail_URL.properties @@ -0,0 +1,23 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PDP_URL=http://localhost:8080 diff --git a/PolicyEngineAPI/Test/config_pass.properties b/PolicyEngineAPI/Test/config_pass.properties new file mode 100644 index 000000000..0a74f5ab8 --- /dev/null +++ b/PolicyEngineAPI/Test/config_pass.properties @@ -0,0 +1,36 @@ +### +# ============LICENSE_START======================================================= +# PolicyEngineAPI +# ================================================================================ +# 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========================================================= +### + +# Policies to load +# +PAP_URL=http://localhost:8070/pap/ , test, test +PDP_URL=http://localhost:8092/pdp/ , test, test +CLIENT_ID= +CLIENT_KEY= +JUNIT=test + +NOTIFICATION_TYPE=ueb +NOTIFICATION_SERVERS= +NOTIFICATION_TOPIC= +NOTIFICATION_DELAY= + +ENVIRONMENT=TEST + + diff --git a/PolicyEngineAPI/Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt b/PolicyEngineAPI/Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt new file mode 100644 index 000000000..1982255bf --- /dev/null +++ b/PolicyEngineAPI/Test/test.Config_BRMS_Raw_TestBrmsPolicy.1.txt @@ -0,0 +1,11 @@ +rule "B to C" + agenda-group "B to C" + auto-focus true + when + State(name == "B", state == State.FINISHED ) + c : State(name == "C", state == State.NOTRUN ) + then + System.out.println(c.getName() + " finished" ); + c.setState( State.FINISHED ); + kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "B to D" ).setFocus(); +end diff --git a/PolicyEngineAPI/Test/test_PolicyEngine.xml b/PolicyEngineAPI/Test/test_PolicyEngine.xml new file mode 100644 index 000000000..d83c12a4c --- /dev/null +++ b/PolicyEngineAPI/Test/test_PolicyEngine.xml @@ -0,0 +1,595 @@ + + + + + Test Policies for the ProtoType PolicyEngineAPI + + + + Check if the CPU Utilization or Memory reach the threshold values. + + CPU + + + + 95 + + + Memory + + + + 95 + + + + + + Spinoff if the VM if CPU or memory value reaches the threshold + + CPU + + + + 90 + + + Memory + + + + 90 + + + + + Json Test + + + + + JSON + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_json.json + + + + + + Json + Config test + + + + + JSON + + + + JSONconfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_json.json + + + + + + XML test + + + + + XML + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_xml.xml + + + + + + XML + Config test + + + + + XML + + + + XMLConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_xml.xml + + + + + + Properties Test + + + + + Properties + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_prop.properties + + + + + + Properties + Config Test + + + + + Properties + + + + PropConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_prop.properties + + + + + + Other Test + + + + + Other + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_other.txt + + + + + + Other + Config Test + + + + + Other + + + + OtherConfig + + + + ACCESS + + + + Config + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_other.txt + + + + + + JSON + Attributes + + + + + JSON + + + + JSONconfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_json.json + + + + + + XML + Attributes + + + + + XML + + + + XMLConfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_xml.xml + + + + + + Prop + Attributes + + + + + Properties + + + + PropConfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_prop.properties + + + + + + Other + Attributes + + + + + Other + + + + Otherconfig + + + + TestSubject + + + + ACCESS + + + + TestJSON + + + + Config + + + + Test + + + + + + + + + Configuration + + + http://10.01.10.01:5443/config/test_other.txt + + + + + + + Permit to RESET VM if the values reach the threshold settings. + + + + + Restart + + + + + + + + Restart VM if this condition is met + + true + + + + + + Restart + + + + + + + + + Permit to SpinOff VM if the values reach the threshold settings. + + + + + SpinOff + + + + + + + + SpinOff VM if this condition is met + + true + + + + + + SpinOff + + + PDPAction + + + REST + + + + + + GET + + + http://localhost:8635/RESTjson/PDP/VM/$org.ecomp.obligation.spinoff/$org.ecomp.obligation.server + + + + + + Deny all the other requests. + + + -- cgit