Committed by
Gerrit Code Review
P2P intents have drop treatment if ethSrc&Dst not set
ONOS-1311 Change-Id: I62e4872a16bad29ba14fb74d2dc19cf443131dee
Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -25,6 +25,7 @@ import org.apache.karaf.shell.commands.Option; | ... | @@ -25,6 +25,7 @@ import org.apache.karaf.shell.commands.Option; |
25 | import org.onosproject.cli.AbstractShellCommand; | 25 | import org.onosproject.cli.AbstractShellCommand; |
26 | import org.onosproject.net.Link; | 26 | import org.onosproject.net.Link; |
27 | import org.onosproject.net.flow.DefaultTrafficSelector; | 27 | import org.onosproject.net.flow.DefaultTrafficSelector; |
28 | +import org.onosproject.net.flow.DefaultTrafficTreatment; | ||
28 | import org.onosproject.net.flow.TrafficSelector; | 29 | import org.onosproject.net.flow.TrafficSelector; |
29 | import org.onosproject.net.flow.TrafficTreatment; | 30 | import org.onosproject.net.flow.TrafficTreatment; |
30 | import org.onosproject.net.intent.Constraint; | 31 | import org.onosproject.net.intent.Constraint; |
... | @@ -155,13 +156,19 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -155,13 +156,19 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
155 | * @return traffic treatment | 156 | * @return traffic treatment |
156 | */ | 157 | */ |
157 | protected TrafficTreatment buildTrafficTreatment() { | 158 | protected TrafficTreatment buildTrafficTreatment() { |
158 | - final TrafficTreatment.Builder builder = builder(); | 159 | + boolean hasEthSrc = !isNullOrEmpty(setEthSrcString); |
160 | + boolean hasEthDst = !isNullOrEmpty(setEthDstString); | ||
161 | + | ||
162 | + if (!hasEthSrc && !hasEthDst) { | ||
163 | + return DefaultTrafficTreatment.emptyTreatment(); | ||
164 | + } | ||
159 | 165 | ||
160 | - if (!isNullOrEmpty(setEthSrcString)) { | 166 | + final TrafficTreatment.Builder builder = builder(); |
167 | + if (hasEthSrc) { | ||
161 | final MacAddress setEthSrc = MacAddress.valueOf(setEthSrcString); | 168 | final MacAddress setEthSrc = MacAddress.valueOf(setEthSrcString); |
162 | builder.setEthSrc(setEthSrc); | 169 | builder.setEthSrc(setEthSrc); |
163 | } | 170 | } |
164 | - if (!isNullOrEmpty(setEthDstString)) { | 171 | + if (hasEthDst) { |
165 | final MacAddress setEthDst = MacAddress.valueOf(setEthDstString); | 172 | final MacAddress setEthDst = MacAddress.valueOf(setEthDstString); |
166 | builder.setEthDst(setEthDst); | 173 | builder.setEthDst(setEthDst); |
167 | } | 174 | } | ... | ... |
-
Please register or login to post a comment