Esempio n. 1
0
    def _network_check_config_files(self):
        """
        Check related configuration files
        :return: True if no warning
        """
        warns = False
        output(b('>>> Checking config files...\n'))
        file = '/etc/sysctl.conf'
        lines = [
            'net.ipv4.ip_forward=1',
            'net.ipv4.conf.default.rp_filter=0',
            'net.ipv4.conf.all.rp_filter=0',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/neutron.conf'
        lines = [
            '[DEFAULT]',
            'router_distributed = True',
            'core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin',
            'allow_overlapping_ips = True',
            'allow_automatic_l3agent_failover = True',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/plugins/ml2/ml2_conf.ini'
        lines = [
            '[securitygroup]',
            'enable_security_group = True',
            'enable_ipset = True',
            '[ovs]',
            'bridge_mappings = external:br-ex',
            '[agent]',
            'l2_population = True',
            'enable_distributed_routing = True',
            'arp_responder = True',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s Not has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/l3_agent.ini'
        lines = [
            '[DEFAULT]',
            'use_namespaces = True',
            #'external_network_bridge =',
            'router_delete_namespaces = True',
            'agent_mode = dvr_snat',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/dhcp_agent.ini'
        lines = [
            '[DEFAULT]',
            'interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver',
            'dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq',
            'use_namespaces = True',
            'dhcp_delete_namespaces = True',
            'dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf'
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s Not has %s\n' % (file, l)))
                if l == lines[-1]:
                    warn(r(' Suggest change MTU if using VXLAN, '))
                    warn(r('adding following line into '
                           '/etc/neutron/dnsmasq-neutron.conf\n'))
                    warn(r(' dhcp-option-force=26,1450\n'))
                warns = True
        if not warns:
            output(g('<<< Checking config files passed\n'))
            return True
        else:
            warn(r('<<< Checking config files has warnings\n'))
            return False
Esempio n. 2
0
    def _compute_check_config_files(self):
        """
        Check related configuration files
        :return: True if no warning
        """
        warns = False
        output(b('>>> Checking config files...\n'))
        file = '/etc/sysctl.conf'
        lines = [
            'net.ipv4.ip_forward=1',
            'net.ipv4.conf.default.rp_filter=0',
            'net.ipv4.conf.all.rp_filter=0',
            'net.bridge.bridge-nf-call-iptables=1',
            'net.bridge.bridge-nf-call-ip6tables=1'
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/neutron.conf'
        lines = [
            '[DEFAULT]',
            #'router_distributed = True',
            'core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin',
            'allow_overlapping_ips = True',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/plugins/ml2/ml2_conf.ini'
        lines = [
            '[agent]',
            'l2_population = True',
            'enable_distributed_routing = True',
            'arp_responder = True',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s Not has %s\n' % (file, l)))
                warns = True

        file = '/etc/neutron/l3_agent.ini'
        lines = [
            '[DEFAULT]',
            'use_namespaces = True',  # optional
            'router_delete_namespaces = True',
            'agent_mode = dvr',
        ]
        output(b('# Checking file = %s...\n' % file))
        for l in lines:
            if not fileHasLine(file, l):
                warn(r('file %s NOT has %s\n' % (file, l)))
                warns = True
        if not warns:
            output(g('<<< Checking config files passed\n'))
            return True
        else:
            warn(r('<<< Checking config files has warnings\n'))
            return False