Policy for Casablanca

Policy on OOM?

kubectl exec -it dev-pap-8587696769-vwj6k -c pap -n onap -- bash -c "export PRELOAD_POLICIES=true; /tmp/policy-install/config/push-policies.sh"?

end a PUT request on the session object found using the Start / End / Elapsed: 20181024 16:32:52.111 / 20181024 16:32:52.448 / 00:00:00.337 16:32:52.111 TRACE Arguments: [ 'policy' | '/pdp/api/updatePolicy' | data={'attributes': {'MATCHING': {'controller': 'amsterdam'}, 'RULE': {'closedLoopControlName': 'ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a', 'controlLoopYaml': 'controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+7e2811c3-71d4-4b95-a596-d5710c24541d%0D%0A++++++type%3A+VNF%0D

Wiki Resource from Policy Project

https://wiki.onap.org/display/DW/Policy+R1+Amsterdam+Functional+Test+Cases

Policy Cookbook

Policy interface CSIT

Workaround from Policy Cookbook to fix Policy failure on health check, see  POLICY-365 - Getting issue details... STATUS

Workaround on Policy Failing on Health Check
docker volume rm $(docker volume ls -qf dangling=true)
docker rmi $(docker images -f dangling=true -q)
docker kill $(docker ps -q)
docker rm -v $(docker ps -a -q)
/opt/policy_vm_init.sh




Curl command to send ONSET event to Policy through DMAAP

Curl to Send DMAAP ONSET Event to Policy
ubuntu@vm03-robot:~/policy$ curl -X POST -H 'Content-Type: application/json' -d @onset http://{{dmaap_ip}}:3904/events/unauthenticated.DCAE_CL_OUTPUT
{
    "serverTimeMs": 2,
    "count": 1
}


ONSET event from Holmes

ONSET Event Posted by Holmes
{
       "target": "vserver.vserver-name",
       "target_type": "VM",
       "AAI": {
           "vserver.in-maint": true,
           "vserver.is-closed-loop-disabled": false,
           "vserver.prov-status": "example-prov-status-val-2",
           "vserver.resource-version": "1504912891060",
           "vserver.vserver-id": "example-vserver-id-val-2",
           "vserver.vserver-name": "example-vserver-name-val-2",
           "vserver.vserver-name2": "example-vserver-name2-val-2",
           "vserver.vserver-selflink": "example-vserver-selflink-val-2",
           "generic-vnf.vnf-id": "5e49ca06-2972-4532-9ed4-6d071588d792",
           "service-instance.service-instance-id": "USUCP0PCOIL0110UJZZ01"
       },
       "closedLoopAlarmStart": 1484855291527925,
       "closedLoopEventStatus": "ONSET",
       "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b",
       "version": "1.0.2",
       "requestID": "8c1b8bd8-06f7-493f-8ed7-daaa4cc481bc",
       "from": "DCAE"
}

Health Check

Health Check
root@vm03-policy:/opt/policy/config/drools# curl --silent --user 'healthcheck:zb!XztG34' -X GET http://localhost:6969/healthcheck | python -m json.tool
{
    "details": [
        {
            "code": 200,
            "healthy": true,
            "message": "alive",
            "name": "PDP-D",
            "url": "self"
        },
        {
            "code": 200,
            "healthy": true,
            "message": "",
            "name": "PAP",
            "url": "http://pap:9091/pap/test"
        },
        {
            "code": 200,
            "healthy": true,
            "message": "",
            "name": "PDP",
            "url": "http://pdp:8081/pdp/test"
        }
    ],
    "healthy": true
}

Debug

Drools dcoker configuraion file. You can set VFC MSB service url in it and then restart the constainer

Drools configuration file
policy@drools:/opt/app/policy/logs$ cat ../config/controlloop.properties.environment 
###
# ============LICENSE_START=======================================================
# ONAP APPS Base Package
# ================================================================================
# 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=========================================================
###
# Environment file (.environment) for control loop applications in this
# directory, it will be automatically loaded by PDP-D, after being expanded
# by installation scripts.
sql.db.host=mariadb
sql.db.username=policy_user
sql.db.password=policy_user
aai.url=https://aai.api.simpledemo.openecomp.org:8443
aai.username=POLICY
aai.password=POLICY
so.url=http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra
so.username=InfraPortalClient
so.password=password1$
vfc.url=http://172.30.3.58
vfc.username=
vfc.password=
pdpx.host=pdp
pdpx.username=testpdp
pdpx.password=alpha123
pdpx.environment=TEST
pdpx.client.username=python
pdpx.client.password=test
guard.url=http://pdp:8081/pdp/api/getDecision
guard.jdbc.url=mariadb://mariadb:3306/operationshistory10
guard.disabled=true


Drools logs directory. Event message can be seen in network.log. network.log has moved to a different directory on Drools container, search for it. 

network.log
policy@dev-policy-drools-0:/tmp/policy-install$ ls -l /var/log/onap/policy/pdpd/network.log
-rw-r--r-- 1 policy policy 5086528 Feb 4 05:13 /var/log/onap/policy/pdpd/network.log



  • No labels