@Test public void testCompile() { sut.activate(); List<Intent> compiled = sut.compile(intent, Collections.emptyList()); assertThat(compiled, hasSize(1)); Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules(); assertThat(rules, hasSize(3)); FlowRule rule = rules.stream() .filter(x -> x.deviceId().equals(d2p0.deviceId())) .findFirst() .get(); assertThat(rule.deviceId(), is(d2p0.deviceId())); sut.deactivate(); }
@Override public List<Intent> compile(MplsPathIntent intent, List<Intent> installable) { Map<LinkKey, MplsLabel> labels = assignMplsLabel(intent); List<FlowRule> rules = generateRules(intent, labels); return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); }
MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { @Override public List<Intent> compile(MplsPathIntent intent, List<Intent> installable) { Map<LinkKey, MplsLabel> labels = assignMplsLabel(intent); List<FlowRule> rules = generateRules(intent, labels); return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); } }
MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { @Override public List<Intent> compile(MplsPathIntent intent, List<Intent> installable) { Map<LinkKey, MplsLabel> labels = assignMplsLabel(intent); List<FlowRule> rules = generateRules(intent, labels); return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); }  }
MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { @Override public List<Intent> compile(MplsPathIntent intent, List<Intent> installable) { Map<LinkKey, MplsLabel> labels = assignMplsLabel(intent); List<FlowRule> rules = generateRules(intent, labels); return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); }  @Override List<Intent> compile(MplsPathIntent intent, List<Intent> installable); @Activate void activate(); @Deactivate void deactivate(); }
MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { @Override public List<Intent> compile(MplsPathIntent intent, List<Intent> installable) { Map<LinkKey, MplsLabel> labels = assignMplsLabel(intent); List<FlowRule> rules = generateRules(intent, labels); return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); }  @Override List<Intent> compile(MplsPathIntent intent, List<Intent> installable); @Activate void activate(); @Deactivate void deactivate();  }