package org.opendaylight.lispflowmapping.implementation.mdsal;
import java.util.Collection;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem;
+import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataObjectModification;
+import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
+import org.opendaylight.mdsal.binding.api.DataTreeModification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
/**
* DataListener for all AuthenticationKey modification events.
LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
LOG.trace("Value: {}", authKey);
- mapSystem.removeAuthenticationKey(authKey.getEid());
+ final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
+
+ mapSystem.removeAuthenticationKey(convertedAuthKey.getEid());
} else if (ModificationType.WRITE == mod.getModificationType() || ModificationType.SUBTREE_MODIFIED == mod
.getModificationType()) {
if (ModificationType.WRITE == mod.getModificationType()) {
LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
LOG.trace("Value: {}", authKey);
- mapSystem.addAuthenticationKey(authKey.getEid(), authKey.getMappingAuthkey());
+ final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
+
+ mapSystem.addAuthenticationKey(convertedAuthKey.getEid(), convertedAuthKey.getMappingAuthkey());
} else {
LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
}
}
}
+ private static AuthenticationKey convertToBinaryIfNecessary(AuthenticationKey authKey) {
+ Eid originalEid = authKey.getEid();
+ if (LispAddressUtil.addressNeedsConversionToBinary(originalEid.getAddress())) {
+ AuthenticationKeyBuilder akb = new AuthenticationKeyBuilder(authKey);
+ akb.setEid(LispAddressUtil.convertToBinary(originalEid));
+ return akb.build();
+ }
+ return authKey;
+ }
+
void setMappingSystem(IMappingSystem msmr) {
this.mapSystem = msmr;
}