Search in sources :

Example 6 with IntProgrammable

use of org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable in project onos by opennetworkinglab.

the class TestCodecService method getMockIntProgrammable.

private IntProgrammable getMockIntProgrammable(boolean supportSource, boolean supportTransit, boolean supportSink, boolean supportPostcard) {
    IntProgrammable intProg = createNiceMock(IntProgrammable.class);
    if (supportSource) {
        expect(intProg.supportsFunctionality(SOURCE)).andReturn(true).anyTimes();
    }
    if (supportTransit) {
        expect(intProg.supportsFunctionality(TRANSIT)).andReturn(true).anyTimes();
    }
    if (supportSink) {
        expect(intProg.supportsFunctionality(SINK)).andReturn(true).anyTimes();
    }
    if (supportPostcard) {
        expect(intProg.supportsFunctionality(POSTCARD)).andReturn(true).anyTimes();
    }
    expect(intProg.init()).andReturn(true).anyTimes();
    return intProg;
}
Also used : IntProgrammable(org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable)

Example 7 with IntProgrammable

use of org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable in project onos by opennetworkinglab.

the class TestCodecService method testConfigPostcardOnlyDevice.

@Test
public void testConfigPostcardOnlyDevice() {
    reset(deviceService, hostService);
    Device device = getMockDevice(true, DEVICE_ID);
    IntProgrammable intProg = getMockIntProgrammable(false, false, false, true);
    setUpDeviceTest(device, intProg, true, true);
    IntObjective intObj = IntObjective.builder().withSelector(FLOW_SELECTOR1).build();
    expect(intProg.addIntObjective(eq(intObj))).andReturn(true).once();
    replay(deviceService, hostService, device, intProg);
    installTestIntents();
    assertTrue(manager.configDevice(DEVICE_ID));
    verify(intProg);
}
Also used : DefaultDevice(org.onosproject.net.DefaultDevice) Device(org.onosproject.net.Device) IntObjective(org.onosproject.net.behaviour.inbandtelemetry.IntObjective) IntProgrammable(org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable) Test(org.junit.Test)

Aggregations

IntProgrammable (org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable)7 Device (org.onosproject.net.Device)5 Test (org.junit.Test)4 DefaultDevice (org.onosproject.net.DefaultDevice)4 IntObjective (org.onosproject.net.behaviour.inbandtelemetry.IntObjective)3 IntDeviceConfig (org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Maps (com.google.common.collect.Maps)1 Striped (com.google.common.util.concurrent.Striped)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors.newSingleThreadScheduledExecutor (java.util.concurrent.Executors.newSingleThreadScheduledExecutor)1 ScheduledFuture (java.util.concurrent.ScheduledFuture)1 TimeUnit (java.util.concurrent.TimeUnit)1 TimeoutException (java.util.concurrent.TimeoutException)1 Lock (java.util.concurrent.locks.Lock)1