def config_changed(): configs = register_configs() configs.write_all() import pkg_resources NEUTRON_ENTRY_POINT = "/usr/lib/python2.7/dist-packages/neutron-" + \ pkg_resources.get_distribution('neutron').version + \ ".egg-info/entry_points.txt" cplane_config(neutron_config, NEUTRON_ENTRY_POINT)
def config_changed(): configs = register_configs() configs.write_all() if config('cplane-version') == "1.3.5": import pkg_resources NEUTRON_ENTRY_POINT = "/usr/lib/python2.7/dist-packages/neutron-" \ + pkg_resources.get_distribution('neutron').\ version + ".egg-info/entry_points.txt" cplane_config(neutron_config, NEUTRON_ENTRY_POINT)
def test_register_configs(self): class _mock_OSConfigRenderer(): def __init__(self, templates_dir=None, openstack_release=None): self.configs = [] self.ctxts = [] def register(self, config, ctxt): self.configs.append(config) self.ctxts.append(ctxt) self.os_release.return_value = 'liberty' templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer _regconfs = cplane_utils.register_configs() confs = ['/etc/neutron/plugins/ml2/ml2_conf.ini'] self.assertItemsEqual(_regconfs.configs, confs)
def config_changed(): configs = register_configs() configs.write_all() if config('cplane-version') == "1.3.5": import pkg_resources NEUTRON_ENTRY_POINT = "/usr/lib/python2.7/dist-packages/neutron-" \ + pkg_resources.get_distribution('neutron').\ version + ".egg-info/entry_points.txt" cplane_config(neutron_config, NEUTRON_ENTRY_POINT) 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]) add_controller_ip()
NEUTRON_CONF, neutron_config, restart_cp_agentd, assess_status, fake_register_configs, get_os_release, ) from cplane_network import ( add_bridge, check_interface, change_iface_config, ) hooks = Hooks() CONFIGS = register_configs() @hooks.hook('cplane-controller-relation-changed') def cplane_controller_relation_changed(): set_cp_agent() manage_fip() restart_cp_agentd() @hooks.hook('neutron-plugin-api-relation-changed') def neutron_plugin_api_changed(): if not relation_get('neutron-api-ready'): log('Relationship with neutron-api not yet complete') return CONFIGS.write_all()
fake_register_configs, is_leader_ready, is_oracle_relation_joined, set_data_source, configure_database, register_configs, HAPROXY_CONF, ) from cplane_network import ( change_iface_config, ) hooks = Hooks() if config('controller-app-mode') == 'msm' or config('controller-app-mode') == 'doctl': configs = register_configs() @hooks.hook('cplane-controller-relation-joined') def cplane_controller_relation_joined(rid=None): tm = commands.getoutput("date") if config('controller-app-mode') == 'dvnd': if check_fip_mode() == 'true': fip_mode = True else: fip_mode = False else: fip_mode = False relation_info = { 'fip-mode': fip_mode, 'mport': config('multicast-port'),
register_configs, NEUTRON_CONF, assess_status, disable_bridge_fw, fake_register_configs, ML2_CONFIG, disable_port_security, ) from cplane_network import ( change_iface_config, ) hooks = Hooks() CONFIGS = register_configs() @hooks.hook('cloud-controller-relation-changed') def cloud_controller_relation_changed(): controller = relation_get('private-address') if controller: metadata_agent_config.update({'nova_metadata_ip': controller}) cplane_config(metadata_agent_config, METADATA_AGENT_INI, 'DEFAULT') @hooks.hook('neutron-plugin-relation-joined') def neutron_plugin_relation_joined(rid=None): principle_config = { 'nova-compute': { '/etc/nova/nova.conf': {
def cplane_controller_relation_changed(): configs = register_configs() configs.write_all()
set_oracle_host, install_oracle_client, configure_oracle_client, configure_keystone, create_ketstone_user, send_active_notification, create_domain, assess_status, fake_register_configs, ) from cplane_network import ( change_iface_config, ) hooks = Hooks() configs = register_configs() @hooks.hook('config-changed') def config_changed(): configs.write_all() 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])