SONA: OpenstackSwitching - remove flows
- Remove the corresponding flows when VMs are removed. - Remove the IP mapping of the VM removed from the DHCP service (even when doNotPushFlows is true) - Updated the network config json file to reflect the change of cordvtn Change-Id: I4c359d456422ece37b93e6366f2fd4daaf081a37
Showing
6 changed files
with
166 additions
and
22 deletions
... | @@ -35,13 +35,14 @@ public interface OpenstackSwitchingService { | ... | @@ -35,13 +35,14 @@ public interface OpenstackSwitchingService { |
35 | * Removes flow rules corresponding to the port removed by Openstack. | 35 | * Removes flow rules corresponding to the port removed by Openstack. |
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | - void deletePorts(); | 38 | + void deletePort(String uuid); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Updates flow rules corresponding to the port information updated by Openstack. | 41 | * Updates flow rules corresponding to the port information updated by Openstack. |
42 | * | 42 | * |
43 | + * @param openstackPort | ||
43 | */ | 44 | */ |
44 | - void updatePorts(); | 45 | + void updatePort(OpenstackPort openstackPort); |
45 | 46 | ||
46 | /** | 47 | /** |
47 | * Stores the network information created by openstack. | 48 | * Stores the network information created by openstack. | ... | ... |
... | @@ -40,6 +40,9 @@ | ... | @@ -40,6 +40,9 @@ |
40 | </api.description> | 40 | </api.description> |
41 | <api.package>org.onosproject.openstackswitching.web</api.package> | 41 | <api.package>org.onosproject.openstackswitching.web</api.package> |
42 | <onos.app.origin>SKT, Inc.</onos.app.origin> | 42 | <onos.app.origin>SKT, Inc.</onos.app.origin> |
43 | + <onos.app.requires> | ||
44 | + org.onosproject.dhcp | ||
45 | + </onos.app.requires> | ||
43 | </properties> | 46 | </properties> |
44 | 47 | ||
45 | 48 | ... | ... |
... | @@ -25,11 +25,14 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; | ... | @@ -25,11 +25,14 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; |
25 | import org.apache.felix.scr.annotations.Service; | 25 | import org.apache.felix.scr.annotations.Service; |
26 | import org.onlab.packet.Ethernet; | 26 | import org.onlab.packet.Ethernet; |
27 | import org.onlab.packet.Ip4Address; | 27 | import org.onlab.packet.Ip4Address; |
28 | +import org.onlab.packet.IpAddress; | ||
28 | import org.onosproject.core.ApplicationId; | 29 | import org.onosproject.core.ApplicationId; |
29 | import org.onosproject.core.CoreService; | 30 | import org.onosproject.core.CoreService; |
30 | import org.onosproject.dhcp.DhcpService; | 31 | import org.onosproject.dhcp.DhcpService; |
32 | +import org.onosproject.event.AbstractEvent; | ||
31 | import org.onosproject.net.Device; | 33 | import org.onosproject.net.Device; |
32 | import org.onosproject.net.DeviceId; | 34 | import org.onosproject.net.DeviceId; |
35 | +import org.onosproject.net.Host; | ||
33 | import org.onosproject.net.Port; | 36 | import org.onosproject.net.Port; |
34 | import org.onosproject.net.config.ConfigFactory; | 37 | import org.onosproject.net.config.ConfigFactory; |
35 | import org.onosproject.net.config.NetworkConfigEvent; | 38 | import org.onosproject.net.config.NetworkConfigEvent; |
... | @@ -39,7 +42,16 @@ import org.onosproject.net.device.DeviceEvent; | ... | @@ -39,7 +42,16 @@ import org.onosproject.net.device.DeviceEvent; |
39 | import org.onosproject.net.device.DeviceListener; | 42 | import org.onosproject.net.device.DeviceListener; |
40 | import org.onosproject.net.device.DeviceService; | 43 | import org.onosproject.net.device.DeviceService; |
41 | import org.onosproject.net.driver.DriverService; | 44 | import org.onosproject.net.driver.DriverService; |
45 | +import org.onosproject.net.flow.FlowEntry; | ||
46 | +import org.onosproject.net.flow.FlowRuleService; | ||
47 | +import org.onosproject.net.flow.criteria.Criterion; | ||
48 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
49 | +import org.onosproject.net.flow.instructions.Instruction; | ||
50 | +import org.onosproject.net.flow.instructions.L2ModificationInstruction; | ||
42 | import org.onosproject.net.flowobjective.FlowObjectiveService; | 51 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
52 | +import org.onosproject.net.host.HostEvent; | ||
53 | +import org.onosproject.net.host.HostListener; | ||
54 | +import org.onosproject.net.host.HostService; | ||
43 | import org.onosproject.net.packet.InboundPacket; | 55 | import org.onosproject.net.packet.InboundPacket; |
44 | import org.onosproject.net.packet.PacketContext; | 56 | import org.onosproject.net.packet.PacketContext; |
45 | import org.onosproject.net.packet.PacketProcessor; | 57 | import org.onosproject.net.packet.PacketProcessor; |
... | @@ -48,6 +60,7 @@ import org.slf4j.Logger; | ... | @@ -48,6 +60,7 @@ import org.slf4j.Logger; |
48 | import org.slf4j.LoggerFactory; | 60 | import org.slf4j.LoggerFactory; |
49 | import java.util.List; | 61 | import java.util.List; |
50 | import java.util.Collection; | 62 | import java.util.Collection; |
63 | +import java.util.NoSuchElementException; | ||
51 | import java.util.Set; | 64 | import java.util.Set; |
52 | import java.util.concurrent.ExecutorService; | 65 | import java.util.concurrent.ExecutorService; |
53 | import java.util.concurrent.Executors; | 66 | import java.util.concurrent.Executors; |
... | @@ -76,6 +89,9 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -76,6 +89,9 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
76 | protected DeviceService deviceService; | 89 | protected DeviceService deviceService; |
77 | 90 | ||
78 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 91 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
92 | + protected HostService hostService; | ||
93 | + | ||
94 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
79 | protected FlowObjectiveService flowObjectiveService; | 95 | protected FlowObjectiveService flowObjectiveService; |
80 | 96 | ||
81 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 97 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -87,6 +103,8 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -87,6 +103,8 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
87 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 103 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
88 | protected DriverService driverService; | 104 | protected DriverService driverService; |
89 | 105 | ||
106 | + protected FlowRuleService flowRuleService; | ||
107 | + | ||
90 | private ApplicationId appId; | 108 | private ApplicationId appId; |
91 | private boolean doNotPushFlows; | 109 | private boolean doNotPushFlows; |
92 | private Ip4Address neutronServer; | 110 | private Ip4Address neutronServer; |
... | @@ -101,6 +119,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -101,6 +119,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
101 | private InternalPacketProcessor internalPacketProcessor = new InternalPacketProcessor(); | 119 | private InternalPacketProcessor internalPacketProcessor = new InternalPacketProcessor(); |
102 | private InternalDeviceListener internalDeviceListener = new InternalDeviceListener(); | 120 | private InternalDeviceListener internalDeviceListener = new InternalDeviceListener(); |
103 | private InternalConfigListener internalConfigListener = new InternalConfigListener(); | 121 | private InternalConfigListener internalConfigListener = new InternalConfigListener(); |
122 | + private InternalHostListener internalHostListener = new InternalHostListener(); | ||
104 | private final Set<ConfigFactory> factories = ImmutableSet.of( | 123 | private final Set<ConfigFactory> factories = ImmutableSet.of( |
105 | new ConfigFactory<ApplicationId, OpenstackSwitchingConfig>(APP_SUBJECT_FACTORY, | 124 | new ConfigFactory<ApplicationId, OpenstackSwitchingConfig>(APP_SUBJECT_FACTORY, |
106 | OpenstackSwitchingConfig.class, | 125 | OpenstackSwitchingConfig.class, |
... | @@ -120,6 +139,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -120,6 +139,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
120 | factories.forEach(cfgService::registerConfigFactory); | 139 | factories.forEach(cfgService::registerConfigFactory); |
121 | packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); | 140 | packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); |
122 | deviceService.addListener(internalDeviceListener); | 141 | deviceService.addListener(internalDeviceListener); |
142 | + hostService.addListener(internalHostListener); | ||
123 | cfgService.addListener(internalConfigListener); | 143 | cfgService.addListener(internalConfigListener); |
124 | 144 | ||
125 | internalConfigListener.configureNetwork(); | 145 | internalConfigListener.configureNetwork(); |
... | @@ -132,6 +152,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -132,6 +152,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
132 | packetService.removeProcessor(internalPacketProcessor); | 152 | packetService.removeProcessor(internalPacketProcessor); |
133 | deviceService.removeListener(internalDeviceListener); | 153 | deviceService.removeListener(internalDeviceListener); |
134 | cfgService.removeListener(internalConfigListener); | 154 | cfgService.removeListener(internalConfigListener); |
155 | + factories.forEach(cfgService::unregisterConfigFactory); | ||
135 | 156 | ||
136 | deviceEventExcutorService.shutdown(); | 157 | deviceEventExcutorService.shutdown(); |
137 | 158 | ||
... | @@ -144,13 +165,12 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -144,13 +165,12 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
144 | } | 165 | } |
145 | 166 | ||
146 | @Override | 167 | @Override |
147 | - public void deletePorts() { | 168 | + public void deletePort(String uuid) { |
148 | 169 | ||
149 | } | 170 | } |
150 | 171 | ||
151 | @Override | 172 | @Override |
152 | - public void updatePorts() { | 173 | + public void updatePort(OpenstackPort openstackPort) { |
153 | - | ||
154 | } | 174 | } |
155 | 175 | ||
156 | @Override | 176 | @Override |
... | @@ -201,7 +221,8 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -201,7 +221,8 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
201 | } | 221 | } |
202 | 222 | ||
203 | private void processPortAdded(Device device, Port port) { | 223 | private void processPortAdded(Device device, Port port) { |
204 | - if (!port.annotations().value("portName").equals("vxlan")) { | 224 | + if (!port.annotations().value("portName").equals("vxlan") |
225 | + && port.isEnabled() && !doNotPushFlows) { | ||
205 | OpenstackSwitchingRulePopulator rulePopulator = | 226 | OpenstackSwitchingRulePopulator rulePopulator = |
206 | new OpenstackSwitchingRulePopulator(appId, flowObjectiveService, | 227 | new OpenstackSwitchingRulePopulator(appId, flowObjectiveService, |
207 | deviceService, restHandler, driverService); | 228 | deviceService, restHandler, driverService); |
... | @@ -210,7 +231,6 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -210,7 +231,6 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
210 | } | 231 | } |
211 | 232 | ||
212 | private void processPortRemoved(Device device, Port port) { | 233 | private void processPortRemoved(Device device, Port port) { |
213 | - // TODO: Remove flow rules for the VM removed | ||
214 | log.debug("port {} is removed", port.toString()); | 234 | log.debug("port {} is removed", port.toString()); |
215 | } | 235 | } |
216 | 236 | ||
... | @@ -238,6 +258,50 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -238,6 +258,50 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
238 | ); | 258 | ); |
239 | } | 259 | } |
240 | 260 | ||
261 | + private void processHostRemoved(Host host) { | ||
262 | + log.debug("host {} was removed", host.toString()); | ||
263 | + | ||
264 | + try { | ||
265 | + if (!doNotPushFlows) { | ||
266 | + IpAddress hostIp = host.ipAddresses().stream(). | ||
267 | + filter(ip -> ip.isIp4()).findAny().orElse(null); | ||
268 | + OpenstackSwitchingRulePopulator rulePopulator = | ||
269 | + new OpenstackSwitchingRulePopulator(appId, flowObjectiveService, | ||
270 | + deviceService, restHandler, driverService); | ||
271 | + rulePopulator.removeSwitchingRules(host.location().deviceId(), | ||
272 | + hostIp.getIp4Address()); | ||
273 | + } | ||
274 | + | ||
275 | + dhcpService.removeStaticMapping(host.mac()); | ||
276 | + } catch (NoSuchElementException e) { | ||
277 | + log.error("No IP address is assigned."); | ||
278 | + } | ||
279 | + } | ||
280 | + | ||
281 | + private long getVniFromFlowRules(DeviceId deviceId, Ip4Address hostIp) { | ||
282 | + | ||
283 | + for (FlowEntry flowEntry: flowRuleService.getFlowEntries(deviceId)) { | ||
284 | + Criterion c = flowEntry.selector().getCriterion(Criterion.Type.IPV4_DST); | ||
285 | + if (c != null) { | ||
286 | + IPCriterion destIpCriterion = (IPCriterion) c; | ||
287 | + if (destIpCriterion.ip().getIp4Prefix().address().equals(hostIp)) { | ||
288 | + for (Instruction i : flowEntry.treatment().immediate()) { | ||
289 | + if (i.type().equals(Instruction.Type.L2MODIFICATION)) { | ||
290 | + L2ModificationInstruction l2m = (L2ModificationInstruction) i; | ||
291 | + if (l2m.subtype().equals(L2ModificationInstruction.L2SubType.TUNNEL_ID)) { | ||
292 | + L2ModificationInstruction.ModTunnelIdInstruction setTunnelInstr = | ||
293 | + (L2ModificationInstruction.ModTunnelIdInstruction) l2m; | ||
294 | + return setTunnelInstr.tunnelId(); | ||
295 | + } | ||
296 | + } | ||
297 | + } | ||
298 | + } | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
302 | + return 0; | ||
303 | + } | ||
304 | + | ||
241 | private void registerDhcpInfo(OpenstackPort openstackPort) { | 305 | private void registerDhcpInfo(OpenstackPort openstackPort) { |
242 | Ip4Address ip4Address; | 306 | Ip4Address ip4Address; |
243 | Ip4Address subnetMask; | 307 | Ip4Address subnetMask; |
... | @@ -301,6 +365,14 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -301,6 +365,14 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
301 | } | 365 | } |
302 | } | 366 | } |
303 | 367 | ||
368 | + private class InternalHostListener implements HostListener { | ||
369 | + | ||
370 | + @Override | ||
371 | + public void event(HostEvent hostEvent) { | ||
372 | + deviceEventExcutorService.execute(new InternalEventHandler(hostEvent)); | ||
373 | + } | ||
374 | + } | ||
375 | + | ||
304 | private class InternalDeviceListener implements DeviceListener { | 376 | private class InternalDeviceListener implements DeviceListener { |
305 | 377 | ||
306 | @Override | 378 | @Override |
... | @@ -311,18 +383,17 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -311,18 +383,17 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
311 | 383 | ||
312 | private class InternalEventHandler implements Runnable { | 384 | private class InternalEventHandler implements Runnable { |
313 | 385 | ||
314 | - volatile DeviceEvent deviceEvent; | 386 | + volatile AbstractEvent event; |
315 | 387 | ||
316 | - InternalEventHandler(DeviceEvent deviceEvent) { | 388 | + InternalEventHandler(AbstractEvent event) { |
317 | - this.deviceEvent = deviceEvent; | 389 | + this.event = event; |
318 | } | 390 | } |
319 | 391 | ||
320 | @Override | 392 | @Override |
321 | public void run() { | 393 | public void run() { |
322 | 394 | ||
323 | - if (doNotPushFlows) { | 395 | + if (event instanceof DeviceEvent) { |
324 | - return; | 396 | + DeviceEvent deviceEvent = (DeviceEvent) event; |
325 | - } | ||
326 | 397 | ||
327 | switch (deviceEvent.type()) { | 398 | switch (deviceEvent.type()) { |
328 | case DEVICE_ADDED: | 399 | case DEVICE_ADDED: |
... | @@ -352,6 +423,17 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -352,6 +423,17 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
352 | default: | 423 | default: |
353 | break; | 424 | break; |
354 | } | 425 | } |
426 | + } else if (event instanceof HostEvent) { | ||
427 | + HostEvent hostEvent = (HostEvent) event; | ||
428 | + | ||
429 | + switch (hostEvent.type()) { | ||
430 | + case HOST_REMOVED: | ||
431 | + processHostRemoved((Host) hostEvent.subject()); | ||
432 | + break; | ||
433 | + default: | ||
434 | + break; | ||
435 | + } | ||
436 | + } | ||
355 | } | 437 | } |
356 | } | 438 | } |
357 | 439 | ||
... | @@ -395,5 +477,4 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { | ... | @@ -395,5 +477,4 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService { |
395 | this.hostIp = hostIp; | 477 | this.hostIp = hostIp; |
396 | } | 478 | } |
397 | } | 479 | } |
398 | - | ||
399 | } | 480 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -131,6 +131,21 @@ public class OpenstackSwitchingRulePopulator { | ... | @@ -131,6 +131,21 @@ public class OpenstackSwitchingRulePopulator { |
131 | } | 131 | } |
132 | 132 | ||
133 | /** | 133 | /** |
134 | + * Remove flows rules for the VM removed. | ||
135 | + * | ||
136 | + * @param deviceId device to remove rules | ||
137 | + * @param vmIp IP address of the VM removed | ||
138 | + */ | ||
139 | + public void removeSwitchingRules(DeviceId deviceId, Ip4Address vmIp) { | ||
140 | + removeFlowRuleForVMsInSameCnode(deviceId, vmIp); | ||
141 | + deviceService.getAvailableDevices().forEach(device -> { | ||
142 | + if (!device.id().equals(deviceId)) { | ||
143 | + removeVxLanFlowRule(device.id(), vmIp); | ||
144 | + } | ||
145 | + }); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
134 | * Populates the flow rules for traffic to VMs in the same Cnode as the sender. | 149 | * Populates the flow rules for traffic to VMs in the same Cnode as the sender. |
135 | * | 150 | * |
136 | * @param device device to put the rules | 151 | * @param device device to put the rules |
... | @@ -170,10 +185,11 @@ public class OpenstackSwitchingRulePopulator { | ... | @@ -170,10 +185,11 @@ public class OpenstackSwitchingRulePopulator { |
170 | Ip4Address hostIpx = Ip4Address.valueOf(cidx.split(":")[0]); | 185 | Ip4Address hostIpx = Ip4Address.valueOf(cidx.split(":")[0]); |
171 | MacAddress vmMacx = getVmMacAddressForPort(pName); | 186 | MacAddress vmMacx = getVmMacAddressForPort(pName); |
172 | Ip4Address fixedIpx = getFixedIpAddressForPort(pName); | 187 | Ip4Address fixedIpx = getFixedIpAddressForPort(pName); |
173 | - | 188 | + if (port.isEnabled()) { |
174 | setVxLanFlowRule(vni, device.id(), hostIpx, fixedIpx, vmMacx); | 189 | setVxLanFlowRule(vni, device.id(), hostIpx, fixedIpx, vmMacx); |
175 | setVxLanFlowRule(vni, d.id(), hostIpAddress, fixedIp, vmMac); | 190 | setVxLanFlowRule(vni, d.id(), hostIpAddress, fixedIp, vmMac); |
176 | } | 191 | } |
192 | + } | ||
177 | }); | 193 | }); |
178 | } | 194 | } |
179 | }); | 195 | }); |
... | @@ -246,7 +262,7 @@ public class OpenstackSwitchingRulePopulator { | ... | @@ -246,7 +262,7 @@ public class OpenstackSwitchingRulePopulator { |
246 | .findFirst().orElse(null); | 262 | .findFirst().orElse(null); |
247 | 263 | ||
248 | if (port == null) { | 264 | if (port == null) { |
249 | - log.error("There is port information for port name {}", portName); | 265 | + log.error("There is no port information for port name {}", portName); |
250 | return null; | 266 | return null; |
251 | } | 267 | } |
252 | 268 | ||
... | @@ -341,6 +357,40 @@ public class OpenstackSwitchingRulePopulator { | ... | @@ -341,6 +357,40 @@ public class OpenstackSwitchingRulePopulator { |
341 | flowObjectiveService.forward(id, fo); | 357 | flowObjectiveService.forward(id, fo); |
342 | } | 358 | } |
343 | 359 | ||
360 | + private void removeFlowRuleForVMsInSameCnode(DeviceId id, Ip4Address vmIp) { | ||
361 | + TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | ||
362 | + | ||
363 | + sBuilder.matchEthType(Ethernet.TYPE_IPV4) | ||
364 | + .matchIPDst(vmIp.toIpPrefix()); | ||
365 | + | ||
366 | + ForwardingObjective fo = DefaultForwardingObjective.builder() | ||
367 | + .withSelector(sBuilder.build()) | ||
368 | + .withTreatment(DefaultTrafficTreatment.builder().build()) | ||
369 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
370 | + .withPriority(SWITCHING_RULE_PRIORITY) | ||
371 | + .fromApp(appId) | ||
372 | + .remove(); | ||
373 | + | ||
374 | + flowObjectiveService.forward(id, fo); | ||
375 | + } | ||
376 | + | ||
377 | + private void removeVxLanFlowRule(DeviceId id, Ip4Address vmIp) { | ||
378 | + TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | ||
379 | + // XXX: Later, more matches will be added when multiple table is implemented. | ||
380 | + sBuilder.matchEthType(Ethernet.TYPE_IPV4) | ||
381 | + .matchIPDst(vmIp.toIpPrefix()); | ||
382 | + | ||
383 | + ForwardingObjective fo = DefaultForwardingObjective.builder() | ||
384 | + .withSelector(sBuilder.build()) | ||
385 | + .withTreatment(DefaultTrafficTreatment.builder().build()) | ||
386 | + .withFlag(ForwardingObjective.Flag.VERSATILE) | ||
387 | + .withPriority(SWITCHING_RULE_PRIORITY) | ||
388 | + .fromApp(appId) | ||
389 | + .remove(); | ||
390 | + | ||
391 | + flowObjectiveService.forward(id, fo); | ||
392 | + } | ||
393 | + | ||
344 | private ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) { | 394 | private ExtensionTreatment buildNiciraExtenstion(DeviceId id, Ip4Address hostIp) { |
345 | Driver driver = driverService.getDriver(id); | 395 | Driver driver = driverService.getDriver(id); |
346 | DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id)); | 396 | DriverHandler driverHandler = new DefaultDriverHandler(new DefaultDriverData(driver, id)); | ... | ... |
... | @@ -28,6 +28,7 @@ import javax.ws.rs.DELETE; | ... | @@ -28,6 +28,7 @@ import javax.ws.rs.DELETE; |
28 | import javax.ws.rs.POST; | 28 | import javax.ws.rs.POST; |
29 | import javax.ws.rs.PUT; | 29 | import javax.ws.rs.PUT; |
30 | import javax.ws.rs.Path; | 30 | import javax.ws.rs.Path; |
31 | +import javax.ws.rs.PathParam; | ||
31 | import javax.ws.rs.Produces; | 32 | import javax.ws.rs.Produces; |
32 | import javax.ws.rs.core.MediaType; | 33 | import javax.ws.rs.core.MediaType; |
33 | import javax.ws.rs.core.Response; | 34 | import javax.ws.rs.core.Response; |
... | @@ -68,12 +69,9 @@ public class OpenstackPortWebResource extends AbstractWebResource { | ... | @@ -68,12 +69,9 @@ public class OpenstackPortWebResource extends AbstractWebResource { |
68 | } | 69 | } |
69 | } | 70 | } |
70 | 71 | ||
72 | + @Path("{portUUID}") | ||
71 | @DELETE | 73 | @DELETE |
72 | - @Path("{id}") | 74 | + public Response deletePorts(@PathParam("portUUID") String id) { |
73 | - @Consumes(MediaType.APPLICATION_JSON) | ||
74 | - @Produces(MediaType.APPLICATION_JSON) | ||
75 | - public Response deletesPorts(InputStream input) { | ||
76 | - log.debug("REST API ports is called with {}", input.toString()); | ||
77 | return Response.status(Response.Status.OK).build(); | 75 | return Response.status(Response.Status.OK).build(); |
78 | } | 76 | } |
79 | 77 | ||
... | @@ -82,7 +80,6 @@ public class OpenstackPortWebResource extends AbstractWebResource { | ... | @@ -82,7 +80,6 @@ public class OpenstackPortWebResource extends AbstractWebResource { |
82 | @Consumes(MediaType.APPLICATION_JSON) | 80 | @Consumes(MediaType.APPLICATION_JSON) |
83 | @Produces(MediaType.APPLICATION_JSON) | 81 | @Produces(MediaType.APPLICATION_JSON) |
84 | public Response updatePorts(InputStream input) { | 82 | public Response updatePorts(InputStream input) { |
85 | - log.info("REST API ports is called with {}", input.toString()); | ||
86 | return Response.status(Response.Status.OK).build(); | 83 | return Response.status(Response.Status.OK).build(); |
87 | } | 84 | } |
88 | } | 85 | } | ... | ... |
... | @@ -32,19 +32,31 @@ | ... | @@ -32,19 +32,31 @@ |
32 | "nodes" : [ | 32 | "nodes" : [ |
33 | { | 33 | { |
34 | "hostname" : "compute-01", | 34 | "hostname" : "compute-01", |
35 | +<<<<<<< HEAD | ||
35 | "ovsdbIp" : "10.40.101.208", | 36 | "ovsdbIp" : "10.40.101.208", |
37 | +======= | ||
38 | + "ovsdbIp" : "127.0.0.1", | ||
39 | +>>>>>>> 6a78e2e... SONA: OpenstackSwitching - remove flows | ||
36 | "ovsdbPort" : "6640", | 40 | "ovsdbPort" : "6640", |
37 | "bridgeId" : "of:0000000000000001" | 41 | "bridgeId" : "of:0000000000000001" |
38 | }, | 42 | }, |
39 | { | 43 | { |
40 | "hostname" : "compute-02", | 44 | "hostname" : "compute-02", |
45 | +<<<<<<< HEAD | ||
41 | "ovsdbIp" : "10.40.101.227", | 46 | "ovsdbIp" : "10.40.101.227", |
47 | +======= | ||
48 | + "ovsdbIp" : "127.0.0.1", | ||
49 | +>>>>>>> 6a78e2e... SONA: OpenstackSwitching - remove flows | ||
42 | "ovsdbPort" : "6640", | 50 | "ovsdbPort" : "6640", |
43 | "bridgeId" : "of:0000000000000002" | 51 | "bridgeId" : "of:0000000000000002" |
44 | }, | 52 | }, |
45 | { | 53 | { |
46 | "hostname" : "network", | 54 | "hostname" : "network", |
55 | +<<<<<<< HEAD | ||
47 | "ovsdbIp" : "10.40.101.209", | 56 | "ovsdbIp" : "10.40.101.209", |
57 | +======= | ||
58 | + "ovsdbIp" : "127.0.0.1", | ||
59 | +>>>>>>> 6a78e2e... SONA: OpenstackSwitching - remove flows | ||
48 | "ovsdbPort" : "6640", | 60 | "ovsdbPort" : "6640", |
49 | "bridgeId" : "of:0000000000000003" | 61 | "bridgeId" : "of:0000000000000003" |
50 | } | 62 | } | ... | ... |
-
Please register or login to post a comment