Ask Your Question
0

Not able to forward the packet_out message to outport equal to table

asked 2014-08-04 08:17:37 -0700

updated 2014-08-04 08:19:06 -0700

I am trying to send the packet_out message from the controller to the switch output port : table, so that packet out message get processed by the flow table.

I tried the following code :

117     try {
118
119       IPv4 ip = new IPv4();
120       Ethernet ether = new Ethernet();
121       ether.setEtherType(EtherTypes.IPv4.shortValue()).setPayload(ip);
122
123       RawPacket ether_pkt = this.dataPacketService.encodeDataPacket(ether);
125
129       Node node = Node.fromString(Node.NodeIDType.OPENFLOW, "00:00:00:00:00:00:00:01");
130
131       NodeConnector inc = new NodeConnector(NodeConnectorIDType.OPENFLOW, new Short("1"), node);
132       NodeConnector onc = new NodeConnector(NodeConnectorIDType.OPENFLOW, new Short((short)-32761), node);
133       ether_pkt.setIncomingNodeConnector(inc);
134       ether_pkt.setOutgoingNodeConnector(onc);
135
137       dataPacketService.transmitDataPacket(ether_pkt);
138       }

but in wireshark logs revels that packetout message have output port = 32775 not the 0xfff9 !! Please tell me how could I set the output port for the packetout message equal to table (0xfff9).

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-08-05 12:11:43 -0700

Did you try new Short((short)0xfff9) ?

edit flag offensive delete publish link more

Comments

It worked for me!! . But you could please tell me what is the difference in (short) -32761 and (short) 0xfff9.

subhash ( 2014-08-06 03:54:27 -0700 )edit
1

Int is converted to short by keeping the last 2 bytes of the 4 bytes. Note that numbers are represented in two's complement. -32761 is [ff ff 80 07]. Keep the last two bytes [80 07] for short, which is (still) -32761. 0xffff9 is [00 00 ff f9]. Keep the last two bytes [ff f9] for short, which is -7.

Zoltán Lajos Kis ( 2014-08-26 10:38:53 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-08-04 08:17:37 -0700

Seen: 553 times

Last updated: Aug 05 '14