value: content.properties.subscriberRole
policy_info:
+ prioritization_attributes:
+ policy_type:
+ - content.policyType
+ resources:
+ - content.resources
+ - content.objectiveParameter.parameterAttributes.resources
+ service_name:
+ - content.serviceName
+
placement:
policy_fetch: by_scope
policy_scope:
import json
from collections import defaultdict
-
+import itertools
from osdf.utils.programming_utils import dot_notation, list_flatten
"""
filtered_policies = defaultdict(list)
policy_name = []
- policies = [x for x in flat_policies if x['content'].get('policy_type')] # drop ones without 'policy_type'
+ policies = [x for x in flat_policies if x['content'].get('policyType')] # drop ones without 'policy_type'
policy_types = set([x['content'].get('policyType') for x in policies])
aggregated_policies = dict((x, defaultdict(list)) for x in policy_types)
for policy in policies:
policy_type = policy['content'].get('policyType')
- for resource in policy['content'].get('resourceInstanceType', []):
+ for resource in policy['content'].get('resources', []):
aggregated_policies[policy_type][resource].append(policy)
for policy_type in aggregated_policies:
return filtered_policies
+def group_policies_gen(flat_policies, config):
+ """Filter policies using the following steps:
+ 1. Apply prioritization among the policies that are sharing the same policy type and resource type
+ 2. Remove redundant policies that may applicable across different types of resource
+ 3. Filter policies based on type and return
+ :param flat_policies: list of flat policies
+ :return: Filtered policies
+ """
+ filtered_policies = defaultdict(list)
+ policy_name = []
+ policies = [x for x in flat_policies if x['content'].get('policyType')] # drop ones without 'policy_type'
+ priority = config.get('policy_info', {}).get('prioritization_attributes', {})
+ aggregated_policies = dict()
+ for plc in policies:
+ attrs = [dot_notation(plc, dot_path) for key in priority.keys() for dot_path in priority[key]]
+ attrs_list = [x if isinstance(x, list) else [x] for x in attrs]
+ attributes = [list_flatten(x) if isinstance(x, list) else x for x in attrs_list]
+ for y in itertools.product(*attributes):
+ aggregated_policies.setdefault(y, [])
+ aggregated_policies[y].append(plc)
+
+ for key in aggregated_policies.keys():
+ aggregated_policies[key].sort(key=lambda x: x['priority'], reverse=True)
+ prioritized_policy = aggregated_policies[key][0]
+ if prioritized_policy['policyName'] not in policy_name:
+ # TODO: Check logic here... should policy appear only once across all groups?
+ filtered_policies[prioritized_policy['content']['policyType']].append(prioritized_policy)
+ policy_name.append(prioritized_policy['policyName'])
+
+ return filtered_policies
+
+
def policy_name_as_regex(policy_name):
"""Get the correct policy name as a regex
(e.g. OOF_HAS_vCPE.cloudAttributePolicy ends up in policy as OOF_HAS_vCPE.Config_MS_cloudAttributePolicy.1.xml
from jinja2 import Template
import osdf.optimizers.placementopt.conductor.translation as tr
-from osdf.adapters.policy.utils import group_policies
+from osdf.adapters.policy.utils import group_policies_gen
from osdf.utils.programming_utils import list_flatten
-def conductor_api_builder(request_json, flat_policies: list, local_config, prov_status,
- template="templates/conductor_interface.json"):
+def conductor_api_builder(request_json, flat_policies: list, local_config, template="templates/conductor_interface.json"):
"""Build an OSDF southbound API call for HAS-Conductor/Placement optimization
:param request_json: parameter data received from a client
:param flat_policies: policy data received from the policy platform (flat policies)
:return: json to be sent to Conductor/placement optimization
"""
templ = Template(open(template).read())
- gp = group_policies(flat_policies)
+ gp = group_policies_gen(flat_policies, local_config)
demand_vnf_name_list = []
for placementDemand in request_json['placementInfo']['placementDemands']:
reservation_policies = [x for x in reservation_policy_list if len(x) > 0]
reservation_groups = list_flatten(reservation_policies)
req_info = request_json['requestInfo']
- model_name = request_json['serviceInfo']['serviceName']
- service_type = model_name
+ request_type = req_info.get('requestType', None)
+ service_type = request_json['serviceInfo']['serviceName']
service_info = local_config.get('service_info', {}).get(service_type, {})
order_info = {}
if 'orderInfo' in request_json["placementInfo"]:
order_info = json.loads(request_json["placementInfo"]["orderInfo"])
- request_type = req_info.get('requestType', None)
+
subs_com_site_id = ""
if 'subscriberInfo' in request_json['placementInfo']:
subs_com_site_id = request_json['placementInfo']['subscriberInfo'].get('subscriberCommonSiteId', "")
- rendered_req = None
- if service_type == 'vCPE':
- rendered_req = templ.render(
- requestType=request_type,
- chosenComplex=subs_com_site_id,
- demand_list=demand_list,
- policy_groups=policy_groups,
- optimization_policies=optimization_policy_list,
- name=req_info['requestId'],
- timeout=req_info['timeout'],
- limit=req_info['numSolutions'],
- serviceType=service_type,
- serviceInstance=request_json['serviceInfo']['serviceInstanceId'],
- provStatus=prov_status,
- chosenRegion=order_info.get('requestParameters', {}).get('lcpCloudRegionId'),
- json=json)
+ rendered_req = templ.render(
+ requestType=request_type,
+ chosenComplex=subs_com_site_id,
+ demand_list=demand_list,
+ policy_groups=policy_groups,
+ optimization_policies=optimization_policy_list,
+ name=req_info['requestId'],
+ timeout=req_info['timeout'],
+ limit=req_info['numSolutions'],
+ service_type=request_json['serviceInfo']['serviceName'],
+ service_id=request_json['serviceInfo']['serviceInstanceId'],
+ provStatus="",
+ chosenRegion=order_info.get('requestParameters', {}).get('lcpCloudRegionId'),
+ json=json)
json_payload = json.dumps(json.loads(rendered_req)) # need this because template's JSON is ugly!
return json_payload
for attr in content['objectiveParameter']['parameterAttributes']:
parameter = attr['parameter'] if attr['parameter'] == "cloud_version" else attr['parameter']+"_between"
- for res in attr['resource']:
- vnf = get_matching_vnf(res, vnf_list)
+ vnfs = get_matching_vnfs(attr['resources'], vnf_list)
+ for vnf in vnfs:
value = [vnf] if attr['parameter'] == "cloud_version" else [attr['customerLocationInfo'], vnf]
parameter_list.append({
attr['operator']: [attr['weight'], {parameter: value}]
:return: List of matching VNFs
"""
if match_type == "all": # don't bother with any comparisons
- return resources
+ return resources if set(resources) <= set(vnf_list) else None
common_vnfs = set(vnf_list) & set(resources)
if match_type == "intersection": # specifically requested intersection
return list(common_vnfs)
related_policies = []
for policy in resource_policy:
pc = policy['content']
- demands = get_matching_vnfs(pc['resourceInstanceType'], vnf_list, match_type=match_type)
- resource = {pc['identity']: {'type': pc['type'], 'demands': demands}}
+ demands = get_matching_vnfs(pc['resources'], vnf_list, match_type=match_type)
+ resource = {pc['identity']: {'type': pc['policyType'], 'demands': demands}}
if rtype:
resource[pc['identity']]['properties'] = {'controller': pc[rtype]['controller'],
"""Get policies governing distance-to-location for VNFs in order to populate the Conductor API call"""
cur_policies, related_policies = gen_policy_instance(vnf_list, distance_to_location_policy, rtype=None)
for p_new, p_main in zip(cur_policies, related_policies): # add additional fields to each policy
- properties = p_main['content']['distanceToLocationProperty']
- pcp_d = properties['distanceCondition']
+ properties = p_main['content']['distanceProperties']
+ pcp_d = properties['distance']
p_new[p_main['content']['identity']]['properties'] = {
- 'distance': text_to_symbol[pcp_d['operator']] + " " + pcp_d['value'].lower(),
+ 'distance': pcp_d['operator'] + " " + pcp_d['value'].lower() + " " + pcp_d['unit'].lower(),
'location': properties['locationInfo']
}
return cur_policies
def gen_zone_policy(vnf_list, zone_policy):
"""Get zone policies in order to populate the Conductor API call"""
- cur_policies, related_policies = gen_policy_instance(vnf_list, zone_policy, rtype=None)
+ cur_policies, related_policies = gen_policy_instance(vnf_list, zone_policy, match_type="all", rtype=None)
for p_new, p_main in zip(cur_policies, related_policies): # add additional fields to each policy
- pmz = p_main['content']['zoneProperty']
+ pmz = p_main['content']['affinityProperty']
p_new[p_main['content']['identity']]['properties'] = {'category': pmz['category'], 'qualifier': pmz['qualifier']}
return cur_policies
def get_policy_properties(demand, policies):
"""Get policy_properties for cases where there is a match with the demand"""
for policy in policies:
- if not set(policy['content'].get('resourceInstanceType', [])) & set(demand['resourceModuleName']):
+ if demand['resourceModuleName'] not in set(policy['content'].get('resources', [])):
continue # no match for this policy
- for policy_property in policy['content']['property']:
+ for policy_property in policy['content']['vnfProperties']:
yield policy_property
"timeout": {{ timeout }},\r
"limit": {{ limit }},\r
"template": {\r
- "conductor_template_version": "2018-02-01",\r
+ "homing_template_version": "2017-10-10",\r
"parameters": {\r
- "REQUEST_TYPE": "{{ requestType }}",\r
- "CHOSEN_REGION": "{{ chosenRegion }}",\r
- "LATITUDE": "{{ latitude }}",\r
- "LONGITUDE": "{{ longitude }}",\r
- {% if serviceType == 'DHV' %}\r
- "E2EVPNKEY": "{{ e2eVpnKey }}",\r
- "UCPEHOST": "{{ ucpeHostName }}",\r
- "EFFECTIVE_BANDWIDTH": "{{ effectiveBandwidth }}",\r
- "WAN_PORT1_UP": "{{ ipsec_bw_up }}",\r
- "WAN_PORT1_DOWN": "{{ ipsec_bw_down }}",\r
- "WAN_PORT2_UP": "{{ ipsec2_bw_up }}",\r
- "WAN_PORT2_DOWN": "{{ ipsec2_bw_down }}",\r
- {% endif %}\r
- {% if serviceType != 'DHV' %}\r
- "GW_TENANT_ID": "{{ gwTenantId }}",\r
- "PORTAL_TENANT_ID": "{{ portalTenantId }}",\r
- {% endif %}\r
- "CHOSEN_COMPLEX": "{{ chosenComplex }}",\r
- {% if serviceType == 'ADIOD' or serviceType == 'VPE' %}\r
- "BANDWIDTH": "{{ bandwidth }}",\r
- "UNIT": "{{ bandwidth_unit }}",\r
- {% endif %}\r
- "SERVICE_INST": "{{ serviceInstance }}",\r
- "PROV_STATUS": {{ json.dumps(provStatus) }}\r
+ "service_name": "{{ service_name }}",\r
+ "service_id": "{{ service_id }}",\r
+ "customer_lat": "{{ latitude }}",\r
+ "customer_long": "{{ longitude }}",\r
+ "REQUIRED_MEM": "{{ memory }}",\r
+ "REQUIRED_DISK": "{{ storage }}"\r
},\r
"locations": {\r
- {% if serviceType == 'DHV' %}\r
"customer_loc": {\r
- "host_name": { "get_param": "UCPEHOST" }\r
+ "latitude": { "get_param": "customer_lat" },\r
+ "longitude": { "get_param": "customer_long" }\r
}\r
- {% elif serviceType == 'ADIOD' %}\r
- "customer_pref_location": {\r
- "clli_code": { "get_param": "CHOSEN_COMPLEX" }\r
- }\r
- {% elif serviceType == 'NETBOND' %}\r
- "peering_point": {\r
- "latitude": { "get_param": "LATITUDE" },\r
- "longitude": { "get_param": "LONGITUDE" }\r
- }\r
- {% else %}\r
- "customer_pref_loc": {\r
- "clli_code": { "get_param": "CHOSEN_COMPLEX" }\r
- }\r
- {% endif %}\r
},\r
"demands": {{ json.dumps(demand_list) }},\r
{% set comma_main = joiner(",") %}\r
{% endfor %}\r
{% endfor %}\r
},\r
- "reservation": {\r
- {% set comma=joiner(",") %}\r
- {% for elem in reservation_groups %} {{ comma() }}\r
- {% for key, value in elem.items() %}\r
- "{{key}}": {{ json.dumps(value) }}\r
- {% endfor %}\r
- {% endfor %}\r
- },\r
"optimization": {\r
{% set comma=joiner(",") %}\r
{% for elem in optimization_policies %} {{ comma() }}\r
pass
def test_gen_demands(self):
- res = tr.gen_demands(self.request_json, self.policies)
+ # need to run this only on vnf policies
+ vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"]
+ res = tr.gen_demands(self.request_json, vnf_policies)
assert res is not None
value: content.properties.subscriberRole
policy_info:
+ prioritization_attributes:
+ policy_type:
+ - content.policyType
+ resources:
+ - content.resources
+ - content.objectiveParameter.parameterAttributes.resources
+ service_name:
+ - content.serviceName
placement:
policy_fetch: by_scope
policy_scope:
country: country,
geo_region: geoRegion,
exclusivity_groups: exclusivityGroups,
- replication_role: replicationRole,
+ replication_role: replicationRole
remapping:
model-invariant-id: modelInvariantId,
model-version-id: modelVersionId
def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs)
self.folder = './test/policy-local-files'
- self.invalid_policies = ['INVALID-one.json', 'INVALID-two.json']
- self.valid_policies = [
- 'Affinity_vCPE_1.json',
- 'Capacity_vG_1.json',
- 'Distance_vG_1.json',
- 'Placement_Optimization_1.json',
- 'hpa_policy_vGMuxInfra_1.json',
- 'vnfPolicy_vG.json',
- 'Capacity_vGMuxInfra.json',
- 'Distance_vGMuxInfra_1.json',
- 'Min_Guarantee_vGMuxInfra_1.json',
- 'QueryPolicy_vCPE.json',
- 'hpa_policy_vG_1.json',
- 'vnfPolicy_vGMuxInfra.json'
- ]
-
+ self.valid_policies_file = self.folder + '/' + 'meta-valid-policies.txt'
+ self.invalid_policies_file = self.folder + '/' + 'meta-invalid-policies.txt'
+ self.valid_policies = local_policies.get_policy_names_from_file(self.valid_policies_file)
+ self.invalid_policies = local_policies.get_policy_names_from_file(self.invalid_policies_file)
+
def test_get_local_policies_no_policies(self):
with self.assertRaises(FileNotFoundError):
res = local_policies.get_local_policies(self.folder, self.invalid_policies)
if __name__ == "__main__":
unittest.main()
-
-from flask import Response
-
-from osdf import ACCEPTED_MESSAGE_TEMPLATE
-
-
-def osdf_response_for_request_accept(req_id="", text="", response_code=202, as_http=True):
- """Helper method to create a response object for request acceptance, so that the object can be sent to a client
- :param req_id: request ID provided by the caller
- :param text: extra text description about accepting the request (e.g. "Request accepted")
- :param response_code: the HTTP status code to send -- default is 202 (accepted)
- :param as_http: whether to send response as HTTP response object or as a string
- :return: if as_http is True, return a HTTP Response object. Otherwise, return json-encoded-message
- """
- response_message = ACCEPTED_MESSAGE_TEMPLATE.render(description=text, request_id=req_id)
- if not as_http:
- return response_message
-
- response = Response(response_message, content_type='application/json; charset=utf-8')
- response.headers.add('content-length', len(response_message))
- response.status_code = response_code
- return response
"policyConfigMessage": "Config Retrieved! ",
"policyConfigStatus": "CONFIG_RETRIEVED",
"type": "JSON",
- "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vG\",\"description\":\"Capacity policy for vG\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vG\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vG\"],\"resources\":[\"vG\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vG\", \"description\": \"Capacity policy for vG\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vG\", \"policyScope\": [\"VCPE\", \"US\", \"INTERNATIONAL\", \"ip\", \"vG\", \"vim_fit\"], \"resources\": [\"vG\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
"policyName": "oofBeijing.Config_MS_capacityPolicy_vG.1.xml",
"policyVersion": "1",
"matchingConditions": {
"policyConfigMessage": "Config Retrieved! ",
"policyConfigStatus": "CONFIG_RETRIEVED",
"type": "JSON",
- "config": "{\"service\":\"optimizationQueryPolicy\",\"policyName\":\"oofBeijing.queryPolicy_vCPE\",\"description\":\"Optimization query policy for vCPE\",\"templateVersion\":\"0.0.1\",\"version\":\"oofBeijing\",\"priority\":\"3\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"queryProperties\":[{\"attribute\":\"locationId\",\"value\":\"orderInfo.customerLocation\"},{\"attribute\":\"id\",\"value\":\"orderInfo.vpnInfo\"},{\"attribute\":\"upstreamBW\",\"value\":\"orderInfo.vpnInfo\"}],\"policyScope\":[\"vCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\",\"vG\"],\"policyType\":\"optimizationQueryPolicy\"}}",
+ "config": "{\"service\": \"optimizationQueryPolicy\", \"policyName\": \"oofBeijing.queryPolicy_vCPE\", \"description\": \"Optimization query policy for vCPE\", \"templateVersion\": \"0.0.1\", \"version\": \"oofBeijing\", \"priority\": \"3\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"queryProperties\": [{\"attribute\": \"locationId\", \"attribute_location\": \"customerLocation\", \"value\": \"\"}, {\"attribute\": \"id\", \"attribute_location\": \"vpnInfo.vpnId\", \"value\": \"\"}, {\"attribute\": \"upstreamBW\", \"attribute_location\": \"vpnInfo.upstreamBW\", \"value\": \"\"}, {\"attribute\": \"customerLatitude\", \"attribute_location\": \"customerLatitude\", \"value\": 32.89748}, {\"attribute\": \"customerLongitude\", \"attribute_location\": \"customerLongitude\", \"value\": -97.040443}], \"policyScope\": [\"vCPE\", \"US\", \"INTERNATIONAL\", \"ip\", \"vGMuxInfra\", \"vG\", \"optimizationQueryPolicy\"], \"policyType\": \"optimizationQueryPolicy\"}}",
"policyName": "oofBeijing.Config_MS_queryPolicy_vCPE.1.xml",
"policyVersion": "1",
"matchingConditions": {
"policyConfigMessage": "Config Retrieved! ",
"policyConfigStatus": "CONFIG_RETRIEVED",
"type": "JSON",
- "config": "{\"service\":\"capacityPolicy\",\"policyName\":\"oofBeijing.capacityPolicy_vGMuxInfra\",\"description\":\"Capacity policy for vGMuxInfra\",\"templateVersion\":\"1702.03\",\"version\":\"oofBeijing\",\"priority\":\"5\",\"riskType\":\"test\",\"riskLevel\":\"2\",\"guard\":\"False\",\"content\":{\"identity\":\"capacity_vGMuxInfra\",\"policyScope\":[\"VCPE\",\"US\",\"INTERNATIONAL\",\"ip\",\"vGMuxInfra\"],\"resources\":[\"vGMuxInfra\"],\"capacityProperty\":{\"cpu\":{\"value\":2,\"operator\":\">\"},\"memory\":{\"value\":4,\"operator\":\">\",\"unit\":\"GB\"}},\"policyType\":\"capacityPolicy\",\"applicableResources\":\"any\"}}",
+ "config": "{\"service\": \"capacityPolicy\", \"policyName\": \"oofBeijing.capacityPolicy_vGMuxInfra\", \"description\": \"Capacity policy for vGMuxInfra\", \"templateVersion\": \"1702.03\", \"version\": \"oofBeijing\", \"priority\": \"5\", \"riskType\": \"test\", \"riskLevel\": \"2\", \"guard\": \"False\", \"content\": {\"identity\": \"capacity_vGMuxInfra\", \"policyScope\": [\"VCPE\", \"US\", \"INTERNATIONAL\", \"ip\", \"vGMuxInfra\", \"vim_fit\"], \"resources\": [\"vGMuxInfra\"], \"capacityProperty\": {\"controller\": \"multicloud\", \"request\": \"{\\\"vCPU\\\": 10, \\\"Memory\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_MEM\\\"}, \\\"unit\\\": \\\"GB\\\"}, \\\"Storage\\\": {\\\"quantity\\\": {\\\"get_param\\\": \\\"REQUIRED_DISK\\\", \\\"unit\\\": \\\"GB\\\"}}}\"}, \"policyType\": \"vim_fit\", \"applicableResources\": \"any\"}}",
"policyName": "oofBeijing.Config_MS_capacityPolicy_vGMuxInfra.1.xml",
"policyVersion": "1",
"matchingConditions": {
"qualifier": "different",
"category": "complex"
},
- "policyType": "affinityPolicy",
- "resources": ["vGMuxInfra", "vG"]
+ "policyType": "zone",
+ "resources": ["vGMuxInfra", "vG"],
+ "applicableResources": "all"
}
-}
+}
\ No newline at end of file
"guard": "False",
"content": {
"identity": "capacity_vGMuxInfra",
- "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "resources": ["vGMuxInfra"],
+ "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vim_fit"],
+ "resources": ["vGMuxInfra"],
"capacityProperty": {
- "cpu": {"value": 2, "operator": ">"},
- "memory": {"value": 4, "operator": ">", "unit": "Gb"}
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}"
},
- "policyType": "capacityPolicy"
+ "policyType": "vim_fit",
+ "applicableResources": "any"
}
}
{
"service": "capacityPolicy",
- "policyName": "oofBeijing.capacityPolicy_vGMuxInfra",
- "description": "Capacity policy for vGMuxInfra",
+ "policyName": "oofBeijing.capacityPolicy_vG",
+ "description": "Capacity policy for vG",
"templateVersion": "1702.03",
"version": "oofBeijing",
"priority": "5",
"riskLevel": "2",
"guard": "False",
"content": {
- "identity": "capacity_vGMuxInfra",
- "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vG"],
- "resources": ["vG"],
+ "identity": "capacity_vG",
+ "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vG", "vim_fit"],
+ "resources": ["vG"],
"capacityProperty": {
- "cpu": {"value": 2, "operator": ">"},
- "memory": {"value": 4, "operator": ">", "unit": "Gb"}
+ "controller": "multicloud",
+ "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}"
},
- "policyType": "capacityPolicy"
+ "policyType": "vim_fit",
+ "applicableResources": "any"
}
}
},
"identity": "distance-vGMuxInfra",
"resources": ["vGMuxInfra"],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "policyType": "distancePolicy"
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "distancePolicy"],
+ "policyType": "distance_to_location",
+ "applicableResources": "any"
}
}
},
"identity": "distance-vG",
"resources": ["vG"],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"],
- "policyType": "distancePolicy"
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "distancePolicy"],
+ "policyType": "distance_to_location",
+ "applicableResources": "any"
}
}
+++ /dev/null
-{
- "service": "minGuaranteePolicy",
- "policyName": "oofBeijing.minGuaranee_vGMuxInfra",
- "description": "Min guarantee policy for vGMuxInfra",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "5",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "identity": "minGuarantee_vGMuxInfra",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "minGuaranteeProperty": {
- "cpu": {"value": "true", "operator": "="},
- "memory": {"value": "false", "operator": "="}
- },
- "policyType": "minGuaraneePolicy",
- "resourceInstanceType": ["vGMuxInfra"]
- }
-}
"objectiveParameter": {
"parameterAttributes": [
{
- "resource": ["vGMuxInfra"],
+ "resources": ["vGMuxInfra"],
"customerLocationInfo": "customer_loc",
"parameter": "distance",
"weight": "1",
"operator": "product"
},
{
- "resource": ["vG"],
+ "resources": ["vG"],
"customerLocationInfo": "customer_loc",
"parameter": "distance",
"weight": "1",
"operator": "sum"
},
"identity": "optimization",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"],
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "placementOptimization"],
"policyType": "placementOptimization",
"objective": "minimize"
}
"guard": "False",
"content": {
"queryProperties": [
- {"attribute":"locationId", "value": "orderInfo.customerLocation"},
- {"attribute":"id", "value": "orderInfo.vpnInfo"},
- {"attribute":"upstreamBW", "value": "orderInfo.vpnInfo"}
+ {"attribute":"locationId", "attribute_location": "customerLocation", "value": ""},
+ {"attribute":"id", "attribute_location": "vpnInfo.vpnId", "value": ""},
+ {"attribute":"upstreamBW", "attribute_location": "vpnInfo.upstreamBW", "value": ""},
+ {"attribute":"customerLatitude", "attribute_location": "customerLatitude", "value": 32.89748},
+ {"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": -97.040443}
],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"],
- "type": "optimizationQueryPolicy"
+ "serviceName": "vCPE",
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"],
+ "policyType": "optimizationQueryPolicy"
}
}
+++ /dev/null
-{
- "service": "optimizationQueryPolicy",
- "policyName": "oofBeijing.queryPolicy_vCPE",
- "description": "Optimization query policy for vCPE",
- "templateVersion": "0.0.1",
- "version": "oofBeijing",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "queryProperties": [
- {
- "attribute": "locationId",
- "value": "orderInfo.customerLocation"
- },
- {
- "attribute": "id",
- "value": "orderInfo.vpnInfo"
- },
- {
- "attribute": "upstreamBW",
- "value": "orderInfo.vpnInfo"
- }
- ],
- "policyScope": [
- "vCPE",
- "US",
- "INTERNATIONAL",
- "ip",
- "vGMuxInfra",
- "vG",
- "optimizationQueryPolicy"
- ],
- "policyType": "optimizationQueryPolicy"
- }
-}
+++ /dev/null
-{
- "service": "capacityPolicy",
- "policyName": "oofBeijing.capacityPolicy_vGMuxInfra",
- "description": "Capacity policy for vGMuxInfra",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "5",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "identity": "capacity_vGMuxInfra",
- "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vim_fit"],
- "resources": ["vGMuxInfra"],
- "capacityProperty": {
- "controller": "multicloud",
- "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}"
- },
- "policyType": "vim_fit",
- "applicableResources": "any"
- }
-}
+++ /dev/null
-{
- "service": "capacityPolicy",
- "policyName": "oofBeijing.capacityPolicy_vG",
- "description": "Capacity policy for vG",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "5",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "identity": "capacity_vG",
- "policyScope": ["VCPE", "US", "INTERNATIONAL", "ip", "vG", "vim_fit"],
- "resources": ["vG"],
- "capacityProperty": {
- "controller": "multicloud",
- "request": "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\", \"unit\": \"GB\"}}}"
- },
- "policyType": "vim_fit",
- "applicableResources": "any"
- }
-}
+++ /dev/null
-{
- "service": "distancePolicy",
- "policyName": "oofBeijing.distancePolicy_vGMuxInfra",
- "description": "Distance Policy for vGMuxInfra",
- "templateVersion": "0.0.1",
- "version": "oofBeijing",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "distanceProperties": {
- "locationInfo": "customer_location",
- "distance": { "value": "500", "operator": "<", "unit": "km" }
- },
- "identity": "distance-vGMuxInfra",
- "resources": ["vGMuxInfra"],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "distancePolicy"],
- "policyType": "distancePolicy",
- "applicableResources": "any"
- }
-}
+++ /dev/null
-{
- "service": "distancePolicy",
- "policyName": "oofBeijing.distancePolicy_vG",
- "description": "Distance Policy for vG",
- "templateVersion": "0.0.1",
- "version": "oofBeijing",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "distanceProperties": {
- "locationInfo": "customer_location",
- "distance": { "value": "1500", "operator": "<", "unit": "km" }
- },
- "identity": "distance-vG",
- "resources": ["vG"],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "distancePolicy"],
- "policyType": "distancePolicy",
- "applicableResources": "any"
- }
-}
+++ /dev/null
-{
- "service": "minGuaranteePolicy",
- "policyName": "oofBeijing.minGuaranee_vGMuxInfra",
- "description": "Min guarantee policy for vGMuxInfra",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "5",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "identity": "minGuarantee_vGMuxInfra",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "minGuaranteePolicy"],
- "minGuaranteeProperty": {
- "cpu": "true",
- "memory": "false",
- },
- "policyType": "minGuaranteePolicy",
- "resources": ["vGMuxInfra"],
- "applicableResources": "any"
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "service": "PlacementOptimizationPolicy",
- "policyName": "oofBeijing.PlacementOptimizationPolicy_vGMuxInfra",
- "description": "Placement Optimization Policy for vGMuxInfra",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "5",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "objectiveParameter": {
- "parameterAttributes": [
- {
- "resource": ["vGMuxInfra"],
- "customerLocationInfo": "customer_loc",
- "parameter": "distance",
- "weight": "1",
- "operator": "product"
- },
- {
- "resource": ["vG"],
- "customerLocationInfo": "customer_loc",
- "parameter": "distance",
- "weight": "1",
- "operator": "product"
- }
- ],
- "operator": "sum"
- },
- "identity": "optimization",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "placementOptimization"],
- "policyType": "placementOptimization",
- "objective": "minimize"
- }
-}
+++ /dev/null
-{
- "service": "optimizationQueryPolicy",
- "policyName": "oofBeijing.queryPolicy_vCPE",
- "description": "Optimization query policy for vCPE",
- "templateVersion": "0.0.1",
- "version": "oofBeijing",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "queryProperties": [
- {"attribute":"locationId", "attribute_location": "customerLocation", "value": ""},
- {"attribute":"id", "attribute_location": "vpnInfo.vpnId", "value": ""},
- {"attribute":"upstreamBW", "attribute_location": "vpnInfo.upstreamBW", "value": ""},
- {"attribute":"customerLatitude", "attribute_location": "customerLatitude", "value": 32.89748},
- {"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": -97.040443}
- ],
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"],
- "policyType": "optimizationQueryPolicy"
- }
-}
+++ /dev/null
-{
- "service": "hpaPolicy",
- "policyName": "oofBeijing.hpaPolicy_vGMuxInfra",
- "description": "HPA policy for vGMuxInfra",
- "templateVersion": "0.0.1",
- "version": "1.0",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "resources": "vGMuxInfra",
- "identity": "hpaPolicy_vGMuxInfra",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "hpaPolicy"],
- "policyType": "hpaPolicy",
- "flavorFeatures": [
- {
- "flavorLabel": "flavor_label_vm_01",
- "flavorProperties":[
- {
- "hpa-feature" : "cpuTopology",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
- {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
- {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
- {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
- {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
- {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "ovsDpdk",
- "mandatory" : "False",
- "score" : "3",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""}
- ]
- },
- {
- "hpa-feature" : "cpuInstructionSetExtensions",
- "mandatory" : "True",
- "architecture": "INTEL-64",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
- ]
- }
- ]
- },
- {
- "flavorLabel": "flavor_label_vm_02",
- "flavorProperties":[
- {
- "hpa-feature" : "cpuPinningy",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
- {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "localStorage",
- "mandatory" : "False",
- "score" : "5",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
- {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
- {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
- ]
- },
- {
- "hpa-feature" : "pcie",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "functionType", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
- ]
- }
- ]
- },
- {
- "flavorLabel": "flavor_label_vm_03",
- "flavorProperties":[
- {
- "hpa-feature" : "numa",
- "mandatory" : "False",
- "score" : "5",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
- {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "hugePages",
- "mandatory" : "False",
- "score" : "7",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
- ]
- }
- ]
- }
- ]
- }
-}
+++ /dev/null
-{
- "service": "hpaPolicy",
- "policyName": "oofBeijing.hpaPolicy_vG",
- "description": "HPA policy for vG",
- "templateVersion": "0.0.1",
- "version": "1.0",
- "priority": "3",
- "riskType": "test",
- "riskLevel": "2",
- "guard": "False",
- "content": {
- "resources": "vG",
- "identity": "hpaPolicy_vG",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "hpaPolicy"],
- "policyType": "hpaPolicy",
- "flavorFeatures": [
- {
- "flavorLabel": "flavor_label_vm_01",
- "flavorProperties":[
- {
- "hpa-feature" : "cpuTopology",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
- {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
- {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
- {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
- {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
- {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "ovsDpdk",
- "mandatory" : "False",
- "score" : "3",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""}
- ]
- },
- {
- "hpa-feature" : "cpuInstructionSetExtensions",
- "mandatory" : "True",
- "architecture": "INTEL-64",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
- ]
- }
- ]
- },
- {
- "flavorLabel": "flavor_label_vm_02",
- "flavorProperties":[
- {
- "hpa-feature" : "cpuPinningy",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
- {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "localStorage",
- "mandatory" : "False",
- "score" : "5",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
- {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
- {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
- ]
- },
- {
- "hpa-feature" : "pcie",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "functionType", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
- ]
- }
- ]
- },
- {
- "flavorLabel": "flavor_label_vm_03",
- "flavorProperties":[
- {
- "hpa-feature" : "numa",
- "mandatory" : "False",
- "score" : "5",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
- {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
- ]
- },
- {
- "hpa-feature" : "basicCapabilities",
- "mandatory" : "True",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
- {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
- ]
- },
- {
- "hpa-feature" : "hugePages",
- "mandatory" : "False",
- "score" : "7",
- "architecture": "generic",
- "hpa-feature-attributes": [
- {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
- ]
- }
- ]
- }
- ]
- }
-}
+++ /dev/null
-{
- "service": "VnfPolicy",
- "policyName": "oofBeijing.vnfPolicy_vG",
- "description": "vnfPolicy",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "6",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "identity": "vnf_vG",
- "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vG", "vnf_policy"],
- "policyType": "vnf_policy",
- "resources": ["vG"],
- "applicableResources": "any",
- "vnfProperties": [
- {
- "inventoryProvider": "aai",
- "serviceType": "",
- "inventoryType": "cloud",
- "customerId": ""
- },
- {
- "inventoryProvider": "multicloud",
- "serviceType": "HNGATEWAY",
- "inventoryType": "service",
- "customerId": "21014aa2-526b-11e6-beb8-9e71128cae77"
- }
- ]
- }
-}
+++ /dev/null
-{
- "service": "VnfPolicy",
- "policyName": "oofBeijing.vnfPolicy_vGMuxInfra",
- "description": "vnfPolicy",
- "templateVersion": "1702.03",
- "version": "oofBeijing",
- "priority": "6",
- "riskType": "test",
- "riskLevel": "3",
- "guard": "False",
- "content": {
- "identity": "vnf_vGMuxInfra",
- "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vGMuxInfra", "vnf_policy"],
- "policyType": "vnf_policy",
- "resources": ["vGMuxInfra"],
- "applicableResources": "any",
- "vnfProperties": [
- {
- "inventoryProvider": "aai",
- "serviceType": "",
- "inventoryType": "cloud",
- "customerId": ""
- },
- {
- "inventoryProvider": "multicloud",
- "serviceType": "HNGATEWAY",
- "inventoryType": "service",
- "customerId": "21014aa2-526b-11e6-beb8-9e71128cae77"
- }
- ]
- }
-}
"content": {
"resources": "vGMuxInfra",
"identity": "hpaPolicy_vGMuxInfra",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "hpaPolicy"],
"policyType": "hpaPolicy",
"flavorFeatures": [
{
"flavorLabel": "flavor_label_vm_01",
"flavorProperties":[
{
- "hpa_feature" : "cpuTopology",
+ "hpa-feature" : "cpuTopology",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"numCpuSockets", "values": "2","operator": ">=", "unit": ""},
- {"attribute":"numCpuSockets", "values": "4","operator": "<=", "unit": ""},
- {"attribute":"numCpuCores", "value": "2", "operator":">=", "unit": ""},
- {"attribute":"numCpuCores", "value": "4", "operator":"<=", "unit": ""},
- {"attribute":"numCpuThreads", "value": "4", "operator":">=", "unit": ""},
- {"attribute":"numCpuThreads", "value": "8", "operator":"<=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "ovsDpdk",
+ "hpa-feature" : "ovsDpdk",
"mandatory" : "False",
"score" : "3",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"dataProcessingAccelerationLibrary", "value":"ovsDpdk_version", "operator": "=", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""}
]
},
{
- "hpa_feature" : "cpuInstructionSetExtensions",
+ "hpa-feature" : "cpuInstructionSetExtensions",
"mandatory" : "True",
"architecture": "INTEL-64",
- "featureAttributes": [
- {"attribute":"instructionSetExtensions", "value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
]
}
]
"flavorLabel": "flavor_label_vm_02",
"flavorProperties":[
{
- "hpa_feature" : "cpuPinningy",
+ "hpa-feature" : "cpuPinningy",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"logicalCpuThreadPinningPolicy", "value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
- {"attribute":"logicalCpuPinningPolicy", "value": "<CPUPOLICY>","operator": "=", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
+ {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "localStorage",
+ "hpa-feature" : "localStorage",
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "diskSize", "value": "2", "operator": "=", "unit": "GB"},
- {"attribute": "ephemeralDiskSize", "value": "2", "operator": "=", "unit": "GB"},
- {"attribute": "swapMemSize", "value":"16", "operator": "=", "unit": "MB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
]
},
{
- "hpa_feature" : "pcie",
+ "hpa-feature" : "pcie",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "pciCount", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "pciVendorId", "value":"8086", "operator": "=", "unit": ""},
- {"attribute": "pciDeviceId", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "functionType", "value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "functionType", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
]
}
]
"flavorLabel": "flavor_label_vm_03",
"flavorProperties":[
{
- "hpa_feature" : "numa",
+ "hpa-feature" : "numa",
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numaNodes", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "numaCpu-0", "values":"2", "operator": "=", "unit": ""},
- {"attribute": "numaMem-0", "value": "2048", "operator": "=", "unit": "MB"},
- {"attribute": "numaCpu-1", "values":"4", "operator": "=", "unit": ""},
- {"attribute": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
+ {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "hugePages",
+ "hpa-feature" : "hugePages",
"mandatory" : "False",
"score" : "7",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "memoryPageSize", "value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
]
}
]
"content": {
"resources": "vG",
"identity": "hpaPolicy_vG",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"],
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG", "hpaPolicy"],
"policyType": "hpaPolicy",
"flavorFeatures": [
{
"flavorLabel": "flavor_label_vm_01",
"flavorProperties":[
{
- "hpa_feature" : "cpuTopology",
+ "hpa-feature" : "cpuTopology",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"numCpuSockets", "values": "2","operator": ">=", "unit": ""},
- {"attribute":"numCpuSockets", "values": "4","operator": "<=", "unit": ""},
- {"attribute":"numCpuCores", "value": "2", "operator":">=", "unit": ""},
- {"attribute":"numCpuCores", "value": "4", "operator":"<=", "unit": ""},
- {"attribute":"numCpuThreads", "value": "4", "operator":">=", "unit": ""},
- {"attribute":"numCpuThreads", "value": "8", "operator":"<=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "2","operator": ">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuSockets", "hpa-attribute-value": "4","operator": "<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "2", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuCores", "hpa-attribute-value": "4", "operator":"<=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "4", "operator":">=", "unit": ""},
+ {"hpa-attribute-key":"numCpuThreads", "hpa-attribute-value": "8", "operator":"<=", "unit": ""}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "ovsDpdk",
+ "hpa-feature" : "ovsDpdk",
"mandatory" : "False",
"score" : "3",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"dataProcessingAccelerationLibrary", "value":"ovsDpdk_version", "operator": "=", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"dataProcessingAccelerationLibrary", "hpa-attribute-value":"ovsDpdk_version", "operator": "=", "unit":""}
]
},
{
- "hpa_feature" : "cpuInstructionSetExtensions",
+ "hpa-feature" : "cpuInstructionSetExtensions",
"mandatory" : "True",
"architecture": "INTEL-64",
- "featureAttributes": [
- {"attribute":"instructionSetExtensions", "value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"instructionSetExtensions", "hpa-attribute-value":["<CPUINST>", "<CPUINST>"], "operator": "ALL", "unit":""}
]
}
]
"flavorLabel": "flavor_label_vm_02",
"flavorProperties":[
{
- "hpa_feature" : "cpuPinningy",
+ "hpa-feature" : "cpuPinningy",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute":"logicalCpuThreadPinningPolicy", "value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
- {"attribute":"logicalCpuPinningPolicy", "value": "<CPUPOLICY>","operator": "=", "unit":""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key":"logicalCpuThreadPinningPolicy", "hpa-attribute-value":"<CPUTHREADPOLICY>", "operator": "=", "unit":""},
+ {"hpa-attribute-key":"logicalCpuPinningPolicy", "hpa-attribute-value": "<CPUPOLICY>","operator": "=", "unit":""}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "localStorage",
+ "hpa-feature" : "localStorage",
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "diskSize", "value": "2", "operator": "=", "unit": "GB"},
- {"attribute": "ephemeralDiskSize", "value": "2", "operator": "=", "unit": "GB"},
- {"attribute": "swapMemSize", "value":"16", "operator": "=", "unit": "MB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "diskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "ephemeralDiskSize", "hpa-attribute-value": "2", "operator": "=", "unit": "GB"},
+ {"hpa-attribute-key": "swapMemSize", "hpa-attribute-value":"16", "operator": "=", "unit": "MB"}
]
},
{
- "hpa_feature" : "pcie",
+ "hpa-feature" : "pcie",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "pciCount", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "pciVendorId", "value":"8086", "operator": "=", "unit": ""},
- {"attribute": "pciDeviceId", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "functionType", "value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "pciCount", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciVendorId", "hpa-attribute-value":"8086", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "pciDeviceId", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "functionType", "hpa-attribute-value": "<PCITYPEVALUE>","operator": "=", "unit": ""}
]
}
]
"flavorLabel": "flavor_label_vm_03",
"flavorProperties":[
{
- "hpa_feature" : "numa",
+ "hpa-feature" : "numa",
"mandatory" : "False",
"score" : "5",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numaNodes", "value": "2", "operator": "=", "unit": ""},
- {"attribute": "numaCpu-0", "values":"2", "operator": "=", "unit": ""},
- {"attribute": "numaMem-0", "value": "2048", "operator": "=", "unit": "MB"},
- {"attribute": "numaCpu-1", "values":"4", "operator": "=", "unit": ""},
- {"attribute": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numaNodes", "hpa-attribute-value": "2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaCpu-0", "hpa-attribute-value":"2", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-0", "hpa-attribute-value": "2048", "operator": "=", "unit": "MB"},
+ {"hpa-attribute-key": "numaCpu-1", "hpa-attribute-value":"4", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "numaMem-1", "value": "4096", "operator": "=", "unit": "MB"}
]
},
{
- "hpa_feature" : "basicCapabilities",
+ "hpa-feature" : "basicCapabilities",
"mandatory" : "True",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "numVirtualCpu", "value": "6", "operator": "=", "unit": ""},
- {"attribute": "virtualMemSize", "value":"6", "operator": "=", "unit": "GB"}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "numVirtualCpu", "hpa-attribute-value": "6", "operator": "=", "unit": ""},
+ {"hpa-attribute-key": "virtualMemSize", "hpa-attribute-value":"6", "operator": "=", "unit": "GB"}
]
},
{
- "hpa_feature" : "hugePages",
+ "hpa-feature" : "hugePages",
"mandatory" : "False",
"score" : "7",
"architecture": "generic",
- "featureAttributes": [
- {"attribute": "memoryPageSize", "value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
+ "hpa-feature-attributes": [
+ {"hpa-attribute-key": "memoryPageSize", "hpa-attribute-value": "<MEMORYPAGESIZE>", "operator": "=", "unit": ""}
]
}
]
Capacity_vG_1.json
Distance_vGMuxInfra_1.json
Distance_vG_1.json
-Min_Guarantee_vGMuxInfra_1.json
Placement_Optimization_1.json
QueryPolicy_vCPE.json
hpa_policy_vGMuxInfra_1.json
"subscriberRole": ["PVT Homing"],
"provStatus": ["CAPPED"]
},
- "policyType": "subscriberPolicy"
+ "policyType": "subscriberPolicy",
+ "serviceName": "vCPE"
}
}
\ No newline at end of file
"guard": "False",
"content": {
"identity": "vnf_vG",
- "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vG"],
- "policyType": "vnf_policy",
+ "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vG", "vnf_policy"],
+ "policyType": "vnfPolicy",
"resources": ["vG"],
- "vnfProperties": [
+ "applicableResources": "any",
+ "vnfProperties": [
{
"inventoryProvider": "aai",
"serviceType": "",
"guard": "False",
"content": {
"identity": "vnf_vGMuxInfra",
- "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "policyType": "vnf_policy",
+ "policyScope": ["vCPE", "INTERNATIONAL", "ip", "vGMuxInfra", "vnf_policy"],
+ "policyType": "vnfPolicy",
"resources": ["vGMuxInfra"],
+ "applicableResources": "any",
"vnfProperties": [
{
"inventoryProvider": "aai",
def tearDown(self):
pass
- def test_gen_demands(self):
- res = tr.gen_demands(self.request_json, self.policies)
- assert res is not None
-
def test_get_by_name(self):
pol.get_by_name(mock.MagicMock(), self.valid_policies_files[0])
def setUp(self):
self.main_dir = ""
conductor_api_template = self.main_dir + "osdf/templates/conductor_interface.json"
- parameter_data_file = self.main_dir + "test/placement-tests/request.json"
- policy_data_path = self.main_dir + "test/policy-local-files/"
+ parameter_data_file = self.main_dir + "test/placement-tests/request.json" # "test/placement-tests/request.json"
+ policy_data_path = self.main_dir + "test/policy-local-files" # "test/policy-local-files"
local_config_file = self.main_dir + "config/common_config.yaml"
valid_policies_list_file = policy_data_path + '/' + 'meta-valid-policies.txt'
def test_conductor_api_call_builder(self):
main_dir = self.main_dir
- conductor_api_template = main_dir + "osdf/templates/conductor_interface.json"
+ conductor_api_template = main_dir + "osdf/templates/conductor_interface.json" # "osdf/templates/conductor_interface.json"
local_config_file = main_dir + "config/common_config.yaml"
request_json = self.request_json
policies = self.policies
local_config = yaml.load(open(local_config_file))
- templ_string = conductor_api_builder(request_json, policies, local_config, [], conductor_api_template)
+ templ_string = conductor_api_builder(request_json, policies, local_config, conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json["name"], "yyy-yyy-yyyy")
with patch('osdf.adapters.policy.interface.policy_api_call', return_value=policy_response):
self.assertRaises(BusinessException,
lambda: interface.remote_api(req_json, osdf_config, service_type="placement"))
-
+
def test_get_by_scope(self):
req_json_file = "./test/placement-tests/testScoperequest.json"
all_policies = "./test/placement-tests/policy_response.json"
genDemandslist = []
req_json = "./test/placement-tests/request.json"
req_json = json.loads(open(req_json).read())
- genDemands = translation.gen_demands(req_json, self.policies)
+ # need to run this only on vnf policies
+ vnf_policies = [x for x in self.policies if x["content"]["policyType"] == "vnfPolicy"]
+ genDemands = translation.gen_demands(req_json, vnf_policies)
for action in req_json['placementInfo']['placementDemands']:
actionsList.append(action['resourceModuleName'])
for key2,value in genDemands.items():