def create_network_segments(self, context, network, tenant_id):
        segments = self._process_provider_create(network)
        session = context.session
        mtu = []
        with session.begin(subtransactions=True):
            network_id = network['id']
            if segments:
                for segment_index, segment in enumerate(segments):
                    segment = self.reserve_provider_segment(
                        session, segment)
                    self._add_network_segment(session, network_id, segment,
                                              mtu, segment_index)
            elif (cfg.CONF.ml2.external_network_type and
                  self._get_attribute(network, external_net.EXTERNAL)):
                segment = self._allocate_ext_net_segment(session)
                self._add_network_segment(session, network_id, segment, mtu)
            else:
                segment = self._allocate_tenant_net_segment(session)
                self._add_network_segment(session, network_id, segment, mtu)
        network[api.MTU] = min(mtu) if mtu else 0
Call type drivers to create network segments.
dataset/ETHPy150Open openstack/neutron/neutron/plugins/ml2/managers.py/TypeManager.create_network_segments