def create_networks(self, context, **kwargs):
        self._convert_int_args(kwargs)

        kwargs["vlan_start"] = kwargs.get("vlan_start") or CONF.vlan_start
        kwargs["num_networks"] = (kwargs.get("num_networks") or
                                  CONF.num_networks)
        kwargs["network_size"] = (kwargs.get("network_size") or
                                  CONF.network_size)
        # Check that num_networks + vlan_start is not > 4094, fixes lp708025
        if kwargs["num_networks"] + kwargs["vlan_start"] > 4094:
            raise ValueError(_('The sum between the number of networks and'
                               ' the vlan start cannot be greater'
                               ' than 4094'))

        # Check that vlan is not greater than 4094 or less then 1
        vlan_num = kwargs.get("vlan", None)
        if vlan_num is not None:
            try:
                vlan_num = int(vlan_num)
            except ValueError:
                raise ValueError(_("vlan must be an integer"))
            if vlan_num > 4094:
                raise ValueError(_('The vlan number cannot be greater than'
                                   ' 4094'))
            if vlan_num < 1:
                raise ValueError(_('The vlan number cannot be less than 1'))

        # check that num networks and network size fits in fixed_net
        fixed_net = netaddr.IPNetwork(kwargs['cidr'])
        if fixed_net.size < kwargs['num_networks'] * kwargs['network_size']:
            raise ValueError(_('The network range is not '
                  'big enough to fit %(num_networks)s networks. Network '
                  'size is %(network_size)s') % kwargs)

        kwargs['bridge_interface'] = (kwargs.get('bridge_interface') or
                                      CONF.vlan_interface)
        LOG.debug('Create network: |%s|', kwargs)
        return NetworkManager.create_networks(
            self, context, vpn=True, **kwargs)
Create networks based on parameters.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/network/manager.py/VlanManager.create_networks