Committed by
Gerrit Code Review
Fixed javadoc warnings and some cleanups
- Fixed javadoc warnings - Removed commented code lines - Removed OpenstackNetworkingConfig and SubjectFactories class which is no longer used - Fixed scalablegateway app artifact ID - Use PORT_NAME defined in net.AnnotationKeys Change-Id: Id18501addefa12655e4946b9931ec094a34ee83c
Showing
7 changed files
with
11 additions
and
245 deletions
| 1 | -/* | ||
| 2 | - * Copyright 2016-present 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.openstacknetworking; | ||
| 17 | - | ||
| 18 | -import com.fasterxml.jackson.databind.JsonNode; | ||
| 19 | -import com.google.common.collect.Maps; | ||
| 20 | -import org.onlab.packet.Ip4Address; | ||
| 21 | -import org.onosproject.net.DeviceId; | ||
| 22 | -import org.onosproject.net.config.Config; | ||
| 23 | -import org.slf4j.Logger; | ||
| 24 | - | ||
| 25 | -import java.util.Map; | ||
| 26 | - | ||
| 27 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 28 | - | ||
| 29 | -/** | ||
| 30 | - * Network Config for OpenstackNetworking application. | ||
| 31 | - * | ||
| 32 | - */ | ||
| 33 | -public class OpenstackNetworkingConfig extends Config<String> { | ||
| 34 | - | ||
| 35 | - protected final Logger log = getLogger(getClass()); | ||
| 36 | - | ||
| 37 | - public static final String PHYSICAL_ROUTER_MAC = "physicalRouterMac"; | ||
| 38 | - public static final String GATEWAY_BRIDGE_ID = "gatewayBridgeId"; | ||
| 39 | - public static final String GATEWAY_EXTERNAL_INTERFACE_NAME = "gatewayExternalInterfaceName"; | ||
| 40 | - public static final String GATEWAY_EXTERNAL_INTERFACE_MAC = "gatewayExternalInterfaceMac"; | ||
| 41 | - | ||
| 42 | - public static final String NODES = "nodes"; | ||
| 43 | - public static final String DATAPLANE_IP = "dataPlaneIp"; | ||
| 44 | - public static final String BRIDGE_ID = "bridgeId"; | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * Returns physical router mac. | ||
| 49 | - * | ||
| 50 | - * @return physical router mac | ||
| 51 | - */ | ||
| 52 | - public String physicalRouterMac() { | ||
| 53 | - return this.get(PHYSICAL_ROUTER_MAC, ""); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * Returns gateway's bridge id. | ||
| 58 | - * | ||
| 59 | - * @return bridge id | ||
| 60 | - */ | ||
| 61 | - public String gatewayBridgeId() { | ||
| 62 | - return this.get(GATEWAY_BRIDGE_ID, ""); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * Returns gateway's external interface name. | ||
| 67 | - * | ||
| 68 | - * @return external interface name | ||
| 69 | - */ | ||
| 70 | - public String gatewayExternalInterfaceName() { | ||
| 71 | - return this.get(GATEWAY_EXTERNAL_INTERFACE_NAME, ""); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - /** | ||
| 75 | - * Returns gateway's external interface mac. | ||
| 76 | - * | ||
| 77 | - * @return external interface mac | ||
| 78 | - */ | ||
| 79 | - public String gatewayExternalInterfaceMac() { | ||
| 80 | - return this.get(GATEWAY_EXTERNAL_INTERFACE_MAC, ""); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | - * Returns the data plane IP map of nodes read from network config. | ||
| 85 | - * | ||
| 86 | - * @return data plane IP map | ||
| 87 | - */ | ||
| 88 | - public Map<DeviceId, Ip4Address> nodes() { | ||
| 89 | - Map<DeviceId, Ip4Address> nodeMap = Maps.newHashMap(); | ||
| 90 | - | ||
| 91 | - JsonNode jsonNodes = object.get(NODES); | ||
| 92 | - if (jsonNodes == null) { | ||
| 93 | - log.error("There's no node information"); | ||
| 94 | - return null; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - jsonNodes.forEach(jsonNode -> { | ||
| 98 | - try { | ||
| 99 | - nodeMap.putIfAbsent(DeviceId.deviceId(jsonNode.path(BRIDGE_ID).asText()), | ||
| 100 | - Ip4Address.valueOf(jsonNode.path(DATAPLANE_IP).asText())); | ||
| 101 | - } catch (IllegalArgumentException | NullPointerException e) { | ||
| 102 | - log.error("Failed to read {}", e.toString()); | ||
| 103 | - } | ||
| 104 | - }); | ||
| 105 | - return nodeMap; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | -} |
| ... | @@ -81,17 +81,10 @@ public interface OpenstackRoutingService { | ... | @@ -81,17 +81,10 @@ public interface OpenstackRoutingService { |
| 81 | void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface); | 81 | void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface); |
| 82 | 82 | ||
| 83 | /** | 83 | /** |
| 84 | - * Checks floatingIp disassociation when corresponding deleted vm. | ||
| 85 | - * | ||
| 86 | - * @param portId Deleted vm | ||
| 87 | - * @param portInfo stored information about deleted vm | ||
| 88 | - void checkDisassociatedFloatingIp(String portId, OpenstackPortInfo portInfo); | ||
| 89 | - */ | ||
| 90 | - | ||
| 91 | - /** | ||
| 92 | * Returns network id for routerInterface. | 84 | * Returns network id for routerInterface. |
| 93 | * | 85 | * |
| 94 | * @param portId routerInterface`s port id | 86 | * @param portId routerInterface`s port id |
| 87 | + * @return network id | ||
| 95 | */ | 88 | */ |
| 96 | String networkIdForRouterInterface(String portId); | 89 | String networkIdForRouterInterface(String portId); |
| 97 | } | 90 | } | ... | ... |
| 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.openstacknetworking; | ||
| 17 | - | ||
| 18 | -import org.onosproject.net.config.SubjectFactory; | ||
| 19 | - | ||
| 20 | -/** | ||
| 21 | - * SubjectFactory class for OpenstackNetworking configuration. | ||
| 22 | - * | ||
| 23 | - */ | ||
| 24 | -public final class OpenstackSubjectFactories { | ||
| 25 | - | ||
| 26 | - private OpenstackSubjectFactories() { | ||
| 27 | - | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - public static final SubjectFactory<String> USER_DEFINED_SUBJECT_FACTORY = | ||
| 31 | - new SubjectFactory<String>(String.class, "userDefined") { | ||
| 32 | - @Override | ||
| 33 | - public String createSubject(String key) { | ||
| 34 | - return key; | ||
| 35 | - } | ||
| 36 | - }; | ||
| 37 | -} |
| ... | @@ -35,7 +35,8 @@ | ... | @@ -35,7 +35,8 @@ |
| 35 | <onos.app.url>http://onosproject.org</onos.app.url> | 35 | <onos.app.url>http://onosproject.org</onos.app.url> |
| 36 | <onos.app.requires> | 36 | <onos.app.requires> |
| 37 | org.onosproject.openstackinterface, | 37 | org.onosproject.openstackinterface, |
| 38 | - org.onosproject.openstacknode | 38 | + org.onosproject.openstacknode, |
| 39 | + org.onosproject.scalablegateway | ||
| 39 | </onos.app.requires> | 40 | </onos.app.requires> |
| 40 | </properties> | 41 | </properties> |
| 41 | 42 | ||
| ... | @@ -65,7 +66,7 @@ | ... | @@ -65,7 +66,7 @@ |
| 65 | </dependency> | 66 | </dependency> |
| 66 | <dependency> | 67 | <dependency> |
| 67 | <groupId>org.onosproject</groupId> | 68 | <groupId>org.onosproject</groupId> |
| 68 | - <artifactId>onos-scalablegateway</artifactId> | 69 | + <artifactId>onos-app-scalablegateway</artifactId> |
| 69 | <version>${project.version}</version> | 70 | <version>${project.version}</version> |
| 70 | </dependency> | 71 | </dependency> |
| 71 | <dependency> | 72 | <dependency> | ... | ... |
| ... | @@ -146,31 +146,6 @@ public class OpenstackIcmpHandler { | ... | @@ -146,31 +146,6 @@ public class OpenstackIcmpHandler { |
| 146 | PortNumber portNumber = context.inPacket().receivedFrom().port(); | 146 | PortNumber portNumber = context.inPacket().receivedFrom().port(); |
| 147 | if (icmp.getIcmpType() == ICMP.TYPE_ECHO_REQUEST) { | 147 | if (icmp.getIcmpType() == ICMP.TYPE_ECHO_REQUEST) { |
| 148 | //TODO: Considers icmp between internal subnets which are belonged to the same router. | 148 | //TODO: Considers icmp between internal subnets which are belonged to the same router. |
| 149 | - | ||
| 150 | - //OpenstackPortInfo openstackPortInfo = | ||
| 151 | - // getOpenstackPortInfo(Ip4Address.valueOf(ipPacket.getSourceAddress()), ethernet.getSourceMAC()); | ||
| 152 | - | ||
| 153 | - //checkNotNull(openstackPortInfo, "openstackPortInfo can not be null"); | ||
| 154 | - /* XXX Is this handling ICMP to gateway ????? | ||
| 155 | - if (requestToOpenstackRoutingNetwork(ipPacket.getDestinationAddress())) { | ||
| 156 | - Host host = | ||
| 157 | - if (openstackPortInfo == null) { | ||
| 158 | - if (config.gatewayBridgeId().equals(context.inPacket().receivedFrom().deviceId().toString())) { | ||
| 159 | - if (portNumber.equals(getPortForAnnotationPortName(deviceId, | ||
| 160 | - config.gatewayExternalInterfaceName()))) { | ||
| 161 | - processIcmpPacketSentToExtenal(ipPacket, icmp, ipPacket.getSourceAddress(), | ||
| 162 | - ethernet.getSourceMAC(), deviceId, portNumber); | ||
| 163 | - return; | ||
| 164 | - } | ||
| 165 | - } | ||
| 166 | - return; | ||
| 167 | - } else { | ||
| 168 | - processIcmpPacketSentToGateway(ipPacket, icmp, host); | ||
| 169 | - return; | ||
| 170 | - } | ||
| 171 | - } | ||
| 172 | - */ | ||
| 173 | - | ||
| 174 | Optional<Host> host = hostService.getHostsByMac(ethernet.getSourceMAC()).stream().findFirst(); | 149 | Optional<Host> host = hostService.getHostsByMac(ethernet.getSourceMAC()).stream().findFirst(); |
| 175 | if (!host.isPresent()) { | 150 | if (!host.isPresent()) { |
| 176 | log.warn("No host found for MAC {}", ethernet.getSourceMAC()); | 151 | log.warn("No host found for MAC {}", ethernet.getSourceMAC()); | ... | ... |
| ... | @@ -84,6 +84,7 @@ import java.util.stream.Collectors; | ... | @@ -84,6 +84,7 @@ import java.util.stream.Collectors; |
| 84 | 84 | ||
| 85 | import static com.google.common.base.Preconditions.checkNotNull; | 85 | import static com.google.common.base.Preconditions.checkNotNull; |
| 86 | import static org.onlab.util.Tools.groupedThreads; | 86 | import static org.onlab.util.Tools.groupedThreads; |
| 87 | +import static org.onosproject.net.AnnotationKeys.PORT_NAME; | ||
| 87 | 88 | ||
| 88 | @Component(immediate = true) | 89 | @Component(immediate = true) |
| 89 | @Service | 90 | @Service |
| ... | @@ -137,8 +138,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -137,8 +138,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 137 | private ConsistentMap<String, String> routerInterfaceMap; | 138 | private ConsistentMap<String, String> routerInterfaceMap; |
| 138 | private static final ProviderId PID = new ProviderId("of", "org.onosproject.openstackroutering", true); | 139 | private static final ProviderId PID = new ProviderId("of", "org.onosproject.openstackroutering", true); |
| 139 | private static final String APP_ID = "org.onosproject.openstackrouting"; | 140 | private static final String APP_ID = "org.onosproject.openstackrouting"; |
| 140 | - private static final String PORT_NAME = "portName"; | ||
| 141 | - private static final String PORTNAME_PREFIX_VM = "tap"; | ||
| 142 | private static final String DEVICE_OWNER_ROUTER_INTERFACE = "network:router_interface"; | 141 | private static final String DEVICE_OWNER_ROUTER_INTERFACE = "network:router_interface"; |
| 143 | private static final String FLOATING_IP_MAP_NAME = "openstackrouting-floatingip"; | 142 | private static final String FLOATING_IP_MAP_NAME = "openstackrouting-floatingip"; |
| 144 | private static final String TP_PORT_MAP_NAME = "openstackrouting-tpportnum"; | 143 | private static final String TP_PORT_MAP_NAME = "openstackrouting-tpportnum"; |
| ... | @@ -251,8 +250,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -251,8 +250,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 251 | new OpenstackFloatingIPHandler(rulePopulator, openstackFloatingIp, Action.ASSOCIATE, null)); | 250 | new OpenstackFloatingIPHandler(rulePopulator, openstackFloatingIp, Action.ASSOCIATE, null)); |
| 252 | registerFloatingIpToHostService(openstackFloatingIp, Action.ASSOCIATE); | 251 | registerFloatingIpToHostService(openstackFloatingIp, Action.ASSOCIATE); |
| 253 | } | 252 | } |
| 254 | - | ||
| 255 | - | ||
| 256 | } | 253 | } |
| 257 | 254 | ||
| 258 | @Override | 255 | @Override |
| ... | @@ -383,34 +380,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -383,34 +380,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 383 | ); | 380 | ); |
| 384 | } | 381 | } |
| 385 | 382 | ||
| 386 | - /* | ||
| 387 | - @Override | ||
| 388 | - public void checkDisassociatedFloatingIp(String portId, OpenstackPortInfo portInfo) { | ||
| 389 | - if (floatingIpMap.size() < 1) { | ||
| 390 | - log.info("No information in FloatingIpMap"); | ||
| 391 | - return; | ||
| 392 | - } | ||
| 393 | - OpenstackFloatingIP floatingIp = associatedFloatingIps() | ||
| 394 | - .stream() | ||
| 395 | - .filter(fIp -> fIp.portId().equals(portId)) | ||
| 396 | - .findAny() | ||
| 397 | - .orElse(null); | ||
| 398 | - if (floatingIp != null && portInfo != null) { | ||
| 399 | - l3EventExecutorService.execute( | ||
| 400 | - new OpenstackFloatingIPHandler(rulePopulator, floatingIp, false, portInfo)); | ||
| 401 | - OpenstackFloatingIP.Builder fBuilder = new OpenstackFloatingIP.Builder() | ||
| 402 | - .floatingIpAddress(floatingIp.floatingIpAddress()) | ||
| 403 | - .id(floatingIp.id()) | ||
| 404 | - .networkId(floatingIp.networkId()) | ||
| 405 | - .status(floatingIp.status()) | ||
| 406 | - .tenantId(floatingIp.tenantId()); | ||
| 407 | - floatingIpMap.replace(floatingIp.id(), fBuilder.build()); | ||
| 408 | - } else if (portInfo == null) { | ||
| 409 | - log.warn("portInfo is null as timing issue between ovs port update event and openstack deletePort event"); | ||
| 410 | - } | ||
| 411 | - } | ||
| 412 | - */ | ||
| 413 | - | ||
| 414 | @Override | 383 | @Override |
| 415 | public String networkIdForRouterInterface(String portId) { | 384 | public String networkIdForRouterInterface(String portId) { |
| 416 | return routerInterfaceMap.get(portId).value(); | 385 | return routerInterfaceMap.get(portId).value(); |
| ... | @@ -662,7 +631,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -662,7 +631,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 662 | private class InternalHostListener implements HostListener { | 631 | private class InternalHostListener implements HostListener { |
| 663 | 632 | ||
| 664 | private void hostDetected(Host host) { | 633 | private void hostDetected(Host host) { |
| 665 | - | ||
| 666 | String portId = host.annotations().value(Constants.PORT_ID); | 634 | String portId = host.annotations().value(Constants.PORT_ID); |
| 667 | OpenstackPort openstackPort = openstackService.port(portId); | 635 | OpenstackPort openstackPort = openstackService.port(portId); |
| 668 | if (openstackPort == null) { | 636 | if (openstackPort == null) { |
| ... | @@ -769,7 +737,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -769,7 +737,6 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 769 | default: | 737 | default: |
| 770 | break; | 738 | break; |
| 771 | } | 739 | } |
| 772 | - | ||
| 773 | } | 740 | } |
| 774 | } | 741 | } |
| 775 | 742 | ||
| ... | @@ -787,5 +754,4 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { | ... | @@ -787,5 +754,4 @@ public class OpenstackRoutingManager implements OpenstackRoutingService { |
| 787 | // nothing to do | 754 | // nothing to do |
| 788 | } | 755 | } |
| 789 | } | 756 | } |
| 790 | - | ||
| 791 | } | 757 | } | ... | ... |
| ... | @@ -69,6 +69,7 @@ import java.util.stream.StreamSupport; | ... | @@ -69,6 +69,7 @@ import java.util.stream.StreamSupport; |
| 69 | 69 | ||
| 70 | import static com.google.common.base.Preconditions.checkNotNull; | 70 | import static com.google.common.base.Preconditions.checkNotNull; |
| 71 | import static org.onlab.osgi.DefaultServiceDirectory.getService; | 71 | import static org.onlab.osgi.DefaultServiceDirectory.getService; |
| 72 | +import static org.onosproject.net.AnnotationKeys.PORT_NAME; | ||
| 72 | 73 | ||
| 73 | /** | 74 | /** |
| 74 | * Populates Routing Flow Rules. | 75 | * Populates Routing Flow Rules. |
| ... | @@ -86,12 +87,10 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -86,12 +87,10 @@ public class OpenstackRoutingRulePopulator { |
| 86 | private final OpenstackNodeService nodeService; | 87 | private final OpenstackNodeService nodeService; |
| 87 | 88 | ||
| 88 | private static final String PORTNAME_PREFIX_TUNNEL = "vxlan"; | 89 | private static final String PORTNAME_PREFIX_TUNNEL = "vxlan"; |
| 89 | - private static final String PORTNAME = "portName"; | ||
| 90 | private static final String PORTNAME_PREFIX_VM = "tap"; | 90 | private static final String PORTNAME_PREFIX_VM = "tap"; |
| 91 | 91 | ||
| 92 | private static final String PORTNOTNULL = "Port can not be null"; | 92 | private static final String PORTNOTNULL = "Port can not be null"; |
| 93 | private static final String DEVICENOTNULL = "Device can not be null"; | 93 | private static final String DEVICENOTNULL = "Device can not be null"; |
| 94 | - private static final String EXTPORTNOTNULL = "External port can not be null"; | ||
| 95 | private static final String TUNNEL_DESTINATION = "tunnelDst"; | 94 | private static final String TUNNEL_DESTINATION = "tunnelDst"; |
| 96 | private static final int ROUTING_RULE_PRIORITY = 25000; | 95 | private static final int ROUTING_RULE_PRIORITY = 25000; |
| 97 | private static final int FLOATING_RULE_PRIORITY = 42000; | 96 | private static final int FLOATING_RULE_PRIORITY = 42000; |
| ... | @@ -113,6 +112,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -113,6 +112,7 @@ public class OpenstackRoutingRulePopulator { |
| 113 | * @param flowObjectiveService FlowObjectiveService | 112 | * @param flowObjectiveService FlowObjectiveService |
| 114 | * @param deviceService DeviceService | 113 | * @param deviceService DeviceService |
| 115 | * @param driverService DriverService | 114 | * @param driverService DriverService |
| 115 | + * @param nodeService openstack node service | ||
| 116 | * @param gatewayService scalable gateway service | 116 | * @param gatewayService scalable gateway service |
| 117 | */ | 117 | */ |
| 118 | public OpenstackRoutingRulePopulator(ApplicationId appId, | 118 | public OpenstackRoutingRulePopulator(ApplicationId appId, |
| ... | @@ -205,7 +205,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -205,7 +205,7 @@ public class OpenstackRoutingRulePopulator { |
| 205 | 205 | ||
| 206 | private Port getPortOfExternalInterface() { | 206 | private Port getPortOfExternalInterface() { |
| 207 | return deviceService.getPorts(getGatewayNode().id()).stream() | 207 | return deviceService.getPorts(getGatewayNode().id()).stream() |
| 208 | - .filter(p -> p.annotations().value(PORTNAME) | 208 | + .filter(p -> p.annotations().value(PORT_NAME) |
| 209 | .equals(org.onosproject.openstacknode.Constants.PATCH_INTG_BRIDGE)) | 209 | .equals(org.onosproject.openstacknode.Constants.PATCH_INTG_BRIDGE)) |
| 210 | .findAny().orElse(null); | 210 | .findAny().orElse(null); |
| 211 | } | 211 | } |
| ... | @@ -293,7 +293,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -293,7 +293,7 @@ public class OpenstackRoutingRulePopulator { |
| 293 | private boolean findPortinDevice(DeviceId deviceId, String openstackPortName) { | 293 | private boolean findPortinDevice(DeviceId deviceId, String openstackPortName) { |
| 294 | Port port = deviceService.getPorts(deviceId) | 294 | Port port = deviceService.getPorts(deviceId) |
| 295 | .stream() | 295 | .stream() |
| 296 | - .filter(p -> p.isEnabled() && p.annotations().value(PORTNAME).equals(openstackPortName)) | 296 | + .filter(p -> p.isEnabled() && p.annotations().value(PORT_NAME).equals(openstackPortName)) |
| 297 | .findAny() | 297 | .findAny() |
| 298 | .orElse(null); | 298 | .orElse(null); |
| 299 | return port != null; | 299 | return port != null; |
| ... | @@ -332,7 +332,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -332,7 +332,7 @@ public class OpenstackRoutingRulePopulator { |
| 332 | */ | 332 | */ |
| 333 | public PortNumber getTunnelPort(DeviceId deviceId) { | 333 | public PortNumber getTunnelPort(DeviceId deviceId) { |
| 334 | Port port = deviceService.getPorts(deviceId).stream() | 334 | Port port = deviceService.getPorts(deviceId).stream() |
| 335 | - .filter(p -> p.annotations().value(PORTNAME).equals(PORTNAME_PREFIX_TUNNEL)) | 335 | + .filter(p -> p.annotations().value(PORT_NAME).equals(PORTNAME_PREFIX_TUNNEL)) |
| 336 | .findAny().orElse(null); | 336 | .findAny().orElse(null); |
| 337 | 337 | ||
| 338 | if (port == null) { | 338 | if (port == null) { |
| ... | @@ -404,29 +404,6 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -404,29 +404,6 @@ public class OpenstackRoutingRulePopulator { |
| 404 | flowObjectiveService.forward(deviceId, fo); | 404 | flowObjectiveService.forward(deviceId, fo); |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | - /* | ||
| 408 | - private void populateRuleToGateway(DeviceId deviceId, Device gatewayDevice, long vni) { | ||
| 409 | - TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); | ||
| 410 | - TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); | ||
| 411 | - | ||
| 412 | - sBuilder.matchEthType(Ethernet.TYPE_IPV4) | ||
| 413 | - .matchTunnelId(vni) | ||
| 414 | - .matchEthDst(Constants.GATEWAY_MAC); | ||
| 415 | - tBuilder.extension(buildNiciraExtenstion(deviceId, nodeService.nodes().get(gatewayDevice.id())), deviceId) | ||
| 416 | - .setOutput(getTunnelPort(deviceId)); | ||
| 417 | - | ||
| 418 | - ForwardingObjective fo = DefaultForwardingObjective.builder() | ||
| 419 | - .withSelector(sBuilder.build()) | ||
| 420 | - .withTreatment(tBuilder.build()) | ||
| 421 | - .withFlag(ForwardingObjective.Flag.SPECIFIC) | ||
| 422 | - .withPriority(ROUTING_RULE_PRIORITY) | ||
| 423 | - .fromApp(appId) | ||
| 424 | - .add(); | ||
| 425 | - | ||
| 426 | - flowObjectiveService.forward(deviceId, fo); | ||
| 427 | - } | ||
| 428 | - */ | ||
| 429 | - | ||
| 430 | private Device getGatewayNode() { | 407 | private Device getGatewayNode() { |
| 431 | 408 | ||
| 432 | // TODO Return the correct gateway node | 409 | // TODO Return the correct gateway node |
| ... | @@ -628,7 +605,6 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -628,7 +605,6 @@ public class OpenstackRoutingRulePopulator { |
| 628 | getHostIpfromOpenstackPort(openstackPort).getIp4Address()); | 605 | getHostIpfromOpenstackPort(openstackPort).getIp4Address()); |
| 629 | } | 606 | } |
| 630 | }); | 607 | }); |
| 631 | - | ||
| 632 | }); | 608 | }); |
| 633 | } | 609 | } |
| 634 | 610 | ||
| ... | @@ -679,7 +655,7 @@ public class OpenstackRoutingRulePopulator { | ... | @@ -679,7 +655,7 @@ public class OpenstackRoutingRulePopulator { |
| 679 | String openstackPortName = PORTNAME_PREFIX_VM + p.id().substring(0, 11); | 655 | String openstackPortName = PORTNAME_PREFIX_VM + p.id().substring(0, 11); |
| 680 | return deviceService.getPorts(device.id()) | 656 | return deviceService.getPorts(device.id()) |
| 681 | .stream() | 657 | .stream() |
| 682 | - .filter(pt -> pt.annotations().value(PORTNAME).equals(openstackPortName)) | 658 | + .filter(pt -> pt.annotations().value(PORT_NAME).equals(openstackPortName)) |
| 683 | .findAny() | 659 | .findAny() |
| 684 | .orElse(null); | 660 | .orElse(null); |
| 685 | } | 661 | } | ... | ... |
-
Please register or login to post a comment