def config_changed(): set_cp_agent() cplane_config(system_config, SYSTEM_CONF, '') cmd = ['sysctl', '-p'] subprocess.check_call(cmd) CONFIGS.write(METADATA_AGENT_INI) restart_services()
def config_changed(): set_cp_agent() cplane_config(system_config, SYSTEM_CONF, '') cmd = ['sysctl', '-p'] subprocess.check_call(cmd) CONFIGS.write_all() restart_services()
def test_set_cp_agent(self, m_check_call): # Check if valid port is returned self.relation_get.return_value = "9000" cplane_utils.set_cp_agent() self.relation_ids.assert_called_with('cplane-controller') self.related_units.assert_called_with('random_rid') self.relation_get.assert_called_with(attribute='private-address', rid='random_rid', unit='random_unit') self.assertEqual(m_check_call.call_args, call(['cp-agentd', 'set-config', 'vm-mtu=random_interface'])) # Check if invallid port is returned self.relation_get.return_value = "0" cplane_utils.set_cp_agent() self.relation_ids.assert_called_with('cplane-controller') self.related_units.assert_called_with('random_rid') self.relation_get.assert_called_with(attribute='private-address', rid='random_rid', unit='random_unit') self.assertEqual(m_check_call.call_args, call(['cp-agentd', 'set-config', 'vm-mtu=random_interface']))
def cplane_controller_relation_changed(): set_cp_agent() manage_fip() restart_cp_agentd()
def config_changed(): set_cp_agent() cplane_config(system_config, SYSTEM_CONF, '') if get_os_release() == '16.04': cmd = ['modprobe', 'br_netfilter'] subprocess.check_call(cmd) cmd = ['sysctl', '-p'] subprocess.check_call(cmd) CONFIGS.write_all() restart_services() mtu_string = config('intf-mtu') if mtu_string: intf_mtu = mtu_string.split(',') for line in intf_mtu: interface = line.split('=') log("Change request for mtu for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'mtu', interface[1]) tso_string = config('tso-flag') if tso_string: intf_tso = tso_string.split(',') for line in intf_tso: interface = line.split('=') log("Change request for tso for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'tso', interface[1]) gso_string = config('gso-flag') if gso_string: intf_gso = gso_string.split(',') for line in intf_gso: interface = line.split('=') log("Change request for gso for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'gso', interface[1]) rx_string = config('rx-flag') if rx_string: intf_rx = rx_string.split(',') for line in intf_rx: interface = line.split('=') log("Change request for rx for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'rx', interface[1]) tx_string = config('tx-flag') if tx_string: intf_tx = tx_string.split(',') for line in intf_tx: interface = line.split('=') log("Change request for tx for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'tx', interface[1]) sg_string = config('sg-flag') if sg_string: intf_sg = sg_string.split(',') for line in intf_sg: interface = line.split('=') log("Change request for sg for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'sg', interface[1]) ufo_string = config('ufo-flag') if ufo_string: intf_ufo = ufo_string.split(',') for line in intf_ufo: interface = line.split('=') log("Change request for ufo for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'ufo', interface[1]) gro_string = config('gro-flag') if gro_string: intf_gro = gro_string.split(',') for line in intf_gro: interface = line.split('=') log("Change request for gro for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'gro', interface[1]) lro_string = config('lro-flag') if lro_string: intf_lro = lro_string.split(',') for line in intf_lro: interface = line.split('=') log("Change request for lro for interface {} = {}".format( interface[0], interface[1])) change_iface_config(interface[0], 'lro', interface[1])
def cplane_controller_relation_changed(): set_cp_agent() manage_fip() restart_services()
def config_changed(): set_cp_agent() set_cp_agent_dc() cplane_config(system_config, SYSTEM_CONF, '') if get_os_release() == '16.04': cmd = ['modprobe', 'br_netfilter'] subprocess.check_call(cmd) cmd = ['sysctl', '-p'] subprocess.check_call(cmd) restart_services() mtu_string = config('intf-mtu') if mtu_string: intf_mtu = mtu_string.split(',') for line in intf_mtu: interface = line.split('=') log("Change request for mtu for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'mtu', interface[1]) tso_string = config('tso-flag') if tso_string: intf_tso = tso_string.split(',') for line in intf_tso: interface = line.split('=') log("Change request for tso for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'tso', interface[1]) gso_string = config('gso-flag') if gso_string: intf_gso = gso_string.split(',') for line in intf_gso: interface = line.split('=') log("Change request for gso for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'gso', interface[1]) rx_string = config('rx-flag') if rx_string: intf_rx = rx_string.split(',') for line in intf_rx: interface = line.split('=') log("Change request for rx for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'rx', interface[1]) tx_string = config('tx-flag') if tx_string: intf_tx = tx_string.split(',') for line in intf_tx: interface = line.split('=') log("Change request for tx for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'tx', interface[1]) sg_string = config('sg-flag') if sg_string: intf_sg = sg_string.split(',') for line in intf_sg: interface = line.split('=') log("Change request for sg for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'sg', interface[1]) ufo_string = config('ufo-flag') if ufo_string: intf_ufo = ufo_string.split(',') for line in intf_ufo: interface = line.split('=') log("Change request for ufo for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'ufo', interface[1]) gro_string = config('gro-flag') if gro_string: intf_gro = gro_string.split(',') for line in intf_gro: interface = line.split('=') log("Change request for gro for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'gro', interface[1]) lro_string = config('lro-flag') if lro_string: intf_lro = lro_string.split(',') for line in intf_lro: interface = line.split('=') log("Change request for lro for interface {} = {}" .format(interface[0], interface[1])) change_iface_config(interface[0], 'lro', interface[1])
def cplane_controller_relation_changed(): set_cp_agent() set_cp_agent_dc() manage_fip() restart_cp_agentd()