Search in sources :

Example 51 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match in project bgpcep by opendaylight.

the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronization.

@Test
public void testTriggeredResynchronization() throws Exception {
    // session up - sync skipped (LSP-DBs match)
    this.session = getPCEPSession(getOpen(), getOpen());
    this.listener.onSessionUp(this.session);
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = getPcrt();
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // PCEP Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
        return pcc;
    });
    // end of sync
    final Pcrpt syncMsg = getSyncMsg();
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        return pcc;
    });
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
    this.listener.onMessage(this.session, pcRpt);
    // end of sync
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP is not empty, Stale LSP state were purged
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
}
Also used : TriggerSyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Test(org.junit.Test)

Example 52 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match in project bgpcep by opendaylight.

the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronizationLsp.

@Test
public void testTriggeredResynchronizationLsp() throws Exception {
    // session up - sync skipped (LSP-DBs match)
    this.session = getPCEPSession(getOpen(), getOpen());
    this.listener.onSessionUp(this.session);
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = getPcrt();
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        final List<ReportedLsp> reportedLspPcc = pcc.getReportedLsp();
        assertFalse(reportedLspPcc.isEmpty());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // sync rpt + LSP-DB
    final Pcrpt syncMsg = getSyncMsg();
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP
        assertEquals(0, pcc.getReportedLsp().size());
        return pcc;
    });
}
Also used : ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) TriggerSyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Test(org.junit.Test)

Example 53 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match in project bgpcep by opendaylight.

the class PCETriggeredInitialSyncProcedureTest method testPcepTriggeredInitialSyncPerformed.

/**
 * Test Triggered Initial Sync procedure.
 */
@Test
public void testPcepTriggeredInitialSyncPerformed() throws Exception {
    this.listener = (Stateful07TopologySessionListener) getSessionListener();
    // session up - expect triggered sync (LSP-DBs do not match)
    final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.ONE).build();
    final LspDbVersion localDbVersion2 = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build();
    final PCEPSession session = getPCEPSession(getOpen(localDbVersion, Boolean.FALSE), getOpen(localDbVersion2, Boolean.FALSE));
    this.listener.onSessionUp(session);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - not synchronized and TriggeredInitialSync state
        assertEquals(PccSyncState.TriggeredInitialSync, pcc.getStateSync());
        return pcc;
    });
    // sync rpt + LSP-DB
    final Pcrpt syncMsg = getsyncMsg();
    this.listener.onMessage(session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP is empty, LSP state from previous session was purged
        assertTrue(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = getPcrpt();
    this.listener.onMessage(session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
}
Also used : PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) LspDbVersionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder) Test(org.junit.Test)

Example 54 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match in project bgpcep by opendaylight.

the class StateSynchronizationAvoidanceProcedureTest method testStateSynchronizationPerformed.

@Test
public void testStateSynchronizationPerformed() throws Exception {
    PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
    this.listener.onSessionUp(session);
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(1L)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("test".getBytes())).build()).addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.ONE).build()).build()).build()).setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.absent(), createPath(Collections.emptyList()));
    this.listener.onMessage(session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    this.listener.onSessionDown(session, new IllegalArgumentException("Simulate Exception"));
    this.listener = (Stateful07TopologySessionListener) getSessionListener();
    // session up - expect sync (LSP-DBs do not match)
    final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build();
    session = getPCEPSession(getOpen(localDbVersion), getOpen(null));
    this.listener.onSessionUp(session);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - not synchronized
        assertEquals(PccSyncState.InitialResync, pcc.getStateSync());
        // check reported LSP - persisted from previous session
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // sync rpt + LSP-DB
    final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build()).build()).build()), true, false), Optional.absent(), createPath(Collections.emptyList()));
    this.listener.onMessage(session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP is empty, LSP state from previous session was purged
        assertTrue(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId) LspIdentifiersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder) Collections(java.util.Collections) SymbolicPathNameBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.symbolic.path.name.tlv.SymbolicPathNameBuilder) LspDbVersionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder) PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) SymbolicPathName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SymbolicPathName) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId) Test(org.junit.Test)

Example 55 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match in project bgpcep by opendaylight.

the class AbstractTopologySessionListener method makeBeforeBreak.

private List<Path> makeBeforeBreak(final ReportedLspBuilder rlb, final ReportedLsp previous, final String name, final boolean remove) {
    // just one path should be reported
    Preconditions.checkState(rlb.getPath().size() == 1);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId reportedLspId = rlb.getPath().get(0).getLspId();
    final List<Path> updatedPaths;
    // remove existing tunnel's paths now, as explicit path remove will not come
    if (!remove && reportedLspId.getValue() == 0) {
        updatedPaths = new ArrayList<>();
        LOG.debug("Remove previous paths {} to this lsp name {}", previous.getPath(), name);
    } else {
        // check previous report for existing paths
        updatedPaths = new ArrayList<>(previous.getPath());
        LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
        for (final Path path : previous.getPath()) {
            // we found reported path in previous reports
            if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
                LOG.debug("Match on lsp-id {}", path.getLspId().getValue());
                // path that was reported previously and does have the same lsp-id, path will be updated
                final boolean r = updatedPaths.remove(path);
                LOG.trace("Request removed? {}", r);
            }
        }
    }
    // if the path does not exist in previous report, add it to path list, it's a new ERO
    // only one path will be added
    // lspId is 0 means confirmation message that shouldn't be added (because we have no means of deleting it later)
    LOG.trace("Adding new path {} to {}", rlb.getPath(), updatedPaths);
    updatedPaths.addAll(rlb.getPath());
    if (remove) {
        if (reportedLspId.getValue() == 0) {
            // if lsp-id also 0, remove all paths
            LOG.debug("Removing all paths.");
            updatedPaths.clear();
        } else {
            // path is marked to be removed
            LOG.debug("Removing path {} from {}", rlb.getPath(), updatedPaths);
            final boolean r = updatedPaths.removeAll(rlb.getPath());
            LOG.trace("Request removed? {}", r);
        }
    }
    LOG.debug("Setting new paths {} to lsp {}", updatedPaths, name);
    return updatedPaths;
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.reported.lsp.Path)

Aggregations

Test (org.junit.Test)182 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)138 ArrayList (java.util.ArrayList)82 BigInteger (java.math.BigInteger)66 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)62 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)61 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)60 ByteBuf (io.netty.buffer.ByteBuf)59 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)53 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)49 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)48 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)45 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)44 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)43 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)43 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)42 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)41 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)40 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)40 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)39