OOF Cloud Agnostic Policies

Functional Requirement Link: Edge Scoping MVP for Casablanca - ONAP Enhancements#ONAPEnhancements-Cloud-agnosticPlacement/Networking&HomingPolicies(Phase1-CasablancaMVP,Phase2-StretchGoal)

Cloud Agnostic Intent Examples
# #Example 1: vCPE, Burstable QoS #vCPE: Infrastructure Resource Isolation for VNF with Burstable QoS # { "service": "cloudDeploymentPolicy", "policyName": "OSDF_R3.cloud_deployment_policy_vG_1", "description": "Cloud Deployment policy for vG", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", "riskType": "test", "riskLevel": "2", "guard": "False", "content": { "resources": "vG", "identity": "cloudDeploymentPolicy_vG", "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], "policyType": "cloudDeploymentPolicy", "cloudDeploymentIntentList": [ { "Cloud Type (Cloud Provider)": "VMware VIO", "intentProperties":[ { "deploymentIntent" : "Infrastructure Resource Isolation for VNF", "intent-attributes": [ {"intent-attribute-key":"Infrastructure Resource Isolation for VNF", "intent-attribute-value": "Burstable QoS","operator": "=", "unit": ""}, {"intent-attribute-key":"Burstable QoS Oversubscription Percentage", "intent-attribute-value": "25","operator": "=", "unit": ""}, ] }, ] }, ] } } # #Example 2: #vCPE: Infrastructure Resource Isolation for VNF with Guaranteed QoS # { "service": "cloudDeploymentPolicy", "policyName": "OSDF_R3.cloud_deployment_policy_vG_1", "description": "Cloud Deployment policy for vG", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", "riskType": "test", "riskLevel": "2", "guard": "False", "content": { "resources": "vG", "identity": "cloudDeploymentPolicy_vG", "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"], "policyType": "cloudDeploymentPolicy", "cloudDeploymentIntentList": [ { "intentProperties":[ { "deploymentIntent" : "Infrastructure Resource Isolation for VNF", "intent-attributes": [ {"intent-attribute-key":"Infrastructure Resource Isolation for VNF", "intent-attribute-value": "Guaranteed QoS","operator": "=", "unit": ""}, ] }, ] }, ] } } # #Example 3: vDNS, Burstable QoS #vDNS: Infrastructure Resource Isolation for VNF with Burstable QoS # { "service": "cloudDeploymentPolicy", "policyName": "OSDF_R3.cloud_deployment_policy_vDNS_1", "description": "Cloud Deployment policy for vDNS", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", "riskType": "test", "riskLevel": "2", "guard": "False", "content": { "resources": "vDNS", "identity": "cloudDeploymentPolicy_vDNS", "policyScope": ["vDNS", "US", "INTERNATIONAL", "ip", "vDNS"], "policyType": "cloudDeploymentPolicy", "cloudDeploymentIntentList": [ { "Cloud Type (Cloud Provider)": "VMware VIO", "intentProperties":[ { "deploymentIntent" : "Infrastructure Resource Isolation for VNF", "intent-attributes": [ {"intent-attribute-key":"Infrastructure Resource Isolation for VNF", "intent-attribute-value": "Burstable QoS","operator": "=", "unit": ""}, {"intent-attribute-key":"Burstable QoS Oversubscription Percentage", "intent-attribute-value": "25","operator": "=", "unit": ""}, ] }, { "deploymentIntent" : "Infrastructure High Availability for VNF", }, ] }, ] } } # #Example 4: #vDNS: Infrastructure Resource Isolation for VNF with Guaranteed QoS # { "service": "cloudDeploymentPolicy", "policyName": "OSDF_R3.cloud_deployment_policy_vDNS_1", "description": "Cloud Deployment policy for vDNS", "templateVersion": "OpenSource.version.1", "version": "test1", "priority": "3", "riskType": "test", "riskLevel": "2", "guard": "False", "content": { "resources": "vDNS", "identity": "cloudDeploymentPolicy_vG", "policyScope": ["vDNS", "US", "INTERNATIONAL", "ip", "vDNS"], //vDNS VNF has 3 VNFCs - vDNS, vLB and vPacketgen "policyType": "cloudDeploymentPolicy", "cloudDeploymentIntentList": [ { "intentProperties":[ { "deploymentIntent" : "Infrastructure Resource Isolation for VNF", "intent-attributes": [ {"intent-attribute-key":"Infrastructure Resource Isolation for VNF", "intent-attribute-value": "Guaranteed QoS","operator": "=", "unit": ""}, ] }, { "deploymentIntent" : "Infrastructure High Availability for VNF", }, ] }, ] } }

#
#Spec Reference: https://lf-onap.atlassian.net/wiki/display/DW/Edge+Scoping+MVP+for+Casablanca+-+ONAP+Enhancements#EdgeScopingMVPforCasablanca-ONAPEnhancements-Cloud-agnosticPlacement/Networking&HomingPolicies(Phase1-CasablancaMVP,Phase2-StretchGoal)
#
 
from jsonschema import validate
 
oof_cloud_selection_policy_schema = {
        "service": {"type""string"},
        "policyName": {"type""string"},
        "policyDescription": {"type""string"},
        "templateVersion": {"type""string"},
        "version": {"type""string"},
        "priority": {"type""string"},
        "riskType": {"type""string"},
        "riskLevel": {"type""string"},
        "guard": {"type""string"},
 
        "content": {
                "type""object",
                "required": ["cloud-deployment-intent"],
                "properties" : {
 
                        # VNFC is not used in the OOF->MC path for R3
                        # This is kept to be consistent with the SO-> MC path
                        # As an example, vDNS VNF in ONAP has 3 VNFCs - DNS, Packet Gen & Load Balancer --
                        # Each of the VNFCs could have different policies                                                                                                      
                        "vnfc": {"type""string"},
 
                        # cloud-specific realization of the specified deployment intent
                        # happens in  multi-cloud in the cloud-specific plugin
                        "cloud-deployment-intent": {
                                "type""object",
                                "properties" : {
 
                                        # Cloud Type -- Azure, K8S, OpenStack, VMware VIO, Wind River Titanium
                                        # Optionally Accomodate policies per Cloud Type
                                        "Cloud Type (Cloud Provider)": {"type""array"},
                                         
                                        "Infrastructure High Availability for VNF": {"type""boolean"},
 
                                        "Infrastructure Resource Isolation for VNF": {"type""string"},
 
                                        # Infrastructure Resource Isolation for VNF
                                        # Only certain pre-defined over-subscription values are allowed to
                                        # reflect practical deployment and simplify implementation for R3
                                        "Infrastructure Resource Isolation for VNF - Burstable QoS Oversubscription Percentage": {"type""int"},
                                },
                        },
                },
        },
 
        "resources": {"type""array"}, #"vgw" is also interchangeably used as "vg"
        "applicableResources": {"type""string"},
        "identity": {"type""string"},
        "policyScope": {"type""array"},
        "policyType": {"type""string"}
}
 
#
#Example 1: vCPE, Burstable QoS
#vCPE: Infrastructure Resource Isolation for VNF with Burstable QoS
#
oof_cloud_selection_policy_instance1 = {
        "service""cloudSelectionPolicy",
        "policyName""oofMulti-cloudCasablanca.cloudSelectionPolicy_vCPE_VNF",
        "policyDescription""Cloud Selection Policy for vCPE VNFs",
        "templateVersion""0.0.1",
        "version""oofMulti-cloudCasablanca",
        "priority""3",
        "riskType""test",
        "riskLevel""2",
        "guard""False",
 
        "content": {
                "vnfc""vgw",
                "cloud-deployment-intent": {
                        "Cloud Type (Cloud Provider)": {"VMware VIO"},
                        "Infrastructure Resource Isolation for VNF""Burstable QoS",
                        "Infrastructure Resource Isolation for VNF - Burstable QoS Oversubscription Percentage"25,
                },
        },
 
        "resources": ["vgw"], #"vgw" is also interchangeably used as "vg"
        "applicableResources""any",
        "identity""cloud-atrributes",
        "policyScope": ["vCPE""US""INTERNATIONAL""ip""vgw""vgmux"],
        "policyType""AllPolicy"
}
 
#
#Example 2:
#vCPE: Infrastructure Resource Isolation for VNF with Guaranteed QoS
#
oof_cloud_selection_policy_instance2 = {
        "service""cloudSelectionPolicy",
        "policyName""oofMulti-cloudCasablanca.cloudSelectionPolicy_vCPE_VNF",
        "policyDescription""Cloud Selection Policy for vCPE VNFs",
        "templateVersion""0.0.1",
        "version""oofMulti-cloudCasablanca",
        "priority""3",
        "riskType""test",
        "riskLevel""2",
        "guard""False",
 
        "content": {
                "vnfc""vgw",
                "cloud-deployment-intent": {
                        "Infrastructure Resource Isolation for VNF""Guaranteed QoS",
                },
        },
 
        "resources": ["vgw"], #"vgw" is also interchangeably used as "vg"
        "applicableResources""any",
        "identity""cloud-atrributes",
        "policyScope": ["vCPE""US""INTERNATIONAL""ip""vgw""vgmux"],
        "policyType""AllPolicy"
}
 
#
#Example 3:
#vDNS: Infrastructure HA for VNF & Infrastructure Resource Isolation for VNF with Burstable QoS
#
oof_cloud_selection_policy_instance3 = {
        "service""cloudSelectionPolicy",
        "policyName""oofMulti-cloudCasablanca.cloudSelectionPolicy_vDNS_VNF",
        "policyDescription""Cloud Selection Policy for vDNS VNFs",
        "templateVersion""0.0.1",
        "version""oofMulti-cloudCasablanca",
        "priority""3",
        "riskType""test",
        "riskLevel""2",
        "guard""False",
 
        "content": {
                "vnfc""vdns",
                "cloud-deployment-intent": {
                        "Cloud Type (Cloud Provider)": {"VMware VIO""Azure"},
                        "Infrastructure High Availability for VNF"True,
                        "Infrastructure Resource Isolation for VNF""Burstable QoS",
                        "Infrastructure Resource Isolation for VNF - Burstable QoS Oversubscription Percentage"25,
                },
        },
 
        "resources": ["vDNS"],
        "applicableResources""any",
        "identity""cloud-atrributes",
        "policyScope": ["vDNS""US""INTERNATIONAL""vDNS"],
        "policyType""AllPolicy"
}
 
#
# Example 4:
# vDNS: Infrastructure HA for VNF & Infrastructure Resource Isolation for VNF
# with Guaranteed QoS
#
oof_cloud_selection_policy_instance4 = {
        "service""cloudSelectionPolicy",
        "policyName""oofMulti-cloudCasablanca.cloudSelectionPolicy_vDNS_VNF",
        "policyDescription""Cloud Selection Policy for vDNS VNFs",
        "templateVersion""0.0.1",
        "version""oofMulti-cloudCasablanca",
        "priority""3",
        "riskType""test",
        "riskLevel""2",
        "guard""False",
 
        "content": {
                "vnfc""vdns",
                "cloud-deployment-intent": {
                        "Infrastructure High Availability for VNF"True,
                        "Infrastructure Resource Isolation for VNF""Guaranteed QoS",
                },
        },
 
        "resources": ["vDNS"],
        "applicableResources""any",
        "identity""cloud-atrributes",
        "policyScope": ["vDNS""US""INTERNATIONAL""vDNS"],
        "policyType""AllPolicy"
}
 
validate(oof_cloud_selection_policy_instance1, oof_cloud_selection_policy_schema)
validate(oof_cloud_selection_policy_instance2, oof_cloud_selection_policy_schema)
validate(oof_cloud_selection_policy_instance3, oof_cloud_selection_policy_schema)
validate(oof_cloud_selection_policy_instance4, oof_cloud_selection_policy_schema)