aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tutorials/vFWDT/policies/rules/QueryPolicy_vFW_TD.json88
-rw-r--r--tutorials/vFWDT/policies/rules/affinity_vFW_TD.json59
-rwxr-xr-xtutorials/vFWDT/policies/rules/affinity_vFW_TD_push.json8
-rwxr-xr-xtutorials/vFWDT/policies/rules/dt-policies.sh46
-rwxr-xr-xtutorials/vFWDT/policies/rules/queryPolicy_vFW_TD_push.json8
-rwxr-xr-xtutorials/vFWDT/policies/rules/uploadPolicies.sh58
-rw-r--r--tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD.json86
-rwxr-xr-xtutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD_push.json8
-rw-r--r--tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD.json87
-rwxr-xr-xtutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD_push.json8
-rw-r--r--tutorials/vFWDT/workflow/templates/osdfRequest.json3
11 files changed, 264 insertions, 195 deletions
diff --git a/tutorials/vFWDT/policies/rules/QueryPolicy_vFW_TD.json b/tutorials/vFWDT/policies/rules/QueryPolicy_vFW_TD.json
index 312ad651..c29e7709 100644
--- a/tutorials/vFWDT/policies/rules/QueryPolicy_vFW_TD.json
+++ b/tutorials/vFWDT/policies/rules/QueryPolicy_vFW_TD.json
@@ -1,46 +1,54 @@
{
- "service": "queryPolicy",
- "policyName": "OSDF_DUBLIN.QueryPolicy_vFW_TD",
- "description": "Query policy for vFW TD",
- "templateVersion": "OpenSource.version.1",
- "version": "OpenSource.version.1",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "queryProperties": [
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "topology_template": {
+ "policies": [
{
- "attribute": "customerLatitude",
- "attribute_location": "customerLatitude",
- "value": 1.1
- },
- {
- "attribute": "customerLongitude",
- "attribute_location": "customerLongitude",
- "value": 2.2
- },
- {
- "attribute": "chosen_region",
- "attribute_location": "chosenRegion"
- },
- {
- "attribute": "chosen_customer_id",
- "attribute_location": "chosenCustomerId"
+ "OSDF_FRANKFURT.queryPolicy_vFW_TD": {
+ "type": "onap.policies.optimization.service.QueryPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vFW_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT"
+ ],
+ "services": [
+ "vFW_TD"
+ ],
+ "resources": [
+ "vFW-SINK",
+ "vPGN"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vFW_TD_Query_Policy",
+ "queryProperties": [
+ {
+ "attribute": "chosen_region",
+ "attribute_location": "chosenRegion"
+ },
+ {
+ "attribute": "chosen_customer_id",
+ "attribute_location": "chosenCustomerId"
+ },
+ {
+ "attribute": "customerLatitude",
+ "attribute_location": "customerLatitude",
+ "value": 1.1
+ },
+ {
+ "attribute": "customerLongitude",
+ "attribute_location": "customerLongitude",
+ "value": 2.2
+ }
+ ]
+ }
+ }
}
- ],
- "policyScope": [
- "td",
- "us",
- "vFW-SINK",
- "vPGN"
- ],
- "policyType": "request_param_query",
- "serviceName": "vFW_TD",
- "identity": "vFW_TD_Query_Policy",
- "resources": [
- "vFW-SINK",
- "vPGN"
]
}
}
diff --git a/tutorials/vFWDT/policies/rules/affinity_vFW_TD.json b/tutorials/vFWDT/policies/rules/affinity_vFW_TD.json
index 590de1c9..8f953fe4 100644
--- a/tutorials/vFWDT/policies/rules/affinity_vFW_TD.json
+++ b/tutorials/vFWDT/policies/rules/affinity_vFW_TD.json
@@ -1,29 +1,38 @@
{
- "service": "affinityPolicy",
- "policyName": "OSDF_DUBLIN.Affinity_vFW_TD",
- "description": "Affinity policy for vPGN Anchor and vFW destination point",
- "templateVersion": "OpenSource.version.1",
- "version": "OpenSource.version.1",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "identity": "affinity_vFW_TD",
- "policyScope": [
- "td",
- "us",
- "vFW-SINK",
- "vPGN"
- ],
- "affinityProperty": {
- "qualifier": "same",
- "category": "region"
- },
- "policyType": "zone",
- "resources": [
- "vFW-SINK",
- "vPGN"
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "topology_template": {
+ "policies": [
+ {
+ "OSDF_FRANKFURT.Affinity_vFW_TD": {
+ "type": "onap.policies.optimization.resource.AffinityPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.Affinity_vFW_TD",
+ "policy-version": 1
+ },
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vFW-SINK",
+ "vPGN"
+ ],
+ "geography": [
+ "US",
+ "INTERNATIONAL"
+ ],
+ "identity": "affinity_vFW_TD",
+ "applicableResources": "any",
+ "affinityProperties": {
+ "qualifier": "same",
+ "category": "region"
+ }
+ }
+ }
+ }
]
}
}
diff --git a/tutorials/vFWDT/policies/rules/affinity_vFW_TD_push.json b/tutorials/vFWDT/policies/rules/affinity_vFW_TD_push.json
new file mode 100755
index 00000000..052f941c
--- /dev/null
+++ b/tutorials/vFWDT/policies/rules/affinity_vFW_TD_push.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "OSDF_FRANKFURT.Affinity_vFW_TD",
+ "policy-version": "1.0.0"
+ }
+ ]
+}
diff --git a/tutorials/vFWDT/policies/rules/dt-policies.sh b/tutorials/vFWDT/policies/rules/dt-policies.sh
new file mode 100755
index 00000000..05d4882c
--- /dev/null
+++ b/tutorials/vFWDT/policies/rules/dt-policies.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 Orange
+# ================================================================================
+# 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=========================================================
+
+echo -e '\n\nUploading Affinity Policy\n'
+curl --silent -i -k -X POST --user 'healthcheck:zb!XztG34' "https://policy-api:6969/policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies" -H "X-ONAP-RequestID: e1763e61-9eef-4911-b952-1be1edd9812b" -H 'Content-Type: application/json' -d @/tmp/affinity_vFW_TD.json
+sleep 3
+echo -e '\n\nPushing Affinity Policy\n'
+curl --silent -k -i -X POST --user 'healthcheck:zb!XztG34' "https://policy-pap:6969/policy/pap/v1/pdps/policies" -H 'Content-Type: application/json' -H "Accept: application/json" -d @/tmp/affinity_vFW_TD_push.json
+sleep 3
+
+echo -e '\n\nUploading Query Policy\n'
+curl --silent -i -k -X POST --user 'healthcheck:zb!XztG34' "https://policy-api:6969/policy/api/v1/policytypes/onap.policies.optimization.service.QueryPolicy/versions/1.0.0/policies" -H "X-ONAP-RequestID: e1763e61-9eef-4911-b952-1be1edd9812b" -H 'Content-Type: application/json' -d @/tmp/QueryPolicy_vFW_TD.json
+sleep 3
+echo -e '\n\nPushing Query Policy\n'
+curl --silent -k -i -X POST --user 'healthcheck:zb!XztG34' "https://policy-pap:6969/policy/pap/v1/pdps/policies" -H 'Content-Type: application/json' -H "Accept: application/json" -d @/tmp/queryPolicy_vFW_TD_push.json
+sleep 3
+
+echo -e '\n\nUploading vFW VNF Policy\n'
+curl --silent -i -k -X POST --user 'healthcheck:zb!XztG34' "https://policy-api:6969/policy/api/v1/policytypes/onap.policies.optimization.resource.VnfPolicy/versions/1.0.0/policies" -H "X-ONAP-RequestID: e1763e61-9eef-4911-b952-1be1edd9812b" -H 'Content-Type: application/json' -d @/tmp/vnfPolicy_vFW_TD.json
+sleep 3
+echo -e '\n\nPushing vFW VNF Policy\n'
+curl --silent -k -i -X POST --user 'healthcheck:zb!XztG34' "https://policy-pap:6969/policy/pap/v1/pdps/policies" -H 'Content-Type: application/json' -H "Accept: application/json" -d @/tmp/vnfPolicy_vFW_TD_push.json
+sleep 3
+
+echo -e '\n\nUploading vPGN VNF Policy\n'
+curl --silent -i -k -X POST --user 'healthcheck:zb!XztG34' "https://policy-api:6969/policy/api/v1/policytypes/onap.policies.optimization.resource.VnfPolicy/versions/1.0.0/policies" -H "X-ONAP-RequestID: e1763e61-9eef-4911-b952-1be1edd9812b" -H 'Content-Type: application/json' -d @/tmp/vnfPolicy_vPGN_TD.json
+sleep 3
+echo -e '\n\nPushing vPGN VNF Policy\n'
+curl --silent -k -i -X POST --user 'healthcheck:zb!XztG34' "https://policy-pap:6969/policy/pap/v1/pdps/policies" -H 'Content-Type: application/json' -H "Accept: application/json" -d @/tmp/vnfPolicy_vPGN_TD_push.json
+
diff --git a/tutorials/vFWDT/policies/rules/queryPolicy_vFW_TD_push.json b/tutorials/vFWDT/policies/rules/queryPolicy_vFW_TD_push.json
new file mode 100755
index 00000000..9977a73e
--- /dev/null
+++ b/tutorials/vFWDT/policies/rules/queryPolicy_vFW_TD_push.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "OSDF_FRANKFURT.queryPolicy_vFW_TD",
+ "policy-version": "1.0.0"
+ }
+ ]
+}
diff --git a/tutorials/vFWDT/policies/rules/uploadPolicies.sh b/tutorials/vFWDT/policies/rules/uploadPolicies.sh
index 7d1ccd12..58c7927e 100755
--- a/tutorials/vFWDT/policies/rules/uploadPolicies.sh
+++ b/tutorials/vFWDT/policies/rules/uploadPolicies.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Orange
+# Copyright (C) 2020 Orange
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,59 +17,13 @@
#
# ============LICENSE_END=========================================================
-`./yq > /dev/null 2>&1`
-
-if [ $? -ne 0 ]; then
- echo "Install yq"
- wget -cO yq https://github.com/mikefarah/yq/releases/download/2.4.0/yq_linux_amd64
- chmod 755 yq
-fi
-
-`jo -p n=1 > /dev/null 2>&1`
-
-if [ $? -ne 0 ]; then
- echo "Install jo"
- sudo add-apt-repository -y ppa:duggan/jo
- sudo apt update
- sudo apt install jo -y
-fi
-
-echo "Uploading policies"
-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-PDP=`kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep policy-pdp`
-
-echo $PDP
-CMD='createPolicy'
-MODE=$1
+API=`kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep policy-api`
-if [[ $MODE == "U" ]]; then
- CMD='updatePolicy'
-fi
+`find $DIR/*.json | xargs -i{} kubectl cp {} onap/$API:/tmp/`
-echo $CMD
SCRIPT="dt-policies.sh"
-echo "#!/bin/bash" > $SCRIPT
-
-for f in $DIR/*.json; do
- NAME=`./yq r $f policyName`
- SCOPE="$(cut -d'.' -f1 <<< $NAME )"
- RULE=`cat $f`
- BODY="\"$RULE\""
- echo "Processing $NAME rule..";
- echo "echo \"$NAME Policy\"" >> $SCRIPT
- BODY=`jo -p configBody="$BODY" -p policyName=$NAME -p policyConfigType=MicroService -p onapName=SampleDemo -p policyScope=$SCOPE`
- LINK="curl -k -v -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '$BODY' 'https://localhost:8081/pdp/api/$CMD'"
- LINK="${LINK/\"\\\"{\\n/\"{}"
- LINK="${LINK/\\\"\"/\"}"
- LINK="${LINK//\\n/ }"
- echo "$LINK" >> $SCRIPT
- BODY=`jo -p policyType=MicroService -p pdpGroup=default -p policyName=$NAME`
- LINK="curl -k -v -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '$BODY' 'https://localhost:8081/pdp/api/pushPolicy'"
- echo "$LINK" >> $SCRIPT
-done
-
-`kubectl cp $SCRIPT onap/$PDP:/tmp/policy-install`
-`kubectl exec $PDP -- chmod 755 $SCRIPT`
-`kubectl exec $PDP -- ./$SCRIPT`
+kubectl cp $DIR/$SCRIPT onap/$API:/tmp/`
+kubectl exec $API -- chmod 755 /tmp/$SCRIPT`
+kubectl exec $API -- /tmp/$SCRIPT
diff --git a/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD.json b/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD.json
index 240c7325..71b5b2bb 100644
--- a/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD.json
+++ b/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD.json
@@ -1,44 +1,54 @@
{
- "service": "vnfPolicy",
- "policyName": "OSDF_DUBLIN.vnfPolicy_vFW_TD",
- "description": "vnfPolicy",
- "templateVersion": "OpenSource.version.1",
- "version": "OpenSource.version.1",
- "priority": "6",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "identity": "vnf_vFW_TD",
- "policyScope": [
- "td",
- "us",
- "vFW-SINK"
- ],
- "policyType": "vnfPolicy",
- "resources": [
- "vFW-SINK"
- ],
- "applicableResources": "any",
- "vnfProperties": [
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "topology_template": {
+ "policies": [
{
- "inventoryProvider": "aai",
- "serviceType": "",
- "inventoryType": "vfmodule",
- "customerId": {
- "get_param": "chosen_customer_id"
- },
- "equipmentRole": "",
- "attributes": {
- "orchestrationStatus": [
- "active"
- ],
- "provStatus": "ACTIVE",
- "cloudRegionId": {
- "get_param": "chosen_region"
+ "OSDF_FRANKFURT.vnfPolicy_vFW_TD": {
+ "type": "onap.policies.optimization.resource.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vFW_TD",
+ "policy-version": 1
},
- "service_instance_id": {
- "get_param": "service_id"
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vFW-SINK"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vnf_vFW_TD",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "vfmodule",
+ "customerId": {
+ "get_param": "chosen_customer_id"
+ },
+ "equipmentRole": "",
+ "attributes": {
+ "orchestrationStatus": [
+ "Active"
+ ],
+ "cloudRegionId": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthroughAttributes": {
+ "td-role": "destination"
+ }
+ }
+ ]
}
}
}
diff --git a/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD_push.json b/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD_push.json
new file mode 100755
index 00000000..cf970736
--- /dev/null
+++ b/tutorials/vFWDT/policies/rules/vnfPolicy_vFW_TD_push.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vFW_TD",
+ "policy-version": "1.0.0"
+ }
+ ]
+}
diff --git a/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD.json b/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD.json
index 277d7d0d..6ae34e60 100644
--- a/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD.json
+++ b/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD.json
@@ -1,44 +1,55 @@
{
- "service": "vnfPolicy",
- "policyName": "OSDF_DUBLIN.vnfPolicy_vPGN_TD",
- "description": "vnfPolicy",
- "templateVersion": "OpenSource.version.1",
- "version": "OpenSource.version.1",
- "priority": "6",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "identity": "vnf_vPGN_TD",
- "policyScope": [
- "td",
- "us",
- "vPGN"
- ],
- "policyType": "vnfPolicy",
- "resources": [
- "vPGN"
- ],
- "applicableResources": "any",
- "vnfProperties": [
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "topology_template": {
+ "policies": [
{
- "inventoryProvider": "aai",
- "serviceType": "",
- "inventoryType": "vfmodule",
- "customerId": {
- "get_param": "chosen_customer_id"
- },
- "equipmentRole": "",
- "attributes": {
- "orchestrationStatus": [
- "active"
- ],
- "provStatus": "ACTIVE",
- "cloudRegionId": {
- "get_param": "chosen_region"
+ "OSDF_FRANKFURT.vnfPolicy_vPGN_TD": {
+ "type": "onap.policies.optimization.resource.VnfPolicy",
+ "version": "1.0.0",
+ "type_version": "1.0.0",
+ "metadata": {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vPGN_TD",
+ "policy-version": 1
},
- "service_instance_id": {
- "get_param": "service_id"
+ "properties": {
+ "scope": [
+ "OSDF_FRANKFURT",
+ "TD"
+ ],
+ "resources": [
+ "vPGN"
+ ],
+ "geography": [
+ "US"
+ ],
+ "identity": "vnf_vPGN_TD",
+ "applicableResources": "any",
+ "vnfProperties": [
+ {
+ "inventoryProvider": "aai",
+ "serviceType": "",
+ "inventoryType": "vfmodule",
+ "customerId": {
+ "get_param": "chosen_customer_id"
+ },
+ "equipmentRole": "",
+ "unique": "False",
+ "attributes": {
+ "orchestrationStatus": [
+ "Active"
+ ],
+ "cloudRegionId": {
+ "get_param": "chosen_region"
+ },
+ "service_instance_id": {
+ "get_param": "service_id"
+ }
+ },
+ "passthroughAttributes": {
+ "td-role": "anchor"
+ }
+ }
+ ]
}
}
}
diff --git a/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD_push.json b/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD_push.json
new file mode 100755
index 00000000..074698e8
--- /dev/null
+++ b/tutorials/vFWDT/policies/rules/vnfPolicy_vPGN_TD_push.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "OSDF_FRANKFURT.vnfPolicy_vPGN_TD",
+ "policy-version": "1.0.0"
+ }
+ ]
+}
diff --git a/tutorials/vFWDT/workflow/templates/osdfRequest.json b/tutorials/vFWDT/workflow/templates/osdfRequest.json
index 1bd2ce5c..61a0cd98 100644
--- a/tutorials/vFWDT/workflow/templates/osdfRequest.json
+++ b/tutorials/vFWDT/workflow/templates/osdfRequest.json
@@ -44,7 +44,6 @@
{
"resourceModuleName": "vPGN",
"serviceResourceId": "vPGN-XX",
- "unique": "false",
"resourceModelInfo": {
"modelInvariantId": "f2f88e29-d571-49ef-aea3-b8d13900c16f",
"modelVersionId": "3ccebc76-66e1-47c8-aee9-98f30d08db97"
@@ -54,7 +53,7 @@
},
"serviceInfo": {
"serviceInstanceId": "209fb01e-60ca-4325-b074-c5ad4e0499f8",
- "serviceName": "TD",
+ "serviceName": "vFW_TD",
"modelInfo": {
"modelInvariantId": "TD-invariantId",
"modelVersionId": "TD-versionId"