- Set "Output to conroller" action in acl table only for Dell switchwq
Change-Id: Id9190e61f249810ab6da93f5610d3861d15501c1
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
index 10621e4..8f7bc48 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
@@ -388,10 +388,11 @@
for (Link link: sw.getOutgoingLinks()) {
Port dstPort = link.getDstPort();
IOF13Switch dstSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(dstPort.getDpid().toString()));
+ dstPort.getDpid().value());
if (dstSw != null) {
dstSw.removePortFromGroups(dstPort.getNumber());
- log.debug("MasterSwitch {} is gone: remove port {}", sw.getDpid(), dstPort);
+ log.debug("MasterSwitch {} is gone: remove port {}",
+ sw.getDpid(), dstPort);
}
}
// Flush the groupId table for adjacencySid;
@@ -423,7 +424,7 @@
Dpid dpid = port.getDpid();
IOF13Switch sw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(port.getDpid().toString()));
+ port.getDpid().value());
if (sw != null) {
sw.addPortToGroups(port.getPortNumber());
//log.debug("Add port {} to switch {}", port, dpid);
@@ -468,9 +469,9 @@
}
IOF13Switch srcSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(srcPort.getDpid().toString()));
+ srcPort.getDpid().value());
IOF13Switch dstSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(dstPort.getDpid().toString()));
+ dstPort.getDpid().value());
if ((srcSw == null) || (dstSw == null))
continue;
@@ -502,9 +503,9 @@
SwitchPort dstPort = link.getDst();
IOF13Switch srcSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(srcPort.getDpid().toString()));
+ srcPort.getDpid().value());
IOF13Switch dstSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(dstPort.getDpid().toString()));
+ dstPort.getDpid().value());
if ((srcSw == null) || (dstSw == null))
/* If this link is not between two switches, ignore it */
continue;
@@ -550,7 +551,7 @@
Dpid dpid = port.getDpid();
IOF13Switch sw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(port.getDpid().toString()));
+ port.getDpid().value());
if (sw != null) {
sw.removePortFromGroups(port.getPortNumber());
log.debug("Remove port {} from switch {}", port, dpid);
@@ -644,10 +645,11 @@
* @param adjId Adjacency ID
* @param ports List of ports assigned to the Adjacency ID
*/
- private void setAdjacencyRuleOfGroup(Switch sw, Integer adjId, List<Integer> ports) {
+ private void setAdjacencyRuleOfGroup(Switch sw, Integer adjId,
+ List<Integer> ports) {
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ sw.getDpid().value());
Integer groupId = -1;
if (sw13 != null) {
@@ -787,7 +789,7 @@
new MatchActionOperationEntry(operator, matchAction);
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ sw.getDpid().value());
if (sw13 != null) {
try {
@@ -935,7 +937,7 @@
if (!entries.isEmpty()) {
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(targetSw.getDpid().toString()));
+ targetSw.getDpid().value());
if (sw13 != null) {
try {
@@ -1018,8 +1020,8 @@
MatchActionOperationEntry maEntry =
new MatchActionOperationEntry(operator, matchAction);
- IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(sw.getDpid().value());
+ // getSwId(sw.getDpid().toString()));
if (sw13 != null) {
try {
@@ -1071,7 +1073,7 @@
maEntries.add(buildMAEntry(sw, mplsLabel, fwdSws, false, false));
}
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ sw.getDpid().value());
if (sw13 != null) {
try {
@@ -1393,7 +1395,7 @@
*/
private OFBarrierReplyFuture sendBarrier(Switch sw) {
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ sw.getDpid().value());
OFBarrierReplyFuture replyFuture = null;
if (sw13 != null) {
try {
@@ -1502,7 +1504,7 @@
}
IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(sw.getDpid().toString()));
+ sw.getDpid().value());
if ((sw13 instanceof OFSwitchImplDellOSR) && isTransitRouter(sw) && !php) {
PortNumber port = pickOnePort(sw, fwdSws);
if (port == null) {
@@ -1611,7 +1613,7 @@
Dpid firstVia = via.get(via.size()-1);
fwdSws.add(firstVia);
IOF13Switch targetSw13 = (IOF13Switch)floodlightProvider.getMasterSwitch(
- getSwId(targetSw.getDpid().toString()));
+ targetSw.getDpid().value());
if (targetSw13 instanceof OFSwitchImplDellOSR &&
isTransitRouter(targetSw) &&
isTransitRouter(mutableTopology.getSwitch(firstVia))) {
@@ -1645,23 +1647,6 @@
}
/**
- * Convert a string DPID to its Switch Id (integer)
- *
- * @param dpid
- * @return
- */
- private long getSwId(String dpid) {
-
- long swId = 0;
-
- String swIdHexStr = "0x"+dpid.substring(dpid.lastIndexOf(":") + 1);
- if (swIdHexStr != null)
- swId = Integer.decode(swIdHexStr);
-
- return swId;
- }
-
- /**
* Check if the switch is the edge router or not.
*
* @param dpid Dpid of the switch to check
@@ -1859,10 +1844,11 @@
* @param dpid Switch DPID
* @return IOF13Switch object
*/
- public IOF13Switch getIOF13Switch(String dpid) {
+ public IOF13Switch getIOF13Switch(String dpidStr) {
+ Dpid dpid = new Dpid(dpidStr);
IOF13Switch targetSw = (IOF13Switch) floodlightProvider.getMasterSwitch(
- getSwId(dpid));
+ dpid.value());
return targetSw;
}
diff --git a/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplDellOSR.java b/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplDellOSR.java
index 13afbeb..18b3e59 100644
--- a/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplDellOSR.java
+++ b/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplDellOSR.java
@@ -1,5 +1,7 @@
package net.onrc.onos.core.drivermanager;
+import java.io.IOException;
+
import net.onrc.onos.core.matchaction.match.Ipv4Match;
import net.onrc.onos.core.matchaction.match.Match;
import net.onrc.onos.core.util.IPv4Net;
@@ -57,4 +59,16 @@
return oxmList;
}
+ @Override
+ protected void setTableMissEntries() throws IOException {
+ // set all table-miss-entries
+ populateTableMissEntry(vlanTableId, true, false, false, -1);
+ populateTableMissEntry(tmacTableId, true, false, false, -1);
+ populateTableMissEntry(ipv4UnicastTableId, false, true, true,
+ aclTableId);
+ populateTableMissEntry(mplsTableId, false, true, true,
+ aclTableId);
+ populateTableMissEntry(aclTableId, true, false, false, -1);
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplSpringOpenTTP.java b/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplSpringOpenTTP.java
index e625144..8a81fab 100644
--- a/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplSpringOpenTTP.java
+++ b/src/main/java/net/onrc/onos/core/drivermanager/OFSwitchImplSpringOpenTTP.java
@@ -156,11 +156,11 @@
/* Set the default values. These variables will get
* overwritten based on the switch vendor type
*/
- private int vlanTableId = TABLE_VLAN;
- private int tmacTableId = TABLE_TMAC;
- private int ipv4UnicastTableId = TABLE_IPv4_UNICAST;
- private int mplsTableId = TABLE_MPLS;
- private int aclTableId = TABLE_ACL;
+ protected int vlanTableId = TABLE_VLAN;
+ protected int tmacTableId = TABLE_TMAC;
+ protected int ipv4UnicastTableId = TABLE_IPv4_UNICAST;
+ protected int mplsTableId = TABLE_MPLS;
+ protected int aclTableId = TABLE_ACL;
public OFSwitchImplSpringOpenTTP(OFDescStatsReply desc, boolean usePipeline13) {
super();
@@ -549,7 +549,7 @@
// Utility methods
// *****************************
- void setTableMissEntries() throws IOException {
+ protected void setTableMissEntries() throws IOException {
// set all table-miss-entries
populateTableMissEntry(vlanTableId, true, false, false, -1);
populateTableMissEntry(tmacTableId, true, false, false, -1);
@@ -590,7 +590,7 @@
* @throws IOException
*/
@SuppressWarnings("unchecked")
- private void populateTableMissEntry(int tableToAdd, boolean toControllerNow,
+ protected void populateTableMissEntry(int tableToAdd, boolean toControllerNow,
boolean toControllerWrite,
boolean toTable, int tableToSend) throws IOException {
OFOxmList oxmList = OFOxmList.EMPTY;