'Adds an IP on a given network to an instance.'

@wsgi.Controller.api_version('2.1', '2.43')
@wsgi.response(202)
@wsgi.action('addFixedIp')
@extensions.expected_errors((400, 404))
@validation.schema(multinic.add_fixed_ip)
def _add_fixed_ip(self, req, id, body):

    context = req.environ['nova.context']
    context.can(multinic_policies.BASE_POLICY_NAME)
    instance = common.get_instance(self.compute_api, context, id)
    network_id = body['addFixedIp']['networkId']
    try:
        self.compute_api.add_fixed_ip(context, instance, network_id)
    except exception.InstanceUnknownCell as e:
        raise exc.HTTPNotFound(explanation=e.format_message())
    except exception.NoMoreFixedIps as e:
        raise exc.HTTPBadRequest(explanation=e.format_message())
