/** * Update the selector builder using a L1 instruction. * * @param builder the builder to update * @param l1instruction the l1 instruction to use */ private void updateBuilder(TrafficSelector.Builder builder, L1ModificationInstruction l1instruction) { throw new IntentCompilationException(UNSUPPORTED_L1); }
/** * Update the selector builder using a L0 instruction. * * @param builder the builder to update * @param l0instruction the l0 instruction to use */ private void updateBuilder(TrafficSelector.Builder builder, L0ModificationInstruction l0instruction) { throw new IntentCompilationException(UNSUPPORTED_L0); }
throw new IntentCompilationException(String.format(UNSUPPORTED_INSTRUCTION, "L2"));
return false; default: throw new IntentCompilationException(String.format(UNSUPPORTED_INSTRUCTION, "L3"));
/** * Finds label resource, which can be used in common along the path. * * @param path path * @param klass Label class * @return Set of common resources * @throws IntentCompilationException when there is no resource available * @param <T> label resource type */ <T> Set<T> commonLabelResource(Path path, Class<T> klass) { Optional<Set<T>> common = path.links().stream() .flatMap(link -> Stream.of(link.src(), link.dst())) .distinct() .map(cp -> getAvailableResourceValues(cp, klass)) .reduce(Sets::intersection); if (!common.isPresent() || common.get().isEmpty()) { log.error("No common label available for: {}", path); throw new IntentCompilationException("No common label available for: " + path); } return common.get(); }
throw new IntentCompilationException("0 hop not supported yet.");
/** * Helper method to handle the optimization of the instructions. * * @param index the index of the instruction * @param instruction the instruction to optimize * @param instructions the list of instructions to optimize * @return no action if the action can be removed. The same instruction * if we have to perform it */ private Instruction optimizeInstruction(int index, Instruction instruction, List<Instruction> instructions) { switch (instruction.type()) { /* * Here we have the chance to optimize the dec mpls ttl action. */ case L2MODIFICATION: /* * Here we have the chance to optimize the ttl related actions. */ case L3MODIFICATION: return optimizeTtlInstructions(index, instruction, instructions); default: throw new IntentCompilationException(UNKNOWN_INSTRUCTION); } }
log.debug("Interrupted", e); Thread.currentThread().interrupt(); throw new IntentCompilationException("Interrupted", e); } catch (ExecutionException e) { log.debug("ExecutionException", e); throw new IntentCompilationException("ExecutionException caught", e); } catch (TimeoutException e) { } else { log.debug("Timeout", e); throw new IntentCompilationException("Timeout", e);
/** * The method generates a selector starting from * the encapsulation information (type and label to match). * * @param selectorBuilder the builder to update * @param type the type of encapsulation * @param identifier the label to match */ private void updateSelectorFromEncapsulation(TrafficSelector.Builder selectorBuilder, EncapsulationType type, Identifier<?> identifier) { switch (type) { case MPLS: MplsLabel label = (MplsLabel) identifier; selectorBuilder.matchMplsLabel(label); selectorBuilder.matchEthType(Ethernet.MPLS_UNICAST); break; case VLAN: VlanId id = (VlanId) identifier; selectorBuilder.matchVlanId(id); break; default: throw new IntentCompilationException(UNKNOWN_ENCAPSULATION); } }
throw new IntentCompilationException(String.format(NO_LABELS, inCp));
throw new IntentCompilationException(UNKNOWN_INSTRUCTION);
throw new IntentCompilationException(WRONG_INGRESS);
/** * Update the selector builder using a L4 instruction. * * @param builder the builder to update * @param l4instruction the l4 instruction to use */ private void updateBuilder(TrafficSelector.Builder builder, L4ModificationInstruction l4instruction) { if (l4instruction instanceof ModTransportPortInstruction) { // TODO check IP proto ModTransportPortInstruction l4mod = (ModTransportPortInstruction) l4instruction; switch (l4mod.subtype()) { case TCP_SRC: builder.matchTcpSrc(l4mod.port()); break; case TCP_DST: builder.matchTcpDst(l4mod.port()); break; case UDP_SRC: builder.matchUdpSrc(l4mod.port()); break; case UDP_DST: builder.matchUdpDst(l4mod.port()); break; default: throw new IntentCompilationException(UNSUPPORTED_L4_SUBTYPE); } } else { throw new IntentCompilationException(UNSUPPORTED_L4); } }
throw new IntentCompilationException(UNSUPPORTED_ETH_SUBTYPE); throw new IntentCompilationException(UNSUPPORTED_POP_ACTION); case VLAN_PCP: ModVlanPcpInstruction vlanPcpInstruction = (ModVlanPcpInstruction) l2instruction; throw new IntentCompilationException(UNSUPPORTED_POP_ACTION); case DEC_MPLS_TTL: throw new IntentCompilationException(UNSUPPORTED_L2);
private FilteredConnectPoint getFilteredPointFromLink(Link link) { FilteredConnectPoint filteredConnectPoint; if (link.src().elementId() instanceof DeviceId) { filteredConnectPoint = new FilteredConnectPoint(link.src()); } else if (link.dst().elementId() instanceof DeviceId) { filteredConnectPoint = new FilteredConnectPoint(link.dst()); } else { throw new IntentCompilationException(DEVICE_ID_NOT_FOUND); } return filteredConnectPoint; }
throw new IntentCompilationException( "No matching link starting at " + ingress .connectPoint().deviceId());
throw new IntentCompilationException(UNSUPPORTED_INSTRUCTION);
throw new IntentCompilationException(ERROR_VLAN + link); throw new IntentCompilationException(ERROR_VLAN + link);
if (disjointPath == null || disjointPath.backup() == null) { log.error("Unable to find disjoint path between {}, {}", did1, did2); throw new IntentCompilationException("Unable to find disjoint paths.");
throw new IntentCompilationException(UNSUPPORTED_IP_SUBTYPE); builder.matchArpSpa((Ip4Address) arpIpInstr.ip()); } else { throw new IntentCompilationException(UNSUPPORTED_ARP); throw new IntentCompilationException(UNSUPPORTED_L3);