diff options
13 files changed, 468 insertions, 50 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java index 47ab45894..03fbe0763 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java @@ -90,9 +90,11 @@ public class DecisionPolicy extends Policy { private static final String AAFPROVIDER = "AAF"; public static final String GUARD_YAML = "GUARD_YAML"; public static final String GUARD_BL_YAML = "GUARD_BL_YAML"; + public static final String GUARD_MIN_MAX = "GUARD_MIN_MAX"; public static final String RAINY_DAY = "Rainy_Day"; private static final String XACML_GUARD_TEMPLATE = "Decision_GuardPolicyTemplate.xml"; private static final String XACML_BLGUARD_TEMPLATE = "Decision_GuardBLPolicyTemplate.xml"; + private static final String XACML_GUARD_MIN_MAX_TEMPLATE = "Decision_GuardMinMaxPolicyTemplate.xml"; private static final String ONAPNAME = "ONAPName"; private static final String POLICY_NAME = "PolicyName"; @@ -194,8 +196,10 @@ public class DecisionPolicy extends Policy { } policyName = policyAdapter.getNewFileName(); - if (policyAdapter.getRuleProvider().equals(GUARD_YAML) - || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML)) { + if(policyAdapter.getRuleProvider().equals(GUARD_YAML) || + policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || + policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)){ + Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; @@ -353,6 +357,12 @@ public class DecisionPolicy extends Policy { } cons.setBlacklist(blackList); break; + case GUARD_MIN_MAX: + templateFile = new File(classLoader.getResource(XACML_GUARD_MIN_MAX_TEMPLATE).getFile()); + xacmlTemplatePath = templateFile.toPath(); + cons = new Constraint(Integer.parseInt(yamlParams.get("min")), + Integer.parseInt(yamlParams.get("max")), activeTimeRange); + break; default: templateFile = new File(classLoader.getResource(XACML_GUARD_TEMPLATE).getFile()); xacmlTemplatePath = templateFile.toPath(); @@ -372,6 +382,7 @@ public class DecisionPolicy extends Policy { cons = new Constraint(Integer.parseInt(yamlParams.get("limit")), timeWindow, activeTimeRange); break; } + builder = builder.addLimitConstraint(policy1.getId(), cons); // Build the specification Results results = builder.buildSpecification(); @@ -399,6 +410,18 @@ public class DecisionPolicy extends Policy { yamlSpecs.put("twUnits", yamlGuardObject.getGuards().getFirst().getLimit_constraints().getFirst() .getTime_window().get("units")); } + + if (yamlGuardObject.getGuards().getFirst().getLimit_constraints(). + getFirst().getMaxVnfCount() != null) { + yamlSpecs.put("max", yamlGuardObject.getGuards().getFirst().getLimit_constraints().getFirst() + .getMaxVnfCount().toString()); + } + if (yamlGuardObject.getGuards().getFirst().getLimit_constraints(). + getFirst().getMinVnfCount() != null) { + yamlSpecs.put("min", yamlGuardObject.getGuards().getFirst().getLimit_constraints().getFirst() + .getMinVnfCount().toString()); + } + yamlSpecs.put("guardActiveStart", yamlGuardObject.getGuards().getFirst().getLimit_constraints() .getFirst().getActive_time_range().get("start")); yamlSpecs.put("guardActiveEnd", yamlGuardObject.getGuards().getFirst().getLimit_constraints().getFirst() @@ -406,9 +429,11 @@ public class DecisionPolicy extends Policy { String xacmlPolicyContent = SafePolicyBuilder.generateXacmlGuard(xacmlTemplateContent, yamlSpecs, yamlGuardObject.getGuards().getFirst().getLimit_constraints().getFirst().getBlacklist(), yamlGuardObject.getGuards().getFirst().getMatch_parameters().getTargets()); + // Convert the Policy into Stream input to Policy Adapter. Object policy = XACMLPolicyScanner .readPolicy(new ByteArrayInputStream(xacmlPolicyContent.getBytes(StandardCharsets.UTF_8))); + return (PolicyType) policy; } catch (IOException e) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error while creating the policy " + e.getMessage(), diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java index 951f25c25..de5d1cf49 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java @@ -402,46 +402,56 @@ public class PolicyCreation extends AbstractPolicyCreation{ } } } - if(policyData.getRuleProvider()!=null && (policyData.getRuleProvider().equals(DecisionPolicy.GUARD_YAML)|| policyData.getRuleProvider().equals(DecisionPolicy.GUARD_BL_YAML)) - && policyData.getYamlparams()!=null){ + if (policyData.getRuleProvider() != null + && (policyData.getRuleProvider().equals(DecisionPolicy.GUARD_YAML) + || policyData.getRuleProvider().equals(DecisionPolicy.GUARD_BL_YAML) + || policyData.getRuleProvider().equals(DecisionPolicy.GUARD_MIN_MAX)) + && policyData.getYamlparams() != null) { attributeMap.put("actor", policyData.getYamlparams().getActor()); attributeMap.put("recipe", policyData.getYamlparams().getRecipe()); attributeMap.put("clname", policyData.getYamlparams().getClname()); attributeMap.put("limit", policyData.getYamlparams().getLimit()); + attributeMap.put("min", policyData.getYamlparams().getMin()); + attributeMap.put("max", policyData.getYamlparams().getMax()); attributeMap.put("timeWindow", policyData.getYamlparams().getTimeWindow()); attributeMap.put("timeUnits", policyData.getYamlparams().getTimeUnits()); attributeMap.put("guardActiveStart", policyData.getYamlparams().getGuardActiveStart()); attributeMap.put("guardActiveEnd", policyData.getYamlparams().getGuardActiveEnd()); - if(policyData.getYamlparams().getBlackList()!=null){ + if (policyData.getYamlparams().getBlackList() != null) { String blackList = StringUtils.join(policyData.getYamlparams().getBlackList(), ","); attributeMap.put("blackList", blackList); } - if(DecisionPolicy.GUARD_BL_YAML.equals(policyData.getRuleProvider()) && "Use File Upload".equals(policyData.getBlackListEntryType())){ - if(policyData.getBlackListEntries() != null && !policyData.getBlackListEntries().isEmpty()){ + if (DecisionPolicy.GUARD_BL_YAML.equals(policyData.getRuleProvider()) + && "Use File Upload".equals(policyData.getBlackListEntryType())) { + if (policyData.getBlackListEntries() != null + && !policyData.getBlackListEntries().isEmpty()) { String blackList = StringUtils.join(policyData.getBlackListEntries(), ","); attributeMap.put("blackList", blackList); } - if(policyData.getAppendBlackListEntries() != null && !policyData.getAppendBlackListEntries().isEmpty()){ + if (policyData.getAppendBlackListEntries() != null + && !policyData.getAppendBlackListEntries().isEmpty()) { String blackList = StringUtils.join(policyData.getAppendBlackListEntries(), ","); attributeMap.put("appendBlackList", blackList); } } - if(policyData.getYamlparams().getTargets()!=null){ - String targets = StringUtils.join(policyData.getYamlparams().getTargets(),","); + if (policyData.getYamlparams().getTargets() != null) { + String targets = StringUtils.join(policyData.getYamlparams().getTargets(), ","); attributeMap.put("targets", targets); } } - if(policyData.getRuleProvider()!=null && policyData.getRuleProvider().equals(DecisionPolicy.RAINY_DAY)){ + if (policyData.getRuleProvider() != null + && policyData.getRuleProvider().equals(DecisionPolicy.RAINY_DAY)) { attributeMap.put("ServiceType", policyData.getRainyday().getServiceType()); attributeMap.put("VNFType", policyData.getRainyday().getVnfType()); attributeMap.put("BB_ID", policyData.getRainyday().getBbid()); attributeMap.put("WorkStep", policyData.getRainyday().getWorkstep()); - if(policyData.getRainyday().getTreatmentTableChoices()!=null && policyData.getRainyday().getTreatmentTableChoices().size() > 0){ - for (Object table : policyData.getRainyday().getTreatmentTableChoices()){ - if(table instanceof LinkedHashMap<?,?>){ - String errorcode = ((LinkedHashMap<?,?>) table).get("errorcode").toString(); - String treatment = ((LinkedHashMap<?,?>) table).get("treatment").toString(); + if (policyData.getRainyday().getTreatmentTableChoices() != null + && policyData.getRainyday().getTreatmentTableChoices().isEmpty()) { + for (Object table : policyData.getRainyday().getTreatmentTableChoices()) { + if (table instanceof LinkedHashMap<?, ?>) { + String errorcode = ((LinkedHashMap<?, ?>) table).get("errorcode").toString(); + String treatment = ((LinkedHashMap<?, ?>) table).get("treatment").toString(); treatmentMap.put(errorcode, treatment); } } diff --git a/ONAP-PAP-REST/src/main/resources/Decision_GuardMinMaxPolicyTemplate.xml b/ONAP-PAP-REST/src/main/resources/Decision_GuardMinMaxPolicyTemplate.xml new file mode 100644 index 000000000..afb118aa5 --- /dev/null +++ b/ONAP-PAP-REST/src/main/resources/Decision_GuardMinMaxPolicyTemplate.xml @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + ============LICENSE_START================================================== + ONAP Policy Engine + =========================================================================== + Copyright (C) 2018 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==================================================== + --> +<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:d56af069-6cf1-430c-ba07-e26602e06a52" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-unless-deny"> + <Description>${description}</Description> + <Target> + <AnyOf> + <AllOf> + <Match MatchId="org.onap.function.regex-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${PolicyName}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + </AllOf> + <AllOf> + <Match MatchId="org.onap.function.regex-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${ONAPName}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">(?i)${actor}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="actor" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">(?i)${recipe}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="recipe" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${targets}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="target" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${clname}</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="clname" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + </AllOf> + </AnyOf> + </Target> + <Rule RuleId="urn:com:xacml:rule:id:284d9393-f861-4250-b62d-fc36640a363a" Effect="Permit"> + <Target> + <AnyOf> + <AllOf> + <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DECIDE</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + </AllOf> + </AnyOf> + </Target> + <Condition> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and"> + <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:time-in-range"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:time-one-and-only"> + <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time" DataType="http://www.w3.org/2001/XMLSchema#time" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveStart}</AttributeValue> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveEnd}</AttributeValue> + </Apply> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than-or-equal"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="vfCount" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">${min}</AttributeValue> + </Apply> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-less-than-or-equal"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="vfCount" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">${max}</AttributeValue> + </Apply> + </Apply> + </Apply> + </Condition> + </Rule> + <Rule RuleId="urn:com:xacml:rule:id:284d9393-f861-4250-b62d-fc36640a363a" Effect="Deny"> + <Target> + <AnyOf> + <AllOf> + <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DECIDE</AttributeValue> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/> + </Match> + </AllOf> + </AnyOf> + </Target> + <Condition> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and"> + <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:time-in-range"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:time-one-and-only"> + <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time" DataType="http://www.w3.org/2001/XMLSchema#time" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveStart}</AttributeValue> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveEnd}</AttributeValue> + </Apply> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than-or-equal"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="vfCount" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">${min}</AttributeValue> + </Apply> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-less-than-or-equal"> + <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only"> + <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="vfCount" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false"/> + </Apply> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">${max}</AttributeValue> + </Apply> + </Apply> + </Apply> + </Apply> + </Condition> + <AdviceExpressions> + <AdviceExpression AdviceId="GUARD_MIN_MAX" AppliesTo="Deny"> + <AttributeAssignmentExpression AttributeId="guard.response" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"> + <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Denied By Guard</AttributeValue> + </AttributeAssignmentExpression> + </AdviceExpression> + </AdviceExpressions> + </Rule> +</Policy>
\ No newline at end of file diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java index 4ba72afcb..00553e0ee 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java @@ -408,6 +408,43 @@ public class XACMLPAPTest { Mockito.verify(httpServletResponse).addHeader("successMapKey", "success"); Mockito.verify(httpServletResponse).addHeader("policyName", "test.Decision_testGuard.1.xml"); } + + @Test + public void testDecisonGuardMinMaxPolicy() throws IOException, ServletException, SQLException { + httpServletRequest = Mockito.mock(HttpServletRequest.class); + Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL"); + Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT"); + Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api"); + Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create"); + Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision"); + Map<String, String> matchingAttributes = new HashMap<>(); + matchingAttributes.put("actor", "test"); + matchingAttributes.put("recipe", "scaleOut"); + matchingAttributes.put("targets", "test,test1"); + matchingAttributes.put("clname", "test"); + matchingAttributes.put("min", "1"); + matchingAttributes.put("max", "5"); + matchingAttributes.put("guardActiveStart", "05:00"); + matchingAttributes.put("guardActiveEnd", "10:00"); + StdPAPPolicy newPAPPolicy = + + new StdPAPPolicy( + StdPAPPolicyParams.builder().policyName("testGuard").description("test rule").onapName("PDPD") + .providerComboBox("GUARD_MIN_MAX").dynamicFieldConfigAttributes(matchingAttributes) + .editPolicy(false).domain("test").highestVersion(0).build()); + MockServletInputStream mockInput = new MockServletInputStream( + PolicyUtils.objectToJsonString(newPAPPolicy).getBytes()); + Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput); + + // set DBDao + setDBDao(); + pap.service(httpServletRequest, httpServletResponse); + + Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK); + Mockito.verify(httpServletResponse).addHeader("successMapKey", "success"); + Mockito.verify(httpServletResponse).addHeader("policyName", "test.Decision_testGuard.1.xml"); + } + @Test public void testDecisonBLGuardPolicy() throws IOException, ServletException, SQLException { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java index ec43a19f2..c7063b86e 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -27,6 +27,8 @@ public class YAMLParams { private String recipe; private String clname; private String limit; + private String min; + private String max; private String timeWindow; private String timeUnits; private String guardActiveStart; @@ -52,6 +54,23 @@ public class YAMLParams { public void setLimit(String limit) { this.limit = limit; } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } + public String getTimeWindow() { return timeWindow; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java index 42f94cfa7..df4e4726d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java @@ -900,48 +900,74 @@ public class PolicyValidation { } } - if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){ - if(policyData.getYamlparams()==null){ + if ("GUARD_YAML".equals(policyData.getRuleProvider()) + || "GUARD_BL_YAML".equals(policyData.getRuleProvider()) + || "GUARD_MIN_MAX".equals(policyData.getRuleProvider())) { + if (policyData.getYamlparams() == null) { responseString.append("<b> Guard Params are Required </b>" + HTML_ITALICS_LNBREAK); valid = false; - }else{ - if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){ + } else { + if (Strings.isNullOrEmpty(policyData.getYamlparams().getActor())) { responseString.append("Guard Params <b>Actor</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){ + if (Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())) { responseString.append("Guard Params <b>Recipe</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())){ - responseString.append("Guard Params <b>Guard Active Start</b> is Required " + HTML_ITALICS_LNBREAK); + if (Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())) { + responseString.append( + "Guard Params <b>Guard Active Start</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())){ - responseString.append("Guard Params <b>Guard Active End</b> is Required " + HTML_ITALICS_LNBREAK); + if (Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())) { + responseString + .append("Guard Params <b>Guard Active End</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } - if("GUARD_YAML".equals(policyData.getRuleProvider())){ - if(Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())){ + if ("GUARD_YAML".equals(policyData.getRuleProvider())) { + if (Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())) { responseString.append(" Guard Params <b>Limit</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; - }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){ - responseString.append(" Guard Params <b>Limit</b> Should be Integer " + HTML_ITALICS_LNBREAK); + } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())) { + responseString + .append(" Guard Params <b>Limit</b> Should be Integer " + HTML_ITALICS_LNBREAK); + valid = false; + } + if (Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())) { + responseString + .append("Guard Params <b>Time Window</b> is Required" + HTML_ITALICS_LNBREAK); + valid = false; + } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())) { + responseString.append( + " Guard Params <b>Time Window</b> Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())){ - responseString.append("Guard Params <b>Time Window</b> is Required" + HTML_ITALICS_LNBREAK); + if (Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())) { + responseString + .append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else if ("GUARD_MIN_MAX".equals(policyData.getRuleProvider())) { + if (Strings.isNullOrEmpty(policyData.getYamlparams().getMin())) { + responseString.append(" Guard Params <b>Min</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; - }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){ - responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + HTML_ITALICS_LNBREAK); + } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getMin())) { + responseString + .append(" Guard Params <b>Min</b> Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } - if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){ - responseString.append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); + if (Strings.isNullOrEmpty(policyData.getYamlparams().getMax())) { + responseString.append(" Guard Params <b>Max</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getMax())) { + responseString + .append(" Guard Params <b>Max</b> Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } } else if ("GUARD_BL_YAML".equals(policyData.getRuleProvider()) && "Use Manual Entry".equals(policyData.getBlackListEntryType())) { + if (policyData.getYamlparams().getBlackList() == null || policyData.getYamlparams().getBlackList().isEmpty()) { responseString diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java index 66628e2da..779c5227a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java @@ -176,7 +176,8 @@ public class PolicyValidationRequestWrapper { rainyday.setTreatmentTableChoices(treatmentsTableChoices); policyData.setRainyday(rainyday); - }else if("GUARD_YAML".equals(ruleProvider) || "GUARD_BL_YAML".equals(ruleProvider)) { + } else if ("GUARD_YAML".equals(ruleProvider) || "GUARD_BL_YAML".equals(ruleProvider) + || "GUARD_MIN_MAX".equals(ruleProvider)) { // Set Matching attributes in YAMLParams in adapter YAMLParams yamlparams = new YAMLParams(); @@ -191,6 +192,9 @@ public class PolicyValidationRequestWrapper { yamlparams.setLimit(matching.get("limit")); yamlparams.setTimeWindow(matching.get("timeWindow")); yamlparams.setTimeUnits(matching.get("timeUnits")); + } else if ("GUARD_MIN_MAX".equals(ruleProvider)) { + yamlparams.setMin(matching.get("min")); + yamlparams.setMax(matching.get("max")); }else{ List<String> blackList = new ArrayList<>(); diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java index 69c3d2fcb..4e8c8c141 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java @@ -69,6 +69,7 @@ public class DecisionPolicyController extends RestrictedBaseController { private static final String DECISIONRAWTYPE = "@#RuleProvider@#Decision_Raw@#RuleProvider@#"; private static final String GUARD_YAML= "GUARD_YAML"; private static final String GUARD_BL_YAML= "GUARD_BL_YAML"; + private static final String GUARD_MIN_MAX= "GUARD_MIN_MAX"; protected PolicyRestAdapter policyAdapter = null; private ArrayList<Object> ruleAlgorithmList; @@ -233,6 +234,9 @@ public class DecisionPolicyController extends RestrictedBaseController { } else if (GUARD_BL_YAML.equalsIgnoreCase(((RuleType) object).getAdviceExpressions() .getAdviceExpression().get(0).getAdviceId())) { policyAdapter.setRuleProvider(GUARD_BL_YAML); + } else if (GUARD_MIN_MAX.equalsIgnoreCase(((RuleType) object).getAdviceExpressions() + .getAdviceExpression().get(0).getAdviceId())) { + policyAdapter.setRuleProvider(GUARD_MIN_MAX); } } else { policyAdapter.setRuleProvider("Custom"); @@ -244,7 +248,8 @@ public class DecisionPolicyController extends RestrictedBaseController { ruleAlgoirthmTracker = new LinkedList<>(); if (policyAdapter.getRuleProvider() != null && (GUARD_YAML.equals(policyAdapter.getRuleProvider()) - || (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider())))) { + || (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider())) + || (GUARD_MIN_MAX.equals(policyAdapter.getRuleProvider())))){ YAMLParams yamlParams = new YAMLParams(); for (int i = 0; i < attributeList.size(); i++) { Map<String, String> map = (Map<String, String>) attributeList.get(i); @@ -256,6 +261,10 @@ public class DecisionPolicyController extends RestrictedBaseController { yamlParams.setTargets(Arrays.asList(map.get("value").split("\\|"))); } else if ("clname".equals(map.get("key"))) { yamlParams.setClname(map.get("value")); + } else if ("min".equals(map.get("key"))) { + yamlParams.setMin(map.get("value")); + } else if ("max".equals(map.get("key"))) { + yamlParams.setMax(map.get("value")); } } ApplyType apply = 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 ba9e44868..0e53ce9de 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 @@ -238,10 +238,11 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy $scope.blackListEntries = []; $scope.temp.policy.appendBlackListEntries = []; $scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList)); - } else if ($scope.temp.policy.ruleProvider == "GUARD_YAML") { - if ($scope.temp.policy.yamlparams.targets.length == 0) { - $scope.temp.policy.yamlparams.targets = []; - } + + }else if($scope.temp.policy.ruleProvider=="GUARD_YAML" || $scope.temp.policy.ruleProvider=="GUARD_MIN_MAX"){ + if($scope.temp.policy.yamlparams.targets.length==0){ + $scope.temp.policy.yamlparams.targets = []; + } } else if ($scope.temp.policy.ruleProvider == "Rainy_Day") { if ($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0) { $scope.temp.policy.rainyday.treatmentTableChoices = []; @@ -286,9 +287,9 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy $scope.addNewBL = function() { $scope.temp.policy.yamlparams.blackList.push(''); }; - - $scope.removeBL = function(id) { - $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function(obj) { + + $scope.removeBL = function(id) { + $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function (obj){ return obj !== id; }); }; @@ -296,9 +297,11 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy $scope.treatmentDatas = [ { "treatmentValues" : $scope.temp.policy.rainyday.treatmentTableChoices } ]; + $scope.addNewTreatment = function() { $scope.temp.policy.rainyday.treatmentTableChoices.push({}); }; + $scope.removeTreatment = function() { var lastItem = $scope.temp.policy.rainyday.treatmentTableChoices.length - 1; $scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html index f27d5c619..f482554a2 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html @@ -55,6 +55,7 @@ <option>Rainy_Day</option> <option>GUARD_YAML</option> <option>GUARD_BL_YAML</option> + <option>GUARD_MIN_MAX</option> <option>Raw</option> </select> </div> @@ -438,6 +439,121 @@ </div> </div> + <div ng-if="temp.policy.ruleProvider == 'GUARD_MIN_MAX'"> + <div class="well"> + <div class="form-group row"> + <div class="form-group col-sm-1"> + <label>Guard MIN/MAX Attributes:</label><br> + </div> + </div> + <div class="form-group row"> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> actor: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.actor" placeholder="Actor" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> recipe: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.recipe" placeholder="Recipe" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> CLName: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.clname" placeholder="CLName" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> Targets: </label> + <button type="button" class="btn btn-default" + ng-disabled="temp.policy.readOnly" ng-click="addNewTarget()"> + <i class="fa fa-plus"></i> + </button> + </div> + <div class="form-group col-sm-4"> + <div + data-ng-repeat="choice in temp.policy.yamlparams.targets track by $index"> + <div class="form-group row"> + <div class="form-group col-sm-9"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.targets[$index]" + placeholder="Target" /> + </div> + <div class="form-group col-sm-1"> + <button type="button" class="btn btn-default" ng-show="$last" + ng-disabled="temp.policy.readOnly" ng-click="removeTarget()"> + <i class="fa fa-minus"></i> + </button> + </div> + </div> + </div> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> min: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.min" placeholder="Min" + title="Enter minimum number of VNF instances" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> max: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.max" placeholder="Max" + title="Enter maximum number of VNF instances" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> guardActiveStart: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.guardActiveStart" + title="Enter Guard Active Start value in following patren '00:00:00-05:00'." + placeholder="00:00:00-05:00" /> + </div> + </div> + <div class="form-group row" style="margin-left: 2%"> + <div class="form-group col-sm-3"> + <label> guardActiveEnd: </label> + </div> + <div class="form-group col-sm-3"> + <input type="text" class="form-control" + ng-disabled="temp.policy.readOnly" + ng-model="temp.policy.yamlparams.guardActiveEnd" + title="Enter Guard Active End value in following patren '00:00:00-05:00'." + placeholder="00:00:00-05:00" /> + </div> + </div> + </div> + </div> + </div> <div ng-if="temp.policy.ruleProvider == 'Custom'"> <div class="well"> diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java index 24d0bcd2c..7f470a2e1 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java @@ -42,15 +42,19 @@ public enum RuleProvider { */ GUARD_YAML("GUARD_YAML"), /** - * Indicates Guard BLACKLIST YAML + * Indicates Guard MIN / MAX will be providing the Rule information. + */ + GUARD_MIN_MAX("GUARD_MIN_MAX"), + /** + * Indicates Guard BLACKLIST YAML. */ GUARD_BL_YAML("GUARD_BL_YAML"), /** - * Indicates Guard BLACKLIST YAML + * Indicates Rainy Day Decision Policy. */ RAINY_DAY("Rainy_Day"), /** - * Indicates Raw + * Indicates Raw. */ RAW("Raw"); diff --git a/docs/platform/api-docs.json b/docs/platform/api-docs.json index 55726b271..36281a089 100755 --- a/docs/platform/api-docs.json +++ b/docs/platform/api-docs.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"description":"This API helps to make queries against Policy Engine","version":"3.0","title":"Policy Engine REST API"},"host":"104.239.197.207:8081","basePath":"/pdp/api","tags":[{"name":"policy-engine-services","description":"Policy Engine Services"}],"paths":{"/createConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Policy based on given Policy Parameters.","operationId":"createConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"createDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/createFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Firewall Policy","operationId":"createFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Policy based on given Policy Parameters.","operationId":"createPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/deletePolicy":{"delete":{"tags":["policy-engine-services"],"summary":"Deletes the specified policy from the PDP Group or PAP.","operationId":"deletePolicyUsingDELETE","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"deletePolicyParameters","description":"deletePolicyParameters","required":true,"schema":{"$ref":"#/definitions/DeletePolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"204":{"description":"No Content"},"403":{"description":"Forbidden"}}}},"/getConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP)","operationId":"getConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getConfigByPolicyName":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP) using PolicyName","operationId":"getConfigByPolicyNameUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configNameRequest","description":"configNameRequest","required":true,"schema":{"$ref":"#/definitions/ConfigNameRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/getDecision":{"post":{"tags":["policy-engine-services"],"summary":"Gets the Decision using specified decision parameters","operationId":"getDecisionUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"decisionRequestParameters","description":"decisionRequestParameters","required":true,"schema":{"$ref":"#/definitions/DecisionRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DecisionResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getDictionaryItems":{"post":{"tags":["policy-engine-services"],"summary":"Gets the dictionary items from the PAP","operationId":"getDictionaryItemsUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DictionaryResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getMetrics":{"get":{"tags":["policy-engine-services"],"summary":"Gets the policy metrics from the PolicyAccessPoint(PAP)","operationId":"getMetricsUsingGET","consumes":["application/json"],"produces":["*/*"],"parameters":[{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/MetricsResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getNotification":{"post":{"tags":["policy-engine-services"],"summary":"Registers DMaaP Topic to recieve notification from Policy Engine","operationId":"getNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/listConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the list of configuration policies from the PDP","operationId":"listConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«string»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/policyEngineImport":{"post":{"tags":["policy-engine-services"],"summary":"Imports Policy based on the parameters which represent the service used to create a policy Service.","operationId":"policyEngineImportUsingPOST","consumes":["multipart/form-data"],"produces":["*/*"],"parameters":[{"name":"importParametersJson","in":"query","description":"importParametersJson","required":true,"type":"string"},{"name":"file","in":"formData","description":"file","required":true,"type":"file"},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/pushPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Pushes the specified policy to the PDP Group.","operationId":"pushPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"pushPolicyParameters","description":"pushPolicyParameters","required":true,"schema":{"$ref":"#/definitions/PushPolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendEvent":{"post":{"tags":["policy-engine-services"],"summary":"Sends the Events specified to the Policy Engine","operationId":"sendEventUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"eventRequestParameters","description":"eventRequestParameters","required":true,"schema":{"$ref":"#/definitions/EventRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyResponse»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendHeartbeat":{"post":{"tags":["policy-engine-services"],"summary":"Sends Heartbeat to DMaaP Topic Registry to continue recieving notifications from Policy Engine","operationId":"sendHeartbeatUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/stopNotification":{"post":{"tags":["policy-engine-services"],"summary":"De-Registers DMaaP Topic to stop recieving notifications from Policy Engine","operationId":"stopNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Policy based on given Policy Parameters.","operationId":"updateConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updateDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"updateDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Firewall Policy","operationId":"updateFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updatePolicy":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Policy based on given Policy Parameters.","operationId":"updatePolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}}},"definitions":{"PolicyParameters":{"type":"object","properties":{"actionAttribute":{"type":"string"},"actionPerformer":{"type":"string"},"attributes":{"type":"object","additionalProperties":{"$ref":"#/definitions/Map«string,string»"}},"configBody":{"type":"string"},"configBodyType":{"type":"string","enum":["Properties","json","xml","other"]},"configName":{"type":"string"},"controllerName":{"type":"string"},"dependencyNames":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField1":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField2":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmFunctions":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmLabels":{"type":"array","items":{"type":"string"}},"ecompName":{"type":"string"},"extendedOption":{"type":"string"},"guard":{"type":"boolean"},"onapName":{"type":"string"},"policyClass":{"type":"string","enum":["Config","Action","Decision"]},"policyConfigType":{"type":"string","enum":["Base","Fault","PM","FW","BRMS_Raw","BRMS_Param","MS","EXTENDED"]},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"priority":{"type":"string"},"requestID":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ruleProvider":{"type":"string","enum":["Custom","AAF","GUARD_YAML","GUARD_BL_YAML"]},"ttlDate":{"type":"string","format":"date-time"}}},"ConfigRequestParameters":{"type":"object","properties":{"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"ecompName":{"type":"string"},"onapName":{"type":"string"},"policyName":{"type":"string"},"requestID":{"type":"string"},"unique":{"type":"boolean"}}},"Collection«PolicyResponse»":{"type":"object"},"DecisionResponse":{"type":"object","properties":{"decision":{"type":"string","enum":["permit","deny","error"]},"details":{"type":"string"}}},"DictionaryParameters":{"type":"object","properties":{"dictionary":{"type":"string"},"dictionaryJson":{"type":"string"},"dictionaryType":{"type":"string","enum":["Common","Action","ClosedLoop","Firewall","Decision","BRMS","MicroService","DescriptiveScope","PolicyScope","Enforcer","SafePolicy","Extended"]},"requestID":{"type":"string"}}},"JsonValue":{"type":"object","properties":{"valueType":{"type":"string","enum":["ARRAY","OBJECT","STRING","NUMBER","TRUE","FALSE","NULL"]}}},"DecisionRequestParameters":{"type":"object","properties":{"decisionAttributes":{"type":"object","additionalProperties":{"type":"string"}},"ecompcomponentName":{"type":"string"},"onapName":{"type":"string"},"requestID":{"type":"string"}}},"ConfigPolicyAPIRequest":{"type":"object","properties":{"body":{"type":"string"},"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"configType":{"type":"string"},"ecompName":{"type":"string"},"guard":{"type":"string"},"onapName":{"type":"string"},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PushPolicyParameters":{"type":"object","properties":{"pdpGroup":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}},"ConfigFirewallPolicyAPIRequest":{"type":"object","properties":{"firewallJson":{"type":"string"},"guard":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PolicyConfig":{"type":"object","properties":{"config":{"type":"string"},"matchingConditions":{"type":"object","additionalProperties":{"type":"string"}},"policyConfigMessage":{"type":"string"},"policyConfigStatus":{"type":"string","enum":["retrieved","not_found"]},"policyName":{"type":"string"},"policyVersion":{"type":"string"},"property":{"type":"object","additionalProperties":{"type":"string"}},"responseAttributes":{"type":"object","additionalProperties":{"type":"string"}},"type":{"type":"string","enum":["Properties","json","xml","other"]}}},"EventRequestParameters":{"type":"object","properties":{"eventAttributes":{"type":"object","additionalProperties":{"type":"string"}},"requestID":{"type":"string"}}},"Map«string,string»":{"type":"object","additionalProperties":{"type":"string"}},"Collection«PolicyConfig»":{"type":"object"},"DictionaryResponse":{"type":"object","properties":{"dictionaryData":{"type":"object","additionalProperties":{"type":"string"}},"dictionaryJson":{"type":"object","additionalProperties":{"$ref":"#/definitions/JsonValue"}},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"ConfigNameRequest":{"type":"object","properties":{"policyName":{"type":"string"}}},"MetricsResponse":{"type":"object","properties":{"metricsTotal":{"type":"integer","format":"int32"},"papMetrics":{"type":"integer","format":"int32"},"pdpMetrics":{"type":"integer","format":"int32"},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"Collection«string»":{"type":"object"},"PolicyResponse":{"type":"object","properties":{"actionAdvised":{"type":"object","additionalProperties":{"type":"string"}},"actionTaken":{"type":"object","additionalProperties":{"type":"string"}},"policyResponseMessage":{"type":"string"},"policyResponseStatus":{"type":"string","enum":["no_action","action_advised","action_taken"]},"requestAttributes":{"type":"object","additionalProperties":{"type":"string"}}}},"DeletePolicyParameters":{"type":"object","properties":{"deleteCondition":{"type":"string","enum":["Current Version","All Versions"]},"pdpGroup":{"type":"string"},"policyComponent":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}}}}
\ No newline at end of file +{"swagger":"2.0","info":{"description":"This API helps to make queries against Policy Engine","version":"3.0","title":"Policy Engine REST API"},"host":"104.239.197.207:8081","basePath":"/pdp/api","tags":[{"name":"policy-engine-services","description":"Policy Engine Services"}],"paths":{"/createConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Policy based on given Policy Parameters.","operationId":"createConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"createDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/createFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Firewall Policy","operationId":"createFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Policy based on given Policy Parameters.","operationId":"createPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/deletePolicy":{"delete":{"tags":["policy-engine-services"],"summary":"Deletes the specified policy from the PDP Group or PAP.","operationId":"deletePolicyUsingDELETE","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"deletePolicyParameters","description":"deletePolicyParameters","required":true,"schema":{"$ref":"#/definitions/DeletePolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"204":{"description":"No Content"},"403":{"description":"Forbidden"}}}},"/getConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP)","operationId":"getConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getConfigByPolicyName":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP) using PolicyName","operationId":"getConfigByPolicyNameUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configNameRequest","description":"configNameRequest","required":true,"schema":{"$ref":"#/definitions/ConfigNameRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/getDecision":{"post":{"tags":["policy-engine-services"],"summary":"Gets the Decision using specified decision parameters","operationId":"getDecisionUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"decisionRequestParameters","description":"decisionRequestParameters","required":true,"schema":{"$ref":"#/definitions/DecisionRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DecisionResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getDictionaryItems":{"post":{"tags":["policy-engine-services"],"summary":"Gets the dictionary items from the PAP","operationId":"getDictionaryItemsUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DictionaryResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getMetrics":{"get":{"tags":["policy-engine-services"],"summary":"Gets the policy metrics from the PolicyAccessPoint(PAP)","operationId":"getMetricsUsingGET","consumes":["application/json"],"produces":["*/*"],"parameters":[{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/MetricsResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getNotification":{"post":{"tags":["policy-engine-services"],"summary":"Registers DMaaP Topic to recieve notification from Policy Engine","operationId":"getNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/listConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the list of configuration policies from the PDP","operationId":"listConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«string»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/policyEngineImport":{"post":{"tags":["policy-engine-services"],"summary":"Imports Policy based on the parameters which represent the service used to create a policy Service.","operationId":"policyEngineImportUsingPOST","consumes":["multipart/form-data"],"produces":["*/*"],"parameters":[{"name":"importParametersJson","in":"query","description":"importParametersJson","required":true,"type":"string"},{"name":"file","in":"formData","description":"file","required":true,"type":"file"},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/pushPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Pushes the specified policy to the PDP Group.","operationId":"pushPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"pushPolicyParameters","description":"pushPolicyParameters","required":true,"schema":{"$ref":"#/definitions/PushPolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendEvent":{"post":{"tags":["policy-engine-services"],"summary":"Sends the Events specified to the Policy Engine","operationId":"sendEventUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"eventRequestParameters","description":"eventRequestParameters","required":true,"schema":{"$ref":"#/definitions/EventRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyResponse»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendHeartbeat":{"post":{"tags":["policy-engine-services"],"summary":"Sends Heartbeat to DMaaP Topic Registry to continue recieving notifications from Policy Engine","operationId":"sendHeartbeatUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/stopNotification":{"post":{"tags":["policy-engine-services"],"summary":"De-Registers DMaaP Topic to stop recieving notifications from Policy Engine","operationId":"stopNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Policy based on given Policy Parameters.","operationId":"updateConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updateDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"updateDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Firewall Policy","operationId":"updateFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updatePolicy":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Policy based on given Policy Parameters.","operationId":"updatePolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}}},"definitions":{"PolicyParameters":{"type":"object","properties":{"actionAttribute":{"type":"string"},"actionPerformer":{"type":"string"},"attributes":{"type":"object","additionalProperties":{"$ref":"#/definitions/Map«string,string»"}},"configBody":{"type":"string"},"configBodyType":{"type":"string","enum":["Properties","json","xml","other"]},"configName":{"type":"string"},"controllerName":{"type":"string"},"dependencyNames":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField1":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField2":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmFunctions":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmLabels":{"type":"array","items":{"type":"string"}},"ecompName":{"type":"string"},"extendedOption":{"type":"string"},"guard":{"type":"boolean"},"onapName":{"type":"string"},"policyClass":{"type":"string","enum":["Config","Action","Decision"]},"policyConfigType":{"type":"string","enum":["Base","Fault","PM","FW","BRMS_Raw","BRMS_Param","MS","EXTENDED"]},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"priority":{"type":"string"},"requestID":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ruleProvider":{"type":"string","enum":["Custom","AAF","GUARD_YAML","GUARD_BL_YAML","GUARD_MIN_MAX"]},"ttlDate":{"type":"string","format":"date-time"}}},"ConfigRequestParameters":{"type":"object","properties":{"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"ecompName":{"type":"string"},"onapName":{"type":"string"},"policyName":{"type":"string"},"requestID":{"type":"string"},"unique":{"type":"boolean"}}},"Collection«PolicyResponse»":{"type":"object"},"DecisionResponse":{"type":"object","properties":{"decision":{"type":"string","enum":["permit","deny","error"]},"details":{"type":"string"}}},"DictionaryParameters":{"type":"object","properties":{"dictionary":{"type":"string"},"dictionaryJson":{"type":"string"},"dictionaryType":{"type":"string","enum":["Common","Action","ClosedLoop","Firewall","Decision","BRMS","MicroService","DescriptiveScope","PolicyScope","Enforcer","SafePolicy","Extended"]},"requestID":{"type":"string"}}},"JsonValue":{"type":"object","properties":{"valueType":{"type":"string","enum":["ARRAY","OBJECT","STRING","NUMBER","TRUE","FALSE","NULL"]}}},"DecisionRequestParameters":{"type":"object","properties":{"decisionAttributes":{"type":"object","additionalProperties":{"type":"string"}},"ecompcomponentName":{"type":"string"},"onapName":{"type":"string"},"requestID":{"type":"string"}}},"ConfigPolicyAPIRequest":{"type":"object","properties":{"body":{"type":"string"},"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"configType":{"type":"string"},"ecompName":{"type":"string"},"guard":{"type":"string"},"onapName":{"type":"string"},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PushPolicyParameters":{"type":"object","properties":{"pdpGroup":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}},"ConfigFirewallPolicyAPIRequest":{"type":"object","properties":{"firewallJson":{"type":"string"},"guard":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PolicyConfig":{"type":"object","properties":{"config":{"type":"string"},"matchingConditions":{"type":"object","additionalProperties":{"type":"string"}},"policyConfigMessage":{"type":"string"},"policyConfigStatus":{"type":"string","enum":["retrieved","not_found"]},"policyName":{"type":"string"},"policyVersion":{"type":"string"},"property":{"type":"object","additionalProperties":{"type":"string"}},"responseAttributes":{"type":"object","additionalProperties":{"type":"string"}},"type":{"type":"string","enum":["Properties","json","xml","other"]}}},"EventRequestParameters":{"type":"object","properties":{"eventAttributes":{"type":"object","additionalProperties":{"type":"string"}},"requestID":{"type":"string"}}},"Map«string,string»":{"type":"object","additionalProperties":{"type":"string"}},"Collection«PolicyConfig»":{"type":"object"},"DictionaryResponse":{"type":"object","properties":{"dictionaryData":{"type":"object","additionalProperties":{"type":"string"}},"dictionaryJson":{"type":"object","additionalProperties":{"$ref":"#/definitions/JsonValue"}},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"ConfigNameRequest":{"type":"object","properties":{"policyName":{"type":"string"}}},"MetricsResponse":{"type":"object","properties":{"metricsTotal":{"type":"integer","format":"int32"},"papMetrics":{"type":"integer","format":"int32"},"pdpMetrics":{"type":"integer","format":"int32"},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"Collection«string»":{"type":"object"},"PolicyResponse":{"type":"object","properties":{"actionAdvised":{"type":"object","additionalProperties":{"type":"string"}},"actionTaken":{"type":"object","additionalProperties":{"type":"string"}},"policyResponseMessage":{"type":"string"},"policyResponseStatus":{"type":"string","enum":["no_action","action_advised","action_taken"]},"requestAttributes":{"type":"object","additionalProperties":{"type":"string"}}}},"DeletePolicyParameters":{"type":"object","properties":{"deleteCondition":{"type":"string","enum":["Current Version","All Versions"]},"pdpGroup":{"type":"string"},"policyComponent":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}}}}
\ No newline at end of file diff --git a/docs/platform/guardpolicy.rst b/docs/platform/guardpolicy.rst index 6c72ce6d4..2b44c468b 100644 --- a/docs/platform/guardpolicy.rst +++ b/docs/platform/guardpolicy.rst @@ -66,6 +66,32 @@ The request should be in the following form for the regular guard policy: } } +The request should be in the following form for the Min/Max guard policy: + +.. code-block:: json + :caption: Min/Max Guard Policy Creation + :linenos: + + { + "policyClass": "Decision", + "policyName": "Test.TestingGUARDMinMaxtest", + "policyDescription": "Testing new Min/Max Guard Policy", + "onapName": "PDPD", + "ruleProvider": "GUARD_MIN_MAX", + "attributes": { + "MATCHING": { + "actor": "SO", + "recipe": "scaleOut", + "targets" : ".*", + "clname" : "test", + "min": "1", + "max": "5", + "guardActiveStart": "05:00:00-05:00", + "guardActiveEnd": "23:59:59-05:00" + } + } + } + The request should be in the following form for blacklist guard policy: .. code-block:: json @@ -117,7 +143,8 @@ The guard_request.json should be in the form of the following: "actor": "APPC", "recipe": "Restart", "target": "test13", - "clname" : "piptest" + "clname" : "piptest", + "vfCount" : "4" }, "onapName": "PDPD" } |