The document describes the steps that can be used to create and onboard optimization policies for the Network Slice and Subnet models onto the Policy module in ONAP. These policies will be used by OOF during the optimization(NSI and NSSI selection).
Prerequisites
Make sure that the policy and OOF modules are deployed and all the pods are up and running. You can check the pod status using the following command
kubectl get pods -n onap | grep policy kubectl get pods -n onap | grep oof
Download the policies.zip file (The archive contains all the required policy templates and a script which helps in creating the policies). Extract it and copy the contents into the one of the onap pods(The script in the zip uses dns name of the policy-api, so that it is essential to run the script from within a pod in the kubernetes environment). The below example uses the OOF pod, since it has python3 and necessary libraries already installed.
unzip policies.zip kubectl cp policies -n onap <oof-pod-name>:/opt/osdf kubectl exec -ti -n onap <oof-pod-name> bash cd policies
Policy contents
The contents of the archive are as follows
- policy_types (dir) - The directory contains the addtional policy types that needs to be created for the Network slicing use case.
- nsi_polices (dir) - The directory contains the policy templates required for NSI selection.
- nssi_policies (dir) - The directory contains the policy templates required for NSSI selection.
- policy_utils.py - The python script which can be used to generate, create and delete policies
The directories mainly have the policies created for testing purposes. If you would like, you can modify the templates to suit your optimization needs.
Policy type creation
The policy types must be created before creating and pushing the policies
python3 policy_utils.py create_policy_types policy_types
Policy generation
For every network slice template, set of policies have to be created. They can be generated using the following the commands
# for nsi policies python3 policy_utils.py generate_nsi_policies <service_name(nst)> # for nssi policies python3 policy_utils.py generate_nssi_policies <service_name(nsst)> minimize latency
Note: generate_nssi_policies have addtional fields that can be used to specify the optmization goals say, minimize latency or maximize throughput
The above commands will create directories named gen_nsi_policies and gen_nssi_policies
Policy Creation
The following commands can be used to create and push policies to policy module
# for nsi policies python3 policy_utils.py create_and_push_policies gen_nsi_policies # for nssi policies python3 policy_utils.py create_and_push_policies gen_nssi_policies
Policy Deletion
The following commands can be used to delete policies in the policy module
# for nsi policies python3 policy_utils.py delete_policies gen_nsi_policies # for nssi policies python3 policy_utils.py delete_policies gen_nssi_policies