def create_kubernetes_vnf_startup_config(**kwargs): """Create Kubernetes VNF startup configuration. :param kwargs: Key-value pairs used to create configuration. :param kwargs: dict """ skip_cnt = kwargs['cpu_skip'] + (kwargs['i'] - 1) * \ (kwargs['cpu_cnt'] - 1) cpuset_cpus = \ CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], cpu_node=kwargs['cpu_node'], skip_cnt=skip_cnt, cpu_cnt=kwargs['cpu_cnt']-1, smt_used=kwargs['smt_used']) cpuset_main = \ CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], cpu_node=kwargs['cpu_node'], skip_cnt=1, cpu_cnt=1, smt_used=kwargs['smt_used']) # Create config instance vpp_config = VppConfigGenerator() vpp_config.set_node(kwargs['node']) vpp_config.add_unix_cli_listen(value='0.0.0.0:5002') vpp_config.add_unix_nodaemon() # We will pop first core from list to be main core vpp_config.add_cpu_main_core(str(cpuset_main.pop(0))) # if this is not only core in list, the rest will be used as workers. if cpuset_cpus: corelist_workers = ','.join(str(cpu) for cpu in cpuset_cpus) vpp_config.add_cpu_corelist_workers(corelist_workers) vpp_config.add_plugin_disable('dpdk_plugin.so') vpp_config.apply_config(filename=kwargs['filename'], restart_vpp=False)
def create_kubernetes_vnf_startup_config(**kwargs): """Create Kubernetes VNF startup configuration. :param kwargs: Key-value pairs used to create configuration. :param kwargs: dict """ smt_used = CpuUtils.is_smt_enabled(kwargs[u"node"][u"cpuinfo"]) skip_cnt = kwargs[u"cpu_skip"] + (kwargs[u"i"] - 1) * \ (kwargs[u"phy_cores"] - 1) cpuset_cpus = CpuUtils.cpu_slice_of_list_per_node( node=kwargs[u"node"], cpu_node=kwargs[u"cpu_node"], skip_cnt=skip_cnt, cpu_cnt=kwargs[u"phy_cores"] - 1, smt_used=smt_used) cpuset_main = CpuUtils.cpu_slice_of_list_per_node( node=kwargs[u"node"], cpu_node=kwargs[u"cpu_node"], skip_cnt=1, cpu_cnt=1, smt_used=smt_used) # Create config instance vpp_config = VppConfigGenerator() vpp_config.set_node(kwargs[u"node"]) vpp_config.add_unix_cli_listen(value=u"0.0.0.0:5002") vpp_config.add_unix_nodaemon() vpp_config.add_socksvr() # We will pop first core from list to be main core vpp_config.add_cpu_main_core(str(cpuset_main.pop(0))) # if this is not only core in list, the rest will be used as workers. if cpuset_cpus: corelist_workers = u",".join(str(cpu) for cpu in cpuset_cpus) vpp_config.add_cpu_corelist_workers(corelist_workers) vpp_config.add_plugin(u"disable", [u"dpdk_plugin.so"]) vpp_config.write_config(filename=kwargs[u"filename"])
def construct_container(self, **kwargs): """Construct container object on node with specified parameters. :param kwargs: Key-value pairs used to construct container. :param kwargs: dict """ # Create base class self.engine.initialize() # Set parameters for key in kwargs: setattr(self.engine.container, key, kwargs[key]) # Set additional environmental variables setattr(self.engine.container, 'env', 'MICROSERVICE_LABEL={label}'.format(label=kwargs['name'])) # Set cpuset.cpus cgroup skip_cnt = kwargs['cpu_skip'] if not kwargs['cpu_shared']: skip_cnt += kwargs['i'] * kwargs['cpu_count'] self.engine.container.cpuset_cpus = \ CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], cpu_node=kwargs['cpuset_mems'], skip_cnt=skip_cnt, cpu_cnt=kwargs['cpu_count'], smt_used=kwargs['smt_used']) # Store container instance self.containers[kwargs['name']] = self.engine.container
def create_kubernetes_vswitch_startup_config(**kwargs): """Create Kubernetes VSWITCH startup configuration. :param kwargs: Key-value pairs used to create configuration. :param kwargs: dict """ cpuset_cpus = \ CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'], cpu_node=kwargs['cpu_node'], skip_cnt=kwargs['cpu_skip'], cpu_cnt=kwargs['cpu_cnt'], smt_used=kwargs['smt_used']) # Create config instance vpp_config = VppConfigGenerator() vpp_config.set_node(kwargs['node']) vpp_config.add_unix_cli_listen(value='0.0.0.0:5002') vpp_config.add_unix_nodaemon() vpp_config.add_dpdk_socketmem('1024,1024') vpp_config.add_heapsize('3G') vpp_config.add_ip6_hash_buckets('2000000') vpp_config.add_ip6_heap_size('3G') if kwargs['framesize'] < 1522: vpp_config.add_dpdk_no_multi_seg() vpp_config.add_dpdk_dev_default_rxq(kwargs['rxq']) vpp_config.add_dpdk_dev(kwargs['if1'], kwargs['if2']) # We will pop first core from list to be main core vpp_config.add_cpu_main_core(str(cpuset_cpus.pop(0))) # if this is not only core in list, the rest will be used as workers. if cpuset_cpus: corelist_workers = ','.join(str(cpu) for cpu in cpuset_cpus) vpp_config.add_cpu_corelist_workers(corelist_workers) vpp_config.apply_config(filename=kwargs['filename'], restart_vpp=False)
def create_kubernetes_vswitch_startup_config(**kwargs): """Create Kubernetes VSWITCH startup configuration. :param kwargs: Key-value pairs used to create configuration. :param kwargs: dict """ smt_used = CpuUtils.is_smt_enabled(kwargs[u"node"][u"cpuinfo"]) cpuset_cpus = CpuUtils.cpu_slice_of_list_per_node( node=kwargs[u"node"], cpu_node=kwargs[u"cpu_node"], skip_cnt=2, cpu_cnt=kwargs[u"phy_cores"], smt_used=smt_used) cpuset_main = CpuUtils.cpu_slice_of_list_per_node( node=kwargs[u"node"], cpu_node=kwargs[u"cpu_node"], skip_cnt=1, cpu_cnt=1, smt_used=smt_used) # Create config instance vpp_config = VppConfigGenerator() vpp_config.set_node(kwargs[u"node"]) vpp_config.add_unix_cli_listen(value=u"0.0.0.0:5002") vpp_config.add_unix_nodaemon() vpp_config.add_socksvr() vpp_config.add_heapsize(u"4G") vpp_config.add_ip_heap_size(u"4G") vpp_config.add_ip6_heap_size(u"4G") vpp_config.add_ip6_hash_buckets(u"2000000") if not kwargs[u"jumbo"]: vpp_config.add_dpdk_no_multi_seg() vpp_config.add_dpdk_no_tx_checksum_offload() vpp_config.add_dpdk_dev_default_rxq(kwargs[u"rxq_count_int"]) vpp_config.add_dpdk_dev(kwargs[u"if1"], kwargs[u"if2"]) vpp_config.add_buffers_per_numa(kwargs[u"buffers_per_numa"]) # We will pop first core from list to be main core vpp_config.add_cpu_main_core(str(cpuset_main.pop(0))) # if this is not only core in list, the rest will be used as workers. if cpuset_cpus: corelist_workers = u",".join(str(cpu) for cpu in cpuset_cpus) vpp_config.add_cpu_corelist_workers(corelist_workers) vpp_config.write_config(filename=kwargs[u"filename"])