use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentManagerTest method errorIntentCompile.
/**
* Tests for proper behavior of installation of an intent that triggers
* a compilation error.
*/
@Test
public void errorIntentCompile() {
final TestIntentCompilerError errorCompiler = new TestIntentCompilerError();
extensionService.registerCompiler(MockIntent.class, errorCompiler);
MockIntent intent = new MockIntent(MockIntent.nextId());
listener.setLatch(1, Type.INSTALL_REQ);
listener.setLatch(1, Type.FAILED);
service.submit(intent);
listener.await(Type.INSTALL_REQ);
listener.await(Type.FAILED);
verifyState();
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentManagerTest method errorIntentInstallFromFlows.
/**
* Tests handling a future that contains an error as a result of
* installing an intent.
*/
@Ignore("skipping until we fix update ordering problem")
@Test
public void errorIntentInstallFromFlows() {
final Long id = MockIntent.nextId();
flowRuleService.setFuture(false);
MockIntent intent = new MockIntent(id);
listener.setLatch(1, Type.FAILED);
listener.setLatch(1, Type.INSTALL_REQ);
service.submit(intent);
listener.await(Type.INSTALL_REQ);
listener.await(Type.FAILED);
// FIXME the intent will be moved into INSTALLED immediately which overrides FAILED
// ... the updates come out of order
verifyState();
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentManagerTest method intentSubclassCompile.
/**
* Tests that a compiler for a subclass of an intent that already has a
* compiler is automatically added.
*/
@Test
public void intentSubclassCompile() {
class MockIntentSubclass extends MockIntent {
public MockIntentSubclass(Long number) {
super(number);
}
}
flowRuleService.setFuture(true);
listener.setLatch(1, Type.INSTALL_REQ);
listener.setLatch(1, Type.INSTALLED);
Intent intent = new MockIntentSubclass(MockIntent.nextId());
service.submit(intent);
listener.await(Type.INSTALL_REQ);
listener.await(Type.INSTALLED);
assertEquals(1L, service.getIntentCount());
assertEquals(1L, flowRuleService.getFlowRuleCount());
final Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> compilers = extensionService.getCompilers();
assertEquals(2, compilers.size());
assertNotNull(compilers.get(MockIntentSubclass.class));
assertNotNull(compilers.get(MockIntent.class));
verifyState();
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentManagerTest method submitIntent.
@Test
public void submitIntent() {
flowRuleService.setFuture(true);
listener.setLatch(1, Type.INSTALL_REQ);
listener.setLatch(1, Type.INSTALLED);
Intent intent = new MockIntent(MockIntent.nextId());
service.submit(intent);
listener.await(Type.INSTALL_REQ);
listener.await(Type.INSTALLED);
assertEquals(1L, service.getIntentCount());
assertEquals(1L, flowRuleService.getFlowRuleCount());
verifyState();
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentAccumulatorTest method setUp.
/**
* Creates mock intents used by the test.
*/
@Before
public void setUp() {
super.setUp();
intent1 = new MockIntent(1L);
intent2 = new MockIntent(2L);
intent3 = new MockIntent(3L);
}
Aggregations