aboutsummaryrefslogtreecommitdiffstats
path: root/test/hpa_automation/heat/insert_policy_models_heat.py
blob: 68a1d23bf098b99529f42bf186753cec8d94852d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.")