<commit_before>// Module included in the following assemblies:
//
// scalability_and_performance/ztp-deploying-disconnected.adoc

[id="ztp-generating-ran-policies_{context}"]
= Generating RAN policies

.Prerequisites

* Install Kustomize
* Install golang

.Procedure

. Build the plug-in using the following commands:
+
[source,terminal]
----
$ cd ztp/ztp-policy-generator/kustomize/plugin/policyGenerator/v1/policygenerator/
----
+
[source,terminal]
----
$ go build -o PolicyGenerator
----
+
The `kustomization.yaml` file has a reference to the `policyGenerator.yaml` file. The following example shows the PolicyGenerator definition:
+
[source,yaml]
----
apiVersion: policyGenerator/v1
kind: PolicyGenerator
metadata:
  name: acm-policy
  namespace: acm-policy-generator
# The arguments should be given and defined as below with same order --policyGenTempPath= --sourcePath= --outPath= --stdout --customResources
argsOneLiner: ./ranPolicyGenTempExamples ./sourcePolicies ./out true false
----
+
Where:

* `policyGenTempPath` is the path to the `policyGenTemp` files.
* `sourcePath`: is the path to the source policies.
* `outPath`: is the path to save the generated ACM policies.
* `stdout`: If `true`, prints the generated policies to the console.
* `customResources`: If `true` generates the CRs from the `sourcePolicies` files without ACM policies.<commit_msg>BZ2020756: Specifying that policyGenerator is a Kustomize plugin<commit_after>// Module included in the following assemblies:
//
// scalability_and_performance/ztp-deploying-disconnected.adoc

[id="ztp-generating-ran-policies_{context}"]
= Generating RAN policies

.Prerequisites

* Install Kustomize
* Install the link:https://github.com/stolostron/policy-generator-plugin[Kustomize Policy Generator plug-in]

.Procedure

. Configure the `kustomization.yaml` file to reference the `policyGenerator.yaml` file. The following example shows the PolicyGenerator definition:
+
[source,yaml]
----
apiVersion: policyGenerator/v1
kind: PolicyGenerator
metadata:
  name: acm-policy
  namespace: acm-policy-generator
# The arguments should be given and defined as below with same order --policyGenTempPath= --sourcePath= --outPath= --stdout --customResources
argsOneLiner: ./ranPolicyGenTempExamples ./sourcePolicies ./out true false
----
+
Where:

* `policyGenTempPath` is the path to the `policyGenTemp` files.
* `sourcePath`: is the path to the source policies.
* `outPath`: is the path to save the generated ACM policies.
* `stdout`: If `true`, prints the generated policies to the console.
* `customResources`: If `true` generates the CRs from the `sourcePolicies` files without ACM policies.
{'fraction_non_alphanumeric': 0.10633484162895927, 'fraction_numerical': 0.003770739064856712, 'mean_word_length': 4.767391304347826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6947149', 'n_tokens_mistral': 787, 'n_tokens_neox': 763, 'n_words': 260}