Search in sources :

Example 16 with OpticalConnectivityId

use of org.onosproject.newoptical.api.OpticalConnectivityId in project onos by opennetworkinglab.

the class OpticalPathProvisionerTest method testInstalledEventLocal.

/**
 * Checks if PATH_INSTALLED event comes up after intent whose master is this node is installed.
 */
@Test
public void testInstalledEventLocal() {
    Bandwidth bandwidth = Bandwidth.bps(100);
    Duration latency = Duration.ofMillis(10);
    OpticalConnectivityId cid = target.setupConnectivity(CP12, CP71, bandwidth, latency);
    // notify all intents are installed
    intentService.notifyInstalled();
    assertEquals(1, listener.events.size());
    assertEquals(OpticalPathEvent.Type.PATH_INSTALLED, listener.events.get(0).type());
    assertEquals(cid, listener.events.get(0).subject());
}
Also used : OpticalConnectivityId(org.onosproject.newoptical.api.OpticalConnectivityId) Bandwidth(org.onlab.util.Bandwidth) Duration(java.time.Duration) Test(org.junit.Test)

Example 17 with OpticalConnectivityId

use of org.onosproject.newoptical.api.OpticalConnectivityId in project onos by opennetworkinglab.

the class OpticalPathProvisionerTest method testRemovedEventRemote.

/**
 * Checks if PATH_REMOVED event comes up after packet link is removed.
 */
@Test
public void testRemovedEventRemote() {
    // set the master for ingress device of intent to remote node
    mastershipService.setMastership(DEVICE2.id(), MastershipRole.NONE);
    Bandwidth bandwidth = Bandwidth.bps(100);
    Duration latency = Duration.ofMillis(10);
    OpticalConnectivityId cid = target.setupConnectivity(CP12, CP71, bandwidth, latency);
    // notify all intents are installed
    intentService.notifyInstalled();
    target.removeConnectivity(cid);
    // notify all intents are withdrawn
    intentService.notifyWithdrawn();
    // remote nodes must not receive event before distributed map is updated
    assertEquals(0, listener.events.size());
}
Also used : OpticalConnectivityId(org.onosproject.newoptical.api.OpticalConnectivityId) Bandwidth(org.onlab.util.Bandwidth) Duration(java.time.Duration) Test(org.junit.Test)

Aggregations

OpticalConnectivityId (org.onosproject.newoptical.api.OpticalConnectivityId)17 Bandwidth (org.onlab.util.Bandwidth)14 Duration (java.time.Duration)12 Test (org.junit.Test)11 Link (org.onosproject.net.Link)6 ConnectPoint (org.onosproject.net.ConnectPoint)5 DefaultLink (org.onosproject.net.DefaultLink)5 OpticalConnectivityIntent (org.onosproject.net.intent.OpticalConnectivityIntent)5 Path (org.onosproject.net.Path)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ScalarWeight (org.onlab.graph.ScalarWeight)2 OpticalCircuitIntent (org.onosproject.net.intent.OpticalCircuitIntent)2 OpticalPathService (org.onosproject.newoptical.api.OpticalPathService)2 Beta (com.google.common.annotations.Beta)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 ImmutableList (com.google.common.collect.ImmutableList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1