summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-01-04 16:56:33 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-01-04 18:06:38 +0000
commitf85354b24e3b18dfe9ce6cd289b947061f46d5c6 (patch)
treec7bfeaeb9dbed4251205c0441e4b33af5eda659c /v3po/v3po2vpp/src
parentae767d51cdba6f2296c52b63cd569a98d6f7db27 (diff)
HONEYCOMB-182 - Vrf support
Change-Id: Ic2328b626b198bffb550f22ca1144853c16b39e4 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java7
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/Ipv6NeighbourCustomizer.java22
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java3
3 files changed, 19 insertions, 13 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
index 6255d08ee..d7f6f327a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
@@ -60,12 +60,11 @@ public class SubInterfaceIpv4NeighbourCustomizer extends FutureJVppCustomizer
request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ // we don't have support for sub-interface routing, so not setting vrf
- //TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
- //request.vrfId
return request;
}, getFutureJVpp());
- LOG.info("Neighbour {} successfully written", id);
+ LOG.debug("Neighbour {} successfully written", id);
}
@Override
@@ -93,7 +92,7 @@ public class SubInterfaceIpv4NeighbourCustomizer extends FutureJVppCustomizer
//request.vrfId
return request;
}, getFutureJVpp());
- LOG.info("Neighbour {} successfully deleted", id);
+ LOG.debug("Neighbour {} successfully deleted", id);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/Ipv6NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/Ipv6NeighbourCustomizer.java
index 376ac9a1b..dc059c3c9 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/Ipv6NeighbourCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/Ipv6NeighbourCustomizer.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
+import com.google.common.base.Optional;
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
@@ -35,6 +36,7 @@ import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Neighbor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.NeighborKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,8 +70,8 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Parent interface index found");
addDelNeighbourAndReply(id, true,
- interfaceContext.getIndex(interfaceName, mappingContext), dataAfter);
- LOG.info("Neighbour successfully written");
+ interfaceContext.getIndex(interfaceName, mappingContext), dataAfter, writeContext);
+ LOG.debug("Neighbour successfully written");
}
@Override
@@ -97,12 +99,12 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Parent interface[{}] index found", interfaceName);
addDelNeighbourAndReply(id, false,
- interfaceContext.getIndex(interfaceName, mappingContext), dataBefore);
- LOG.info("Neighbour {} successfully deleted", id);
+ interfaceContext.getIndex(interfaceName, mappingContext), dataBefore, writeContext);
+ LOG.debug("Neighbour {} successfully deleted", id);
}
private void addDelNeighbourAndReply(InstanceIdentifier<Neighbor> id, boolean add, int parentInterfaceIndex,
- Neighbor data) throws WriteFailedException {
+ Neighbor data, WriteContext writeContext) throws WriteFailedException {
IpNeighborAddDel request = new IpNeighborAddDel();
@@ -113,8 +115,14 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
request.swIfIndex = parentInterfaceIndex;
- //TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
- //request.vrfId
+ final Optional<Interface> optIface = writeContext.readBefore(id.firstIdentifierOf(Interface.class));
+
+ // if routing set, reads vrf-id
+ if (optIface.isPresent() && optIface.get().getAugmentation(VppInterfaceAugmentation.class) != null &&
+ optIface.get().getAugmentation(VppInterfaceAugmentation.class).getRouting() != null) {
+ request.vrfId = optIface.get().getAugmentation(VppInterfaceAugmentation.class).getRouting().getIpv4VrfId()
+ .byteValue();
+ }
getReplyForWrite(getFutureJVpp().ipNeighborAddDel(request).toCompletableFuture(), id);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
index 9d26a9a40..00a0832a3 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/ip/v6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
@@ -60,9 +60,8 @@ public class SubInterfaceIpv6NeighbourCustomizer extends FutureJVppCustomizer
request.dstAddress = ipv6AddressNoZoneToArray(data.getIp());
request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ // we don't have support for sub-interface routing, so not setting vrf
- //TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
- //request.vrfId
return request;
}, getFutureJVpp());
LOG.debug("Neighbour {} successfully written", id);