Committed by
Gerrit Code Review
[ONOS-3804] [ONOS-3805] Initial L3 flowrules setup for Compute/Gateway nodes and…
… PNAT Handler for OpenstackRouting - Performs app refactoring (openstackrouting and openstackswitching) - Implements L3 REST call corresponding openstackRouter and openstackRouterInterface. - Implements initail L3 rules population to compute/gateway node. - Implements PNAT rules population corresponding packet-in event. - Fixs comments and javadocs. - Rebases on master. Change-Id: I5ad68810f50dc977737d30c43150c892b978b7cb
Showing
19 changed files
with
234 additions
and
1182 deletions
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.openstacknetworking; | 16 | package org.onosproject.openstacknetworking; |
17 | 17 | ||
18 | +import com.google.common.collect.ImmutableMap; | ||
18 | import com.google.common.collect.Maps; | 19 | import com.google.common.collect.Maps; |
19 | import org.onlab.packet.Ip4Address; | 20 | import org.onlab.packet.Ip4Address; |
20 | import java.util.Map; | 21 | import java.util.Map; |
... | @@ -60,7 +61,7 @@ public final class OpenstackExternalGateway { | ... | @@ -60,7 +61,7 @@ public final class OpenstackExternalGateway { |
60 | * @return External fixed IP informations | 61 | * @return External fixed IP informations |
61 | */ | 62 | */ |
62 | public Map<String, Ip4Address> externalFixedIps() { | 63 | public Map<String, Ip4Address> externalFixedIps() { |
63 | - return externalFixedIps; | 64 | + return ImmutableMap.copyOf(externalFixedIps); |
64 | } | 65 | } |
65 | 66 | ||
66 | @Override | 67 | @Override |
... | @@ -137,7 +138,7 @@ public final class OpenstackExternalGateway { | ... | @@ -137,7 +138,7 @@ public final class OpenstackExternalGateway { |
137 | * @return OpenstackExternalGateway object | 138 | * @return OpenstackExternalGateway object |
138 | */ | 139 | */ |
139 | public OpenstackExternalGateway build() { | 140 | public OpenstackExternalGateway build() { |
140 | - return new OpenstackExternalGateway(networkId, enablePnat, externalFixedIps); | 141 | + return new OpenstackExternalGateway(networkId, enablePnat, ImmutableMap.copyOf(externalFixedIps)); |
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ... | ... |
... | @@ -19,12 +19,14 @@ import org.onlab.packet.Ip4Address; | ... | @@ -19,12 +19,14 @@ import org.onlab.packet.Ip4Address; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
23 | + | ||
22 | /** | 24 | /** |
23 | * An Openstack Neutron Floating IP Model. | 25 | * An Openstack Neutron Floating IP Model. |
24 | */ | 26 | */ |
25 | public final class OpenstackFloatingIP { | 27 | public final class OpenstackFloatingIP { |
26 | 28 | ||
27 | - public enum FloatingIPStatus { | 29 | + public enum FloatingIpStatus { |
28 | UP, | 30 | UP, |
29 | DOWN, | 31 | DOWN, |
30 | ACTIVE, | 32 | ACTIVE, |
... | @@ -33,13 +35,13 @@ public final class OpenstackFloatingIP { | ... | @@ -33,13 +35,13 @@ public final class OpenstackFloatingIP { |
33 | private final String tenantId; | 35 | private final String tenantId; |
34 | private final String networkId; | 36 | private final String networkId; |
35 | private final Ip4Address fixedIpAddress; | 37 | private final Ip4Address fixedIpAddress; |
36 | - private final String portId; | 38 | + private String portId; |
37 | - private final String routerId; | 39 | + private String routerId; |
38 | private final String id; | 40 | private final String id; |
39 | private final Ip4Address floatingIpAddress; | 41 | private final Ip4Address floatingIpAddress; |
40 | - private final FloatingIPStatus status; | 42 | + private final FloatingIpStatus status; |
41 | 43 | ||
42 | - private OpenstackFloatingIP(FloatingIPStatus status, String id, String tenantId, | 44 | + private OpenstackFloatingIP(FloatingIpStatus status, String id, String tenantId, |
43 | String networkId, Ip4Address fixedIpAddress, String portId, | 45 | String networkId, Ip4Address fixedIpAddress, String portId, |
44 | String routerId, Ip4Address floatingIpAddress) { | 46 | String routerId, Ip4Address floatingIpAddress) { |
45 | this.status = status; | 47 | this.status = status; |
... | @@ -57,7 +59,7 @@ public final class OpenstackFloatingIP { | ... | @@ -57,7 +59,7 @@ public final class OpenstackFloatingIP { |
57 | * | 59 | * |
58 | * @return floating IP status | 60 | * @return floating IP status |
59 | */ | 61 | */ |
60 | - public FloatingIPStatus status() { | 62 | + public FloatingIpStatus status() { |
61 | return status; | 63 | return status; |
62 | } | 64 | } |
63 | 65 | ||
... | @@ -107,6 +109,15 @@ public final class OpenstackFloatingIP { | ... | @@ -107,6 +109,15 @@ public final class OpenstackFloatingIP { |
107 | } | 109 | } |
108 | 110 | ||
109 | /** | 111 | /** |
112 | + * Updates port ID. | ||
113 | + * | ||
114 | + * @param portId Updated port ID | ||
115 | + */ | ||
116 | + public void updatePortId(String portId) { | ||
117 | + this.portId = portId; | ||
118 | + } | ||
119 | + | ||
120 | + /** | ||
110 | * Returns router ID. | 121 | * Returns router ID. |
111 | * | 122 | * |
112 | * @return router ID | 123 | * @return router ID |
... | @@ -116,6 +127,15 @@ public final class OpenstackFloatingIP { | ... | @@ -116,6 +127,15 @@ public final class OpenstackFloatingIP { |
116 | } | 127 | } |
117 | 128 | ||
118 | /** | 129 | /** |
130 | + * Updates router ID. | ||
131 | + * | ||
132 | + * @param routerId Updated router ID | ||
133 | + */ | ||
134 | + public void updateRouterId(String routerId) { | ||
135 | + this.routerId = routerId; | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
119 | * Returns floating IP address. | 139 | * Returns floating IP address. |
120 | * | 140 | * |
121 | * @return Floating IP address | 141 | * @return Floating IP address |
... | @@ -162,7 +182,7 @@ public final class OpenstackFloatingIP { | ... | @@ -162,7 +182,7 @@ public final class OpenstackFloatingIP { |
162 | private String routerId; | 182 | private String routerId; |
163 | private String id; | 183 | private String id; |
164 | private Ip4Address floatingIpAddress; | 184 | private Ip4Address floatingIpAddress; |
165 | - private FloatingIPStatus status; | 185 | + private FloatingIpStatus status; |
166 | 186 | ||
167 | /** | 187 | /** |
168 | * Sets tenant ID. | 188 | * Sets tenant ID. |
... | @@ -181,7 +201,7 @@ public final class OpenstackFloatingIP { | ... | @@ -181,7 +201,7 @@ public final class OpenstackFloatingIP { |
181 | * @param status Floating IP status | 201 | * @param status Floating IP status |
182 | * @return Builder object | 202 | * @return Builder object |
183 | */ | 203 | */ |
184 | - public Builder status(FloatingIPStatus status) { | 204 | + public Builder status(FloatingIpStatus status) { |
185 | this.status = status; | 205 | this.status = status; |
186 | return this; | 206 | return this; |
187 | } | 207 | } |
... | @@ -258,8 +278,9 @@ public final class OpenstackFloatingIP { | ... | @@ -258,8 +278,9 @@ public final class OpenstackFloatingIP { |
258 | * @return OpenstackFloatingIP object | 278 | * @return OpenstackFloatingIP object |
259 | */ | 279 | */ |
260 | public OpenstackFloatingIP build() { | 280 | public OpenstackFloatingIP build() { |
261 | - return new OpenstackFloatingIP(status, id, tenantId, networkId, | 281 | + return new OpenstackFloatingIP(checkNotNull(status), checkNotNull(id), checkNotNull(tenantId), |
262 | - fixedIpAddress, portId, routerId, floatingIpAddress); | 282 | + checkNotNull(networkId), fixedIpAddress, portId, |
283 | + routerId, checkNotNull(floatingIpAddress)); | ||
263 | 284 | ||
264 | } | 285 | } |
265 | } | 286 | } | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.openstacknetworking; | 16 | package org.onosproject.openstacknetworking; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * An Openstack Neutron Router Model. | 22 | * An Openstack Neutron Router Model. |
... | @@ -31,9 +32,9 @@ public final class OpenstackRouter { | ... | @@ -31,9 +32,9 @@ public final class OpenstackRouter { |
31 | private final String tenantId; | 32 | private final String tenantId; |
32 | private final String id; | 33 | private final String id; |
33 | private final String name; | 34 | private final String name; |
34 | - private final RouterStatus status; | 35 | + private RouterStatus status; |
35 | - private final boolean adminStateUp; | 36 | + private boolean adminStateUp; |
36 | - private final OpenstackExternalGateway gatewayExternalInfo; | 37 | + private OpenstackExternalGateway gatewayExternalInfo; |
37 | 38 | ||
38 | private OpenstackRouter(String id, String tenantId, String name, RouterStatus status, | 39 | private OpenstackRouter(String id, String tenantId, String name, RouterStatus status, |
39 | boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) { | 40 | boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) { |
... | @@ -209,8 +210,8 @@ public final class OpenstackRouter { | ... | @@ -209,8 +210,8 @@ public final class OpenstackRouter { |
209 | * @return OpenstasckRouter object | 210 | * @return OpenstasckRouter object |
210 | */ | 211 | */ |
211 | public OpenstackRouter build() { | 212 | public OpenstackRouter build() { |
212 | - return new OpenstackRouter(id, tenantId, name, status, | 213 | + return new OpenstackRouter(checkNotNull(id), checkNotNull(tenantId), name, checkNotNull(status), |
213 | - adminStateUp, gatewayExternalInfo); | 214 | + checkNotNull(adminStateUp), gatewayExternalInfo); |
214 | } | 215 | } |
215 | } | 216 | } |
216 | 217 | ... | ... |
... | @@ -99,12 +99,12 @@ public final class OpenstackRouterInterface { | ... | @@ -99,12 +99,12 @@ public final class OpenstackRouterInterface { |
99 | * An Openstack Router Interface Builder class. | 99 | * An Openstack Router Interface Builder class. |
100 | */ | 100 | */ |
101 | public static final class Builder { | 101 | public static final class Builder { |
102 | - private String id; | 102 | + private String id; |
103 | - private String tenantId; | 103 | + private String tenantId; |
104 | - private String subnetId; | 104 | + private String subnetId; |
105 | - private String portId; | 105 | + private String portId; |
106 | 106 | ||
107 | - /** | 107 | + /** |
108 | * Sets Router Interface ID. | 108 | * Sets Router Interface ID. |
109 | * | 109 | * |
110 | * @param id router interface ID | 110 | * @param id router interface ID |
... | @@ -148,14 +148,14 @@ public final class OpenstackRouterInterface { | ... | @@ -148,14 +148,14 @@ public final class OpenstackRouterInterface { |
148 | return this; | 148 | return this; |
149 | } | 149 | } |
150 | 150 | ||
151 | - | ||
152 | /** | 151 | /** |
153 | * Builds an Openstack Router Interface object. | 152 | * Builds an Openstack Router Interface object. |
154 | * | 153 | * |
155 | * @return OpenstackRouterInterface object | 154 | * @return OpenstackRouterInterface object |
156 | */ | 155 | */ |
157 | public OpenstackRouterInterface build() { | 156 | public OpenstackRouterInterface build() { |
158 | - return new OpenstackRouterInterface(id, tenantId, subnetId, portId); | 157 | + return new OpenstackRouterInterface(checkNotNull(id), checkNotNull(tenantId), |
158 | + checkNotNull(subnetId), checkNotNull(portId)); | ||
159 | } | 159 | } |
160 | 160 | ||
161 | } | 161 | } | ... | ... |
... | @@ -17,24 +17,29 @@ package org.onosproject.openstacknetworking.routing; | ... | @@ -17,24 +17,29 @@ package org.onosproject.openstacknetworking.routing; |
17 | 17 | ||
18 | import org.onlab.packet.Ethernet; | 18 | import org.onlab.packet.Ethernet; |
19 | import org.onlab.packet.IPv4; | 19 | import org.onlab.packet.IPv4; |
20 | +import org.onlab.packet.Ip4Address; | ||
20 | import org.onlab.packet.MacAddress; | 21 | import org.onlab.packet.MacAddress; |
21 | import org.onlab.packet.TCP; | 22 | import org.onlab.packet.TCP; |
22 | import org.onlab.packet.UDP; | 23 | import org.onlab.packet.UDP; |
23 | import org.onosproject.net.DeviceId; | 24 | import org.onosproject.net.DeviceId; |
24 | -import org.onosproject.net.PortNumber; | 25 | +import org.onosproject.net.Port; |
25 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 26 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
26 | import org.onosproject.net.flow.TrafficTreatment; | 27 | import org.onosproject.net.flow.TrafficTreatment; |
27 | import org.onosproject.net.packet.DefaultOutboundPacket; | 28 | import org.onosproject.net.packet.DefaultOutboundPacket; |
28 | import org.onosproject.net.packet.InboundPacket; | 29 | import org.onosproject.net.packet.InboundPacket; |
29 | import org.onosproject.net.packet.PacketContext; | 30 | import org.onosproject.net.packet.PacketContext; |
30 | import org.onosproject.net.packet.PacketService; | 31 | import org.onosproject.net.packet.PacketService; |
32 | +import org.onosproject.openstacknetworking.OpenstackNetwork; | ||
33 | +import org.onosproject.openstacknetworking.OpenstackNetworkingService; | ||
31 | import org.onosproject.openstacknetworking.OpenstackPort; | 34 | import org.onosproject.openstacknetworking.OpenstackPort; |
35 | +import org.onosproject.openstacknetworking.OpenstackRouter; | ||
32 | import org.slf4j.Logger; | 36 | import org.slf4j.Logger; |
33 | import org.slf4j.LoggerFactory; | 37 | import org.slf4j.LoggerFactory; |
34 | 38 | ||
35 | import java.nio.ByteBuffer; | 39 | import java.nio.ByteBuffer; |
36 | 40 | ||
37 | import static com.google.common.base.Preconditions.checkNotNull; | 41 | import static com.google.common.base.Preconditions.checkNotNull; |
42 | +import static org.onlab.osgi.DefaultServiceDirectory.getService; | ||
38 | 43 | ||
39 | 44 | ||
40 | /** | 45 | /** |
... | @@ -50,13 +55,20 @@ public class OpenstackPnatHandler implements Runnable { | ... | @@ -50,13 +55,20 @@ public class OpenstackPnatHandler implements Runnable { |
50 | private final OpenstackRoutingRulePopulator rulePopulator; | 55 | private final OpenstackRoutingRulePopulator rulePopulator; |
51 | private final int portNum; | 56 | private final int portNum; |
52 | private final OpenstackPort openstackPort; | 57 | private final OpenstackPort openstackPort; |
58 | + private final Port port; | ||
59 | + | ||
60 | + private static final String DEVICE_OWNER_ROUTER_INTERFACE = "network:router_interface"; | ||
61 | + // TODO: This will be replaced to get the information from openstacknetworkingservice. | ||
62 | + private static final MacAddress GATEWAYMAC = MacAddress.valueOf("1f:1f:1f:1f:1f:1f"); | ||
63 | + private static final MacAddress EXTERNAL_INTERFACE_MAC = MacAddress.valueOf("00:00:00:00:00:11"); | ||
53 | 64 | ||
54 | OpenstackPnatHandler(OpenstackRoutingRulePopulator rulePopulator, PacketContext context, | 65 | OpenstackPnatHandler(OpenstackRoutingRulePopulator rulePopulator, PacketContext context, |
55 | - int portNum, OpenstackPort openstackPort) { | 66 | + int portNum, OpenstackPort openstackPort, Port port) { |
56 | this.rulePopulator = checkNotNull(rulePopulator); | 67 | this.rulePopulator = checkNotNull(rulePopulator); |
57 | this.context = checkNotNull(context); | 68 | this.context = checkNotNull(context); |
58 | this.portNum = checkNotNull(portNum); | 69 | this.portNum = checkNotNull(portNum); |
59 | this.openstackPort = checkNotNull(openstackPort); | 70 | this.openstackPort = checkNotNull(openstackPort); |
71 | + this.port = checkNotNull(port); | ||
60 | } | 72 | } |
61 | 73 | ||
62 | @Override | 74 | @Override |
... | @@ -70,14 +82,41 @@ public class OpenstackPnatHandler implements Runnable { | ... | @@ -70,14 +82,41 @@ public class OpenstackPnatHandler implements Runnable { |
70 | return; | 82 | return; |
71 | } | 83 | } |
72 | 84 | ||
73 | - packetOut(inboundPacket, portNum); | 85 | + OpenstackRouter router = getOpenstackRouter(openstackPort); |
74 | 86 | ||
75 | rulePopulator.populatePnatFlowRules(inboundPacket, openstackPort, portNum, | 87 | rulePopulator.populatePnatFlowRules(inboundPacket, openstackPort, portNum, |
76 | - getExternalInterfaceMacAddress(), getExternalRouterMacAddress()); | 88 | + getExternalIp(router), getExternalInterfaceMacAddress(), getExternalRouterMacAddress()); |
89 | + | ||
90 | + packetOut((Ethernet) ethernet.clone(), inboundPacket.receivedFrom().deviceId(), portNum, router); | ||
77 | } | 91 | } |
78 | 92 | ||
79 | - private void packetOut(InboundPacket inboundPacket, int portNum) { | 93 | + private OpenstackRouter getOpenstackRouter(OpenstackPort openstackPort) { |
80 | - Ethernet ethernet = checkNotNull(inboundPacket.parsed()); | 94 | + OpenstackNetworkingService networkingService = getService(OpenstackNetworkingService.class); |
95 | + OpenstackNetwork network = networkingService.network(openstackPort.networkId()); | ||
96 | + | ||
97 | + OpenstackPort port = networkingService.ports() | ||
98 | + .stream() | ||
99 | + .filter(p -> p.deviceOwner().equals(DEVICE_OWNER_ROUTER_INTERFACE)) | ||
100 | + .filter(p -> checkSameSubnet(p, openstackPort)) | ||
101 | + .findAny() | ||
102 | + .orElse(null); | ||
103 | + | ||
104 | + return checkNotNull(networkingService.router(port.deviceId())); | ||
105 | + } | ||
106 | + | ||
107 | + private boolean checkSameSubnet(OpenstackPort p, OpenstackPort openstackPort) { | ||
108 | + String key1 = checkNotNull(p.fixedIps().keySet().stream().findFirst().orElse(null)).toString(); | ||
109 | + String key2 = checkNotNull(openstackPort.fixedIps().keySet().stream().findFirst().orElse(null)).toString(); | ||
110 | + return key1.equals(key2) ? true : false; | ||
111 | + } | ||
112 | + | ||
113 | + private Ip4Address getExternalIp(OpenstackRouter router) { | ||
114 | + return router.gatewayExternalInfo().externalFixedIps().values().stream().findAny().orElse(null); | ||
115 | + } | ||
116 | + | ||
117 | + private void packetOut(Ethernet ethernet, DeviceId deviceId, int portNum, OpenstackRouter router) { | ||
118 | + PacketService packetService = getService(PacketService.class); | ||
119 | + | ||
81 | IPv4 iPacket = (IPv4) ethernet.getPayload(); | 120 | IPv4 iPacket = (IPv4) ethernet.getPayload(); |
82 | 121 | ||
83 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); | 122 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); |
... | @@ -98,31 +137,27 @@ public class OpenstackPnatHandler implements Runnable { | ... | @@ -98,31 +137,27 @@ public class OpenstackPnatHandler implements Runnable { |
98 | iPacket.setPayload(udpPacket); | 137 | iPacket.setPayload(udpPacket); |
99 | break; | 138 | break; |
100 | default: | 139 | default: |
101 | - break; | 140 | + log.error("Temporally, this method can process UDP and TCP protocol."); |
141 | + return; | ||
102 | } | 142 | } |
103 | 143 | ||
144 | + iPacket.setSourceAddress(getExternalIp(router).toString()); | ||
104 | iPacket.resetChecksum(); | 145 | iPacket.resetChecksum(); |
105 | - iPacket.setPayload(ethernet); | 146 | + iPacket.setParent(ethernet); |
106 | ethernet.setSourceMACAddress(getExternalInterfaceMacAddress()) | 147 | ethernet.setSourceMACAddress(getExternalInterfaceMacAddress()) |
107 | .setDestinationMACAddress(getExternalRouterMacAddress()); | 148 | .setDestinationMACAddress(getExternalRouterMacAddress()); |
108 | ethernet.resetChecksum(); | 149 | ethernet.resetChecksum(); |
109 | 150 | ||
110 | - treatment.setOutput(getExternalPort(inboundPacket.receivedFrom().deviceId())); | 151 | + treatment.setOutput(port.number()); |
111 | 152 | ||
112 | - packetService.emit(new DefaultOutboundPacket(inboundPacket.receivedFrom().deviceId(), | 153 | + packetService.emit(new DefaultOutboundPacket(deviceId, treatment.build(), |
113 | - treatment.build(), ByteBuffer.wrap(ethernet.serialize()))); | 154 | + ByteBuffer.wrap(ethernet.serialize()))); |
114 | } | 155 | } |
115 | 156 | ||
116 | - private PortNumber getExternalPort(DeviceId deviceId) { | ||
117 | - // TODO | ||
118 | - return null; | ||
119 | - } | ||
120 | private MacAddress getExternalInterfaceMacAddress() { | 157 | private MacAddress getExternalInterfaceMacAddress() { |
121 | - // TODO | 158 | + return EXTERNAL_INTERFACE_MAC; |
122 | - return null; | ||
123 | } | 159 | } |
124 | private MacAddress getExternalRouterMacAddress() { | 160 | private MacAddress getExternalRouterMacAddress() { |
125 | - // TODO | 161 | + return GATEWAYMAC; |
126 | - return null; | ||
127 | } | 162 | } |
128 | } | 163 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -29,6 +29,8 @@ import org.onlab.packet.Ip4Address; | ... | @@ -29,6 +29,8 @@ import org.onlab.packet.Ip4Address; |
29 | import org.onlab.packet.MacAddress; | 29 | import org.onlab.packet.MacAddress; |
30 | import org.onosproject.core.ApplicationId; | 30 | import org.onosproject.core.ApplicationId; |
31 | import org.onosproject.core.CoreService; | 31 | import org.onosproject.core.CoreService; |
32 | +import org.onosproject.net.DeviceId; | ||
33 | +import org.onosproject.net.Port; | ||
32 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
33 | import org.onosproject.net.driver.DriverService; | 35 | import org.onosproject.net.driver.DriverService; |
34 | import org.onosproject.net.flowobjective.FlowObjectiveService; | 36 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
... | @@ -55,14 +57,14 @@ import java.util.stream.Collectors; | ... | @@ -55,14 +57,14 @@ import java.util.stream.Collectors; |
55 | import static com.google.common.base.Preconditions.checkNotNull; | 57 | import static com.google.common.base.Preconditions.checkNotNull; |
56 | import static org.onlab.util.Tools.groupedThreads; | 58 | import static org.onlab.util.Tools.groupedThreads; |
57 | 59 | ||
58 | -@Service | ||
59 | @Component(immediate = true) | 60 | @Component(immediate = true) |
61 | +@Service | ||
60 | /** | 62 | /** |
61 | * Populates flow rules about L3 functionality for VMs in Openstack. | 63 | * Populates flow rules about L3 functionality for VMs in Openstack. |
62 | */ | 64 | */ |
63 | public class OpenstackRoutingManager implements OpenstackRoutingService { | 65 | public class OpenstackRoutingManager implements OpenstackRoutingService { |
64 | - private final Logger log = LoggerFactory | 66 | + |
65 | - .getLogger(getClass()); | 67 | + private final Logger log = LoggerFactory.getLogger(getClass()); |
66 | 68 | ||
67 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 69 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
68 | protected CoreService coreService; | 70 | protected CoreService coreService; |
... | @@ -86,6 +88,12 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -86,6 +88,12 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
86 | private Map<String, OpenstackRouterInterface> routerInterfaceMap = Maps.newHashMap(); | 88 | private Map<String, OpenstackRouterInterface> routerInterfaceMap = Maps.newHashMap(); |
87 | private Map<Integer, String> portNumMap = initPortNumMap(); | 89 | private Map<Integer, String> portNumMap = initPortNumMap(); |
88 | private static final String APP_ID = "org.onosproject.openstackrouting"; | 90 | private static final String APP_ID = "org.onosproject.openstackrouting"; |
91 | + private static final String PORT_NAME = "portName"; | ||
92 | + private static final String DEVICE_OWNER_ROUTER_INTERFACE = "network:router_interface"; | ||
93 | + | ||
94 | + // TODO: This will be replaced to get the information from openstackswitchingservice. | ||
95 | + private static final String EXTERNAL_INTERFACE_NAME = "veth0"; | ||
96 | + | ||
89 | private Map<Integer, String> initPortNumMap() { | 97 | private Map<Integer, String> initPortNumMap() { |
90 | Map<Integer, String> map = Maps.newHashMap(); | 98 | Map<Integer, String> map = Maps.newHashMap(); |
91 | for (int i = 1024; i < 65535; i++) { | 99 | for (int i = 1024; i < 65535; i++) { |
... | @@ -104,7 +112,7 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -104,7 +112,7 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
104 | protected void activate() { | 112 | protected void activate() { |
105 | appId = coreService.registerApplication(APP_ID); | 113 | appId = coreService.registerApplication(APP_ID); |
106 | packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); | 114 | packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); |
107 | - | 115 | + reloadInitL3Rules(); |
108 | log.info("onos-openstackrouting started"); | 116 | log.info("onos-openstackrouting started"); |
109 | } | 117 | } |
110 | 118 | ||
... | @@ -150,7 +158,7 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -150,7 +158,7 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
150 | routerInterfaceMap.putIfAbsent(routerInterface.portId(), routerInterface); | 158 | routerInterfaceMap.putIfAbsent(routerInterface.portId(), routerInterface); |
151 | List<OpenstackRouterInterface> routerInterfaces = Lists.newArrayList(); | 159 | List<OpenstackRouterInterface> routerInterfaces = Lists.newArrayList(); |
152 | routerInterfaces.add(routerInterface); | 160 | routerInterfaces.add(routerInterface); |
153 | - checkExternalConnection(getOpenstackRouter(routerInterface.tenantId()), routerInterfaces); | 161 | + checkExternalConnection(getOpenstackRouter(routerInterface.portId()), routerInterfaces); |
154 | } | 162 | } |
155 | 163 | ||
156 | @Override | 164 | @Override |
... | @@ -160,6 +168,27 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -160,6 +168,27 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
160 | rulePopulator.removeExternalRules(routerInterface); | 168 | rulePopulator.removeExternalRules(routerInterface); |
161 | routerInterfaceMap.remove(routerInterface.portId()); | 169 | routerInterfaceMap.remove(routerInterface.portId()); |
162 | } | 170 | } |
171 | + | ||
172 | + private void reloadInitL3Rules() { | ||
173 | + openstackService.ports() | ||
174 | + .stream() | ||
175 | + .filter(p -> p.deviceOwner().equals(DEVICE_OWNER_ROUTER_INTERFACE)) | ||
176 | + .forEach(p -> { | ||
177 | + OpenstackRouterInterface routerInterface = portToRouterInterface(p); | ||
178 | + updateRouterInterface(routerInterface); | ||
179 | + }); | ||
180 | + } | ||
181 | + | ||
182 | + private OpenstackRouterInterface portToRouterInterface(OpenstackPort p) { | ||
183 | + OpenstackRouterInterface.Builder osBuilder = new OpenstackRouterInterface.Builder() | ||
184 | + .id(checkNotNull(p.id())) | ||
185 | + .tenantId(checkNotNull(openstackService.network(p.networkId()).tenantId())) | ||
186 | + .subnetId(checkNotNull(p.fixedIps().keySet().stream().findFirst().orElse(null)).toString()) | ||
187 | + .portId(checkNotNull(p.deviceId())); | ||
188 | + | ||
189 | + return osBuilder.build(); | ||
190 | + } | ||
191 | + | ||
163 | private class InternalPacketProcessor implements PacketProcessor { | 192 | private class InternalPacketProcessor implements PacketProcessor { |
164 | 193 | ||
165 | @Override | 194 | @Override |
... | @@ -183,10 +212,15 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -183,10 +212,15 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
183 | break; | 212 | break; |
184 | default: | 213 | default: |
185 | int portNum = getPortNum(ethernet.getSourceMAC(), iPacket.getDestinationAddress()); | 214 | int portNum = getPortNum(ethernet.getSourceMAC(), iPacket.getDestinationAddress()); |
215 | + Port port = getExternalPort(pkt.receivedFrom().deviceId(), EXTERNAL_INTERFACE_NAME); | ||
216 | + if (port == null) { | ||
217 | + log.warn("There`s no external interface"); | ||
218 | + break; | ||
219 | + } | ||
186 | OpenstackPort openstackPort = getOpenstackPort(ethernet.getSourceMAC(), | 220 | OpenstackPort openstackPort = getOpenstackPort(ethernet.getSourceMAC(), |
187 | Ip4Address.valueOf(iPacket.getSourceAddress())); | 221 | Ip4Address.valueOf(iPacket.getSourceAddress())); |
188 | l3EventExecutorService.execute(new OpenstackPnatHandler(rulePopulator, context, | 222 | l3EventExecutorService.execute(new OpenstackPnatHandler(rulePopulator, context, |
189 | - portNum, openstackPort)); | 223 | + portNum, openstackPort, port)); |
190 | break; | 224 | break; |
191 | } | 225 | } |
192 | 226 | ||
... | @@ -201,24 +235,30 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -201,24 +235,30 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
201 | } | 235 | } |
202 | } | 236 | } |
203 | 237 | ||
238 | + private Port getExternalPort(DeviceId deviceId, String interfaceName) { | ||
239 | + return deviceService.getPorts(deviceId) | ||
240 | + .stream() | ||
241 | + .filter(p -> p.annotations().value(PORT_NAME).equals(interfaceName)) | ||
242 | + .findAny() | ||
243 | + .orElse(null); | ||
244 | + } | ||
245 | + | ||
204 | private void checkExternalConnection(OpenstackRouter router, | 246 | private void checkExternalConnection(OpenstackRouter router, |
205 | Collection<OpenstackRouterInterface> routerInterfaces) { | 247 | Collection<OpenstackRouterInterface> routerInterfaces) { |
206 | checkNotNull(router, "Router can not be null"); | 248 | checkNotNull(router, "Router can not be null"); |
207 | - checkNotNull(routerInterfaces, "RouterInterfaces can not be null"); | 249 | + checkNotNull(routerInterfaces, "routerInterfaces can not be null"); |
208 | Ip4Address externalIp = router.gatewayExternalInfo().externalFixedIps() | 250 | Ip4Address externalIp = router.gatewayExternalInfo().externalFixedIps() |
209 | .values().stream().findFirst().orElse(null); | 251 | .values().stream().findFirst().orElse(null); |
210 | if ((externalIp == null) || (!router.gatewayExternalInfo().isEnablePnat())) { | 252 | if ((externalIp == null) || (!router.gatewayExternalInfo().isEnablePnat())) { |
211 | - log.debug("Failed to set pnat configuration"); | 253 | + log.debug("Not satisfied to set pnat configuration"); |
212 | return; | 254 | return; |
213 | } | 255 | } |
214 | - routerInterfaces.forEach(routerInterface -> { | 256 | + routerInterfaces.forEach(routerInterface -> initiateL3Rule(router, routerInterface)); |
215 | - initiateL3Rule(router, routerInterface); | ||
216 | - }); | ||
217 | } | 257 | } |
218 | 258 | ||
219 | private void initiateL3Rule(OpenstackRouter router, OpenstackRouterInterface routerInterface) { | 259 | private void initiateL3Rule(OpenstackRouter router, OpenstackRouterInterface routerInterface) { |
220 | long vni = Long.parseLong(openstackService.network(openstackService | 260 | long vni = Long.parseLong(openstackService.network(openstackService |
221 | - .port(routerInterface.portId()).networkId()).segmentId()); | 261 | + .port(routerInterface.id()).networkId()).segmentId()); |
222 | OpenstackRoutingRulePopulator rulePopulator = new OpenstackRoutingRulePopulator(appId, | 262 | OpenstackRoutingRulePopulator rulePopulator = new OpenstackRoutingRulePopulator(appId, |
223 | openstackService, flowObjectiveService, deviceService, driverService); | 263 | openstackService, flowObjectiveService, deviceService, driverService); |
224 | rulePopulator.populateExternalRules(vni, router, routerInterface); | 264 | rulePopulator.populateExternalRules(vni, router, routerInterface); |
... | @@ -229,15 +269,15 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -229,15 +269,15 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
229 | .collect(Collectors.toList()); | 269 | .collect(Collectors.toList()); |
230 | } | 270 | } |
231 | 271 | ||
232 | - private OpenstackRouter getOpenstackRouter(String tenantId) { | 272 | + private OpenstackRouter getOpenstackRouter(String id) { |
233 | return openstackService.routers().stream().filter(r -> | 273 | return openstackService.routers().stream().filter(r -> |
234 | - r.tenantId().equals(tenantId)).findFirst().orElse(null); | 274 | + r.id().equals(id)).findAny().orElse(null); |
235 | } | 275 | } |
236 | 276 | ||
237 | private OpenstackPort getOpenstackPort(MacAddress sourceMac, Ip4Address ip4Address) { | 277 | private OpenstackPort getOpenstackPort(MacAddress sourceMac, Ip4Address ip4Address) { |
238 | - OpenstackPort openstackPort = openstackService.ports("").stream() | 278 | + OpenstackPort openstackPort = openstackService.ports().stream() |
239 | .filter(p -> p.macAddress().equals(sourceMac)).findFirst().orElse(null); | 279 | .filter(p -> p.macAddress().equals(sourceMac)).findFirst().orElse(null); |
240 | - return openstackPort.fixedIps().values().stream().findFirst().orElse(null) | 280 | + return checkNotNull(openstackPort.fixedIps().values().stream().findFirst().orElse(null)) |
241 | .equals(ip4Address) ? openstackPort : null; | 281 | .equals(ip4Address) ? openstackPort : null; |
242 | } | 282 | } |
243 | 283 | ... | ... |
... | @@ -51,6 +51,7 @@ import org.onosproject.openstacknetworking.OpenstackNetworkingService; | ... | @@ -51,6 +51,7 @@ import org.onosproject.openstacknetworking.OpenstackNetworkingService; |
51 | import org.onosproject.openstacknetworking.OpenstackPort; | 51 | import org.onosproject.openstacknetworking.OpenstackPort; |
52 | import org.onosproject.openstacknetworking.OpenstackRouter; | 52 | import org.onosproject.openstacknetworking.OpenstackRouter; |
53 | import org.onosproject.openstacknetworking.OpenstackRouterInterface; | 53 | import org.onosproject.openstacknetworking.OpenstackRouterInterface; |
54 | +import org.onosproject.openstacknetworking.OpenstackSubnet; | ||
54 | import org.slf4j.Logger; | 55 | import org.slf4j.Logger; |
55 | import org.slf4j.LoggerFactory; | 56 | import org.slf4j.LoggerFactory; |
56 | 57 | ||
... | @@ -63,19 +64,22 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -63,19 +64,22 @@ import static com.google.common.base.Preconditions.checkNotNull; |
63 | */ | 64 | */ |
64 | public class OpenstackRoutingRulePopulator { | 65 | public class OpenstackRoutingRulePopulator { |
65 | 66 | ||
66 | - private static Logger log = LoggerFactory | 67 | + private final Logger log = LoggerFactory.getLogger(getClass()); |
67 | - .getLogger(OpenstackRoutingRulePopulator.class); | ||
68 | - private ApplicationId appId; | ||
69 | - private FlowObjectiveService flowObjectiveService; | ||
70 | - private OpenstackNetworkingService openstackService; | ||
71 | - private DeviceService deviceService; | ||
72 | - private DriverService driverService; | ||
73 | 68 | ||
74 | - public static final String PORTNAME_PREFIX_VM = "tap"; | 69 | + private final ApplicationId appId; |
75 | - public static final String PORTNAME_PREFIX_ROUTER = "qr"; | 70 | + private final FlowObjectiveService flowObjectiveService; |
76 | - public static final String PORTNAME_PREFIX_TUNNEL = "vxlan"; | 71 | + private final OpenstackNetworkingService openstackService; |
77 | - public static final String PORTNAME = "portName"; | 72 | + private final DeviceService deviceService; |
73 | + private final DriverService driverService; | ||
78 | 74 | ||
75 | + private static final String PORTNAME_PREFIX_VM = "tap"; | ||
76 | + private static final String PORTNAME_PREFIX_ROUTER = "qr"; | ||
77 | + private static final String PORTNAME_PREFIX_TUNNEL = "vxlan"; | ||
78 | + private static final String PORTNAME = "portName"; | ||
79 | + | ||
80 | + private static final String PORTNOTNULL = "Port can not be null"; | ||
81 | + private static final String TUNNEL_DESTINATION = "tunnelDst"; | ||
82 | + private static final String DEVICE_ANNOTATION_CHANNELID = "channelId"; | ||
79 | private static final int ROUTING_RULE_PRIORITY = 25000; | 83 | private static final int ROUTING_RULE_PRIORITY = 25000; |
80 | private static final int PNAT_RULE_PRIORITY = 24000; | 84 | private static final int PNAT_RULE_PRIORITY = 24000; |
81 | private static final int PNAT_TIMEOUT = 120; | 85 | private static final int PNAT_TIMEOUT = 120; |
... | @@ -90,8 +94,17 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -90,8 +94,17 @@ public class OpenstackRoutingRulePopulator { |
90 | private OpenstackRouterInterface routerInterface; | 94 | private OpenstackRouterInterface routerInterface; |
91 | 95 | ||
92 | // TODO: This will be replaced to get the information from openstackswitchingservice. | 96 | // TODO: This will be replaced to get the information from openstackswitchingservice. |
93 | - private static final String EXTERNAL_INTERFACE_NAME = "eth3"; | 97 | + private static final String EXTERNAL_INTERFACE_NAME = "veth0"; |
94 | - | 98 | + |
99 | + /** | ||
100 | + * The constructor of openstackRoutingRulePopulator. | ||
101 | + * | ||
102 | + * @param appId Caller`s appId | ||
103 | + * @param openstackService OpenstackNetworkingService | ||
104 | + * @param flowObjectiveService FlowObjectiveService | ||
105 | + * @param deviceService DeviceService | ||
106 | + * @param driverService DriverService | ||
107 | + */ | ||
95 | public OpenstackRoutingRulePopulator(ApplicationId appId, OpenstackNetworkingService openstackService, | 108 | public OpenstackRoutingRulePopulator(ApplicationId appId, OpenstackNetworkingService openstackService, |
96 | FlowObjectiveService flowObjectiveService, | 109 | FlowObjectiveService flowObjectiveService, |
97 | DeviceService deviceService, DriverService driverService) { | 110 | DeviceService deviceService, DriverService driverService) { |
... | @@ -102,8 +115,18 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -102,8 +115,18 @@ public class OpenstackRoutingRulePopulator { |
102 | this.driverService = driverService; | 115 | this.driverService = driverService; |
103 | } | 116 | } |
104 | 117 | ||
118 | + /** | ||
119 | + * Populates flow rules for Pnat configurations. | ||
120 | + * @param inboundPacket Packet-in event packet | ||
121 | + * @param openstackPort Target VM information | ||
122 | + * @param portNum Pnat port number | ||
123 | + * @param externalIp | ||
124 | + * @param externalInterfaceMacAddress Gateway external interface macaddress | ||
125 | + * @param externalRouterMacAddress Outer(physical) router`s macaddress | ||
126 | + */ | ||
105 | public void populatePnatFlowRules(InboundPacket inboundPacket, OpenstackPort openstackPort, int portNum, | 127 | public void populatePnatFlowRules(InboundPacket inboundPacket, OpenstackPort openstackPort, int portNum, |
106 | - MacAddress externalInterfaceMacAddress, MacAddress externalRouterMacAddress) { | 128 | + Ip4Address externalIp, MacAddress externalInterfaceMacAddress, |
129 | + MacAddress externalRouterMacAddress) { | ||
107 | this.inboundPacket = inboundPacket; | 130 | this.inboundPacket = inboundPacket; |
108 | this.openstackPort = openstackPort; | 131 | this.openstackPort = openstackPort; |
109 | this.portNum = portNum; | 132 | this.portNum = portNum; |
... | @@ -112,11 +135,11 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -112,11 +135,11 @@ public class OpenstackRoutingRulePopulator { |
112 | 135 | ||
113 | long vni = getVni(openstackPort); | 136 | long vni = getVni(openstackPort); |
114 | 137 | ||
115 | - populatePnatIncomingFlowRules(vni); | 138 | + populatePnatIncomingFlowRules(vni, externalIp); |
116 | - populatePnatOutgoingFlowRules(vni); | 139 | + populatePnatOutgoingFlowRules(vni, externalIp); |
117 | } | 140 | } |
118 | 141 | ||
119 | - private void populatePnatOutgoingFlowRules(long vni) { | 142 | + private void populatePnatOutgoingFlowRules(long vni, Ip4Address externalIp) { |
120 | IPv4 iPacket = (IPv4) inboundPacket.parsed().getPayload(); | 143 | IPv4 iPacket = (IPv4) inboundPacket.parsed().getPayload(); |
121 | 144 | ||
122 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | 145 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); |
... | @@ -128,27 +151,27 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -128,27 +151,27 @@ public class OpenstackRoutingRulePopulator { |
128 | 151 | ||
129 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); | 152 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
130 | tBuilder.setEthSrc(externalInterface) | 153 | tBuilder.setEthSrc(externalInterface) |
131 | - .setEthDst(externalRouter); | 154 | + .setEthDst(externalRouter) |
155 | + .setIpSrc(externalIp); | ||
132 | 156 | ||
133 | switch (iPacket.getProtocol()) { | 157 | switch (iPacket.getProtocol()) { |
134 | case IPv4.PROTOCOL_TCP: | 158 | case IPv4.PROTOCOL_TCP: |
135 | TCP tcpPacket = (TCP) iPacket.getPayload(); | 159 | TCP tcpPacket = (TCP) iPacket.getPayload(); |
136 | sBuilder.matchTcpSrc(TpPort.tpPort(tcpPacket.getSourcePort())) | 160 | sBuilder.matchTcpSrc(TpPort.tpPort(tcpPacket.getSourcePort())) |
137 | .matchTcpDst(TpPort.tpPort(tcpPacket.getDestinationPort())); | 161 | .matchTcpDst(TpPort.tpPort(tcpPacket.getDestinationPort())); |
138 | - tBuilder.setTcpDst(TpPort.tpPort(portNum)); | 162 | + tBuilder.setTcpSrc(TpPort.tpPort(portNum)); |
139 | break; | 163 | break; |
140 | case IPv4.PROTOCOL_UDP: | 164 | case IPv4.PROTOCOL_UDP: |
141 | UDP udpPacket = (UDP) iPacket.getPayload(); | 165 | UDP udpPacket = (UDP) iPacket.getPayload(); |
142 | - sBuilder.matchUdpDst(TpPort.tpPort(udpPacket.getSourcePort())) | 166 | + sBuilder.matchUdpSrc(TpPort.tpPort(udpPacket.getSourcePort())) |
143 | .matchUdpDst(TpPort.tpPort(udpPacket.getDestinationPort())); | 167 | .matchUdpDst(TpPort.tpPort(udpPacket.getDestinationPort())); |
144 | - tBuilder.setUdpDst(TpPort.tpPort(portNum)); | 168 | + tBuilder.setUdpSrc(TpPort.tpPort(portNum)); |
145 | break; | 169 | break; |
146 | default: | 170 | default: |
147 | break; | 171 | break; |
148 | } | 172 | } |
149 | 173 | ||
150 | - Port port = getPortNumOfExternalInterface(); | 174 | + Port port = checkNotNull(getPortNumOfExternalInterface(), PORTNOTNULL); |
151 | - checkNotNull(port, "Port can not be null"); | ||
152 | tBuilder.setOutput(port.number()); | 175 | tBuilder.setOutput(port.number()); |
153 | 176 | ||
154 | ForwardingObjective fo = DefaultForwardingObjective.builder() | 177 | ForwardingObjective fo = DefaultForwardingObjective.builder() |
... | @@ -165,18 +188,19 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -165,18 +188,19 @@ public class OpenstackRoutingRulePopulator { |
165 | 188 | ||
166 | private Port getPortNumOfExternalInterface() { | 189 | private Port getPortNumOfExternalInterface() { |
167 | return deviceService.getPorts(inboundPacket.receivedFrom().deviceId()).stream() | 190 | return deviceService.getPorts(inboundPacket.receivedFrom().deviceId()).stream() |
168 | - .filter(p -> p.annotations().value("portName").equals(EXTERNAL_INTERFACE_NAME)) | 191 | + .filter(p -> p.annotations().value(PORTNAME).equals(EXTERNAL_INTERFACE_NAME)) |
169 | .findAny().orElse(null); | 192 | .findAny().orElse(null); |
170 | } | 193 | } |
171 | 194 | ||
172 | 195 | ||
173 | - private void populatePnatIncomingFlowRules(long vni) { | 196 | + private void populatePnatIncomingFlowRules(long vni, Ip4Address externalIp) { |
174 | IPv4 iPacket = (IPv4) inboundPacket.parsed().getPayload(); | 197 | IPv4 iPacket = (IPv4) inboundPacket.parsed().getPayload(); |
175 | DeviceId deviceId = inboundPacket.receivedFrom().deviceId(); | 198 | DeviceId deviceId = inboundPacket.receivedFrom().deviceId(); |
176 | 199 | ||
177 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | 200 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); |
178 | sBuilder.matchEthType(Ethernet.TYPE_IPV4) | 201 | sBuilder.matchEthType(Ethernet.TYPE_IPV4) |
179 | .matchIPProtocol(iPacket.getProtocol()) | 202 | .matchIPProtocol(iPacket.getProtocol()) |
203 | + .matchIPDst(IpPrefix.valueOf(externalIp, 32)) | ||
180 | .matchIPSrc(IpPrefix.valueOf(iPacket.getDestinationAddress(), 32)); | 204 | .matchIPSrc(IpPrefix.valueOf(iPacket.getDestinationAddress(), 32)); |
181 | 205 | ||
182 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); | 206 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
... | @@ -225,7 +249,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -225,7 +249,7 @@ public class OpenstackRoutingRulePopulator { |
225 | ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type()); | 249 | ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type()); |
226 | 250 | ||
227 | try { | 251 | try { |
228 | - extensionInstruction.setPropertyValue("tunnelDst", hostIp); | 252 | + extensionInstruction.setPropertyValue(TUNNEL_DESTINATION, hostIp); |
229 | } catch (ExtensionPropertyException e) { | 253 | } catch (ExtensionPropertyException e) { |
230 | log.error("Error setting Nicira extension setting {}", e); | 254 | log.error("Error setting Nicira extension setting {}", e); |
231 | } | 255 | } |
... | @@ -235,7 +259,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -235,7 +259,7 @@ public class OpenstackRoutingRulePopulator { |
235 | 259 | ||
236 | private PortNumber getTunnelPort(DeviceId deviceId) { | 260 | private PortNumber getTunnelPort(DeviceId deviceId) { |
237 | Port port = deviceService.getPorts(deviceId).stream() | 261 | Port port = deviceService.getPorts(deviceId).stream() |
238 | - .filter(p -> p.annotations().value("portName").equals(PORTNAME_PREFIX_TUNNEL)) | 262 | + .filter(p -> p.annotations().value(PORTNAME).equals(PORTNAME_PREFIX_TUNNEL)) |
239 | .findAny().orElse(null); | 263 | .findAny().orElse(null); |
240 | 264 | ||
241 | if (port == null) { | 265 | if (port == null) { |
... | @@ -246,6 +270,13 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -246,6 +270,13 @@ public class OpenstackRoutingRulePopulator { |
246 | 270 | ||
247 | } | 271 | } |
248 | 272 | ||
273 | + /** | ||
274 | + * Populates flow rules from openstackComputeNode to GatewayNode. | ||
275 | + * | ||
276 | + * @param vni Target network | ||
277 | + * @param router corresponding router | ||
278 | + * @param routerInterface corresponding routerInterface | ||
279 | + */ | ||
249 | public void populateExternalRules(long vni, OpenstackRouter router, | 280 | public void populateExternalRules(long vni, OpenstackRouter router, |
250 | OpenstackRouterInterface routerInterface) { | 281 | OpenstackRouterInterface routerInterface) { |
251 | this.router = router; | 282 | this.router = router; |
... | @@ -284,11 +315,6 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -284,11 +315,6 @@ public class OpenstackRoutingRulePopulator { |
284 | StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false) | 315 | StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false) |
285 | .filter(d -> !checkGatewayNode(d.id())) | 316 | .filter(d -> !checkGatewayNode(d.id())) |
286 | .forEach(d -> populateRuleToGateway(d, gatewayDevice, vni)); | 317 | .forEach(d -> populateRuleToGateway(d, gatewayDevice, vni)); |
287 | - /*deviceService.getAvailableDevices().forEach(d -> { | ||
288 | - if (!checkGatewayNode(d.id())) { | ||
289 | - populateRuleToGateway(d, gatewayDevice, vni); | ||
290 | - } | ||
291 | - });*/ | ||
292 | } | 318 | } |
293 | 319 | ||
294 | private void populateRuleToGateway(Device d, Device gatewayDevice, long vni) { | 320 | private void populateRuleToGateway(Device d, Device gatewayDevice, long vni) { |
... | @@ -313,34 +339,40 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -313,34 +339,40 @@ public class OpenstackRoutingRulePopulator { |
313 | } | 339 | } |
314 | 340 | ||
315 | private Ip4Address getIPAddressforDevice(Device device) { | 341 | private Ip4Address getIPAddressforDevice(Device device) { |
316 | - return Ip4Address.valueOf(device.annotations().value("channelId").split(":")[0]); | 342 | + return Ip4Address.valueOf(device.annotations().value(DEVICE_ANNOTATION_CHANNELID).split(":")[0]); |
317 | } | 343 | } |
318 | 344 | ||
319 | private Device getGatewayNode() { | 345 | private Device getGatewayNode() { |
320 | - final Device[] device = new Device[1]; | 346 | + return checkNotNull(StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false) |
321 | - deviceService.getAvailableDevices().forEach(d -> { | 347 | + .filter(d -> checkGatewayNode(d.id())) |
322 | - if (checkGatewayNode(d.id())) { | 348 | + .findAny() |
323 | - device[0] = d; | 349 | + .orElse(null)); |
324 | - } | ||
325 | - }); | ||
326 | - return device[0]; | ||
327 | } | 350 | } |
328 | 351 | ||
329 | private boolean checkGatewayNode(DeviceId deviceId) { | 352 | private boolean checkGatewayNode(DeviceId deviceId) { |
330 | return !deviceService.getPorts(deviceId).stream().anyMatch(port -> | 353 | return !deviceService.getPorts(deviceId).stream().anyMatch(port -> |
331 | - port.annotations().value("portName").startsWith(PORTNAME_PREFIX_ROUTER) || | 354 | + port.annotations().value(PORTNAME).startsWith(PORTNAME_PREFIX_ROUTER) || |
332 | - port.annotations().value("portName").startsWith(PORTNAME_PREFIX_VM)); | 355 | + port.annotations().value(PORTNAME).startsWith(PORTNAME_PREFIX_VM)); |
333 | } | 356 | } |
334 | 357 | ||
335 | private long getVni(OpenstackPort openstackPort) { | 358 | private long getVni(OpenstackPort openstackPort) { |
336 | return Long.parseLong(openstackService.network(openstackPort.networkId()).segmentId()); | 359 | return Long.parseLong(openstackService.network(openstackPort.networkId()).segmentId()); |
337 | } | 360 | } |
338 | 361 | ||
362 | + private long getVni(OpenstackSubnet openstackSubnet) { | ||
363 | + return Long.parseLong(openstackService.network(openstackSubnet.networkId()).segmentId()); | ||
364 | + } | ||
365 | + | ||
366 | + /** | ||
367 | + * Remove flow rules for external connection. | ||
368 | + * | ||
369 | + * @param routerInterface Corresponding routerInterface | ||
370 | + */ | ||
339 | public void removeExternalRules(OpenstackRouterInterface routerInterface) { | 371 | public void removeExternalRules(OpenstackRouterInterface routerInterface) { |
340 | - OpenstackPort openstackPort = openstackService.port(routerInterface.portId()); | 372 | + OpenstackSubnet openstackSubnet = openstackService.subnet(routerInterface.subnetId()); |
341 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | 373 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); |
342 | sBuilder.matchEthType(Ethernet.TYPE_IPV4) | 374 | sBuilder.matchEthType(Ethernet.TYPE_IPV4) |
343 | - .matchTunnelId(getVni(openstackPort)) | 375 | + .matchTunnelId(getVni(openstackSubnet)) |
344 | .matchEthDst(GATEWAYMAC); | 376 | .matchEthDst(GATEWAYMAC); |
345 | 377 | ||
346 | StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false) | 378 | StreamSupport.stream(deviceService.getAvailableDevices().spliterator(), false) | ... | ... |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import com.google.common.collect.ImmutableMap; | ||
19 | -import org.onlab.packet.Ip4Address; | ||
20 | - | ||
21 | -import java.util.HashMap; | ||
22 | -import java.util.Map; | ||
23 | - | ||
24 | -/** | ||
25 | - * A configurable external gateway modes extension model in openstack router. | ||
26 | - */ | ||
27 | -public final class OpenstackExternalGateway { | ||
28 | - | ||
29 | - private String networkId; | ||
30 | - private boolean enablePnat; | ||
31 | - private Map<String, Ip4Address> externalFixedIps; | ||
32 | - | ||
33 | - private OpenstackExternalGateway(String networkId, boolean enablePnat, | ||
34 | - Map<String, Ip4Address> externalFixedIps) { | ||
35 | - this.networkId = networkId; | ||
36 | - this.enablePnat = enablePnat; | ||
37 | - this.externalFixedIps = externalFixedIps; | ||
38 | - } | ||
39 | - | ||
40 | - public static OpenstackExternalGateway.Builder builder() { | ||
41 | - return new Builder(); | ||
42 | - } | ||
43 | - /** | ||
44 | - * Returns network ID. | ||
45 | - * | ||
46 | - * @return Network ID | ||
47 | - */ | ||
48 | - public String networkId() { | ||
49 | - return networkId; | ||
50 | - } | ||
51 | - | ||
52 | - /** | ||
53 | - * Returns the PNAT status for external gateway. | ||
54 | - * | ||
55 | - * @return PNAT status | ||
56 | - */ | ||
57 | - public boolean isEnablePnat() { | ||
58 | - return enablePnat; | ||
59 | - } | ||
60 | - | ||
61 | - public Map<String, Ip4Address> externalFixedIps() { | ||
62 | - return ImmutableMap.copyOf(externalFixedIps); | ||
63 | - } | ||
64 | - | ||
65 | - /** | ||
66 | - * An Openstack External Gateway Builder class. | ||
67 | - */ | ||
68 | - public static final class Builder { | ||
69 | - private String networkId; | ||
70 | - private boolean enablePnat; | ||
71 | - private Map<String, Ip4Address> externalFixedIps; | ||
72 | - | ||
73 | - Builder() { | ||
74 | - externalFixedIps = new HashMap<>(); | ||
75 | - } | ||
76 | - | ||
77 | - /** | ||
78 | - * Sets network ID. | ||
79 | - * | ||
80 | - * @param networkId Network ID | ||
81 | - * @return Builder object | ||
82 | - */ | ||
83 | - public Builder networkId(String networkId) { | ||
84 | - this.networkId = networkId; | ||
85 | - return this; | ||
86 | - } | ||
87 | - | ||
88 | - /** | ||
89 | - * Sets whether PNAT status is enabled or not. | ||
90 | - * | ||
91 | - * @param enablePnat true if PNAT status is enabled, false otherwise | ||
92 | - * @return Builder object | ||
93 | - */ | ||
94 | - public Builder enablePnat(boolean enablePnat) { | ||
95 | - this.enablePnat = enablePnat; | ||
96 | - return this; | ||
97 | - } | ||
98 | - | ||
99 | - /** | ||
100 | - * Sets external fixed IP address information. | ||
101 | - * | ||
102 | - * @param externalFixedIps External fixed IP information | ||
103 | - * @return Builder object | ||
104 | - */ | ||
105 | - | ||
106 | - public Builder externalFixedIps(Map<String, Ip4Address> externalFixedIps) { | ||
107 | - this.externalFixedIps.putAll(externalFixedIps); | ||
108 | - return this; | ||
109 | - } | ||
110 | - | ||
111 | - /** | ||
112 | - * Builds an OpenstackExternalGateway object. | ||
113 | - * | ||
114 | - * @return OpenstackExternalGateway object | ||
115 | - */ | ||
116 | - public OpenstackExternalGateway build() { | ||
117 | - return new OpenstackExternalGateway(networkId, enablePnat, externalFixedIps); | ||
118 | - } | ||
119 | - } | ||
120 | - | ||
121 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import org.onlab.packet.Ip4Address; | ||
19 | - | ||
20 | -/** | ||
21 | - * An Openstack Neutron Floating IP Model. | ||
22 | - */ | ||
23 | -public final class OpenstackFloatingIP { | ||
24 | - | ||
25 | - public enum FloatingIPStatus { | ||
26 | - UP, | ||
27 | - DOWN, | ||
28 | - ACTIVE, | ||
29 | - } | ||
30 | - | ||
31 | - private String tenantId; | ||
32 | - private String networkId; | ||
33 | - private Ip4Address fixedIpAddress; | ||
34 | - private String portId; | ||
35 | - private String routerId; | ||
36 | - private String id; | ||
37 | - private Ip4Address floatingIpAddress; | ||
38 | - private FloatingIPStatus status; | ||
39 | - | ||
40 | - private OpenstackFloatingIP(FloatingIPStatus status, String id, String tenantId, | ||
41 | - String networkId, Ip4Address fixedIpAddress, String portId, | ||
42 | - String routerId, Ip4Address floatingIpAddress) { | ||
43 | - this.status = status; | ||
44 | - this.id = id; | ||
45 | - this.tenantId = tenantId; | ||
46 | - this.networkId = networkId; | ||
47 | - this.fixedIpAddress = fixedIpAddress; | ||
48 | - this.portId = portId; | ||
49 | - this.routerId = routerId; | ||
50 | - this.floatingIpAddress = floatingIpAddress; | ||
51 | - } | ||
52 | - | ||
53 | - /** | ||
54 | - * Returns floating ip status. | ||
55 | - * | ||
56 | - * @return floating ip status | ||
57 | - */ | ||
58 | - public FloatingIPStatus status() { | ||
59 | - return status; | ||
60 | - } | ||
61 | - | ||
62 | - /** | ||
63 | - * Returns floating ip`s ID. | ||
64 | - * | ||
65 | - * @return floating ip`s ID | ||
66 | - */ | ||
67 | - public String id() { | ||
68 | - return id; | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * Returns tenant ID. | ||
73 | - * | ||
74 | - * @return tenant ID | ||
75 | - */ | ||
76 | - public String tenantId() { | ||
77 | - return tenantId; | ||
78 | - } | ||
79 | - | ||
80 | - /** | ||
81 | - * Returns network ID. | ||
82 | - * | ||
83 | - * @return network ID | ||
84 | - */ | ||
85 | - public String networkId() { | ||
86 | - return networkId; | ||
87 | - } | ||
88 | - | ||
89 | - /** | ||
90 | - * Returns fixed IP Address. | ||
91 | - * | ||
92 | - * @return fixed IP Address | ||
93 | - */ | ||
94 | - public Ip4Address fixedIpAddress() { | ||
95 | - return fixedIpAddress; | ||
96 | - } | ||
97 | - | ||
98 | - /** | ||
99 | - * Returns port ID. | ||
100 | - * | ||
101 | - * @return port ID | ||
102 | - */ | ||
103 | - public String portId() { | ||
104 | - return portId; | ||
105 | - } | ||
106 | - | ||
107 | - /** | ||
108 | - * Returns router ID. | ||
109 | - * | ||
110 | - * @return router ID | ||
111 | - */ | ||
112 | - public String routerId() { | ||
113 | - return routerId; | ||
114 | - } | ||
115 | - | ||
116 | - /** | ||
117 | - * Returns floating IP address. | ||
118 | - * | ||
119 | - * @return Floating IP address | ||
120 | - */ | ||
121 | - public Ip4Address floatingIpAddress() { | ||
122 | - return floatingIpAddress; | ||
123 | - } | ||
124 | - | ||
125 | - /** | ||
126 | - * An Openstack Floating IP Builder class. | ||
127 | - */ | ||
128 | - public static final class Builder { | ||
129 | - private String tenantId; | ||
130 | - private String networkId; | ||
131 | - private Ip4Address fixedIpAddress; | ||
132 | - private String portId; | ||
133 | - private String routerId; | ||
134 | - private String id; | ||
135 | - private Ip4Address floatingIpAddress; | ||
136 | - private FloatingIPStatus status; | ||
137 | - | ||
138 | - /** | ||
139 | - * Sets tenant ID. | ||
140 | - * | ||
141 | - * @param tenantId tenant ID | ||
142 | - * @return Builder object | ||
143 | - */ | ||
144 | - public Builder tenantId(String tenantId) { | ||
145 | - this.tenantId = tenantId; | ||
146 | - return this; | ||
147 | - } | ||
148 | - | ||
149 | - /** | ||
150 | - * Sets floating IP status. | ||
151 | - * | ||
152 | - * @param status Floating IP status | ||
153 | - * @return Builder object | ||
154 | - */ | ||
155 | - public Builder status(FloatingIPStatus status) { | ||
156 | - this.status = status; | ||
157 | - return this; | ||
158 | - } | ||
159 | - | ||
160 | - /** | ||
161 | - * Sets Floating IP`s ID. | ||
162 | - * | ||
163 | - * @param id Floating IP`s ID | ||
164 | - * @return Builder object | ||
165 | - */ | ||
166 | - public Builder id(String id) { | ||
167 | - this.id = id; | ||
168 | - return this; | ||
169 | - } | ||
170 | - | ||
171 | - /** | ||
172 | - * Sets network ID. | ||
173 | - * | ||
174 | - * @param networkId Network ID | ||
175 | - * @return Builder object | ||
176 | - */ | ||
177 | - public Builder networkId(String networkId) { | ||
178 | - this.networkId = networkId; | ||
179 | - return this; | ||
180 | - } | ||
181 | - | ||
182 | - /** | ||
183 | - * Sets fixed IP address. | ||
184 | - * | ||
185 | - * @param fixedIpAddress Fixed IP address | ||
186 | - * @return Builder object | ||
187 | - */ | ||
188 | - public Builder fixedIpAddress(Ip4Address fixedIpAddress) { | ||
189 | - this.fixedIpAddress = fixedIpAddress; | ||
190 | - return this; | ||
191 | - } | ||
192 | - | ||
193 | - /** | ||
194 | - * Sets port ID. | ||
195 | - * | ||
196 | - * @param portId port ID | ||
197 | - * @return Builder object | ||
198 | - */ | ||
199 | - public Builder portId(String portId) { | ||
200 | - this.portId = portId; | ||
201 | - return this; | ||
202 | - } | ||
203 | - | ||
204 | - /** | ||
205 | - * Sets router ID. | ||
206 | - * | ||
207 | - * @param routerId router ID | ||
208 | - * @return Builder object | ||
209 | - */ | ||
210 | - public Builder routerId(String routerId) { | ||
211 | - this.routerId = routerId; | ||
212 | - return this; | ||
213 | - } | ||
214 | - | ||
215 | - /** | ||
216 | - * Sets floating IP address. | ||
217 | - * | ||
218 | - * @param floatingIpAddress Floating IP address | ||
219 | - * @return Builder object | ||
220 | - */ | ||
221 | - public Builder floatingIpAddress(Ip4Address floatingIpAddress) { | ||
222 | - this.floatingIpAddress = floatingIpAddress; | ||
223 | - return this; | ||
224 | - } | ||
225 | - | ||
226 | - /** | ||
227 | - * Builds an OpenstackFloatingIP object. | ||
228 | - * | ||
229 | - * @return OpenstackFloatingIP object | ||
230 | - */ | ||
231 | - public OpenstackFloatingIP build() { | ||
232 | - return new OpenstackFloatingIP(status, id, tenantId, networkId, | ||
233 | - fixedIpAddress, portId, routerId, floatingIpAddress); | ||
234 | - | ||
235 | - } | ||
236 | - } | ||
237 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import org.onosproject.event.AbstractEvent; | ||
19 | - | ||
20 | -/** | ||
21 | - * Handle FloatingIP Event for Managing Flow Rules In Openstack Nodes. | ||
22 | - */ | ||
23 | -public class OpenstackFloatingIPHandler implements Runnable { | ||
24 | - | ||
25 | - volatile AbstractEvent event; | ||
26 | - OpenstackFloatingIPHandler(AbstractEvent event) { | ||
27 | - this.event = event; | ||
28 | - } | ||
29 | - | ||
30 | - @Override | ||
31 | - public void run() { | ||
32 | - | ||
33 | - } | ||
34 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import org.onosproject.net.packet.PacketContext; | ||
19 | - | ||
20 | -/** | ||
21 | - * Handle ICMP packet processing for Managing Flow Rules In Openstack Nodes. | ||
22 | - */ | ||
23 | -public class OpenstackIcmpHandler implements Runnable { | ||
24 | - | ||
25 | - volatile PacketContext context; | ||
26 | - OpenstackIcmpHandler(PacketContext context) { | ||
27 | - this.context = context; | ||
28 | - } | ||
29 | - | ||
30 | - @Override | ||
31 | - public void run() { | ||
32 | - | ||
33 | - } | ||
34 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import org.onosproject.net.packet.PacketContext; | ||
19 | - | ||
20 | -/** | ||
21 | - * Handle NAT packet processing for Managing Flow Rules In Openstack Nodes. | ||
22 | - */ | ||
23 | -public class OpenstackPnatHandler implements Runnable { | ||
24 | - | ||
25 | - volatile PacketContext context; | ||
26 | - OpenstackPnatHandler(PacketContext context) { | ||
27 | - this.context = context; | ||
28 | - } | ||
29 | - | ||
30 | - @Override | ||
31 | - public void run() { | ||
32 | - | ||
33 | - } | ||
34 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/openstackrouting/src/main/java/org/onosproject/openstackrouting/OpenstackRouter.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -/** | ||
19 | - * An Openstack Neutron Router Model. | ||
20 | - */ | ||
21 | -public final class OpenstackRouter { | ||
22 | - | ||
23 | - public enum RouterStatus { | ||
24 | - UP, | ||
25 | - DOWN, | ||
26 | - ACTIVE, | ||
27 | - } | ||
28 | - | ||
29 | - private String tenantId; | ||
30 | - private String id; | ||
31 | - private String name; | ||
32 | - private RouterStatus status; | ||
33 | - private boolean adminStateUp; | ||
34 | - private OpenstackExternalGateway gatewayExternalInfo; | ||
35 | - | ||
36 | - private OpenstackRouter(String id, String tenantId, String name, RouterStatus status, | ||
37 | - boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) { | ||
38 | - this.id = id; | ||
39 | - this.tenantId = tenantId; | ||
40 | - this.name = name; | ||
41 | - this.status = status; | ||
42 | - this.adminStateUp = adminStateUp; | ||
43 | - this.gatewayExternalInfo = gatewayExternalInfo; | ||
44 | - | ||
45 | - } | ||
46 | - | ||
47 | - public static OpenstackRouter.Builder builder() { | ||
48 | - return new Builder(); | ||
49 | - } | ||
50 | - | ||
51 | - /** | ||
52 | - * Returns tenant ID. | ||
53 | - * | ||
54 | - * @return tenant ID | ||
55 | - */ | ||
56 | - public String tenantId() { | ||
57 | - return tenantId; | ||
58 | - } | ||
59 | - | ||
60 | - /** | ||
61 | - * Returns router ID. | ||
62 | - * | ||
63 | - * @return router ID | ||
64 | - */ | ||
65 | - public String id() { | ||
66 | - return id; | ||
67 | - } | ||
68 | - | ||
69 | - /** | ||
70 | - * Returns router name. | ||
71 | - * | ||
72 | - * @return router name | ||
73 | - */ | ||
74 | - public String name() { | ||
75 | - return name; | ||
76 | - } | ||
77 | - | ||
78 | - /** | ||
79 | - * Returns router status. | ||
80 | - * | ||
81 | - * @return router stauts | ||
82 | - */ | ||
83 | - public RouterStatus status() { | ||
84 | - return status; | ||
85 | - } | ||
86 | - | ||
87 | - /** | ||
88 | - * Returns whether admin state up or not. | ||
89 | - * | ||
90 | - * @return true if admin state up, false otherwise | ||
91 | - */ | ||
92 | - public boolean adminStateUp() { | ||
93 | - return adminStateUp; | ||
94 | - } | ||
95 | - | ||
96 | - /** | ||
97 | - * Returns external gateway information. | ||
98 | - * | ||
99 | - * @return external gateway information | ||
100 | - */ | ||
101 | - public OpenstackExternalGateway gatewayExternalInfo() { | ||
102 | - return gatewayExternalInfo; | ||
103 | - } | ||
104 | - | ||
105 | - /** | ||
106 | - * An Openstack Router Builder class. | ||
107 | - */ | ||
108 | - public static final class Builder { | ||
109 | - | ||
110 | - private String tenantId; | ||
111 | - private String id; | ||
112 | - private String name; | ||
113 | - private RouterStatus status; | ||
114 | - private Boolean adminStateUp; | ||
115 | - private OpenstackExternalGateway gatewayExternalInfo; | ||
116 | - | ||
117 | - /** | ||
118 | - * Sets router ID. | ||
119 | - * | ||
120 | - * @param id router ID | ||
121 | - * @return Builder object | ||
122 | - */ | ||
123 | - public Builder id(String id) { | ||
124 | - this.id = id; | ||
125 | - return this; | ||
126 | - } | ||
127 | - | ||
128 | - /** | ||
129 | - * Sets router name. | ||
130 | - * | ||
131 | - * @param name router name | ||
132 | - * @return Builder object | ||
133 | - */ | ||
134 | - public Builder name(String name) { | ||
135 | - this.name = name; | ||
136 | - return this; | ||
137 | - } | ||
138 | - | ||
139 | - /** | ||
140 | - * Sets router status. | ||
141 | - * | ||
142 | - * @param status router status | ||
143 | - * @return Builder object | ||
144 | - */ | ||
145 | - public Builder status(RouterStatus status) { | ||
146 | - this.status = status; | ||
147 | - return this; | ||
148 | - } | ||
149 | - | ||
150 | - /** | ||
151 | - * Sets tenant ID. | ||
152 | - * | ||
153 | - * @param tenantId Tenant ID | ||
154 | - * @return Builder object | ||
155 | - */ | ||
156 | - public Builder tenantId(String tenantId) { | ||
157 | - this.tenantId = tenantId; | ||
158 | - return this; | ||
159 | - } | ||
160 | - | ||
161 | - /** | ||
162 | - * Sets whether admin state up or not. | ||
163 | - * | ||
164 | - * @param adminStateUp true if admin state is up, false otherwise | ||
165 | - * @return Builder object | ||
166 | - */ | ||
167 | - public Builder adminStateUp(boolean adminStateUp) { | ||
168 | - this.adminStateUp = adminStateUp; | ||
169 | - return this; | ||
170 | - } | ||
171 | - | ||
172 | - /** | ||
173 | - * Sets external gateway information. | ||
174 | - * | ||
175 | - * @param gatewayExternalInfo external gateway information | ||
176 | - * @return Builder object | ||
177 | - */ | ||
178 | - public Builder gatewayExternalInfo(OpenstackExternalGateway gatewayExternalInfo) { | ||
179 | - this.gatewayExternalInfo = gatewayExternalInfo; | ||
180 | - return this; | ||
181 | - } | ||
182 | - | ||
183 | - /** | ||
184 | - * Builds an OpenstackRouter object. | ||
185 | - * | ||
186 | - * @return OpenstasckRouter object | ||
187 | - */ | ||
188 | - public OpenstackRouter build() { | ||
189 | - return new OpenstackRouter(id, tenantId, name, status, | ||
190 | - adminStateUp, gatewayExternalInfo); | ||
191 | - } | ||
192 | - } | ||
193 | - | ||
194 | - | ||
195 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -/** | ||
19 | - * An Openstack Neutron Router Interface Model. | ||
20 | - */ | ||
21 | -public final class OpenstackRouterInterface { | ||
22 | - private String id; | ||
23 | - private String tenantId; | ||
24 | - private String subnetId; | ||
25 | - private String portId; | ||
26 | - | ||
27 | - private OpenstackRouterInterface(String id, String tenantId, | ||
28 | - String subnetId, String portId) { | ||
29 | - this.id = id; | ||
30 | - this.tenantId = tenantId; | ||
31 | - this.subnetId = subnetId; | ||
32 | - this.portId = portId; | ||
33 | - } | ||
34 | - | ||
35 | - /** | ||
36 | - * Returns Router Interface ID. | ||
37 | - * | ||
38 | - * @return router interface ID | ||
39 | - */ | ||
40 | - public String id() { | ||
41 | - return id; | ||
42 | - } | ||
43 | - | ||
44 | - /** | ||
45 | - * Returns tenant ID. | ||
46 | - * | ||
47 | - * @return tenant ID | ||
48 | - */ | ||
49 | - public String tenantId() { | ||
50 | - return tenantId; | ||
51 | - } | ||
52 | - | ||
53 | - /** | ||
54 | - * Returns subnet ID. | ||
55 | - * | ||
56 | - * @return subnet ID | ||
57 | - */ | ||
58 | - public String subnetId() { | ||
59 | - return subnetId; | ||
60 | - } | ||
61 | - | ||
62 | - /** | ||
63 | - * Returns port ID. | ||
64 | - * | ||
65 | - * @return port ID | ||
66 | - */ | ||
67 | - public String portId() { | ||
68 | - return portId; | ||
69 | - } | ||
70 | - | ||
71 | - /** | ||
72 | - * An Openstack Router Interface Builder class. | ||
73 | - */ | ||
74 | - public static final class Builder { | ||
75 | - private String id; | ||
76 | - private String tenantId; | ||
77 | - private String subnetId; | ||
78 | - private String portId; | ||
79 | - | ||
80 | - /** | ||
81 | - * Sets Router Interface ID. | ||
82 | - * | ||
83 | - * @param id router interface ID | ||
84 | - * @return Builder object | ||
85 | - */ | ||
86 | - public Builder id(String id) { | ||
87 | - this.id = id; | ||
88 | - return this; | ||
89 | - } | ||
90 | - | ||
91 | - /** | ||
92 | - * Sets tenant ID. | ||
93 | - * | ||
94 | - * @param tenantId tenant ID | ||
95 | - * @return Builder object | ||
96 | - */ | ||
97 | - public Builder tenantId(String tenantId) { | ||
98 | - this.tenantId = tenantId; | ||
99 | - return this; | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * Sets subnet ID. | ||
104 | - * | ||
105 | - * @param subnetId subnet ID | ||
106 | - * @return Builder object | ||
107 | - */ | ||
108 | - public Builder subnetId(String subnetId) { | ||
109 | - this.subnetId = subnetId; | ||
110 | - return this; | ||
111 | - } | ||
112 | - | ||
113 | - /** | ||
114 | - * Sets port ID. | ||
115 | - * | ||
116 | - * @param portId port ID | ||
117 | - * @return Builder object | ||
118 | - */ | ||
119 | - public Builder portId(String portId) { | ||
120 | - this.portId = portId; | ||
121 | - return this; | ||
122 | - } | ||
123 | - | ||
124 | - | ||
125 | - /** | ||
126 | - * Builds an Openstack Router Interface object. | ||
127 | - * | ||
128 | - * @return OpenstackRouterInterface object | ||
129 | - */ | ||
130 | - public OpenstackRouterInterface build() { | ||
131 | - return new OpenstackRouterInterface(id, tenantId, subnetId, portId); | ||
132 | - } | ||
133 | - | ||
134 | - } | ||
135 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -import org.apache.felix.scr.annotations.Activate; | ||
19 | -import org.apache.felix.scr.annotations.Component; | ||
20 | -import org.apache.felix.scr.annotations.Deactivate; | ||
21 | -import org.apache.felix.scr.annotations.Reference; | ||
22 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
23 | -import org.apache.felix.scr.annotations.Service; | ||
24 | -import org.onlab.packet.Ethernet; | ||
25 | -import org.onlab.packet.IPv4; | ||
26 | -import org.onosproject.core.ApplicationId; | ||
27 | -import org.onosproject.core.CoreService; | ||
28 | -import org.onosproject.net.driver.DriverService; | ||
29 | -import org.onosproject.net.packet.InboundPacket; | ||
30 | -import org.onosproject.net.packet.PacketContext; | ||
31 | -import org.onosproject.net.packet.PacketProcessor; | ||
32 | -import org.onosproject.net.packet.PacketService; | ||
33 | -import org.slf4j.Logger; | ||
34 | -import org.slf4j.LoggerFactory; | ||
35 | - | ||
36 | -import java.util.concurrent.ExecutorService; | ||
37 | -import java.util.concurrent.Executors; | ||
38 | - | ||
39 | -import static org.onlab.util.Tools.groupedThreads; | ||
40 | - | ||
41 | -@Service | ||
42 | -@Component(immediate = true) | ||
43 | -/** | ||
44 | - * Populates flow rules about L3 functionality for VMs in Openstack. | ||
45 | - */ | ||
46 | -public class OpenstackRoutingManager implements OpenstackRoutingService { | ||
47 | - private static Logger log = LoggerFactory | ||
48 | - .getLogger(OpenstackRoutingManager.class); | ||
49 | - | ||
50 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
51 | - protected CoreService coreService; | ||
52 | - | ||
53 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
54 | - protected PacketService packetService; | ||
55 | - | ||
56 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
57 | - protected DriverService driverService; | ||
58 | - | ||
59 | - private ApplicationId appId; | ||
60 | - private OpenstackIcmpHandler icmpHandler; | ||
61 | - private OpenstackPnatHandler natHandler; | ||
62 | - private OpenstackFloatingIPHandler floatingIPHandler; | ||
63 | - private OpenstackRoutingRulePopulator openstackRoutingRulePopulator; | ||
64 | - | ||
65 | - private InternalPacketProcessor internalPacketProcessor = new InternalPacketProcessor(); | ||
66 | - private ExecutorService l3EventExcutorService = | ||
67 | - Executors.newSingleThreadExecutor(groupedThreads("onos/openstackrouting", "L3-event")); | ||
68 | - private ExecutorService icmpEventExcutorService = | ||
69 | - Executors.newSingleThreadExecutor(groupedThreads("onos/openstackrouting", "icmp-event")); | ||
70 | - | ||
71 | - @Activate | ||
72 | - protected void activate() { | ||
73 | - appId = coreService.registerApplication("org.onosproject.openstackrouting"); | ||
74 | - packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); | ||
75 | - | ||
76 | - log.info("onos-openstackrouting started"); | ||
77 | - } | ||
78 | - | ||
79 | - @Deactivate | ||
80 | - protected void deactivate() { | ||
81 | - packetService.removeProcessor(internalPacketProcessor); | ||
82 | - log.info("onos-openstackrouting stopped"); | ||
83 | - } | ||
84 | - | ||
85 | - | ||
86 | - @Override | ||
87 | - public void createFloatingIP(OpenstackFloatingIP openstackFloatingIP) { | ||
88 | - | ||
89 | - } | ||
90 | - | ||
91 | - @Override | ||
92 | - public void updateFloatingIP(OpenstackFloatingIP openstackFloatingIP) { | ||
93 | - | ||
94 | - } | ||
95 | - | ||
96 | - @Override | ||
97 | - public void deleteFloatingIP(String id) { | ||
98 | - | ||
99 | - } | ||
100 | - | ||
101 | - @Override | ||
102 | - public void createRouter(OpenstackRouter openstackRouter) { | ||
103 | - | ||
104 | - } | ||
105 | - | ||
106 | - @Override | ||
107 | - public void updateRouter(OpenstackRouter openstackRouter) { | ||
108 | - | ||
109 | - } | ||
110 | - | ||
111 | - @Override | ||
112 | - public void deleteRouter(String id) { | ||
113 | - | ||
114 | - } | ||
115 | - | ||
116 | - @Override | ||
117 | - public void createRouterInterface(OpenstackRouterInterface openstackRouterInterface) { | ||
118 | - | ||
119 | - } | ||
120 | - | ||
121 | - @Override | ||
122 | - public void updateRouterInterface(OpenstackRouterInterface openstackRouterInterface) { | ||
123 | - | ||
124 | - } | ||
125 | - | ||
126 | - @Override | ||
127 | - public void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface) { | ||
128 | - | ||
129 | - } | ||
130 | - private class InternalPacketProcessor implements PacketProcessor { | ||
131 | - | ||
132 | - @Override | ||
133 | - public void process(PacketContext context) { | ||
134 | - | ||
135 | - if (context.isHandled()) { | ||
136 | - return; | ||
137 | - } | ||
138 | - | ||
139 | - InboundPacket pkt = context.inPacket(); | ||
140 | - Ethernet ethernet = pkt.parsed(); | ||
141 | - | ||
142 | - if (ethernet != null && ethernet.getEtherType() == Ethernet.TYPE_IPV4) { | ||
143 | - IPv4 iPacket = (IPv4) ethernet.getPayload(); | ||
144 | - switch (iPacket.getProtocol()) { | ||
145 | - case IPv4.PROTOCOL_ICMP: | ||
146 | - icmpEventExcutorService.execute(new OpenstackIcmpHandler(context)); | ||
147 | - break; | ||
148 | - default: | ||
149 | - l3EventExcutorService.execute(new OpenstackPnatHandler(context)); | ||
150 | - break; | ||
151 | - } | ||
152 | - | ||
153 | - } | ||
154 | - | ||
155 | - | ||
156 | - } | ||
157 | - } | ||
158 | - | ||
159 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -/** | ||
19 | - * Populates Routing Flow Rules. | ||
20 | - */ | ||
21 | -public class OpenstackRoutingRulePopulator { | ||
22 | -} |
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | -package org.onosproject.openstackrouting; | ||
17 | - | ||
18 | -/** | ||
19 | - * The Interface of Openstack Routing. | ||
20 | - */ | ||
21 | -public interface OpenstackRoutingService { | ||
22 | - | ||
23 | - /** | ||
24 | - * Stores the Floating IP information created by Openstack. | ||
25 | - * | ||
26 | - * @param openstackFloatingIP Floating IP information | ||
27 | - */ | ||
28 | - void createFloatingIP(OpenstackFloatingIP openstackFloatingIP); | ||
29 | - | ||
30 | - /** | ||
31 | - * Updates flow rules corresponding to the Floating IP information updated by Openstack. | ||
32 | - * | ||
33 | - * @param openstackFloatingIP Floating IP information | ||
34 | - */ | ||
35 | - void updateFloatingIP(OpenstackFloatingIP openstackFloatingIP); | ||
36 | - | ||
37 | - /** | ||
38 | - * Removes flow rules corresponding to Floating IP information deleted by Openstack. | ||
39 | - * | ||
40 | - * @param id Deleted Floating IP`s ID | ||
41 | - */ | ||
42 | - void deleteFloatingIP(String id); | ||
43 | - | ||
44 | - /** | ||
45 | - * Stores the router information created by Openstack. | ||
46 | - * | ||
47 | - * @param openstackRouter Floating IP information | ||
48 | - */ | ||
49 | - void createRouter(OpenstackRouter openstackRouter); | ||
50 | - | ||
51 | - /** | ||
52 | - * Updates flow rules corresponding to the router information updated by Openstack. | ||
53 | - * | ||
54 | - * @param openstackRouter Router information | ||
55 | - */ | ||
56 | - void updateRouter(OpenstackRouter openstackRouter); | ||
57 | - | ||
58 | - /** | ||
59 | - * Removes flow rules corresponding to the router information deleted by Openstack. | ||
60 | - * | ||
61 | - * @param id Deleted router`s ID | ||
62 | - */ | ||
63 | - void deleteRouter(String id); | ||
64 | - | ||
65 | - /** | ||
66 | - * Stores the router information created by Openstack. | ||
67 | - * | ||
68 | - * @param openstackRouterInterface Floating IP information | ||
69 | - */ | ||
70 | - void createRouterInterface(OpenstackRouterInterface openstackRouterInterface); | ||
71 | - | ||
72 | - /** | ||
73 | - * Updates flow rules corresponding to the router information updated by Openstack. | ||
74 | - * | ||
75 | - * @param openstackRouterInterface Router information | ||
76 | - */ | ||
77 | - void updateRouterInterface(OpenstackRouterInterface openstackRouterInterface); | ||
78 | - | ||
79 | - /** | ||
80 | - * Removes flow rules corresponding to the router information removed by Openstack. | ||
81 | - * | ||
82 | - * @param openstackRouterInterface Router information | ||
83 | - */ | ||
84 | - void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface); | ||
85 | - | ||
86 | - | ||
87 | -} |
apps/openstackrouting/src/main/java/org/onosproject/openstackrouting/package-info.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2016 Open Networking Laboratory | ||
3 | - * | ||
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 | - */ | ||
16 | - | ||
17 | -/** | ||
18 | - * Application for OpenstackRouting. | ||
19 | - */ | ||
20 | -package org.onosproject.openstackrouting; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -39,7 +39,7 @@ | ... | @@ -39,7 +39,7 @@ |
39 | <dependencies> | 39 | <dependencies> |
40 | <dependency> | 40 | <dependency> |
41 | <groupId>org.onosproject</groupId> | 41 | <groupId>org.onosproject</groupId> |
42 | - <artifactId>onos-app-openstackrouting</artifactId> | 42 | + <artifactId>onos-app-openstackrouting-api</artifactId> |
43 | <version>${project.version}</version> | 43 | <version>${project.version}</version> |
44 | </dependency> | 44 | </dependency> |
45 | </dependencies> | 45 | </dependencies> | ... | ... |
-
Please register or login to post a comment