use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs in project bgpcep by opendaylight.
the class SyncOptimizationTest method testIsSyncAvoidanceEnabledPositive.
@Test
public void testIsSyncAvoidanceEnabledPositive() {
final Tlvs tlvs = createTlvs(1L, true, false);
Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
assertTrue(syncOpt.isSyncAvoidanceEnabled());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs in project bgpcep by opendaylight.
the class SyncOptimizationTest method testIsDeltaSyncEnabledPositive.
@Test
public void testIsDeltaSyncEnabledPositive() {
final Tlvs tlvs = createTlvs(1L, true, true);
Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
assertTrue(syncOpt.isDeltaSyncEnabled());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs in project bgpcep by opendaylight.
the class SyncOptimizationTest method testIsDeltaSyncEnabledNegative.
@Test
public void testIsDeltaSyncEnabledNegative() {
final Tlvs localTlvs = createTlvs(1L, true, true);
final Tlvs remoteTlvs = createTlvs(2L, false, false);
Mockito.doReturn(localTlvs).when(this.pcepSession).getLocalTlvs();
Mockito.doReturn(remoteTlvs).when(this.pcepSession).getRemoteTlvs();
final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
assertFalse(syncOpt.isDeltaSyncEnabled());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testAddAlreadyExistingLsp.
@Test
public void testAddAlreadyExistingLsp() throws InterruptedException, ExecutionException {
listener.onSessionUp(session);
topologyRpcs.addLsp(createAddLspInput());
assertEquals(1, receivedMsgs.size());
assertTrue(receivedMsgs.get(0) instanceof Pcinitiate);
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(Uint32.ONE)).setSync(FALSE).setRemove(FALSE).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
// try to add already existing LSP
final AddLspOutput result = topologyRpcs.addLsp(createAddLspInput()).get().getResult();
assertEquals(FailureType.Unsent, result.getFailure());
assertEquals(1, result.getError().size());
final ErrorObject errorObject = result.getError().get(0).getErrorObject();
assertNotNull(errorObject);
assertEquals(PCEPErrors.USED_SYMBOLIC_PATH_NAME, PCEPErrors.forValue(errorObject.getType(), errorObject.getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs in project bgpcep by opendaylight.
the class BgpPeer method getBgpParameters.
private static List<BgpParameters> getBgpParameters(final AfiSafis afiSafis, final RIB rib, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
final List<BgpParameters> tlvs = new ArrayList<>();
final List<OptionalCapabilities> caps = new ArrayList<>();
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(rib.getLocalAs()).build()).build()).build());
caps.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
caps.add(new OptionalCapabilitiesBuilder().setCParameters(MultiprotocolCapabilitiesUtil.RR_CAPABILITY).build());
final List<AfiSafi> afiSafi = OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafis, false);
final List<AddressFamilies> addPathCapability = OpenConfigMappingUtil.toAddPathCapability(afiSafi, tableTypeRegistry);
if (!addPathCapability.isEmpty()) {
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(addPathCapability).build()).build()).build()).build());
}
final List<BgpTableType> tableTypes = OpenConfigMappingUtil.toTableTypes(afiSafi, tableTypeRegistry);
for (final BgpTableType tableType : tableTypes) {
if (!rib.getLocalTables().contains(tableType)) {
LOG.info("RIB instance does not list {} " + "in its local tables. Incoming data will be dropped.", tableType);
}
caps.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder(tableType).build()).build()).build()).build());
}
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(caps).build());
return tlvs;
}
Aggregations