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" : { "type" : "string" },
"cloud-deployment-intent" : {
"type" : "object" ,
"properties" : {
"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 - Burstable QoS Oversubscription Percentage" : { "type" : "int" },
},
},
},
},
"resources" : { "type" , "array" },
"applicableResources" : { "type" , "string" },
"identity" : { "type" , "string" },
"policyScope" : { "type" , "array" },
"policyType" : { "type" , "string" }
}
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" ],
"applicableResources" : "any" ,
"identity" : "cloud-atrributes" ,
"policyScope" : [ "vCPE" , "US" , "INTERNATIONAL" , "ip" , "vgw" , "vgmux" ],
"policyType" : "AllPolicy"
}
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" ],
"applicableResources" : "any" ,
"identity" : "cloud-atrributes" ,
"policyScope" : [ "vCPE" , "US" , "INTERNATIONAL" , "ip" , "vgw" , "vgmux" ],
"policyType" : "AllPolicy"
}
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"
}
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)
|