diff options
author | Itohan <itohan.ukponmwan@intel.com> | 2019-05-24 23:52:26 +0000 |
---|---|---|
committer | Gary Wu <gwu@futurewei.com> | 2019-05-29 17:23:41 +0000 |
commit | 1f3c8d6b67fcfdc0bcb95d3b283b232a4bb56cbb (patch) | |
tree | c2e9afce785c164cfad09ccb0e1cbdbe7aaaeb9a /test/hpa_automation/heat/insert_policy_models_heat.py | |
parent | c43f25d5a256091c17d4f15d1c9287906cd4a7b7 (diff) |
Modified hpa_automation.py script
-Added more files required to run this script
-Added a README file
-Added sample hpa polices
Issue-ID: INT-905 INT-904 INT-794
Signed-off-by: Itohan Ukponmwan <itohan.ukponmwan@intel.com>
Change-Id: I5c77924863a9517ecaf7caaeb860c3c113a7b9d2
Diffstat (limited to 'test/hpa_automation/heat/insert_policy_models_heat.py')
-rw-r--r-- | test/hpa_automation/heat/insert_policy_models_heat.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/hpa_automation/heat/insert_policy_models_heat.py b/test/hpa_automation/heat/insert_policy_models_heat.py new file mode 100644 index 000000000..68a1d23bf --- /dev/null +++ b/test/hpa_automation/heat/insert_policy_models_heat.py @@ -0,0 +1,30 @@ +import mysql.connector +import sys + +mydb = mysql.connector.connect( + host= sys.argv[1], + user= sys.argv[2], + passwd= sys.argv[3], + database="onap_sdk", +) + +mycursor = mydb.cursor() + +sql = "INSERT INTO microservicemodels (modelname, description, dependency, imported_by, attributes, ref_attributes, sub_attributes, version, annotation, enumValues, dataOrderInfo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" +val = [ + ('hpaPolicy', 'HPA Tests Model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,resources=MANY-true,flavorFeatures=flavorFeatures_properties:MANY-true:description-null', '{"directives_properties":{"attributes":"directives_attributes_properties:required-false:MANY-true:description-null","type":"string:defaultValue-null:required-false:MANY-false:description-null"},"directives_attributes_properties":{"attribute_name":"string:defaultValue-null:required-false:MANY-false:description-null","attribute_value":"string:defaultValue-null:required-false:MANY-false:description-null"},"flavorProperties_properties":{"score":"string:defaultValue-null:required-false:MANY-false:description-null","hpa-feature-attributes":"hpa-feature-attributes_properties:required-true:MANY-true:description-null","directives":"directives_properties:required-true:MANY-true:description-null","hpa-version":"string:defaultValue-null:required-true:MANY-false:description-null","hpa-feature":"string:defaultValue-null:required-true:MANY-false:description-null","mandatory":"string:defaultValue-null:required-true:MANY-false:description-null","architecture":"string:defaultValue-null:required-true:MANY-false:description-null"},"flavorFeatures_properties":{"directives":"directives_properties:required-true:MANY-true:description-null","flavorProperties":"flavorProperties_properties:required-true:MANY-true:description-null","id":"string:defaultValue-null:required-true:MANY-false:description-null","type":"string:defaultValue-null:required-true:MANY-false:description-null"},"hpa-feature-attributes_properties":{"unit":"string:defaultValue-null:required-false:MANY-false:description-null","hpa-attribute-value":"string:defaultValue-null:required-true:MANY-false:description-null","hpa-attribute-key":"string:defaultValue-null:required-true:MANY-false:description-null","operator":"OPERATOR:defaultValue-null:required-false:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true', 'OPERATOR=[<,<equal-sign,>,>equal-sign,equal-sign,!equal-sign,any,all,subset,], POLICYTYPE=[hpa,]', '""'), + ('distancePolicy', 'distancePolicy', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,distanceProperties=distanceProperties_properties:MANY-false:description-null,policyType=POLICYTYPE:MANY-false,resources=MANY-true,applicableResources=APPLICABLERESOURCES:MANY-false', '{"distanceProperties_properties":{"locationInfo":"string:defaultValue-null:required-true:MANY-false:description-null","distance":"distance_properties:required-true:MANY-false:description-null"},"distance_properties":{"unit":"UNIT:defaultValue-null:required-true:MANY-false:description-null","value":"string:defaultValue-null:required-true:MANY-false:description-null","operator":"OPERATOR:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true', 'OPERATOR=[<,<equal-sign,>,>equal-sign,equal-sign,], APPLICABLERESOURCES=[any,all,], POLICYTYPE=[distance_to_location,] ', '""'), + ('optimizationPolicy', 'Optimization policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'objectiveParameter=objectiveParameter_properties:MANY-false:description-null,policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,objective=objectiveParameter_properties:MANY-false:description-null', '{"parameterAttributes_properties":{"customerLocationInfo":"string:defaultValue-null:required-true:MANY-false:description-null","parameter":"string:defaultValue-null:required-true:MANY-false:description-null","resources":"string:defaultValue-null:required-true:MANY-false:description-null","weight":"string:defaultValue-null:required-true:MANY-false:description-null","operator":"OPERATOR:defaultValue-null:required-true:MANY-false:description-null"},"objectiveParameter_properties":{"parameterAttributes":"parameterAttributes_properties:required-true:MANY-true:description-null","operator":"OPERATOR:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true', 'OPERATOR=[*,+,-,/,%,], POLICYTYPE=[placement_optimization,]', '""'), + ('queryPolicy', 'Query policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,queryProperties=queryProperties_properties:MANY-true:description-null', '{"queryProperties_properties":{"attribute_location":"string:defaultValue-null:required-true:MANY-false:description-null","attribute":"string:defaultValue-null:required-true:MANY-false:description-null","value":"string:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true', 'POLICYTYPE=[request_param_query,]', '""'), + ('vnfPolicy', 'VnfPolicy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,resources=MANY-true,vnfProperties=vnfProperties_properties:MANY-true:description-null,applicableResources=APPLICABLERESOURCES:MANY-false', '{"vnfProperties_properties":{"serviceType":"string:defaultValue-null:required-true:MANY-false:description-null","inventoryProvider":"string:defaultValue-null:required-true:MANY-false:description-null","inventoryType":"INVENTORYTYPE:defaultValue-null:required-true:MANY-false:description-null","customerId":"string:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true', 'INVENTORYTYPE=[serviceInstanceId,vnfName,cloudRegionId,vimId,], APPLICABLERESOURCES=[any,all,], POLICYTYPE=[vnfPolicy,]', '""'), + ('vim_fit', 'Capacity policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,capacityProperties=capacityProperties_properties:MANY-false:description-null,resources=MANY-true,applicableResources=APPLICABLERESOURCES:MANY-false', '{"capacityProperties_properties":{"request":"string:defaultValue-null:required-true:MANY-false:description-null","controller":"string:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true ', ' APPLICABLERESOURCES=[any,all,], POLICYTYPE=[vim_fit,]', '""'), + ('affinityPolicy', 'Affinity policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,affinityProperties=affinityProperties_properties:MANY-false:description-null,resources=MANY-true,applicableResources=APPLICABLERESOURCES:MANY-false', '{"affinityProperties_properties":{"qualifier":"QUALIFIER:defaultValue-null:required-true:MANY-false:description-null","category":"string:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true ', ' APPLICABLERESOURCES=[any,all,], POLICYTYPE=[zone,], QUALIFIER=[same,different,]', '""'), + ('pciPolicy', 'Pci policy model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,resources=MANY-true,pciProperties=pciProperties_properties:MANY-true:description-null', '{"pciProperties_properties":{"pciOptimizationTimeConstraint":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptimizationNwConstraint":"string:defaultValue-null:required-false:MANY-false:description-null","algoCategory":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptmizationAlgoName":"string:defaultValue-null:required-false:MANY-false:description-null","pciOptimizationPriority":"string:defaultValue-null:required-false:MANY-false:description-null"}}', 'test1', 'olicyScope=matching-true, policyType=matching-true ', ' POLICYTYPE=[pciPolicy,]', '""'), + ('subscriberPolicy', 'Subscriber Policy Model', '[]', 'demo', 'identity=string:defaultValue-null:required-true:MANY-false:description-null', 'policyScope=MANY-true,policyType=POLICYTYPE:MANY-false,properties=properties_properties:MANY-false:description-type of a policy', '{"properties_properties":{"provStatus":"PROVSTATUS:defaultValue-null:required-true:MANY-false:description-null","subscriberName":"SUBSCRIBERNAME:defaultValue-null:required-true:MANY-false:description-null","subscriberRole":"SUBSCRIBERROLE:defaultValue-null:required-true:MANY-false:description-null"}}', 'test1', 'policyScope=matching-true, policyType=matching-true, properties=matching-true ', ' SUBSCRIBERNAME=[], SUBSCRIBERROLE=[], POLICYTYPE=[subscriberPolicy,], PROVSTATUS=[]', '""') +] + +mycursor.executemany(sql, val) + +mydb.commit() + +print(mycursor.rowcount, "was inserted.") |