@Override
    public List<Intent> compile(PointToPointIntent intent, List<Intent> installable) {
        log.trace("compiling {} {}", intent, installable);
        ConnectPoint ingressPoint = intent.filteredIngressPoint().connectPoint();
        ConnectPoint egressPoint = intent.filteredEgressPoint().connectPoint();

        //TODO: handle protected path case with suggested path!!
        //Idea: use suggested path as primary and another path from path service as protection
        if (intent.suggestedPath() != null && intent.suggestedPath().size() > 0) {
            Path path = new DefaultPath(PID, intent.suggestedPath(), new ScalarWeight(1));
            //Check intent constraints against suggested path and suggested path availability
            if (checkPath(path, intent.constraints()) && pathAvailable(intent)) {
                allocateIntentBandwidth(intent, path);
                return asList(createLinkCollectionIntent(ImmutableSet.copyOf(intent.suggestedPath()),
                                                         DEFAULT_COST, intent));
            }
        }

        if (ingressPoint.deviceId().equals(egressPoint.deviceId())) {
            return createZeroHopLinkCollectionIntent(intent);
        }

        // proceed with no protected paths
        if (!ProtectionConstraint.requireProtectedPath(intent)) {
            return createUnprotectedLinkCollectionIntent(intent);
        }

        try {
            // attempt to compute and implement backup path
            return createProtectedIntent(ingressPoint, egressPoint, intent, installable);
        } catch (PathNotFoundException e) {
            log.warn("Could not find disjoint Path for {}", intent);
            // no disjoint path extant -- maximum one path exists between devices
            return createSinglePathIntent(ingressPoint, egressPoint, intent, installable);
        }
    }
@Test
    public void testBandwidthConstrainedIntentFailure() {
        final double bpsTotal = 10.0;

        final ResourceService resourceService =
                MockResourceService.makeCustomBandwidthResourceService(bpsTotal);
        final List<Constraint> constraints =
                Collections.singletonList(new BandwidthConstraint(Bandwidth.bps(BPS_TO_RESERVE)));

        try {
            final PointToPointIntent intent = makeIntent(new ConnectPoint(DID_1, PORT_1),
                                                         new ConnectPoint(DID_3, PORT_2),
                                                         constraints);

            String[] hops = {S1, S2, S3};
            final PointToPointIntentCompiler compiler = makeCompiler(hops,
                                                                     resourceService);

            compiler.compile(intent, null);

            fail("Point to Point compilation with insufficient bandwidth does "
                    + "not throw exception.");
        } catch (PathNotFoundException noPath) {
            assertThat(noPath.getMessage(), containsString("No path"));
        }
    }