summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java10
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java2
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java8
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/EidTableWriterFactory.java6
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/LocatorSetWriterFactory.java20
5 files changed, 21 insertions, 25 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java
index fc9b2a662..342ff50d1 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java
@@ -67,13 +67,6 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer
checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
checkAllowedCombination(id, dataAfter);
- //checks whether value with specified mapping-id does not exist in mapping allready
- final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(!localMappingsContext
- .containsEid(mappingId, writeContext.getMappingContext()),
- "Local mapping with id %s already defined", id);
-
-
try {
addDelMappingAndReply(true, dataAfter,
id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
@@ -81,7 +74,8 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer
throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
}
- //adds mapping for id and eid
+ // adds mapping for id and eid
+ final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
localMappingsContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java
index f929193a8..b125d4038 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java
@@ -61,8 +61,6 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
checkState(isNonEmptyLocatorSet(writeContext.readAfter(id).get()),
"Creating empty locator-sets is not allowed");
final String locatorSetName = dataAfter.getName();
- checkState(!locatorSetContext.containsIndex(locatorSetName, writeContext.getMappingContext()),
- "Locator set with name %s already defined", locatorSetName);
final int locatorSetIndex = addDelLocatorSetAndReply(true, dataAfter.getName(), id);
locatorSetContext.addName(locatorSetIndex, locatorSetName, writeContext.getMappingContext());
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java
index 2078f57d4..4fec4d527 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java
@@ -81,11 +81,6 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
checkAllowedCombination(id, dataAfter);
- //checks whether mapping not already contains such key
- MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(!remoteMappingContext.containsEid(mappingId, writeContext.getMappingContext()),
- "Mapping for id %s already defined", mappingId);
-
try {
addDelRemoteMappingAndReply(true, dataAfter,
id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
@@ -93,7 +88,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
}
- //after successfull adition adds mapping
+ // after successfull adition adds mapping
+ MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
remoteMappingContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/EidTableWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/EidTableWriterFactory.java
index 3b9c3f69a..3440dc339 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/EidTableWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/EidTableWriterFactory.java
@@ -53,12 +53,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
*/
public final class EidTableWriterFactory extends AbstractLispInfraFactoryBase implements WriterFactory {
- private static final InstanceIdentifier<VniTable> VNI_TABLE_ID =
+ static final InstanceIdentifier<VniTable> VNI_TABLE_ID =
LISP_CONFIG_IDENTIFIER.child(LispFeatureData.class).child(EidTable.class).child(VniTable.class);
- private static final InstanceIdentifier<VrfSubtable> VRF_SUBTABLE_ID = VNI_TABLE_ID.child(VrfSubtable.class);
+ static final InstanceIdentifier<VrfSubtable> VRF_SUBTABLE_ID = VNI_TABLE_ID.child(VrfSubtable.class);
- private static final InstanceIdentifier<BridgeDomainSubtable> BRIDGE_DOMAIN_SUBTABLE_ID =
+ static final InstanceIdentifier<BridgeDomainSubtable> BRIDGE_DOMAIN_SUBTABLE_ID =
VNI_TABLE_ID.child(BridgeDomainSubtable.class);
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/LocatorSetWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/LocatorSetWriterFactory.java
index 14b4aace7..037923798 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/LocatorSetWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/factory/LocatorSetWriterFactory.java
@@ -16,32 +16,40 @@
package io.fd.hc2vpp.lisp.translate.write.factory;
+import static io.fd.hc2vpp.lisp.translate.write.factory.EidTableWriterFactory.BRIDGE_DOMAIN_SUBTABLE_ID;
+import static io.fd.hc2vpp.lisp.translate.write.factory.EidTableWriterFactory.VRF_SUBTABLE_ID;
+
import io.fd.hc2vpp.lisp.translate.AbstractLispInfraFactoryBase;
import io.fd.hc2vpp.lisp.translate.write.InterfaceCustomizer;
import io.fd.hc2vpp.lisp.translate.write.LocatorSetCustomizer;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import java.util.Arrays;
import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
/**
* Factory producing writers for {@code LocatorSets}
*/
public final class LocatorSetWriterFactory extends AbstractLispInfraFactoryBase implements WriterFactory {
+ static InstanceIdentifier<LocatorSet> LOCATOR_SET_ID =
+ LISP_CONFIG_IDENTIFIER.child(LispFeatureData.class).child(LocatorSets.class).child(LocatorSet.class);
@Override
public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- InstanceIdentifier<LocatorSet> locatorSetId =
- LISP_CONFIG_IDENTIFIER.child(LispFeatureData.class).child(LocatorSets.class).child(LocatorSet.class);
+ // LocatorSet must be written before eid table entries, because local mappings under eid-table are referencing it
+ registry.addBefore(new GenericListWriter<>(LOCATOR_SET_ID, new LocatorSetCustomizer(vppApi, locatorSetContext)),
+ Arrays.asList(VRF_SUBTABLE_ID.child(LocalMappings.class).child(LocalMapping.class),
+ BRIDGE_DOMAIN_SUBTABLE_ID.child(LocalMappings.class).child(LocalMapping.class)));
- registry.add(new GenericListWriter<>(locatorSetId, new LocatorSetCustomizer(vppApi, locatorSetContext)));
- registry.add(new GenericListWriter<>(locatorSetId.child(Interface.class),
- new InterfaceCustomizer(vppApi, interfaceContext)));
+ registry.add(new GenericListWriter<>(LOCATOR_SET_ID.child(Interface.class),
+ new InterfaceCustomizer(vppApi, interfaceContext)));
}
}