blob: 75df9b0a9e032ff4df40745f5836dc76f0eef966 [file] [log] [blame]
lishuai6c56f5e2015-11-17 16:38:19 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
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;
23import org.onosproject.net.PortNumber;
24import org.onosproject.net.flowobjective.Objective;
25import org.onosproject.vtnrsc.SegmentationId;
26
27/**
lishuai7547db42015-11-20 14:56:11 +080028 * Applies classifier flows to the device. Classifier table is Table(0).
lishuai6c56f5e2015-11-17 16:38:19 +080029 */
30public interface ClassifierService {
31
32 /**
33 * The port rule that message from host matches Table(0) Match: host mac and
lishuai7547db42015-11-20 14:56:11 +080034 * ingress port Action: set vnid and go to L2Forward Table(50).
lishuai6c56f5e2015-11-17 16:38:19 +080035 *
36 * @param deviceId Device Id
37 * @param segmentationId the vnid of the host belong to
38 * @param inPort the ingress port of the host
39 * @param srcMac the mac of the host
40 * @param appId the application ID of the vtn
41 * @param type the operation of the flow
42 */
43 void programLocalIn(DeviceId deviceId, SegmentationId segmentationId,
44 PortNumber inPort, MacAddress srcMac,
45 ApplicationId appId, Objective.Operation type);
46
47 /**
48 * The port rule that message from tunnel Table(0) Match: tunnel port and
lishuai7547db42015-11-20 14:56:11 +080049 * vnid Action: go to L2Forward Table(50).
lishuai6c56f5e2015-11-17 16:38:19 +080050 *
51 * @param deviceId Device Id
52 * @param segmentationId the vnid of the host belong to
53 * @param localTunnelPorts the tunnel pors of the device
54 * @param type the operation of the flow
55 */
56 void programTunnelIn(DeviceId deviceId, SegmentationId segmentationId,
57 Iterable<PortNumber> localTunnelPorts,
58 Objective.Operation type);
59
lishuai7547db42015-11-20 14:56:11 +080060 /**
61 * Assemble the L3 Classifier table rules which are sended from external port.
62 * Match: ipv4 type, ingress port and destination ip.
63 * Action: go to DNAT Table(20).
64 *
65 * @param deviceId Device Id
66 * @param inPort external port
67 * @param dstIp floating ip
68 * @param type the operation type of the flow rules
69 */
70 void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
71 IpAddress dstIp,
72 Objective.Operation type);
73
74 /**
75 * Assemble the L3 Classifier table rules which are sended from internal port.
76 * Match: ingress port, source mac and destination mac.
77 * Action: set vnid and go to L3Forward Table(30).
78 *
79 * @param deviceId Device Id
80 * @param inPort the ingress port of the host
81 * @param srcMac source mac
82 * @param dstMac destination vm gateway mac
83 * @param actionVni the vni of L3 network
84 * @param type the operation type of the flow rules
85 */
86 void programL3InPortClassifierRules(DeviceId deviceId,
87 PortNumber inPort, MacAddress srcMac,
88 MacAddress dstMac,
89 SegmentationId actionVni,
90 Objective.Operation type);
91
92 /**
93 * Assemble the Arp Classifier table rules.
94 * Match: arp type and destination ip.
95 * Action: set vnid and go to ARP Table(10).
96 *
97 * @param deviceId Device Id
98 * @param dstIp source gateway ip
99 * @param actionVni the vni of the source network (l2vni)
100 * @param type the operation type of the flow rules
101 */
102 void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
103 SegmentationId actionVni,
104 Objective.Operation type);
105
Wu wenbinacc10ea2016-05-06 16:48:56 +0800106 /**
lishuaicfd96d22016-05-09 16:00:01 +0800107 * Assemble the Arp Classifier table rules.
108 * Match: arp type and destination ip.
109 * Action: set vnid and go to ARP Table(10).
110 *
111 * @param deviceId Device Id
112 * @param inPort the ingress port of the host
113 * @param dstIp source gateway ip
114 * @param actionVni the vni of the source network (l2vni)
115 * @param type the operation type of the flow rules
116 */
117 void programArpClassifierRules(DeviceId deviceId, PortNumber inPort,
118 IpAddress dstIp, SegmentationId actionVni,
119 Objective.Operation type);
120
121 /**
Wu wenbinacc10ea2016-05-06 16:48:56 +0800122 * Assemble the Userdata Classifier table rules.
123 * Match: subnet ip prefix and destination ip.
124 * Action: add flow rule to specific ip for userdata.
125 *
126 * @param deviceId Device Id
127 * @param ipPrefix source ip prefix
128 * @param dstIp userdata ip
129 * @param dstmac dst mac
130 * @param actionVni the vni of the source network (l2vni)
131 * @param type the operation type of the flow rules
132 */
133 void programUserdataClassifierRules(DeviceId deviceId, IpPrefix ipPrefix,
134 IpAddress dstIp, MacAddress dstmac,
135 SegmentationId actionVni,
136 Objective.Operation type);
lishuai6c56f5e2015-11-17 16:38:19 +0800137}