blob: fb08e2a54bf6e62d8c0d18b4c6e041730e079b9a [file] [log] [blame]
lishuai6c56f5e2015-11-17 16:38:19 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
lishuai6c56f5e2015-11-17 16:38:19 +08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.vtn.table;
17
lishuai7547db42015-11-20 14:56:11 +080018import org.onlab.packet.IpAddress;
Wu wenbinacc10ea2016-05-06 16:48:56 +080019import org.onlab.packet.IpPrefix;
lishuai6c56f5e2015-11-17 16:38:19 +080020import org.onlab.packet.MacAddress;
21import org.onosproject.core.ApplicationId;
22import org.onosproject.net.DeviceId;
Bob zhou59a21062016-05-12 19:40:05 +080023import org.onosproject.net.Port;
lishuai6c56f5e2015-11-17 16:38:19 +080024import org.onosproject.net.PortNumber;
25import org.onosproject.net.flowobjective.Objective;
Bob zhou59a21062016-05-12 19:40:05 +080026import org.onosproject.net.flowobjective.Objective.Operation;
lishuai6c56f5e2015-11-17 16:38:19 +080027import org.onosproject.vtnrsc.SegmentationId;
28
29/**
lishuai7547db42015-11-20 14:56:11 +080030 * Applies classifier flows to the device. Classifier table is Table(0).
lishuai6c56f5e2015-11-17 16:38:19 +080031 */
32public interface ClassifierService {
33
34 /**
35 * The port rule that message from host matches Table(0) Match: host mac and
lishuai7547db42015-11-20 14:56:11 +080036 * ingress port Action: set vnid and go to L2Forward Table(50).
lishuai6c56f5e2015-11-17 16:38:19 +080037 *
38 * @param deviceId Device Id
39 * @param segmentationId the vnid of the host belong to
40 * @param inPort the ingress port of the host
41 * @param srcMac the mac of the host
42 * @param appId the application ID of the vtn
43 * @param type the operation of the flow
44 */
45 void programLocalIn(DeviceId deviceId, SegmentationId segmentationId,
46 PortNumber inPort, MacAddress srcMac,
47 ApplicationId appId, Objective.Operation type);
48
49 /**
50 * The port rule that message from tunnel Table(0) Match: tunnel port and
lishuai7547db42015-11-20 14:56:11 +080051 * vnid Action: go to L2Forward Table(50).
lishuai6c56f5e2015-11-17 16:38:19 +080052 *
53 * @param deviceId Device Id
54 * @param segmentationId the vnid of the host belong to
55 * @param localTunnelPorts the tunnel pors of the device
56 * @param type the operation of the flow
57 */
58 void programTunnelIn(DeviceId deviceId, SegmentationId segmentationId,
59 Iterable<PortNumber> localTunnelPorts,
60 Objective.Operation type);
61
lishuai7547db42015-11-20 14:56:11 +080062 /**
63 * Assemble the L3 Classifier table rules which are sended from external port.
64 * Match: ipv4 type, ingress port and destination ip.
65 * Action: go to DNAT Table(20).
66 *
67 * @param deviceId Device Id
68 * @param inPort external port
69 * @param dstIp floating ip
70 * @param type the operation type of the flow rules
71 */
72 void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
73 IpAddress dstIp,
74 Objective.Operation type);
75
76 /**
77 * Assemble the L3 Classifier table rules which are sended from internal port.
78 * Match: ingress port, source mac and destination mac.
79 * Action: set vnid and go to L3Forward Table(30).
80 *
81 * @param deviceId Device Id
82 * @param inPort the ingress port of the host
83 * @param srcMac source mac
84 * @param dstMac destination vm gateway mac
85 * @param actionVni the vni of L3 network
86 * @param type the operation type of the flow rules
87 */
88 void programL3InPortClassifierRules(DeviceId deviceId,
89 PortNumber inPort, MacAddress srcMac,
90 MacAddress dstMac,
91 SegmentationId actionVni,
92 Objective.Operation type);
93
94 /**
95 * Assemble the Arp Classifier table rules.
96 * Match: arp type and destination ip.
97 * Action: set vnid and go to ARP Table(10).
98 *
99 * @param deviceId Device Id
100 * @param dstIp source gateway ip
101 * @param actionVni the vni of the source network (l2vni)
102 * @param type the operation type of the flow rules
103 */
104 void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
105 SegmentationId actionVni,
106 Objective.Operation type);
107
Wu wenbinacc10ea2016-05-06 16:48:56 +0800108 /**
lishuaicfd96d22016-05-09 16:00:01 +0800109 * Assemble the Arp Classifier table rules.
110 * Match: arp type and destination ip.
111 * Action: set vnid and go to ARP Table(10).
112 *
113 * @param deviceId Device Id
114 * @param inPort the ingress port of the host
115 * @param dstIp source gateway ip
116 * @param actionVni the vni of the source network (l2vni)
117 * @param type the operation type of the flow rules
118 */
119 void programArpClassifierRules(DeviceId deviceId, PortNumber inPort,
120 IpAddress dstIp, SegmentationId actionVni,
121 Objective.Operation type);
122
123 /**
Wu wenbinacc10ea2016-05-06 16:48:56 +0800124 * Assemble the Userdata Classifier table rules.
125 * Match: subnet ip prefix and destination ip.
126 * Action: add flow rule to specific ip for userdata.
127 *
128 * @param deviceId Device Id
129 * @param ipPrefix source ip prefix
130 * @param dstIp userdata ip
131 * @param dstmac dst mac
132 * @param actionVni the vni of the source network (l2vni)
133 * @param type the operation type of the flow rules
134 */
135 void programUserdataClassifierRules(DeviceId deviceId, IpPrefix ipPrefix,
136 IpAddress dstIp, MacAddress dstmac,
137 SegmentationId actionVni,
138 Objective.Operation type);
Bob zhou59a21062016-05-12 19:40:05 +0800139
140 /**
141 * Assemble the export port Arp Classifier table rules.
142 * Match: export port.
143 * Action: upload packet to controller.
144 *
145 * @param exportPort export port of ovs
146 * @param deviceId Device Id
147 * @param type the operation type of the flow rules
148 */
149 void programExportPortArpClassifierRules(Port exportPort, DeviceId deviceId,
150 Operation type);
lishuai6c56f5e2015-11-17 16:38:19 +0800151}