+ if self.HOST_EPA in vdu_dic:
+ host_epa = vdu_dic.pop(self.HOST_EPA)
+ host_epa_prop = {}
+ self.host_epa = host_epa
+ '''
+ if 'cpu_model' in host_epa:
+ host_epa_prop['cpu_model'] = host_epa['cpu_model'].lower()
+ if 'cpu_arch' in host_epa:
+ host_epa_prop['cpu_arch'] = host_epa['cpu_arch'].lower()
+ if 'cpu_vendor' in host_epa:
+ host_epa_prop['cpu_vendor'] = host_epa['cpu_vendor'].lower()
+ if 'cpu_socket_count' in host_epa:
+ host_epa_prop['cpu_socket_count'] = host_epa['cpu_socket_count']
+ if 'cpu_core_count' in host_epa:
+ host_epa_prop['cpu_core_count'] = host_epa['cpu_core_count']
+ if 'cpu_core_thread_count' in host_epa:
+ host_epa_prop['cpu_core_thread_count'] = host_epa['cpu_core_thread_count']
+ if 'om_cpu_model_string' in host_epa:
+ host_epa_prop['om_cpu_model_string'] = host_epa['om_cpu_model_string']
+ if 'cpu_feature' in host_epa:
+ host_epa_prop['cpu_feature'] = []
+ for cpu_feature in host_epa['cpu_feature']:
+ cpu_feature_prop = {}
+ cpu_feature_prop['feature'] = cpu_feature['feature'].lower()
+ host_epa_prop['cpu_feature'] .append(cpu_feature_prop)
+
+ if 'om_cpu_feature' in host_epa:
+ host_epa_prop['om_cpu_feature'] = []
+ for cpu_feature in host_epa['om_cpu_feature']:
+ om_cpu_feature_prop = {}
+ om_cpu_feature_prop['feature'] = cpu_feature
+ host_epa_prop['om_cpu_feature'].append(om_cpu_feature_prop)
+ self.host_epa = host_epa
+ '''
+ # We might have to re write this piece of code, there are mismatch in
+ # enum names. Its all capital in RIFT yang and TOSCA
+ if self.VSWITCH_EPA in vdu_dic:
+ vswitch_epa = vdu_dic.pop(self.VSWITCH_EPA)
+ self.vswitch_epa = vswitch_epa
+ if self.HYPERVISOR_EPA in vdu_dic:
+ hypervisor_epa = vdu_dic.pop(self.HYPERVISOR_EPA)
+ hypervisor_epa_prop = {}
+
+ if 'type_yang' in hypervisor_epa:
+ hypervisor_epa_prop['type'] = hypervisor_epa['type_yang']
+ if 'version' in hypervisor_epa:
+ hypervisor_epa_prop['version'] = str(hypervisor_epa['version'])
+ else:
+ hypervisor_epa_prop['version'] = '1'
+ self.hypervisor_epa = hypervisor_epa_prop
+
+ if self.GUEST_EPA in vdu_dic:
+ guest_epa = vdu_dic[self.GUEST_EPA]
+ guest_epa_prop = {}
+
+ # This is a hack. I have to rewrite this. I have got this quick to working
+ # 'ANY' check should be added in riftio common file. Its not working for some reason. Will fix.
+
+ if 'cpu_pinning_policy' in guest_epa and guest_epa['cpu_pinning_policy'] != 'ANY':
+ self.pinning_epa_prop['cpu_affinity'] = guest_epa['cpu_pinning_policy'].lower()
+ if 'cpu_thread_pinning_policy' in guest_epa:
+ self.pinning_epa_prop['thread_allocation'] = guest_epa['cpu_thread_pinning_policy'].lower()
+ if 'mempage_size' in guest_epa:
+ self.mem_page_guest_epa = self.TOSCA_MEM_SIZE[guest_epa['mempage_size']]
+
+ if 'numa_node_policy' in guest_epa:
+ num_node_policy = guest_epa['numa_node_policy']
+ if 'node_cnt' in num_node_policy:
+ guest_epa_prop['node_cnt'] = num_node_policy['node_cnt']
+ if 'mem_policy' in num_node_policy:
+ guest_epa_prop['mem_policy'] = num_node_policy['mem_policy']
+ if 'node' in num_node_policy:
+ nodes = []
+ for node in num_node_policy['node']:
+ node_prop = {}
+ if 'id' in node:
+ node_prop['id'] = node['id']
+ if 'vcpu' in node:
+ vc =[]
+ for vcp in node['vcpu']:
+ vc.append(vcp['id'])
+
+ node_prop['vcpus'] = vc
+ if 'memory_mb' in node:
+ node_prop['mem_size'] = "{} MB".format(node['memory_mb'])
+ # om_numa_type generation
+
+ if 'num_cores' in node:
+ node_prop['om_numa_type'] = 'num_cores'
+ node_prop['num_cores'] = node['num_cores']
+ elif 'paired_threads' in node:
+ node_prop['om_numa_type'] = 'paired-threads'
+ node_prop['paired_threads'] = node['paired_threads']
+ elif 'threads]' in node:
+ node_prop['om_numa_type'] = 'threads]'
+ node_prop['num_thread]'] = node['threads]']
+
+ nodes.append(node_prop)
+ guest_epa_prop['node'] = nodes
+
+ self.guest_epa = guest_epa_prop
+