Revision af6a3bc5 snf-cyclades-app/synnefo/api/networks.py

b/snf-cyclades-app/synnefo/api/networks.py
165 165
        subnet6 = d.get('cidr6', None)
166 166
        gateway = d.get('gateway', None)
167 167
        gateway6 = d.get('gateway6', None)
168
        typ = d.get('type', 'PRIVATE_MAC_FILTERED')
168
        net_type = d.get('type', 'PRIVATE_MAC_FILTERED')
169 169
        dhcp = d.get('dhcp', True)
170 170
    except (KeyError, ValueError):
171 171
        raise BadRequest('Malformed request.')
172 172

  
173
    if typ == 'PUBLIC_ROUTED':
173
    if net_type == 'PUBLIC_ROUTED':
174 174
        raise Unauthorized('Can not create a public network.')
175 175

  
176 176
    user_networks = len(Network.objects.filter(userid=request.user_uniq,
......
183 183
        raise OverLimit("Unsupported network size.")
184 184

  
185 185
    try:
186
        link = util.network_link_from_type(typ)
186
        link, mac_prefix = util.net_resources(net_type)
187 187
        if not link:
188 188
            raise Exception("Can not create network. No connectivity link.")
189 189

  
......
195 195
                gateway=gateway,
196 196
                gateway6=gateway6,
197 197
                dhcp=dhcp,
198
                type=typ,
198
                type=net_type,
199 199
                link=link,
200
                mac_prefix=mac_prefix,
200 201
                action='CREATE',
201 202
                state='PENDING')
202 203
    except EmptyPool:

Also available in: Unified diff