def generate_network_scheme(cls, node, networks):

        roles = cls._get_network_roles(node)
        # Create a data structure and fill it with static values.
        attrs = {
            "version": "1.1",
            "provider": "lnx",
            "interfaces": {},  # It's a list of physical interfaces.
            "endpoints": {},
            "roles": roles,
        }

        nm = Cluster.get_network_manager(node.cluster)

        netgroups = nm.get_node_networks_with_ips(node)
        netgroup_mapping = nm.get_node_network_mapping(node)
        for ngname, brname in netgroup_mapping:
            ip_addr = netgroups.get(ngname, {}).get("ip")
            if ip_addr:
                attrs["endpoints"][brname] = {"IP": [ip_addr]}
            else:
                attrs["endpoints"][brname] = {"IP": "none"}

        # TODO(rmoe): fix gateway selection
        if "public/vip" in roles:
            public_ep = roles["public/vip"]
            public_net = None

            for network_group, endpoint in netgroup_mapping:
                if endpoint == public_ep:
                    public_net = network_group
                    break

            attrs["endpoints"][public_ep]["gateway"] = netgroups[public_net]["gateway"]

            # This can go away when we allow separate public and floating nets
            floating_ep = roles["neutron/floating"]
            if floating_ep not in attrs["endpoints"]:
                attrs["endpoints"][floating_ep] = {"IP": "none"}
        else:
            admin_ep = roles["admin/pxe"]
            attrs["endpoints"][admin_ep]["gateway"] = nm.get_default_gateway(node.id)

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs["interfaces"][iface.name] = {}
            else:
                attrs["interfaces"][iface.name] = nm.get_iface_properties(iface)

        attrs["transformations"] = cls.generate_transformations(node)

        if NodeGroupCollection.get_by_cluster_id(node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups, networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        return attrs
    def generate_network_scheme(cls, node):

        # Create a data structure and fill it with static values.
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},  # It's a list of physical interfaces.
            'endpoints': {},
            'roles': {
                'management': 'br-mgmt',
                'storage': 'br-storage',
                'fw-admin': 'br-fw-admin',
            },
        }

        is_public = Node.should_have_public(node)
        if is_public:
            attrs['endpoints']['br-ex'] = {'IP': 'none'}
            attrs['endpoints']['br-floating'] = {'IP': 'none'}
            attrs['roles']['ex'] = 'br-ex'
            attrs['roles']['neutron/floating'] = 'br-floating'

        nm = Cluster.get_network_manager(node.cluster)

        # Populate IP and GW information to endpoints.
        netgroup_mapping = [
            ('storage', 'br-storage'),
            ('management', 'br-mgmt'),
            ('fuelweb_admin', 'br-fw-admin'),
        ]
        if is_public:
            netgroup_mapping.append(('public', 'br-ex'))

        if node.cluster.network_config.segmentation_type in \
                (consts.NEUTRON_SEGMENT_TYPES.gre,
                 consts.NEUTRON_SEGMENT_TYPES.tun):
            netgroup_mapping.append(('private', 'br-mesh'))
            attrs['endpoints']['br-mesh'] = {}
            attrs['roles']['neutron/mesh'] = 'br-mesh'

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_node_network_by_netname(node, ngname)
            if netgroup.get('ip'):
                attrs['endpoints'][brname] = {'IP': [netgroup['ip']]}
            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup['dev']].append({
                'br_name': brname,
                'vlan_id': netgroup['vlan']
            })

        # Add gateway.
        if is_public and netgroups['public'].get('gateway'):
            attrs['endpoints']['br-ex']['gateway'] = \
                netgroups['public']['gateway']
        else:
            gw = nm.get_default_gateway(node.id)
            attrs['endpoints']['br-fw-admin']['gateway'] = gw

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        # Dance around Neutron segmentation type.
        prv_base_ep = None
        if node.cluster.network_config.segmentation_type == \
                consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs['endpoints']['br-prv'] = {'IP': 'none'}
            attrs['roles']['neutron/private'] = 'br-prv'

            netgroup = nm.get_node_network_by_netname(node, 'private')
            # create br-aux if there is no untagged network (endpoint) on the
            # same interface.
            if netgroup['dev'] in nets_by_ifaces:
                for ep in nets_by_ifaces[netgroup['dev']]:
                    if not ep['vlan_id']:
                        prv_base_ep = ep['br_name']
            if not prv_base_ep:
                nets_by_ifaces[netgroup['dev']].append({
                    'br_name': 'br-aux',
                    'vlan_id': None
                })

        attrs['transformations'] = cls.generate_transformations(
            node, nm, nets_by_ifaces, is_public, prv_base_ep)

        if NodeGroupCollection.get_by_cluster_id(
                node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups)

        attrs = cls.generate_driver_information(node, attrs, nm)

        return attrs
    def generate_network_scheme(cls, node):

        roles = cls._get_network_roles(node)
        # Create a data structure and fill it with static values.
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},  # It's a list of physical interfaces.
            'endpoints': {},
            'roles': roles,
        }

        nm = Cluster.get_network_manager(node.cluster)

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        netgroup_mapping = cls._get_netgroup_mapping_by_role(node)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_node_network_by_netname(node, ngname)
            ip_addr = netgroup.get('ip')
            if ip_addr:
                attrs['endpoints'][brname] = {'IP': [ip_addr]}
            else:
                attrs['endpoints'][brname] = {'IP': 'none'}

            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup['dev']].append({
                'br_name': brname,
                'vlan_id': netgroup['vlan']
            })

        # TODO(rmoe): fix gateway selection
        if 'public/vip' in roles:
            public_ep = roles['public/vip']
            public_net = None

            for network_group, endpoint in netgroup_mapping:
                if endpoint == public_ep:
                    public_net = network_group
                    break

            attrs['endpoints'][public_ep]['gateway'] = \
                netgroups[public_net]['gateway']

            # This can go away when we allow separate public and floating nets
            floating_ep = roles['neutron/floating']
            attrs['endpoints'][floating_ep] = {'IP': 'none'}
        else:
            admin_ep = roles['admin/pxe']
            attrs['endpoints'][admin_ep]['gateway'] = settings.MASTER_IP

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        attrs['transformations'] = cls.generate_transformations(node)

        if NodeGroupCollection.get_by_cluster_id(
                node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups)

        attrs = cls.generate_driver_information(node, attrs, nm)

        return attrs
    def generate_network_scheme(cls, node, networks):

        roles = cls._get_network_roles(node)
        # Create a data structure and fill it with static values.
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},  # It's a list of physical interfaces.
            'endpoints': {},
            'roles': roles,
        }

        nm = Cluster.get_network_manager(node.cluster)

        netgroups = nm.get_node_networks_with_ips(node)
        netgroup_mapping = nm.get_node_network_mapping(node)
        for ngname, brname in netgroup_mapping:
            ip_addr = netgroups.get(ngname, {}).get('ip')
            if ip_addr:
                attrs['endpoints'][brname] = {'IP': [ip_addr]}
            else:
                attrs['endpoints'][brname] = {'IP': 'none'}

        # TODO(rmoe): fix gateway selection
        if 'public/vip' in roles:
            public_ep = roles['public/vip']
            public_net = None

            for network_group, endpoint in netgroup_mapping:
                if endpoint == public_ep:
                    public_net = network_group
                    break

            attrs['endpoints'][public_ep]['gateway'] = \
                netgroups[public_net]['gateway']

            # This can go away when we allow separate public and floating nets
            floating_ep = roles['neutron/floating']
            if floating_ep not in attrs['endpoints']:
                attrs['endpoints'][floating_ep] = {'IP': 'none'}
        else:
            admin_ep = roles['admin/pxe']
            attrs['endpoints'][admin_ep]['gateway'] = \
                nm.get_default_gateway(node.id)

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        attrs['transformations'] = cls.generate_transformations(node)

        if NodeGroupCollection.get_by_cluster_id(
                node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups,
                                networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        return attrs
Exemple #5
0
    def generate_network_scheme(cls, node, networks):

        # Create a data structure and fill it with static values.
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},  # It's a list of physical interfaces.
            'endpoints': {},
            'roles': {
                'management': 'br-mgmt',
                'storage': 'br-storage',
                'fw-admin': 'br-fw-admin',
            },
        }

        is_public = Node.should_have_public(node)
        if is_public:
            attrs['endpoints']['br-ex'] = {'IP': 'none'}
            attrs['endpoints']['br-floating'] = {'IP': 'none'}
            attrs['roles']['ex'] = 'br-ex'
            attrs['roles']['neutron/floating'] = 'br-floating'

        nm = Cluster.get_network_manager(node.cluster)

        # Populate IP and GW information to endpoints.
        netgroup_mapping = [
            ('storage', 'br-storage'),
            ('management', 'br-mgmt'),
            ('fuelweb_admin', 'br-fw-admin'),
        ]
        if is_public:
            netgroup_mapping.append(('public', 'br-ex'))

        if node.cluster.network_config.segmentation_type in \
                (consts.NEUTRON_SEGMENT_TYPES.gre,
                 consts.NEUTRON_SEGMENT_TYPES.tun):
            netgroup_mapping.append(('private', 'br-mesh'))
            attrs['endpoints']['br-mesh'] = {}
            attrs['roles']['neutron/mesh'] = 'br-mesh'

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_network_by_netname(ngname, networks)
            if netgroup.get('ip'):
                attrs['endpoints'][brname] = {'IP': [netgroup['ip']]}
            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup['dev']].append({
                'br_name': brname,
                'vlan_id': netgroup['vlan']
            })

        # Add gateway.
        if is_public and netgroups['public'].get('gateway'):
            attrs['endpoints']['br-ex']['gateway'] = \
                netgroups['public']['gateway']
        else:
            gw = nm.get_default_gateway(node.id)
            attrs['endpoints']['br-fw-admin']['gateway'] = gw

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        # Dance around Neutron segmentation type.
        prv_base_ep = None
        if node.cluster.network_config.segmentation_type == \
                consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs['endpoints']['br-prv'] = {'IP': 'none'}
            attrs['roles']['neutron/private'] = 'br-prv'

            netgroup = nm.get_network_by_netname('private', networks)
            # create br-aux if there is no untagged network (endpoint) on the
            # same interface.
            if netgroup['dev'] in nets_by_ifaces:
                for ep in nets_by_ifaces[netgroup['dev']]:
                    if not ep['vlan_id']:
                        prv_base_ep = ep['br_name']
            if not prv_base_ep:
                nets_by_ifaces[netgroup['dev']].append({
                    'br_name': 'br-aux',
                    'vlan_id': None
                })

        attrs['transformations'] = cls.generate_transformations(
            node, nm, nets_by_ifaces, is_public, prv_base_ep)

        if NodeGroupCollection.get_by_cluster_id(node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups,
                                networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        return attrs
Exemple #6
0
    def generate_network_scheme(cls, node, networks):

        roles = cls._get_network_roles(node)
        # Create a data structure and fill it with static values.
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},  # It's a list of physical interfaces.
            'endpoints': {},
            'roles': roles,
        }

        nm = Cluster.get_network_manager(node.cluster)

        netgroups = nm.get_node_networks_with_ips(node)
        netgroup_mapping = nm.get_node_network_mapping(node)
        for ngname, brname in netgroup_mapping:
            ip_addr = netgroups.get(ngname, {}).get('ip')
            if ip_addr:
                attrs['endpoints'][brname] = {'IP': [ip_addr]}
            else:
                attrs['endpoints'][brname] = {'IP': 'none'}

        # TODO(rmoe): fix gateway selection
        if 'public/vip' in roles:
            public_ep = roles['public/vip']
            public_net = None

            for network_group, endpoint in netgroup_mapping:
                if endpoint == public_ep:
                    public_net = network_group
                    break

            attrs['endpoints'][public_ep]['gateway'] = \
                netgroups[public_net]['gateway']

            # This can go away when we allow separate public and floating nets
            floating_ep = roles['neutron/floating']
            if floating_ep not in attrs['endpoints']:
                attrs['endpoints'][floating_ep] = {'IP': 'none'}
        else:
            admin_ep = roles['admin/pxe']
            attrs['endpoints'][admin_ep]['gateway'] = \
                nm.get_default_gateway(node.id)

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        attrs['transformations'] = cls.generate_transformations(node)

        if NodeGroupCollection.get_by_cluster_id(node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups,
                                networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        return attrs
    def generate_network_scheme(cls, node, networks):
        """Create a data structure and fill it with static values.

        :param node: instance of db.sqlalchemy.models.node.Node
        :param networks: list of networks data dicts
        :return: dict of network scheme attributes
        """
        attrs = {
            'version': '1.1',
            'provider': 'lnx',
            'interfaces': {},
            'endpoints': {},
            'roles': cls.get_network_role_mapping_to_interfaces(node),
        }

        is_public = Node.should_have_public(node)
        if is_public:
            attrs['endpoints']['br-ex'] = {'IP': 'none'}
            attrs['endpoints']['br-floating'] = {'IP': 'none'}
            attrs['roles']['ex'] = 'br-ex'
            attrs['roles']['neutron/floating'] = 'br-floating'

        nm = Cluster.get_network_manager(node.cluster)

        # Populate IP and GW information to endpoints.
        netgroup_mapping = (cls.get_network_to_endpoint_mapping(node)
                            .items())
        # get_network_to_endpoint_mapping() adds mapping for 'public' only in
        # case the node 'should_have_public_with_ip'. Here we need to add it
        # because proper transformations should be formed no matter if br-ex
        # has IP or not.
        public_mapping = (consts.NETWORKS.public, 'br-ex')
        if is_public and public_mapping not in netgroup_mapping:
            netgroup_mapping.append(public_mapping)

        if node.cluster.network_config.segmentation_type in \
                (consts.NEUTRON_SEGMENT_TYPES.gre,
                 consts.NEUTRON_SEGMENT_TYPES.tun):
            attrs['endpoints']['br-mesh'] = {}
            attrs['roles']['neutron/mesh'] = 'br-mesh'

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_network_by_netname(ngname, networks)
            if netgroup.get('ip'):
                attrs['endpoints'][brname] = {'IP': [netgroup['ip']]}
            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup['dev']].append({
                'br_name': brname,
                'vlan_id': netgroup['vlan']
            })

        # Add gateway.
        if Node.should_have_public_with_ip(node):
            attrs['endpoints']['br-ex']['gateway'] = \
                netgroups['public']['gateway']
        else:
            gw = nm.get_default_gateway(node.id)
            attrs['endpoints']['br-fw-admin']['gateway'] = gw

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs['interfaces'][iface.name] = {}
            else:
                attrs['interfaces'][iface.name] = \
                    nm.get_iface_properties(iface)

        # Dance around Neutron segmentation type.
        prv_base_ep = None
        if node.cluster.network_config.segmentation_type == \
                consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs['endpoints']['br-prv'] = {'IP': 'none'}
            attrs['roles']['neutron/private'] = 'br-prv'

            netgroup = nm.get_network_by_netname('private', networks)
            # create br-aux if there is no untagged network (endpoint) on the
            # same interface.
            if netgroup['dev'] in nets_by_ifaces:
                for ep in nets_by_ifaces[netgroup['dev']]:
                    if not ep['vlan_id']:
                        prv_base_ep = ep['br_name']
            if not prv_base_ep:
                nets_by_ifaces[netgroup['dev']].append({
                    'br_name': 'br-aux',
                    'vlan_id': None
                })

        attrs['transformations'] = cls.generate_transformations(
            node, nm, nets_by_ifaces, is_public, prv_base_ep)

        if NodeGroupCollection.get_by_cluster_id(
                node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups,
                                networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        if node.cluster.network_config.segmentation_type in \
                (consts.NEUTRON_SEGMENT_TYPES.gre,
                 consts.NEUTRON_SEGMENT_TYPES.tun):
            attrs['roles'].pop('neutron/private', None)

        if node.cluster.network_config.segmentation_type == \
                consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs['roles'].pop('neutron/mesh', None)

        return attrs
    def generate_network_scheme(cls, node, networks):
        """Create a data structure and fill it with static values.

        :param node: instance of db.sqlalchemy.models.node.Node
        :param networks: list of networks data dicts
        :return: dict of network scheme attributes
        """
        attrs = {
            "version": "1.1",
            "provider": "lnx",
            "interfaces": {},
            "endpoints": {},
            "roles": cls.get_network_role_mapping_to_interfaces(node),
        }

        is_public = Node.should_have_public(node)
        if is_public:
            attrs["endpoints"]["br-ex"] = {"IP": "none"}
            attrs["endpoints"]["br-floating"] = {"IP": "none"}
            attrs["roles"]["ex"] = "br-ex"
            attrs["roles"]["neutron/floating"] = "br-floating"

        nm = Cluster.get_network_manager(node.cluster)

        # Populate IP and GW information to endpoints.
        netgroup_mapping = cls.get_network_to_endpoint_mapping(node).items()
        # get_network_to_endpoint_mapping() adds mapping for 'public' only in
        # case the node 'should_have_public_with_ip'. Here we need to add it
        # because proper transformations should be formed no matter if br-ex
        # has IP or not.
        public_mapping = (consts.NETWORKS.public, "br-ex")
        if is_public and public_mapping not in netgroup_mapping:
            netgroup_mapping.append(public_mapping)

        if node.cluster.network_config.segmentation_type in (
            consts.NEUTRON_SEGMENT_TYPES.gre,
            consts.NEUTRON_SEGMENT_TYPES.tun,
        ):
            attrs["endpoints"]["br-mesh"] = {}
            attrs["roles"]["neutron/mesh"] = "br-mesh"

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_network_by_netname(ngname, networks)
            if netgroup.get("ip"):
                attrs["endpoints"][brname] = {"IP": [netgroup["ip"]]}
            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup["dev"]].append({"br_name": brname, "vlan_id": netgroup["vlan"]})

        # Add gateway.
        if Node.should_have_public_with_ip(node):
            attrs["endpoints"]["br-ex"]["gateway"] = netgroups["public"]["gateway"]
        else:
            gw = nm.get_default_gateway(node.id)
            attrs["endpoints"]["br-fw-admin"]["gateway"] = gw

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs["interfaces"][iface.name] = {}
            else:
                attrs["interfaces"][iface.name] = nm.get_iface_properties(iface)

        # Dance around Neutron segmentation type.
        prv_base_ep = None
        if node.cluster.network_config.segmentation_type == consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs["endpoints"]["br-prv"] = {"IP": "none"}
            attrs["roles"]["neutron/private"] = "br-prv"

            netgroup = nm.get_network_by_netname("private", networks)
            # create br-aux if there is no untagged network (endpoint) on the
            # same interface.
            if netgroup["dev"] in nets_by_ifaces:
                for ep in nets_by_ifaces[netgroup["dev"]]:
                    if not ep["vlan_id"]:
                        prv_base_ep = ep["br_name"]
            if not prv_base_ep:
                nets_by_ifaces[netgroup["dev"]].append({"br_name": "br-aux", "vlan_id": None})

        attrs["transformations"] = cls.generate_transformations(node, nm, nets_by_ifaces, is_public, prv_base_ep)

        if NodeGroupCollection.get_by_cluster_id(node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups, networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        if node.cluster.network_config.segmentation_type in (
            consts.NEUTRON_SEGMENT_TYPES.gre,
            consts.NEUTRON_SEGMENT_TYPES.tun,
        ):
            attrs["roles"].pop("neutron/private", None)

        if node.cluster.network_config.segmentation_type == consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs["roles"].pop("neutron/mesh", None)

        return attrs
    def generate_network_scheme(cls, node, networks):

        # Create a data structure and fill it with static values.
        attrs = {
            "version": "1.1",
            "provider": "lnx",
            "interfaces": {},  # It's a list of physical interfaces.
            "endpoints": {},
            "roles": {"management": "br-mgmt", "storage": "br-storage", "fw-admin": "br-fw-admin"},
        }

        is_public = Node.should_have_public(node)
        if is_public:
            attrs["endpoints"]["br-ex"] = {"IP": "none"}
            attrs["endpoints"]["br-floating"] = {"IP": "none"}
            attrs["roles"]["ex"] = "br-ex"
            attrs["roles"]["neutron/floating"] = "br-floating"

        nm = Cluster.get_network_manager(node.cluster)

        # Populate IP and GW information to endpoints.
        netgroup_mapping = [("storage", "br-storage"), ("management", "br-mgmt"), ("fuelweb_admin", "br-fw-admin")]
        if is_public:
            netgroup_mapping.append(("public", "br-ex"))

        if node.cluster.network_config.segmentation_type in (
            consts.NEUTRON_SEGMENT_TYPES.gre,
            consts.NEUTRON_SEGMENT_TYPES.tun,
        ):
            netgroup_mapping.append(("private", "br-mesh"))
            attrs["endpoints"]["br-mesh"] = {}
            attrs["roles"]["neutron/mesh"] = "br-mesh"

        netgroups = {}
        nets_by_ifaces = defaultdict(list)
        for ngname, brname in netgroup_mapping:
            # Here we get a dict with network description for this particular
            # node with its assigned IPs and device names for each network.
            netgroup = nm.get_network_by_netname(ngname, networks)
            if netgroup.get("ip"):
                attrs["endpoints"][brname] = {"IP": [netgroup["ip"]]}
            netgroups[ngname] = netgroup
            nets_by_ifaces[netgroup["dev"]].append({"br_name": brname, "vlan_id": netgroup["vlan"]})

        # Add gateway.
        if is_public and netgroups["public"].get("gateway"):
            attrs["endpoints"]["br-ex"]["gateway"] = netgroups["public"]["gateway"]
        else:
            gw = nm.get_default_gateway(node.id)
            attrs["endpoints"]["br-fw-admin"]["gateway"] = gw

        # Fill up interfaces.
        for iface in node.nic_interfaces:
            if iface.bond:
                attrs["interfaces"][iface.name] = {}
            else:
                attrs["interfaces"][iface.name] = nm.get_iface_properties(iface)

        # Dance around Neutron segmentation type.
        prv_base_ep = None
        if node.cluster.network_config.segmentation_type == consts.NEUTRON_SEGMENT_TYPES.vlan:
            attrs["endpoints"]["br-prv"] = {"IP": "none"}
            attrs["roles"]["neutron/private"] = "br-prv"

            netgroup = nm.get_network_by_netname("private", networks)
            # create br-aux if there is no untagged network (endpoint) on the
            # same interface.
            if netgroup["dev"] in nets_by_ifaces:
                for ep in nets_by_ifaces[netgroup["dev"]]:
                    if not ep["vlan_id"]:
                        prv_base_ep = ep["br_name"]
            if not prv_base_ep:
                nets_by_ifaces[netgroup["dev"]].append({"br_name": "br-aux", "vlan_id": None})

        attrs["transformations"] = cls.generate_transformations(node, nm, nets_by_ifaces, is_public, prv_base_ep)

        if NodeGroupCollection.get_by_cluster_id(node.cluster.id).count() > 1:
            cls.generate_routes(node, attrs, nm, netgroup_mapping, netgroups, networks)

        attrs = cls.generate_driver_information(node, attrs, nm, networks)

        return attrs