

def create_subnet(self, body):
    s = body.get('subnet')
    try:
        net = self._fake_networks[s.get('network_id')]
    except KeyError:
        msg = ('Network %s not found' % s.get('network_id'))
        raise n_exc.NeutronClientException(message=msg, status_code=404)
    ret = {
        'name': s.get('name'),
        'network_id': s.get('network_id'),
        'tenant_id': 'fake_tenant',
        'cidr': s.get('cidr'),
        'id': str(uuid.uuid4()),
        'gateway_ip': '10.0.0.1',
    }
    net['subnets'].append(ret['id'])
    self._fake_networks[net['id']] = net
    self._fake_subnets[ret['id']] = ret
    return {
        'subnet': ret,
    }

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py MockClient.create_subnet/original