Search in sources :

Example 1 with NetworkTopologyRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testUpdateUnknownLsp.

@Test
public void testUpdateUnknownLsp() throws InterruptedException, ExecutionException {
    this.listener.onSessionUp(this.session);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.ArgumentsBuilder updArgsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.ArgumentsBuilder();
    updArgsBuilder.setEro(createEroWithIpPrefixes(Lists.newArrayList(this.eroIpPrefix, this.dstIpPrefix)));
    updArgsBuilder.addAugmentation(Arguments3.class, new Arguments3Builder().setLsp(new LspBuilder().setDelegate(true).setAdministrative(true).build()).build());
    final UpdateLspInput update = new UpdateLspInputBuilder().setArguments(updArgsBuilder.build()).setName(this.tunnelName).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
    final UpdateLspOutput result = this.topologyRpcs.updateLsp(update).get().getResult();
    assertEquals(FailureType.Unsent, result.getFailure());
    assertEquals(1, result.getError().size());
    final ErrorObject errorObject = result.getError().get(0).getErrorObject();
    assertNotNull(errorObject);
    assertEquals(PCEPErrors.UNKNOWN_PLSP_ID, PCEPErrors.forValue(errorObject.getType(), errorObject.getValue()));
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) UpdateLspOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspOutput) Arguments3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments3Builder) Collections(java.util.Collections) ErrorObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder) UpdateLspInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInput) UpdateLspInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInputBuilder) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) Test(org.junit.Test)

Example 2 with NetworkTopologyRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method createAddLspInput.

private AddLspInput createAddLspInput() {
    final ArgumentsBuilder argsBuilder = new ArgumentsBuilder();
    final Ipv4CaseBuilder ipv4Builder = new Ipv4CaseBuilder();
    ipv4Builder.setIpv4(new Ipv4Builder().setSourceIpv4Address(new Ipv4Address(this.testAddress)).setDestinationIpv4Address(new Ipv4Address(this.testAddress)).build());
    argsBuilder.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(ipv4Builder.build()).build());
    argsBuilder.setEro(createEroWithIpPrefixes(Lists.newArrayList(this.eroIpPrefix)));
    argsBuilder.addAugmentation(Arguments2.class, new Arguments2Builder().setLsp(new LspBuilder().setDelegate(true).setAdministrative(true).build()).build());
    return new AddLspInputBuilder().setName(this.tunnelName).setArguments(argsBuilder.build()).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) Arguments2Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments2Builder) Ipv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4CaseBuilder) AddLspInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.AddLspInputBuilder) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder) Ipv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.ipv4._case.Ipv4Builder) EndpointsObjBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 3 with NetworkTopologyRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testRemoveUnknownLsp.

@Test
public void testRemoveUnknownLsp() throws InterruptedException, ExecutionException {
    this.listener.onSessionUp(this.session);
    final RemoveLspInput remove = new RemoveLspInputBuilder().setName(this.tunnelName).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
    final OperationResult result = this.topologyRpcs.removeLsp(remove).get().getResult();
    assertEquals(FailureType.Unsent, result.getFailure());
    assertEquals(1, result.getError().size());
    final ErrorObject errorObject = result.getError().get(0).getErrorObject();
    assertNotNull(errorObject);
    assertEquals(PCEPErrors.UNKNOWN_PLSP_ID, PCEPErrors.forValue(errorObject.getType(), errorObject.getValue()));
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) RemoveLspInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInput) ErrorObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject) RemoveLspInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInputBuilder) OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult) Test(org.junit.Test)

Example 4 with NetworkTopologyRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef in project bgpcep by opendaylight.

the class TunnelProgrammingTest method testTunnelProgramming.

@Test
public void testTunnelProgramming() throws TransactionCommitFailedException {
    final Bandwidth bwd = new Bandwidth(new byte[] { 0x00, 0x00, 0x00, (byte) 0xff });
    final ClassType classType = new ClassType((short) 1);
    final String tunnelName = "create-tunnel";
    final NetworkTopologyRef topologyRef = new NetworkTopologyRef(TOPO_IID);
    // create tunnel
    final PcepCreateP2pTunnelInputBuilder createInputBuilder = new PcepCreateP2pTunnelInputBuilder();
    createInputBuilder.setDestination(new DestinationBuilder().setNode(NODE2_ID).setTp(TP2_ID).build());
    createInputBuilder.setSource(new SourceBuilder().setNode(NODE1_ID).setTp(TP1_ID).build());
    createInputBuilder.setNetworkTopologyRef(topologyRef);
    createInputBuilder.setBandwidth(bwd);
    createInputBuilder.setClassType(classType);
    createInputBuilder.setSymbolicPathName(tunnelName);
    createInputBuilder.setExplicitHops(Lists.newArrayList());
    createInputBuilder.addAugmentation(PcepCreateP2pTunnelInput1.class, new PcepCreateP2pTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build());
    this.tunnelProgramming.pcepCreateP2pTunnel(createInputBuilder.build());
    // check add-lsp input
    Assert.assertNotNull(this.addLspInput);
    Assert.assertEquals(tunnelName, this.addLspInput.getName());
    final Arguments agrs = this.addLspInput.getArguments();
    Assert.assertNotNull(agrs);
    Assert.assertEquals(bwd, agrs.getBandwidth().getBandwidth());
    Assert.assertEquals(classType, agrs.getClassType().getClassType());
    final Ipv4 ipv4Endpoints = ((Ipv4Case) agrs.getEndpointsObj().getAddressFamily()).getIpv4();
    Assert.assertEquals(NODE1_IPV4, ipv4Endpoints.getSourceIpv4Address().getValue());
    Assert.assertEquals(NODE2_IPV4, ipv4Endpoints.getDestinationIpv4Address().getValue());
    Assert.assertEquals(NODE1_ID.getValue(), this.addLspInput.getNode().getValue());
    createLink();
    // update tunnel
    final PcepUpdateTunnelInputBuilder updateInputBuilder = new PcepUpdateTunnelInputBuilder();
    updateInputBuilder.setNetworkTopologyRef(topologyRef);
    updateInputBuilder.setBandwidth(bwd);
    updateInputBuilder.setClassType(classType);
    updateInputBuilder.setExplicitHops(Lists.newArrayList(createExplicitHop(IPV4_PREFIX1), createExplicitHop(IPV4_PREFIX2)));
    updateInputBuilder.setLinkId(LINK1_ID);
    updateInputBuilder.addAugmentation(PcepUpdateTunnelInput1.class, new PcepUpdateTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build());
    this.tunnelProgramming.pcepUpdateTunnel(updateInputBuilder.build());
    // check update-lsp input
    Assert.assertNotNull(this.updateLspInput);
    Assert.assertEquals(LINK1_ID.getValue(), this.updateLspInput.getName());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.Arguments updArgs = this.updateLspInput.getArguments();
    Assert.assertEquals(2, updArgs.getEro().getSubobject().size());
    final List<Subobject> subObjects = updArgs.getEro().getSubobject();
    final IpPrefixCase prefix1 = (IpPrefixCase) subObjects.get(0).getSubobjectType();
    final IpPrefixCase prefix2 = (IpPrefixCase) subObjects.get(1).getSubobjectType();
    Assert.assertEquals(IPV4_PREFIX1, prefix1.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
    Assert.assertEquals(IPV4_PREFIX2, prefix2.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
    // delete tunnel
    final PcepDestroyTunnelInputBuilder destroyInputBuilder = new PcepDestroyTunnelInputBuilder();
    destroyInputBuilder.setLinkId(LINK1_ID);
    destroyInputBuilder.setNetworkTopologyRef(topologyRef);
    this.tunnelProgramming.pcepDestroyTunnel(destroyInputBuilder.build());
    Assert.assertNotNull(this.removeLspInput);
    Assert.assertEquals(LINK1_ID.getValue(), this.removeLspInput.getName());
    Assert.assertEquals(NODE1_ID.getValue(), this.removeLspInput.getNode().getValue());
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) PcepUpdateTunnelInput1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepUpdateTunnelInput1Builder) IpPrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase) Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth) PcepCreateP2pTunnelInput1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepCreateP2pTunnelInput1Builder) PcepUpdateTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepUpdateTunnelInputBuilder) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4Case) PcepDestroyTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepDestroyTunnelInputBuilder) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) SourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.create.p2p.tunnel.input.SourceBuilder) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.ipv4._case.Ipv4) Arguments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.Arguments) PcepCreateP2pTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepCreateP2pTunnelInputBuilder) ClassType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType) DestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.create.p2p.tunnel.input.DestinationBuilder) AbstractConcurrentDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 5 with NetworkTopologyRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testStateful07TopologySessionListener.

@Test
public void testStateful07TopologySessionListener() throws Exception {
    this.listener.onSessionUp(this.session);
    final PcepSessionState listenerState = this.listener.listenerState;
    assertEquals(this.testAddress, listenerState.getPeerPref().getIpAddress());
    final LocalPref state = this.listener.listenerState.getLocalPref();
    assertNotNull(state);
    assertEquals(DEAD_TIMER, state.getDeadtimer().shortValue());
    assertEquals(KEEP_ALIVE, state.getKeepalive().shortValue());
    assertEquals(0, state.getSessionId().intValue());
    assertEquals(this.testAddress, state.getIpAddress());
    final PeerPref peerState = listenerState.getPeerPref();
    assertEquals(DEAD_TIMER, peerState.getDeadtimer().shortValue());
    assertEquals(KEEP_ALIVE, peerState.getKeepalive().shortValue());
    assertEquals(0, peerState.getSessionId().intValue());
    assertEquals(this.testAddress, peerState.getIpAddress());
    // add-lsp
    this.topologyRpcs.addLsp(createAddLspInput());
    assertEquals(1, this.receivedMsgs.size());
    assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
    final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
    final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
    final long srpId = req.getSrp().getOperationId().getValue();
    final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, this.testAddress, this.testAddress, this.testAddress, Optional.absent());
    final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(1L)).setSync(false).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
    final Pcrpt esm = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setSync(false).build(), Optional.of(MsgBuilderUtil.createSrp(0L)), null);
    this.listener.onMessage(this.session, esm);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(this.testAddress, pcc.getIpAddress().getIpv4Address().getValue());
        // reported lsp so far empty, has not received response (PcRpt) yet
        assertTrue(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    this.listener.onMessage(this.session, pcRpt);
    // check created lsp
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(1, pcc.getReportedLsp().size());
        final ReportedLsp reportedLsp = pcc.getReportedLsp().get(0);
        assertEquals(this.tunnelName, reportedLsp.getName());
        assertEquals(1, reportedLsp.getPath().size());
        final Path path = reportedLsp.getPath().get(0);
        assertEquals(1, path.getEro().getSubobject().size());
        assertEquals(this.eroIpPrefix, getLastEroIpPrefix(path.getEro()));
        return pcc;
    });
    // check stats
    checkEquals(() -> assertEquals(1, listenerState.getDelegatedLspsCount().intValue()));
    checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
    checkEquals(() -> assertTrue(listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
    checkEquals(() -> assertEquals(2, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
    checkEquals(() -> assertEquals(1, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
    checkEquals(() -> assertEquals(0, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
    // update-lsp
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.ArgumentsBuilder updArgsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.ArgumentsBuilder();
    updArgsBuilder.setEro(createEroWithIpPrefixes(Lists.newArrayList(this.eroIpPrefix, this.dstIpPrefix)));
    updArgsBuilder.addAugmentation(Arguments3.class, new Arguments3Builder().setLsp(new LspBuilder().setDelegate(true).setAdministrative(true).build()).build());
    final UpdateLspInput update = new UpdateLspInputBuilder().setArguments(updArgsBuilder.build()).setName(this.tunnelName).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
    this.topologyRpcs.updateLsp(update);
    assertEquals(2, this.receivedMsgs.size());
    assertTrue(this.receivedMsgs.get(1) instanceof Pcupd);
    final Pcupd updateMsg = (Pcupd) this.receivedMsgs.get(1);
    final Updates upd = updateMsg.getPcupdMessage().getUpdates().get(0);
    final long srpId2 = upd.getSrp().getOperationId().getValue();
    final Tlvs tlvs2 = createLspTlvs(upd.getLsp().getPlspId().getValue(), false, this.newDestinationAddress, this.testAddress, this.testAddress, Optional.absent());
    final Pcrpt pcRpt2 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(upd.getLsp()).setTlvs(tlvs2).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId2)), MsgBuilderUtil.createPath(upd.getPath().getEro().getSubobject()));
    this.listener.onMessage(this.session, pcRpt2);
    // check updated lsp
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(1, pcc.getReportedLsp().size());
        final ReportedLsp reportedLsp = pcc.getReportedLsp().get(0);
        assertEquals(this.tunnelName, reportedLsp.getName());
        assertEquals(1, reportedLsp.getPath().size());
        final Path path = reportedLsp.getPath().get(0);
        assertEquals(2, path.getEro().getSubobject().size());
        assertEquals(this.dstIpPrefix, getLastEroIpPrefix(path.getEro()));
        assertEquals(1, listenerState.getDelegatedLspsCount().intValue());
        assertTrue(this.listener.isSessionSynchronized());
        final StatefulMessagesStatsAug statefulstate = listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class);
        assertTrue(statefulstate.getLastReceivedRptMsgTimestamp() > 0);
        assertEquals(3, statefulstate.getReceivedRptMsgCount().intValue());
        assertEquals(1, statefulstate.getSentInitMsgCount().intValue());
        assertEquals(1, statefulstate.getSentUpdMsgCount().intValue());
        final ReplyTime replyTime = listenerState.getMessages().getReplyTime();
        assertTrue(replyTime.getAverageTime() > 0);
        assertTrue(replyTime.getMaxTime() > 0);
        final StatefulCapabilitiesStatsAug statefulCapabilities = listenerState.getPeerCapabilities().getAugmentation(StatefulCapabilitiesStatsAug.class);
        assertFalse(statefulCapabilities.isActive());
        assertTrue(statefulCapabilities.isInstantiation());
        assertTrue(statefulCapabilities.isStateful());
        return pcc;
    });
    // ensure-operational
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.ensure.lsp.operational.args.ArgumentsBuilder ensureArgs = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.ensure.lsp.operational.args.ArgumentsBuilder();
    ensureArgs.addAugmentation(Arguments1.class, new Arguments1Builder().setOperational(OperationalStatus.Active).build());
    final EnsureLspOperationalInput ensure = new EnsureLspOperationalInputBuilder().setArguments(ensureArgs.build()).setName(this.tunnelName).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
    final OperationResult result = this.topologyRpcs.ensureLspOperational(ensure).get().getResult();
    // check result
    assertNull(result.getFailure());
    // remove-lsp
    final RemoveLspInput remove = new RemoveLspInputBuilder().setName(this.tunnelName).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(this.nodeId).build();
    this.topologyRpcs.removeLsp(remove);
    assertEquals(3, this.receivedMsgs.size());
    assertTrue(this.receivedMsgs.get(2) instanceof Pcinitiate);
    final Pcinitiate pcinitiate2 = (Pcinitiate) this.receivedMsgs.get(2);
    final Requests req2 = pcinitiate2.getPcinitiateMessage().getRequests().get(0);
    final long srpId3 = req2.getSrp().getOperationId().getValue();
    final Tlvs tlvs3 = createLspTlvs(req2.getLsp().getPlspId().getValue(), false, this.testAddress, this.testAddress, this.testAddress, Optional.absent());
    final Pcrpt pcRpt3 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req2.getLsp()).setTlvs(tlvs3).setRemove(true).setSync(true).setOperational(OperationalStatus.Down).build(), Optional.of(MsgBuilderUtil.createSrp(srpId3)), MsgBuilderUtil.createPath(Collections.emptyList()));
    this.listener.onMessage(this.session, pcRpt3);
    // check if lsp was removed
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(0, pcc.getReportedLsp().size());
        return pcc;
    });
    // check stats
    checkEquals(() -> assertEquals(0, listenerState.getDelegatedLspsCount().intValue()));
    checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
    checkEquals(() -> assertTrue(listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
    checkEquals(() -> assertEquals(4, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
    checkEquals(() -> assertEquals(2, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getSentInitMsgCount().intValue()));
    checkEquals(() -> assertEquals(1, listenerState.getMessages().getAugmentation(StatefulMessagesStatsAug.class).getSentUpdMsgCount().intValue()));
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) StatefulCapabilitiesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev171113.StatefulCapabilitiesStatsAug) PcepSessionState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.PcepSessionState) Collections(java.util.Collections) RemoveLspInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInput) OperationResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult) EnsureLspOperationalInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.EnsureLspOperationalInputBuilder) Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) UpdateLspInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInputBuilder) LocalPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Updates(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates) EnsureLspOperationalInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.EnsureLspOperationalInput) Arguments1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments1Builder) Pcinitiate(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId) Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.reported.lsp.Path) Pcupd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcupd) Arguments3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments3Builder) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder) UpdateLspInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInput) ReplyTime(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTime) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs) MsgBuilderUtil.createLspTlvs(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) RemoveLspInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInputBuilder) PeerPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerPref) StatefulMessagesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev171113.StatefulMessagesStatsAug) Test(org.junit.Test)

Aggregations

NetworkTopologyRef (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef)5 Test (org.junit.Test)4 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)3 ArgumentsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder)3 Collections (java.util.Collections)2 Arguments3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments3Builder)2 ErrorObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject)2 OperationResult (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.OperationResult)2 RemoveLspInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInput)2 RemoveLspInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.RemoveLspInputBuilder)2 UpdateLspInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInput)2 UpdateLspInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.UpdateLspInputBuilder)2 AbstractConcurrentDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest)1 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)1 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate)1 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)1 Arguments1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments1Builder)1 Arguments2Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments2Builder)1