def test_manage_fip(self): # Check for correct fip interface self.check_interface.return_value = True self.relation_get.return_value = 'True' cplane_utils.manage_fip() self.relation_ids.assert_called_with('cplane-controller') self.related_units.assert_called_with('random_rid') self.relation_get.assert_called_with(attribute='fip-mode', unit='random_unit', rid='random_rid') self.config.assert_called_with('fip-interface') self.check_interface.assert_called_with('random_interface') self.add_bridge.assert_called_with('br-fip', 'random_interface') # Check for incorrect fip interface self.check_interface.return_value = False cplane_utils.manage_fip() self.relation_ids.assert_called_with('cplane-controller') self.related_units.assert_called_with('random_rid') self.relation_get.assert_called_with(attribute='fip-mode', unit='random_unit', rid='random_rid') self.config.assert_called_with('fip-interface') self.check_interface.assert_called_with('random_interface') self.juju_log.assert_called_with('Fip interface doesnt exist, and \ will be used by default by Cplane controller')
def cplane_controller_relation_changed(): set_cp_agent() manage_fip() restart_cp_agentd()
def cplane_controller_relation_changed(): set_cp_agent() manage_fip() restart_services()
def cplane_controller_relation_changed(): set_cp_agent() set_cp_agent_dc() manage_fip() restart_cp_agentd()
def config_changed(): set_dpdk_env() 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) manage_fip() 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 config_changed(): set_dpdk_env() 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) manage_fip() 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])