annotationBuilder.set(BANDWIDTH, String.valueOf(bwConstraintValue)); annotationBuilder.set(COST_TYPE, String.valueOf(costConstraint.type())); annotationBuilder.set(LSP_SIG_TYPE, lspType.name()); annotationBuilder.set(PCE_INIT, TRUE); annotationBuilder.set(DELEGATE, TRUE); annotationBuilder.set(LOCAL_LSP_ID, String.valueOf(getNextLocalLspId())); annotationBuilder.build());
/** * Generates an annotation from an existing annotation and LinkConfig. * * @param cfg the link config entity from network config * @param an the annotation * @return annotation combining both sources */ public static SparseAnnotations combine(BasicLinkConfig cfg, SparseAnnotations an) { DefaultAnnotations.Builder b = DefaultAnnotations.builder(); b.putAll(an); if (cfg.metric() != DEF_METRIC) { b.set(AnnotationKeys.METRIC, String.valueOf(cfg.metric())); } if (!cfg.latency().equals(DEF_DURATION)) { //Convert the latency from Duration to long, //so that it's computable in the latencyConstraint. b.set(AnnotationKeys.LATENCY, String.valueOf(cfg.latency().toNanos())); } if (cfg.bandwidth() != DEF_BANDWIDTH) { b.set(AnnotationKeys.BANDWIDTH, String.valueOf(cfg.bandwidth())); } if (cfg.isDurable() != null) { b.set(AnnotationKeys.DURABLE, String.valueOf(cfg.isDurable())); } return b.build(); }
@Override public HostDescription combine(HostId hostId, HostDescription descr, Optional<Config> prevConfig) { HostAnnotationConfig cfg = lookupConfig(hostId); if (cfg == null) { return descr; } Map<String, String> annotations = cfg.annotations(); Builder builder = DefaultAnnotations.builder(); builder.putAll(descr.annotations()); if (prevConfig.isPresent()) { HostAnnotationConfig prevHostAnnotationConfig = (HostAnnotationConfig) prevConfig.get(); for (String key : prevHostAnnotationConfig.annotations().keySet()) { if (!annotations.containsKey(key)) { builder.remove(key); } } } builder.putAll(annotations); return DefaultHostDescription.copyReplacingAnnotation(descr, builder.build()); }
annotationBuilder.set(BANDWIDTH, String.valueOf(bwConstraintValue)); if (costType != null) { annotationBuilder.set(COST_TYPE, costType); annotationBuilder.set(LSP_SIG_TYPE, lspSigType); annotationBuilder.set(PCE_INIT, TRUE); annotationBuilder.set(DELEGATE, TRUE); annotationBuilder.set(PLSP_ID, tunnel.annotations().value(PLSP_ID)); annotationBuilder.set(PCC_TUNNEL_ID, tunnel.annotations().value(PCC_TUNNEL_ID)); annotationBuilder.set(LOCAL_LSP_ID, String.valueOf(localLspId)); labelStack, annotationBuilder.build()); Tunnel tunnelForlabelDownload = new DefaultTunnel(null, tunnel.src(), tunnel.dst(), MPLS, INIT, null, updatedTunnelId, tunnel.tunnelName(), computedPath, labelStack, annotationBuilder.build());
annotationBuilder.set(BANDWIDTH, String.valueOf(bwConstraintValue)); if (costType != null) { annotationBuilder.set(COST_TYPE, costType); annotationBuilder.set(LSP_SIG_TYPE, lspSigType); annotationBuilder.set(PCE_INIT, TRUE); annotationBuilder.set(DELEGATE, TRUE); annotationBuilder.set(PLSP_ID, tunnel.annotations().value(PLSP_ID)); annotationBuilder.set(PCC_TUNNEL_ID, tunnel.annotations().value(PCC_TUNNEL_ID)); annotationBuilder.set(LOCAL_LSP_ID, String.valueOf(localLspId)); annotationBuilder.build());
annotationBuilder.set(BANDWIDTH, String.valueOf(bwConstraintValue)); annotationBuilder.set(COST_TYPE, String.valueOf(costConstraint.type())); annotationBuilder.set(LSP_SIG_TYPE, lspType.name()); annotationBuilder.set(PCE_INIT, TRUE); annotationBuilder.set(DELEGATE, TRUE); annotationBuilder.set(LOCAL_LSP_ID, String.valueOf(getNextLocalLspId())); labelStack, annotationBuilder.build());
.build(); List<Link> links = ImmutableList.<Link>builder().add(defaultLink).build(); Annotations annotations = DefaultAnnotations.builder().build(); DefaultPath defaultPath = new DefaultPath(PROVIDER_ID, links, null, annotations); return ImmutableList.<Path>builder().add(defaultPath).build().stream();
annotationBuilder.set(BANDWIDTH, tunnel.annotations().value(BANDWIDTH)); annotationBuilder.set(COST_TYPE, tunnel.annotations().value(COST_TYPE)); annotationBuilder.set(LSP_SIG_TYPE, tunnel.annotations().value(LSP_SIG_TYPE)); annotationBuilder.set(PCE_INIT, tunnel.annotations().value(PCE_INIT)); annotationBuilder.set(DELEGATE, tunnel.annotations().value(DELEGATE)); annotationBuilder.set(PLSP_ID, String.valueOf(lspObj.getPlspId())); annotationBuilder.set(PCC_TUNNEL_ID, String.valueOf(ipv4LspIdenTlv.getTunnelId())); annotationBuilder.set(LOCAL_LSP_ID, tunnel.annotations().value(LOCAL_LSP_ID)); tunnel.path(), tunnel.resource(), annotationBuilder.build());
Tunnel tunnel = pcepTunnelData.tunnel(); Builder annotationBuilder = DefaultAnnotations.builder(); annotationBuilder.putAll(pcepTunnelData.tunnel().annotations()); annotationBuilder.set(PLSP_ID, String.valueOf(lspObj.getPlspId())); annotationBuilder.set(LOCAL_LSP_ID, String.valueOf(ipv4LspTlv.getLspId())); annotationBuilder.set(PCC_TUNNEL_ID, String.valueOf(ipv4LspTlv.getTunnelId())); SparseAnnotations annotations = annotationBuilder.build(); DefaultTunnelDescription td = new DefaultTunnelDescription(tunnel.tunnelId(), tunnel.src(), tunnel.dst(), tunnel.type(), tunnel.groupId(),
.set("SLA", String.valueOf(pcepTunnel.getSla())) .set("bandwidth", String.valueOf(pcepTunnel.bandWidth()) + BANDWIDTH_UINT) .set("index", String.valueOf(pcepTunnel.id())).build(); DefaultAnnotations extendAnnotations = DefaultAnnotations .builder() .set("underLayTunnelIndex", String.valueOf(pcepTunnel.underlayTunnelId())).build(); annotations = DefaultAnnotations.merge(annotations, extendAnnotations);
return new DefaultLinkDescription(src, dst, Link.Type.DIRECT, false, annotationBuilder.build());
DefaultAnnotations annotations = DefaultAnnotations.builder().build();
builder.set(AnnotationKeys.NAME, cfg.name()); builder.set(AnnotationKeys.UI_TYPE, cfg.uiType()); builder.set(AnnotationKeys.LOC_TYPE, cfg.locType()); builder.remove(AnnotationKeys.GRID_X).remove(AnnotationKeys.GRID_Y); builder.remove(AnnotationKeys.LATITUDE).remove(AnnotationKeys.LONGITUDE); builder.set(AnnotationKeys.GRID_Y, Double.toString(cfg.gridY())); builder.set(AnnotationKeys.GRID_X, Double.toString(cfg.gridX())); builder.remove(AnnotationKeys.LATITUDE).remove(AnnotationKeys.LONGITUDE); builder.set(AnnotationKeys.LATITUDE, Double.toString(cfg.latitude())); builder.set(AnnotationKeys.LONGITUDE, Double.toString(cfg.longitude())); builder.remove(AnnotationKeys.GRID_X).remove(AnnotationKeys.GRID_Y); builder.set(AnnotationKeys.RACK_ADDRESS, cfg.rackAddress()); builder.set(AnnotationKeys.OWNER, cfg.owner());
String serialNumber = base.serialNumber(); ChassisId chassisId = base.chassisId(); DefaultAnnotations annotations = DefaultAnnotations.builder().build(); annotations = merge(annotations, base.annotations());
builder.putAll(annotations); builder.set(OpticalAnnotations.MIN_FREQ_HZ, String.valueOf(minFrequency.asHz())); builder.set(OpticalAnnotations.MAX_FREQ_HZ, String.valueOf(maxFrequency.asHz())); builder.set(OpticalAnnotations.GRID_HZ, String.valueOf(grid.asHz())); .type(Port.Type.OMS) .portSpeed(portSpeed) .annotations(builder.build()) .build();
/** * Builds the annotation details. * * @param annotationBuilder default annotation builder instance * @param isisLink ISIS link instance * @return annotation builder instance */ private DefaultAnnotations.Builder buildAnnotations(DefaultAnnotations.Builder annotationBuilder, IsisLink isisLink) { int administrativeGroup = 0; long teMetric = 0; Bandwidth maxReservableBandwidth = Bandwidth.bps(0); String routerId = null; String neighborId = null; //TE Info IsisLinkTed isisLinkTed = isisLink.linkTed(); log.info("Ted Information: {}", isisLinkTed.toString()); administrativeGroup = isisLinkTed.administrativeGroup(); teMetric = isisLinkTed.teDefaultMetric(); maxReservableBandwidth = isisLinkTed.maximumReservableLinkBandwidth(); routerId = isisLink.localSystemId(); neighborId = isisLink.remoteSystemId(); annotationBuilder.set(ADMINISTRATIVEGROUP, String.valueOf(administrativeGroup)); annotationBuilder.set(TE_METRIC, String.valueOf(teMetric)); annotationBuilder.set(MAXRESERVABLEBANDWIDTH, String.valueOf(maxReservableBandwidth)); annotationBuilder.set(ROUTERID, String.valueOf(routerId)); annotationBuilder.set(NEIGHBORID, String.valueOf(neighborId)); return annotationBuilder; }