summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
f1740cd)
Fix for BUG 5137 in Neutron changes the type of extraroutes from string to
destination and nexthop. This fix is to change vpnservice code as per
neutron change.
Neutron change: https://git.opendaylight.org/gerrit/33846
Change-Id: I702f81adc3579943bef9e71e616dde4280692847
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
(cherry picked from commit
535c182e3b03fa32aaccc4349fecb835a1468a82)
package org.opendaylight.vpnservice.neutronvpn;
package org.opendaylight.vpnservice.neutronvpn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
ArrayList<Interfaces>();
List<Interfaces> newInterfaces = (update.getInterfaces() != null) ? update.getInterfaces() : new
ArrayList<Interfaces>();
ArrayList<Interfaces>();
List<Interfaces> newInterfaces = (update.getInterfaces() != null) ? update.getInterfaces() : new
ArrayList<Interfaces>();
- List<String> oldRoutes = (original.getRoutes() != null) ? original.getRoutes() : new ArrayList<String>();
- List<String> newRoutes = (update.getRoutes() != null) ? update.getRoutes() : new ArrayList<String>();
-
+ List<Routes> oldRoutes = (original.getRoutes() != null) ? original.getRoutes() : new ArrayList<Routes>();
+ List<Routes> newRoutes = (update.getRoutes() != null) ? update.getRoutes() : new ArrayList<Routes>();
if (!oldInterfaces.equals(newInterfaces)) {
for (Interfaces intrf : newInterfaces) {
if (!oldInterfaces.remove(intrf)) {
if (!oldInterfaces.equals(newInterfaces)) {
for (Interfaces intrf : newInterfaces) {
if (!oldInterfaces.remove(intrf)) {
}
}
if (!oldRoutes.equals(newRoutes)) {
}
}
if (!oldRoutes.equals(newRoutes)) {
- Iterator<String> iterator = newRoutes.iterator();
+ Iterator<Routes> iterator = newRoutes.iterator();
while (iterator.hasNext()) {
while (iterator.hasNext()) {
- String route = iterator.next();
+ Routes route = iterator.next();
if (oldRoutes.remove(route)) {
iterator.remove();
}
if (oldRoutes.remove(route)) {
iterator.remove();
}
*/
package org.opendaylight.vpnservice.neutronvpn;
*/
package org.opendaylight.vpnservice.neutronvpn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.SettableFuture;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.vpnservice.mdsalutil.MDSALUtil;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.vpnservice.mdsalutil.MDSALUtil;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
adjList.add(vmAdj);
// create extra route adjacency
if (rtr != null && rtr.getRoutes() != null) {
adjList.add(vmAdj);
// create extra route adjacency
if (rtr != null && rtr.getRoutes() != null) {
- List<String> routeList = rtr.getRoutes();
+ List<Routes> routeList = rtr.getRoutes();
List<Adjacency> erAdjList = addAdjacencyforExtraRoute(routeList, false, portname);
if (erAdjList != null && !erAdjList.isEmpty()) {
adjList.addAll(erAdjList);
List<Adjacency> erAdjList = addAdjacencyforExtraRoute(routeList, false, portname);
if (erAdjList != null && !erAdjList.isEmpty()) {
adjList.addAll(erAdjList);
- protected List<Adjacency> addAdjacencyforExtraRoute(List<String> routeList, boolean rtrUp, String vpnifname) {
+ protected List<Adjacency> addAdjacencyforExtraRoute(List<Routes> routeList, boolean rtrUp, String vpnifname) {
List<Adjacency> adjList = new ArrayList<Adjacency>();
List<Adjacency> adjList = new ArrayList<Adjacency>();
- for (String route : routeList) {
- // assuming extra route is strictly in the format "nexthop destination" > "10.1.1.10 40.0.1.0/24"
- String[] parts = route.split(" ");
- if (parts.length == 2) {
+ for (Routes route : routeList) {
+ if (route != null && route.getNexthop() != null && route.getDestination() != null) {
boolean isLockAcquired = false;
boolean isLockAcquired = false;
- String nextHop = parts[0];
- String destination = parts[1];
+ String nextHop = String.valueOf(route.getNexthop().getValue());
+ String destination = String.valueOf(route.getDestination().getValue());
String tapPortName = NeutronvpnUtils.getNeutronPortNamefromPortFixedIp(broker, nextHop);
logger.trace("Adding extra route with nexthop {}, destination {}, ifName {}", nextHop,
String tapPortName = NeutronvpnUtils.getNeutronPortNamefromPortFixedIp(broker, nextHop);
logger.trace("Adding extra route with nexthop {}, destination {}, ifName {}", nextHop,
- logger.error("Incorrect input received for extra route. {}", parts);
+ logger.error("Incorrect input received for extra route. {}", route);
- protected void removeAdjacencyforExtraRoute(List<String> routeList) {
- for (String route : routeList) {
- // assuming extra route is strictly in the format "nexthop destination" > "10.1.1.10 40.0.1.0/24"
- String[] parts = route.split(" ");
- if (parts.length == 2) {
+ protected void removeAdjacencyforExtraRoute(List<Routes> routeList) {
+ for (Routes route : routeList) {
+ if (route != null && route.getNexthop() != null && route.getDestination() != null) {
boolean isLockAcquired = false;
boolean isLockAcquired = false;
- String nextHop = parts[0];
- String destination = parts[1];
+ String nextHop = String.valueOf(route.getNexthop().getValue());
+ String destination = String.valueOf(route.getDestination().getValue());
String tapPortName = NeutronvpnUtils.getNeutronPortNamefromPortFixedIp(broker, nextHop);
logger.trace("Removing extra route with nexthop {}, destination {}, ifName {}", nextHop,
String tapPortName = NeutronvpnUtils.getNeutronPortNamefromPortFixedIp(broker, nextHop);
logger.trace("Removing extra route with nexthop {}, destination {}, ifName {}", nextHop,
- logger.error("Incorrect input received for extra route. {}", parts);
+ logger.error("Incorrect input received for extra route. {}", route);