Search in sources :

Example 1 with ConsumerContext

use of org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext in project openflowplugin by opendaylight.

the class SalIntegrationTest method handshakeAndNodeUpdate.

/**
 * test basic integration with OFLib running the handshake
 *
 * @throws Exception
 */
@Test
public void handshakeAndNodeUpdate() throws Exception {
    final TestInventoryListener listener = new TestInventoryListener();
    BindingAwareConsumer openflowConsumer = new BindingAwareConsumer() {

        @Override
        public void onSessionInitialized(ConsumerContext session) {
            session.getSALService(NotificationService.class).registerNotificationListener(listener);
        }
    };
    ConsumerContext consumerReg = broker.registerConsumer(openflowConsumer, ctx);
    assertNotNull(consumerReg);
    LOG.debug("handshake integration test");
    LOG.debug("openflowPluginProvider: " + openflowPluginProvider);
    switchSim.setSecuredClient(false);
    ScenarioHandler scenario = new ScenarioHandler(ScenarioFactory.createHandshakeScenarioVBM(ScenarioFactory.VERSION_BITMAP_13, (short) 0, ScenarioFactory.VERSION_BITMAP_10_13, true));
    switchSim.setScenarioHandler(scenario);
    scenarioPool.execute(switchSim);
    finalCheck = new Runnable() {

        @Override
        public void run() {
            // FIXME: Enable the test -- It's requires EntityOnwershipService hook to the test
            // assertEquals(1, listener.nodeUpdated.size());
            assertEquals(0, listener.nodeUpdated.size());
        // assertNotNull(listener.nodeUpdated.get(0));
        }
    };
}
Also used : ConsumerContext(org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext) ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) NotificationService(org.opendaylight.controller.sal.binding.api.NotificationService) BindingAwareConsumer(org.opendaylight.controller.sal.binding.api.BindingAwareConsumer) Test(org.junit.Test)

Example 2 with ConsumerContext

use of org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext in project controller by opendaylight.

the class BindingContextUtils method createConsumerContextAndInitialize.

public static ConsumerContext createConsumerContextAndInitialize(BindingAwareConsumer consumer, ClassToInstanceMap<BindingAwareService> serviceProvider) {
    ConsumerContext context = createConsumerContext(consumer, serviceProvider);
    consumer.onSessionInitialized(context);
    return context;
}
Also used : ConsumerContext(org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext)

Aggregations

ConsumerContext (org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext)2 Test (org.junit.Test)1 BindingAwareConsumer (org.opendaylight.controller.sal.binding.api.BindingAwareConsumer)1 NotificationService (org.opendaylight.controller.sal.binding.api.NotificationService)1 ScenarioHandler (org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler)1