use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.SendToController in project openflowplugin by opendaylight.
the class PacketReceivedTranslatorTest method testTranslate.
@Test
public void testTranslate() throws Exception {
final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:10")));
final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
final PacketInMessage packetInMessage = createPacketInMessage(DATA.getBytes(), PORT_NO);
Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
final PacketReceived packetReceived = packetReceivedTranslator.translate(packetInMessage, deviceInfo, null);
Assert.assertArrayEquals(packetInMessage.getData(), packetReceived.getPayload());
Assert.assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.SendToController", packetReceived.getPacketInReason().getName());
Assert.assertEquals("openflow:10:" + PORT_NO, packetReceived.getIngress().getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue());
Assert.assertEquals(0L, packetReceived.getFlowCookie().getValue().longValue());
Assert.assertEquals(42L, packetReceived.getTableId().getValue().longValue());
}
Aggregations