'Call type drivers to create network segments.'

def create_network_segments(self, context, network, tenant_id):

    segments = self._process_provider_create(network)
    with db_api.context_manager.writer.using(context):
        network_id = network['id']
        if segments:
            for (segment_index, segment) in enumerate(segments):
                segment = self.reserve_provider_segment(context, segment)
                self._add_network_segment(context, network_id, segment, segment_index)
        elif (cfg.CONF.ml2.external_network_type and self._get_attribute(network, external_net.EXTERNAL)):
            segment = self._allocate_ext_net_segment(context)
            self._add_network_segment(context, network_id, segment)
        else:
            segment = self._allocate_tenant_net_segment(context)
            self._add_network_segment(context, network_id, segment)
