Search in sources :

Example 1 with FlowRemovedBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder in project openflowplugin by opendaylight.

the class DeviceContextImplTest method testProcessFlowRemovedMessage.

@Test
public void testProcessFlowRemovedMessage() throws Exception {
    // prepare translation result
    final FlowRemovedBuilder flowRemovedMdsalBld = new FlowRemovedBuilder().setTableId((short) 0).setPriority(42).setCookie(new FlowCookie(BigInteger.ONE)).setMatch(new MatchBuilder().build());
    final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
    Mockito.when(messageTranslatorFlowRemoved.translate(any(Object.class), any(DeviceInfo.class), any(Object.class))).thenReturn(flowRemovedMdsalBld.build());
    // insert flow+flowId into local registry
    final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowRemovedMdsalBld.build());
    final FlowDescriptor flowDescriptor = FlowDescriptorFactory.create((short) 0, new FlowId("ut-ofp:f456"));
    deviceContext.getDeviceFlowRegistry().storeDescriptor(flowRegKey, flowDescriptor);
    // prepare empty input message
    final FlowRemovedMessageBuilder flowRemovedBld = new FlowRemovedMessageBuilder();
    // prepare path to flow to be removed
    final KeyedInstanceIdentifier<Flow, FlowKey> flowToBeRemovedPath = nodeKeyIdent.augmentation(FlowCapableNode.class).child(Table.class, new TableKey((short) 0)).child(Flow.class, new FlowKey(new FlowId("ut-ofp:f456")));
    deviceContext.setNotificationPublishService(mockedNotificationPublishService);
    deviceContext.processFlowRemovedMessage(flowRemovedBld.build());
}
Also used : FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) Table(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table) FlowRegistryKey(org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey) FlowDescriptor(org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor) FlowRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) DeviceInfo(org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo) FlowRemovedMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) NotificationPublishService(org.opendaylight.controller.md.sal.binding.api.NotificationPublishService) Test(org.junit.Test)

Example 2 with FlowRemovedBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder in project openflowplugin by opendaylight.

the class FlowNotificationSupplierImpl method deleteNotification.

@Override
public FlowRemoved deleteNotification(final InstanceIdentifier<Flow> path) {
    Preconditions.checkArgument(path != null);
    final FlowRemovedBuilder builder = new FlowRemovedBuilder();
    builder.setFlowRef(new FlowRef(path));
    builder.setNode(createNodeRef(path));
    return builder.build();
}
Also used : FlowRef(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef) FlowRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder)

Aggregations

FlowRemovedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder)2 Test (org.junit.Test)1 NotificationPublishService (org.opendaylight.controller.md.sal.binding.api.NotificationPublishService)1 DeviceInfo (org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo)1 FlowDescriptor (org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor)1 FlowRegistryKey (org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey)1 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)1 Table (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table)1 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)1 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)1 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)1 FlowCookie (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie)1 FlowRef (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef)1 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)1 FlowRemovedMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder)1