package org.opendaylight.lispflowmapping.implementation;
+import java.util.List;
+
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
+import org.opendaylight.lispflowmapping.implementation.dao.HashMapDb;
import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKey;
import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil;
import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceNoMaskKey;
import org.opendaylight.lispflowmapping.implementation.lisp.MapResolver;
import org.opendaylight.lispflowmapping.implementation.lisp.MapServer;
import org.opendaylight.lispflowmapping.implementation.mdsal.AuthenticationKeyDataListener;
+import org.opendaylight.lispflowmapping.implementation.mdsal.DataStoreBackEnd;
import org.opendaylight.lispflowmapping.implementation.mdsal.MappingDataListener;
import org.opendaylight.lispflowmapping.implementation.serializer.LispMessage;
import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequestmessage.MapRequestBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.transportaddress.TransportAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.transportaddress.TransportAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.Mapping;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
private ProviderContext session;
+ private DataStoreBackEnd dsbe;
private NotificationService notificationService;
private static LispMappingService lfmService = null;
LOG.debug("BindingAwareBroker set!");
BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
bindingAwareBroker.registerProvider(this, bundleContext);
+
+ // For the time being we initialize variables here. But once we remove the activator, these should
+ // be moved to the constructor.
lfmService = this;
+ setLispDao(new HashMapDb());
}
void unsetBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
LOG.debug("BindingAwareBroker was unset in LispMappingService");
lfmService = null;
+ unsetLispDao(lispDao);
}
public void basicInit(ILispDAO dao) {
LOG.info("LISP (RFC6830) Mapping Service is destroyed!");
mapResolver = null;
mapServer = null;
+ unsetLispDao(lispDao);
closeDataListeners();
}
public void onSessionInitiated(ProviderContext session) {
LOG.info("Lisp Consumer session initialized!");
notificationService = session.getSALService(NotificationService.class);
+ dsbe = new DataStoreBackEnd(session.getSALService(DataBroker.class));
registerNotificationListener(AddMapping.class, new MapRegisterNotificationHandler());
registerNotificationListener(RequestMapping.class, new MapRequestNotificationHandler());
registerDataListeners(session.getSALService(DataBroker.class));
LOG.warn("got null map notify");
}
+ List<Mapping> mappings = LispNotificationHelper.getMapping(mapRegisterNotification);
+ for (Mapping mapping : mappings) {
+ dsbe.updateMapping(mapping);
+ }
}
}