Packet API changes.
* Renamed 'broadcastPacket' methods to 'broadcastPacketOutEdge'
* Changed parameter order in the 'sendPacket' methods to remain consistent
with the 'broadcastPacketOutEdge' methods, i.e. have the Ethernet packet
as the first parameter
* Added unimplemented notes and exceptions for currently unimplemented methods
Change-Id: I99b14fd8bd34a9a830b301d4a5b6c51e071c0488
diff --git a/src/main/java/net/onrc/onos/api/packet/IPacketService.java b/src/main/java/net/onrc/onos/api/packet/IPacketService.java
index 4321a11..d182c57 100644
--- a/src/main/java/net/onrc/onos/api/packet/IPacketService.java
+++ b/src/main/java/net/onrc/onos/api/packet/IPacketService.java
@@ -28,27 +28,30 @@
// passed around.
/**
* Send a packet out a specific port in the network.
- *
- * @param switchPort the port to send the packet out
* @param eth the packet to send
+ * @param switchPort the port to send the packet out
*/
- public void sendPacket(SwitchPort switchPort, Ethernet eth);
+ public void sendPacket(Ethernet eth, SwitchPort switchPort);
/**
* Send a packet out multiple ports in the network.
+ * <p/>
+ * NOTE: currently unimplemented.
*
- * @param switchPorts a list of ports to send the packet out
* @param eth the packet to send
+ * @param switchPorts a list of ports to send the packet out
*/
- public void sendPacket(List<SwitchPort> switchPorts, Ethernet eth);
+ public void sendPacket(Ethernet eth, List<SwitchPort> switchPorts);
/**
* Broadcast the packet out all edge ports in the network. An edge port is
* defined as any port that doesn't have a link to another switch.
+ * <p/>
+ * NOTE: currently unimplemented.
*
* @param eth the packet to broadcast
*/
- public void broadcastPacket(Ethernet eth);
+ public void broadcastPacketOutEdge(Ethernet eth);
/**
* Broadcast the packet out all edge ports in the network, except for the
@@ -63,5 +66,5 @@
* @param inSwitchPort the exception port that the packet is not
* broadcast out
*/
- public void broadcastPacket(Ethernet eth, SwitchPort inSwitchPort);
+ public void broadcastPacketOutEdge(Ethernet eth, SwitchPort inSwitchPort);
}
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
index a7b7fbc..4e0fd47 100644
--- a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
@@ -206,7 +206,7 @@
log.trace("Sending broadcast packet to other ONOS instances");
}
- packetService.broadcastPacket(eth,
+ packetService.broadcastPacketOutEdge(eth,
new SwitchPort(sw.getDpid(), inPort.getNumber().shortValue()));
}
@@ -339,8 +339,8 @@
} else {
log.debug("Sending packet out from sw {}, outport{}", sw, existingFlow.firstOutPort);
- packetService.sendPacket(new SwitchPort(
- sw.getDpid(), existingFlow.firstOutPort), eth);
+ packetService.sendPacket(eth, new SwitchPort(
+ sw.getDpid(), existingFlow.firstOutPort));
}
} else {
// Flow path has not yet been installed to switches so save the
@@ -458,8 +458,8 @@
for (PacketToPush packet : packets) {
log.debug("Start packetToPush to sw {}, outPort {}, path {}", packet.dpid, existingFlow.firstOutPort, path);
- packetService.sendPacket(new SwitchPort(
- packet.dpid, existingFlow.firstOutPort), packet.eth);
+ packetService.sendPacket(packet.eth, new SwitchPort(
+ packet.dpid, existingFlow.firstOutPort));
}
}
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
index f026745..25d4646 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
@@ -464,7 +464,7 @@
}
// We don't know the device so broadcast the request out
- packetService.broadcastPacket(eth,
+ packetService.broadcastPacketOutEdge(eth,
new SwitchPort(dpid, inPort));
} else {
// Even if the device exists in our database, we do not reply to
@@ -489,7 +489,7 @@
" - broadcasting", macAddress);
}
- packetService.broadcastPacket(eth,
+ packetService.broadcastPacketOutEdge(eth,
new SwitchPort(dpid, inPort));
} else {
for (net.onrc.onos.core.topology.Port portObject : outPorts) {
@@ -509,7 +509,7 @@
}
packetService.sendPacket(
- new SwitchPort(outSwitch, outPort), eth);
+ eth, new SwitchPort(outSwitch, outPort));
}
}
}
@@ -574,7 +574,7 @@
// sendArpRequestToSwitches(ipAddress, eth.serialize());
packetService.sendPacket(
- new SwitchPort(intf.getDpid(), intf.getPort()), eth);
+ eth, new SwitchPort(intf.getDpid(), intf.getPort()));
}
//Please leave it for now because this code is needed for SDN-IP. It will be removed soon.
@@ -665,7 +665,7 @@
eth.setVlanID(vlan).setPriorityCode((byte) 0);
}
- packetService.sendPacket(new SwitchPort(dpid, port), eth);
+ packetService.sendPacket(eth, new SwitchPort(dpid, port));
}
private String inetAddressToString(byte[] bytes) {
diff --git a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
index 1e3cae6..6bdf874 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
@@ -99,7 +99,7 @@
}
@Override
- public void sendPacket(SwitchPort switchPort, Ethernet eth) {
+ public void sendPacket(Ethernet eth, SwitchPort switchPort) {
SinglePacketOutNotification notification =
new SinglePacketOutNotification(eth.serialize(), 0,
switchPort.dpid().value(), switchPort.port().value());
@@ -110,19 +110,19 @@
}
@Override
- public void sendPacket(List<SwitchPort> switchPorts, Ethernet eth) {
+ public void sendPacket(Ethernet eth, List<SwitchPort> switchPorts) {
// TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("Not yet implemented");
}
@Override
- public void broadcastPacket(Ethernet eth) {
+ public void broadcastPacketOutEdge(Ethernet eth) {
// TODO Auto-generated method stub
-
+ throw new UnsupportedOperationException("Not yet implemented");
}
@Override
- public void broadcastPacket(Ethernet eth, SwitchPort inSwitchPort) {
+ public void broadcastPacketOutEdge(Ethernet eth, SwitchPort inSwitchPort) {
BroadcastPacketOutNotification notification =
new BroadcastPacketOutNotification(eth.serialize(), 0,
inSwitchPort.dpid().value(), inSwitchPort.port().value());