# Revision history [back]

So, I learned that I could in fact create NodeConnectorIds (or TpIds, I presume) with the value of OpenFlow's reserved ports as the string. The values are given here, and a more detailed description of those values can be found here.

Sending packet directly to controller: Use the CONTROLLER port value.

Sending the packet to table 0 where it will then be processed: Use the TABLE port value. This is where "setIngress" comes into play: this will set the port from which the packet will be presumed to have come (useful if you have flow rules matching the in-port).

Here is an example:

public final static NodeConnectorId TABLE_PORT = new NodeConnectorId("0xfffffff9");
...
// Output from the ingress port, so the packet is processed from tables
NodeConnectorId egress = TABLE_PORT;
// The first port, because it'll usually exist
NodeConnectorId ingress = new NodeConnectorId(node.getId().getValue() + ":1");
TransmitPacketInput input = new  TransmitPacketInputBuilder()
.setNode(MDSalAccessUtils.nodeRef(node.getId()))
.setEgress(MDSalAccessUtils.nodeConnectorRef(node.getId(), egress))
.setIngress(MDSalAccessUtils.nodeConnectorRef(node.getId(), ingress))
.build();


and

public final static NodeConnectorId CONTROLLER_PORT = new NodeConnectorId("0xfffffffd");
...
// Output from the ingress port, so the packet is processed from tables
NodeConnectorId egress = CONTROLLER_PORT ;
// The first port, because it'll usually exist
TransmitPacketInput input = new  TransmitPacketInputBuilder()
.setNode(MDSalAccessUtils.nodeRef(node.getId()))
.setEgress(MDSalAccessUtils.nodeConnectorRef(node.getId(), egress))