@Test public void testUpdateTunnelInfo() { testAddTunnelInfo(); List<LspLocalLabelInfo> lspLocalLabelInfoList3 = new LinkedList<>(); ResourceConsumer tunnelConsumerId3 = TunnelConsumerId.valueOf(30); DeviceId deviceId3 = DeviceId.deviceId("goo"); LabelResourceId inLabelId3 = LabelResourceId.labelResourceId(3); LabelResourceId outLabelId3 = LabelResourceId.labelResourceId(4); LspLocalLabelInfo lspLocalLabel3 = DefaultLspLocalLabelInfo.builder() .deviceId(deviceId3) .inLabelId(inLabelId3) .outLabelId(outLabelId3) .build(); lspLocalLabelInfoList3.add(lspLocalLabel3); PceccTunnelInfo pceccTunnelInfo3 = new PceccTunnelInfo(lspLocalLabelInfoList3, tunnelConsumerId3); List<LspLocalLabelInfo> lspLocalLabelInfoList4 = new LinkedList<>(); ResourceConsumer tunnelConsumerId4 = TunnelConsumerId.valueOf(40); DeviceId deviceId4 = DeviceId.deviceId("goo"); LabelResourceId inLabelId4 = LabelResourceId.labelResourceId(4); LabelResourceId outLabelId4 = LabelResourceId.labelResourceId(5); LspLocalLabelInfo lspLocalLabel4 = DefaultLspLocalLabelInfo.builder() .deviceId(deviceId4) .inLabelId(inLabelId4) .outLabelId(outLabelId4) .build(); lspLocalLabelInfoList4.add(lspLocalLabel4); PceccTunnelInfo pceccTunnelInfo4 = new PceccTunnelInfo(lspLocalLabelInfoList4, tunnelConsumerId4); assertThat(distrPceStore.updateTunnelInfo(tunnelId1, lspLocalLabelInfoList3), is(true)); assertThat(distrPceStore.updateTunnelInfo(tunnelId2, lspLocalLabelInfoList4), is(true)); assertThat(distrPceStore.updateTunnelInfo(tunnelId1, tunnelConsumerId3), is(true)); assertThat(distrPceStore.updateTunnelInfo(tunnelId2, tunnelConsumerId4), is(true)); assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(pceccTunnelInfo3)); assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(pceccTunnelInfo4)); }
@Override public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) { checkNotNull(tunnelId, TUNNEL_ID_NULL); checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL); if (!tunnelInfoMap.containsKey((tunnelId))) { log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString()); return false; } PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value(); tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList); tunnelInfoMap.put(tunnelId, tunnelInfo); return true; }
DistributedPceStore implements PceStore { @Override public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) { checkNotNull(tunnelId, TUNNEL_ID_NULL); checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL); if (!tunnelInfoMap.containsKey((tunnelId))) { log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString()); return false; } PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value(); tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList); tunnelInfoMap.put(tunnelId, tunnelInfo); return true; } }
DistributedPceStore implements PceStore { @Override public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) { checkNotNull(tunnelId, TUNNEL_ID_NULL); checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL); if (!tunnelInfoMap.containsKey((tunnelId))) { log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString()); return false; } PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value(); tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList); tunnelInfoMap.put(tunnelId, tunnelInfo); return true; }  }
DistributedPceStore implements PceStore { @Override public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) { checkNotNull(tunnelId, TUNNEL_ID_NULL); checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL); if (!tunnelInfoMap.containsKey((tunnelId))) { log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString()); return false; } PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value(); tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList); tunnelInfoMap.put(tunnelId, tunnelInfo); return true; }  @Override boolean existsGlobalNodeLabel(DeviceId id); @Override boolean existsAdjLabel(Link link); @Override boolean existsTunnelInfo(TunnelId tunnelId); @Override boolean existsFailedPathInfo(PcePathInfo failedPathInfo); @Override int getGlobalNodeLabelCount(); @Override int getAdjLabelCount(); @Override int getTunnelInfoCount(); @Override int getFailedPathInfoCount(); @Override Map<DeviceId, LabelResourceId> getGlobalNodeLabels(); @Override Map<Link, LabelResourceId> getAdjLabels(); @Override Map<TunnelId, PceccTunnelInfo> getTunnelInfos(); @Override Iterable<PcePathInfo> getFailedPathInfos(); @Override LabelResourceId getGlobalNodeLabel(DeviceId id); @Override LabelResourceId getAdjLabel(Link link); @Override PceccTunnelInfo getTunnelInfo(TunnelId tunnelId); @Override void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId); @Override void addAdjLabel(Link link, LabelResourceId labelId); @Override void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo); @Override void addFailedPathInfo(PcePathInfo failedPathInfo); @Override boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList); @Override boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId); @Override boolean removeGlobalNodeLabel(DeviceId id); @Override boolean removeAdjLabel(Link link); @Override boolean removeTunnelInfo(TunnelId tunnelId); @Override boolean removeFailedPathInfo(PcePathInfo failedPathInfo); @Override boolean addLsrIdDevice(String lsrId, DeviceId deviceId); @Override boolean removeLsrIdDevice(String lsrId); @Override DeviceId getLsrIdDevice(String lsrId); @Override boolean addPccLsr(DeviceId lsrId); @Override boolean removePccLsr(DeviceId lsrId); @Override boolean hasPccLsr(DeviceId lsrId); }
DistributedPceStore implements PceStore { @Override public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) { checkNotNull(tunnelId, TUNNEL_ID_NULL); checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL); if (!tunnelInfoMap.containsKey((tunnelId))) { log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString()); return false; } PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value(); tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList); tunnelInfoMap.put(tunnelId, tunnelInfo); return true; }  @Override boolean existsGlobalNodeLabel(DeviceId id); @Override boolean existsAdjLabel(Link link); @Override boolean existsTunnelInfo(TunnelId tunnelId); @Override boolean existsFailedPathInfo(PcePathInfo failedPathInfo); @Override int getGlobalNodeLabelCount(); @Override int getAdjLabelCount(); @Override int getTunnelInfoCount(); @Override int getFailedPathInfoCount(); @Override Map<DeviceId, LabelResourceId> getGlobalNodeLabels(); @Override Map<Link, LabelResourceId> getAdjLabels(); @Override Map<TunnelId, PceccTunnelInfo> getTunnelInfos(); @Override Iterable<PcePathInfo> getFailedPathInfos(); @Override LabelResourceId getGlobalNodeLabel(DeviceId id); @Override LabelResourceId getAdjLabel(Link link); @Override PceccTunnelInfo getTunnelInfo(TunnelId tunnelId); @Override void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId); @Override void addAdjLabel(Link link, LabelResourceId labelId); @Override void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo); @Override void addFailedPathInfo(PcePathInfo failedPathInfo); @Override boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList); @Override boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId); @Override boolean removeGlobalNodeLabel(DeviceId id); @Override boolean removeAdjLabel(Link link); @Override boolean removeTunnelInfo(TunnelId tunnelId); @Override boolean removeFailedPathInfo(PcePathInfo failedPathInfo); @Override boolean addLsrIdDevice(String lsrId, DeviceId deviceId); @Override boolean removeLsrIdDevice(String lsrId); @Override DeviceId getLsrIdDevice(String lsrId); @Override boolean addPccLsr(DeviceId lsrId); @Override boolean removePccLsr(DeviceId lsrId); @Override boolean hasPccLsr(DeviceId lsrId);  }