import java.math.BigInteger;\r
import java.util.ArrayList;\r
import java.util.Collection;\r
+import java.util.Collections;\r
import java.util.HashMap;\r
import java.util.List;\r
import java.util.Map;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;\r
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;\r
import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductorImpl;\r
import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContextOFImpl;\r
import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;\r
import org.opendaylight.openflowplugin.openflow.md.queue.QueueProcessorLightImpl;\r
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.SendToController;\r
import org.opendaylight.yangtools.yang.binding.DataObject;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
List<DataObject> salPacketIn = packetInV10Translator.translate(cookie,\r
sessionContextOFImpl, message);\r
\r
- //TODO: rewrite to object and involve object comparison in Assert\r
- String expectedString = "[PacketReceived [_ingress=NodeConnectorRef [_value=KeyedInstanceIdentifier"\r
- + "{targetType=interface org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector,"\r
- + " path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes,"\r
- + " org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node["\r
- + "key=NodeKey [_id=Uri [_value=openflow:"\r
- + datapathId.toString()\r
- + "]]],"\r
- + " org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector["\r
- + "key=NodeConnectorKey [_id=Uri [_value=openflow:"\r
- + datapathId.toString()\r
- + ":"\r
- + message.getInPort().toString()\r
- + "]]]]}], _packetInReason=class org.opendaylight.yang.gen.v1.urn.opendaylight."\r
- + "packet.service.rev130709.SendToController, _payload=[115, 101, 110, 100, 79, 117,"\r
- + " 116, 112, 117, 116, 77, 115, 103, 95, 84, 69, 83, 84], , augmentation=[]]]";\r
- Assert.assertEquals(expectedString, salPacketIn.toString());\r
+ Assert.assertEquals(Collections.singletonList(new PacketReceivedBuilder()\r
+ .setIngress(InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, (long) message.getInPort(), OpenflowVersion.OF10))\r
+ .setPacketInReason(SendToController.class)\r
+ .setPayload(data)\r
+ .build()).toString(), salPacketIn.toString());\r
+\r
LOG.debug("Test translate done.");\r
}\r
\r