lishuai
Committed by Gerrit Code Review

[ONOS-3392] Add L3 interfaces for ClassifierService class.

Change-Id: Ic236452153a8e8c999609893be7ed87538e737d4
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 */ 15 */
16 package org.onosproject.vtn.table; 16 package org.onosproject.vtn.table;
17 17
18 +import org.onlab.packet.IpAddress;
18 import org.onlab.packet.MacAddress; 19 import org.onlab.packet.MacAddress;
19 import org.onosproject.core.ApplicationId; 20 import org.onosproject.core.ApplicationId;
20 import org.onosproject.net.DeviceId; 21 import org.onosproject.net.DeviceId;
...@@ -23,13 +24,13 @@ import org.onosproject.net.flowobjective.Objective; ...@@ -23,13 +24,13 @@ import org.onosproject.net.flowobjective.Objective;
23 import org.onosproject.vtnrsc.SegmentationId; 24 import org.onosproject.vtnrsc.SegmentationId;
24 25
25 /** 26 /**
26 - * Applies classifier flows to the device. 27 + * Applies classifier flows to the device. Classifier table is Table(0).
27 */ 28 */
28 public interface ClassifierService { 29 public interface ClassifierService {
29 30
30 /** 31 /**
31 * The port rule that message from host matches Table(0) Match: host mac and 32 * The port rule that message from host matches Table(0) Match: host mac and
32 - * ingress port Action: set vnid and go to table(50). 33 + * ingress port Action: set vnid and go to L2Forward Table(50).
33 * 34 *
34 * @param deviceId Device Id 35 * @param deviceId Device Id
35 * @param segmentationId the vnid of the host belong to 36 * @param segmentationId the vnid of the host belong to
...@@ -44,7 +45,7 @@ public interface ClassifierService { ...@@ -44,7 +45,7 @@ public interface ClassifierService {
44 45
45 /** 46 /**
46 * The port rule that message from tunnel Table(0) Match: tunnel port and 47 * The port rule that message from tunnel Table(0) Match: tunnel port and
47 - * vnid Action: go to table(50). 48 + * vnid Action: go to L2Forward Table(50).
48 * 49 *
49 * @param deviceId Device Id 50 * @param deviceId Device Id
50 * @param segmentationId the vnid of the host belong to 51 * @param segmentationId the vnid of the host belong to
...@@ -55,4 +56,50 @@ public interface ClassifierService { ...@@ -55,4 +56,50 @@ public interface ClassifierService {
55 Iterable<PortNumber> localTunnelPorts, 56 Iterable<PortNumber> localTunnelPorts,
56 Objective.Operation type); 57 Objective.Operation type);
57 58
59 + /**
60 + * Assemble the L3 Classifier table rules which are sended from external port.
61 + * Match: ipv4 type, ingress port and destination ip.
62 + * Action: go to DNAT Table(20).
63 + *
64 + * @param deviceId Device Id
65 + * @param inPort external port
66 + * @param dstIp floating ip
67 + * @param type the operation type of the flow rules
68 + */
69 + void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
70 + IpAddress dstIp,
71 + Objective.Operation type);
72 +
73 + /**
74 + * Assemble the L3 Classifier table rules which are sended from internal port.
75 + * Match: ingress port, source mac and destination mac.
76 + * Action: set vnid and go to L3Forward Table(30).
77 + *
78 + * @param deviceId Device Id
79 + * @param inPort the ingress port of the host
80 + * @param srcMac source mac
81 + * @param dstMac destination vm gateway mac
82 + * @param actionVni the vni of L3 network
83 + * @param type the operation type of the flow rules
84 + */
85 + void programL3InPortClassifierRules(DeviceId deviceId,
86 + PortNumber inPort, MacAddress srcMac,
87 + MacAddress dstMac,
88 + SegmentationId actionVni,
89 + Objective.Operation type);
90 +
91 + /**
92 + * Assemble the Arp Classifier table rules.
93 + * Match: arp type and destination ip.
94 + * Action: set vnid and go to ARP Table(10).
95 + *
96 + * @param deviceId Device Id
97 + * @param dstIp source gateway ip
98 + * @param actionVni the vni of the source network (l2vni)
99 + * @param type the operation type of the flow rules
100 + */
101 + void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
102 + SegmentationId actionVni,
103 + Objective.Operation type);
104 +
58 } 105 }
......
...@@ -20,6 +20,7 @@ import static org.slf4j.LoggerFactory.getLogger; ...@@ -20,6 +20,7 @@ import static org.slf4j.LoggerFactory.getLogger;
20 20
21 import org.onlab.osgi.DefaultServiceDirectory; 21 import org.onlab.osgi.DefaultServiceDirectory;
22 import org.onlab.osgi.ServiceDirectory; 22 import org.onlab.osgi.ServiceDirectory;
23 +import org.onlab.packet.IpAddress;
23 import org.onlab.packet.MacAddress; 24 import org.onlab.packet.MacAddress;
24 import org.onosproject.core.ApplicationId; 25 import org.onosproject.core.ApplicationId;
25 import org.onosproject.net.DeviceId; 26 import org.onosproject.net.DeviceId;
...@@ -35,6 +36,7 @@ import org.onosproject.net.flowobjective.FlowObjectiveService; ...@@ -35,6 +36,7 @@ import org.onosproject.net.flowobjective.FlowObjectiveService;
35 import org.onosproject.net.flowobjective.ForwardingObjective; 36 import org.onosproject.net.flowobjective.ForwardingObjective;
36 import org.onosproject.net.flowobjective.ForwardingObjective.Flag; 37 import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
37 import org.onosproject.net.flowobjective.Objective; 38 import org.onosproject.net.flowobjective.Objective;
39 +import org.onosproject.net.flowobjective.Objective.Operation;
38 import org.onosproject.vtn.table.ClassifierService; 40 import org.onosproject.vtn.table.ClassifierService;
39 import org.onosproject.vtnrsc.SegmentationId; 41 import org.onosproject.vtnrsc.SegmentationId;
40 import org.slf4j.Logger; 42 import org.slf4j.Logger;
...@@ -117,4 +119,27 @@ public class ClassifierServiceImpl implements ClassifierService { ...@@ -117,4 +119,27 @@ public class ClassifierServiceImpl implements ClassifierService {
117 }); 119 });
118 } 120 }
119 121
122 + @Override
123 + public void programL3ExPortClassifierRules(DeviceId deviceId,
124 + PortNumber exPort,
125 + IpAddress fIp, Operation type) {
126 + // TODO Auto-generated method stub
127 + }
128 +
129 + @Override
130 + public void programL3InPortClassifierRules(DeviceId deviceId,
131 + PortNumber inPort,
132 + MacAddress srcMac,
133 + MacAddress dstVmGwMac,
134 + SegmentationId l3Vni,
135 + Operation type) {
136 + // TODO Auto-generated method stub
137 + }
138 +
139 + @Override
140 + public void programArpClassifierRules(DeviceId deviceId, IpAddress srcGwIp,
141 + SegmentationId srcVni, Operation type) {
142 + // TODO Auto-generated method stub
143 + }
144 +
120 } 145 }
......