Add some more match conditions to connectivity intent CLI commands
Change-Id: I429c34319e8f88bd8899bcee458dc3a60ffcce66
Showing
1 changed file
with
41 additions
and
0 deletions
... | @@ -27,6 +27,7 @@ import org.onlab.onos.net.intent.constraint.BandwidthConstraint; | ... | @@ -27,6 +27,7 @@ import org.onlab.onos.net.intent.constraint.BandwidthConstraint; |
27 | import org.onlab.onos.net.intent.constraint.LambdaConstraint; | 27 | import org.onlab.onos.net.intent.constraint.LambdaConstraint; |
28 | import org.onlab.onos.net.resource.Bandwidth; | 28 | import org.onlab.onos.net.resource.Bandwidth; |
29 | import org.onlab.packet.Ethernet; | 29 | import org.onlab.packet.Ethernet; |
30 | +import org.onlab.packet.IpPrefix; | ||
30 | import org.onlab.packet.MacAddress; | 31 | import org.onlab.packet.MacAddress; |
31 | 32 | ||
32 | import static com.google.common.base.Strings.isNullOrEmpty; | 33 | import static com.google.common.base.Strings.isNullOrEmpty; |
... | @@ -48,6 +49,26 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -48,6 +49,26 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
48 | required = false, multiValued = false) | 49 | required = false, multiValued = false) |
49 | private String ethTypeString = ""; | 50 | private String ethTypeString = ""; |
50 | 51 | ||
52 | + @Option(name = "--ipProto", description = "IP Protocol", | ||
53 | + required = false, multiValued = false) | ||
54 | + private String ipProtoString = null; | ||
55 | + | ||
56 | + @Option(name = "--ipSrc", description = "Source IP Address", | ||
57 | + required = false, multiValued = false) | ||
58 | + private String srcIpString = null; | ||
59 | + | ||
60 | + @Option(name = "--ipDst", description = "Destination IP Address", | ||
61 | + required = false, multiValued = false) | ||
62 | + private String dstIpString = null; | ||
63 | + | ||
64 | + @Option(name = "--tcpSrc", description = "Source TCP Port", | ||
65 | + required = false, multiValued = false) | ||
66 | + private String srcTcpString = null; | ||
67 | + | ||
68 | + @Option(name = "--tcpDst", description = "Destination TCP Port", | ||
69 | + required = false, multiValued = false) | ||
70 | + private String dstTcpString = null; | ||
71 | + | ||
51 | @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth", | 72 | @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth", |
52 | required = false, multiValued = false) | 73 | required = false, multiValued = false) |
53 | private String bandwidthString = ""; | 74 | private String bandwidthString = ""; |
... | @@ -79,6 +100,26 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -79,6 +100,26 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
79 | selectorBuilder.matchEthDst(MacAddress.valueOf(dstMacString)); | 100 | selectorBuilder.matchEthDst(MacAddress.valueOf(dstMacString)); |
80 | } | 101 | } |
81 | 102 | ||
103 | + if (!isNullOrEmpty(ipProtoString)) { | ||
104 | + selectorBuilder.matchIPProtocol((byte) Short.parseShort(ipProtoString)); | ||
105 | + } | ||
106 | + | ||
107 | + if (!isNullOrEmpty(srcIpString)) { | ||
108 | + selectorBuilder.matchIPSrc(IpPrefix.valueOf(srcIpString)); | ||
109 | + } | ||
110 | + | ||
111 | + if (!isNullOrEmpty(dstIpString)) { | ||
112 | + selectorBuilder.matchIPDst(IpPrefix.valueOf(dstIpString)); | ||
113 | + } | ||
114 | + | ||
115 | + if (!isNullOrEmpty(srcTcpString)) { | ||
116 | + selectorBuilder.matchTcpSrc((short) Integer.parseInt(srcTcpString)); | ||
117 | + } | ||
118 | + | ||
119 | + if (!isNullOrEmpty(dstTcpString)) { | ||
120 | + selectorBuilder.matchTcpSrc((short) Integer.parseInt(dstTcpString)); | ||
121 | + } | ||
122 | + | ||
82 | return selectorBuilder.build(); | 123 | return selectorBuilder.build(); |
83 | } | 124 | } |
84 | 125 | ... | ... |
-
Please register or login to post a comment