Madan Jampani
Committed by Gerrit Code Review

Replaced GossipHostStore with a implementation built on top of EventuallyConsistentMap

Change-Id: I6b580727e5f4bb03e606c87a6748e6fbb90223e7
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.net.host;
import org.onosproject.net.HostId;
import org.onosproject.store.Timestamp;
/**
* Interface for a logical clock service that issues per host timestamps.
*/
public interface HostClockService {
/**
* Returns a new timestamp for the specified host.
* @param hostId identifier for the host.
* @return timestamp.
*/
Timestamp getTimestamp(HostId hostId);
}
......@@ -27,7 +27,6 @@ import org.onosproject.net.flowobjective.FlowObjectiveService;
import org.onosproject.net.group.GroupService;
import org.onosproject.net.host.HostAdminService;
import org.onosproject.net.host.HostService;
import org.onosproject.net.host.HostClockService;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentExtensionService;
import org.onosproject.net.intent.IntentClockService;
......@@ -136,8 +135,6 @@ public final class PolicyBuilder {
new PermissionInfo(ServicePermission.class.getName(),
HostService.class.getName(), ServicePermission.GET),
new PermissionInfo(ServicePermission.class.getName(),
HostClockService.class.getName(), ServicePermission.GET),
new PermissionInfo(ServicePermission.class.getName(),
IntentService.class.getName(), ServicePermission.GET),
new PermissionInfo(ServicePermission.class.getName(),
IntentClockService.class.getName(), ServicePermission.GET),
......@@ -209,8 +206,6 @@ public final class PolicyBuilder {
GroupService.class.getName()));
serviceDirectory.put(Permission.GROUP_EVENT, ImmutableSet.of(
GroupService.class.getName()));
serviceDirectory.put(Permission.HOST_READ, ImmutableSet.of(
HostService.class.getName(), HostClockService.class.getName()));
serviceDirectory.put(Permission.HOST_WRITE, ImmutableSet.of(
HostService.class.getName()));
serviceDirectory.put(Permission.HOST_EVENT, ImmutableSet.of(
......
package org.onosproject.store.host.impl;
import static org.onosproject.net.DefaultAnnotations.merge;
import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED;
import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED;
import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT;
import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onlab.util.KryoNamespace;
import org.onosproject.net.Annotations;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DefaultHost;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Host;
import org.onosproject.net.HostId;
import org.onosproject.net.host.HostDescription;
import org.onosproject.net.host.HostEvent;
import org.onosproject.net.host.HostStore;
import org.onosproject.net.host.HostStoreDelegate;
import org.onosproject.net.host.PortAddresses;
import org.onosproject.net.host.HostEvent.Type;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.AbstractStore;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.store.service.EventuallyConsistentMapEvent;
import org.onosproject.store.service.EventuallyConsistentMapListener;
import org.onosproject.store.service.LogicalClockService;
import org.onosproject.store.service.StorageService;
import org.slf4j.Logger;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import static com.google.common.collect.Multimaps.newSetMultimap;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static com.google.common.collect.Sets.newConcurrentHashSet;
/**
* Manages the inventory of hosts using a {@code EventuallyConsistentMap}.
*/
@Component(immediate = true)
@Service
public class ECHostStore
extends AbstractStore<HostEvent, HostStoreDelegate>
implements HostStore {
private final Logger log = getLogger(getClass());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected StorageService storageService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected LogicalClockService clockService;
// Hosts tracked by their location
private final Multimap<ConnectPoint, Host> locations
= synchronizedSetMultimap(newSetMultimap(new ConcurrentHashMap<>(),
() -> newConcurrentHashSet()));
private final SetMultimap<ConnectPoint, PortAddresses> portAddresses =
Multimaps.synchronizedSetMultimap(
HashMultimap.<ConnectPoint, PortAddresses>create());
private EventuallyConsistentMap<HostId, DefaultHost> hosts;
private EventuallyConsistentMapListener<HostId, DefaultHost> hostLocationTracker =
new HostLocationTracker();
@Activate
public void activate() {
KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API);
hosts = storageService.<HostId, DefaultHost>eventuallyConsistentMapBuilder()
.withName("onos-hosts")
.withSerializer(hostSerializer)
.withTimestampProvider((k, v) -> clockService.getTimestamp())
.build();
hosts.addListener(hostLocationTracker);
log.info("Started");
}
@Deactivate
public void deactivate() {
hosts.removeListener(hostLocationTracker);
hosts.destroy();
locations.clear();
portAddresses.clear();
log.info("Stopped");
}
@Override
public HostEvent createOrUpdateHost(ProviderId providerId,
HostId hostId,
HostDescription hostDescription) {
DefaultHost currentHost = hosts.get(hostId);
if (currentHost == null) {
DefaultHost newhost = new DefaultHost(
providerId,
hostId,
hostDescription.hwAddress(),
hostDescription.vlan(),
hostDescription.location(),
ImmutableSet.copyOf(hostDescription.ipAddress()));
hosts.put(hostId, newhost);
return new HostEvent(HOST_ADDED, newhost);
}
return updateHost(providerId, hostId, hostDescription, currentHost);
}
@Override
public HostEvent removeHost(HostId hostId) {
Host host = hosts.remove(hostId);
return host != null ? new HostEvent(HOST_REMOVED, host) : null;
}
@Override
public int getHostCount() {
return hosts.size();
}
@Override
public Iterable<Host> getHosts() {
return ImmutableSet.copyOf(hosts.values());
}
@Override
public Host getHost(HostId hostId) {
return hosts.get(hostId);
}
@Override
public Set<Host> getHosts(VlanId vlanId) {
return filter(hosts.values(), host -> Objects.equals(host.vlan(), vlanId));
}
@Override
public Set<Host> getHosts(MacAddress mac) {
return filter(hosts.values(), host -> Objects.equals(host.mac(), mac));
}
@Override
public Set<Host> getHosts(IpAddress ip) {
return filter(hosts.values(), host -> host.ipAddresses().contains(ip));
}
@Override
public Set<Host> getConnectedHosts(ConnectPoint connectPoint) {
return ImmutableSet.copyOf(locations.get(connectPoint));
}
@Override
public Set<Host> getConnectedHosts(DeviceId deviceId) {
return locations.entries()
.stream()
.filter(entry -> entry.getKey().deviceId().equals(deviceId))
.map(entry -> entry.getValue())
.collect(Collectors.toSet());
}
@Override
public void updateAddressBindings(PortAddresses addresses) {
portAddresses.put(addresses.connectPoint(), addresses);
}
@Override
public void removeAddressBindings(PortAddresses addresses) {
portAddresses.remove(addresses.connectPoint(), addresses);
}
@Override
public void clearAddressBindings(ConnectPoint connectPoint) {
portAddresses.removeAll(connectPoint);
}
@Override
public Set<PortAddresses> getAddressBindings() {
return ImmutableSet.copyOf(portAddresses.values());
}
@Override
public Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint) {
synchronized (portAddresses) {
Set<PortAddresses> addresses = portAddresses.get(connectPoint);
return addresses == null ? Collections.emptySet() : ImmutableSet.copyOf(addresses);
}
}
private Set<Host> filter(Collection<DefaultHost> collection, Predicate<DefaultHost> predicate) {
return collection.stream().filter(predicate).collect(Collectors.toSet());
}
// checks for type of update to host, sends appropriate event
private HostEvent updateHost(ProviderId providerId,
HostId hostId,
HostDescription descr,
DefaultHost currentHost) {
final boolean hostMoved = !currentHost.location().equals(descr.location());
if (hostMoved ||
!currentHost.ipAddresses().containsAll(descr.ipAddress()) ||
!descr.annotations().keys().isEmpty()) {
Set<IpAddress> addresses = Sets.newHashSet(currentHost.ipAddresses());
addresses.addAll(descr.ipAddress());
Annotations annotations = merge((DefaultAnnotations) currentHost.annotations(),
descr.annotations());
DefaultHost updatedHost = new DefaultHost(providerId, currentHost.id(),
currentHost.mac(), currentHost.vlan(),
descr.location(),
addresses,
annotations);
// TODO: We need a way to detect conflicting changes and abort update.
hosts.put(hostId, updatedHost);
locations.remove(currentHost.location(), currentHost);
locations.put(updatedHost.location(), updatedHost);
HostEvent.Type eventType = hostMoved ? Type.HOST_MOVED : Type.HOST_UPDATED;
return new HostEvent(eventType, updatedHost);
}
return null;
}
private class HostLocationTracker implements EventuallyConsistentMapListener<HostId, DefaultHost> {
@Override
public void event(EventuallyConsistentMapEvent<HostId, DefaultHost> event) {
DefaultHost host = event.value();
if (event.type() == PUT) {
locations.put(host.location(), host);
} else if (event.type() == REMOVE) {
locations.remove(host.location(), host);
}
}
}
}
/*
* Copyright 2014-2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import org.onosproject.store.cluster.messaging.MessageSubject;
public final class GossipHostStoreMessageSubjects {
private GossipHostStoreMessageSubjects() {}
public static final MessageSubject HOST_UPDATED_MSG
= new MessageSubject("peer-host-updated");
public static final MessageSubject HOST_REMOVED_MSG
= new MessageSubject("peer-host-removed");
public static final MessageSubject HOST_ANTI_ENTROPY_ADVERTISEMENT
= new MessageSubject("host-enti-entropy-advertisement");;
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import org.onosproject.cluster.NodeId;
import org.onosproject.net.HostId;
import org.onosproject.store.Timestamp;
/**
* Host AE Advertisement message.
*/
public final class HostAntiEntropyAdvertisement {
private final NodeId sender;
private final Map<HostFragmentId, Timestamp> timestamps;
private final Map<HostId, Timestamp> tombstones;
public HostAntiEntropyAdvertisement(NodeId sender,
Map<HostFragmentId, Timestamp> timestamps,
Map<HostId, Timestamp> tombstones) {
this.sender = checkNotNull(sender);
this.timestamps = checkNotNull(timestamps);
this.tombstones = checkNotNull(tombstones);
}
public NodeId sender() {
return sender;
}
public Map<HostFragmentId, Timestamp> timestamps() {
return timestamps;
}
public Map<HostId, Timestamp> tombstones() {
return tombstones;
}
// For serializer
@SuppressWarnings("unused")
private HostAntiEntropyAdvertisement() {
this.sender = null;
this.timestamps = null;
this.tombstones = null;
}
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import static org.slf4j.LoggerFactory.getLogger;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.net.HostId;
import org.onosproject.net.host.HostClockService;
import org.onosproject.store.Timestamp;
import org.onosproject.store.service.WallClockTimestamp;
import org.slf4j.Logger;
/**
* HostClockService to issue Timestamps based on local wallclock time.
*/
@Component(immediate = true)
@Service
public class HostClockManager implements HostClockService {
private final Logger log = getLogger(getClass());
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
log.info("Stopped");
}
@Override
public Timestamp getTimestamp(HostId hostId) {
return new WallClockTimestamp();
}
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import java.util.Objects;
import org.onosproject.net.HostId;
import org.onosproject.net.provider.ProviderId;
import com.google.common.base.MoreObjects;
/**
* Identifier for HostDescription from a Provider.
*/
public final class HostFragmentId {
public final ProviderId providerId;
public final HostId hostId;
public HostFragmentId(HostId hostId, ProviderId providerId) {
this.providerId = providerId;
this.hostId = hostId;
}
public HostId hostId() {
return hostId;
}
public ProviderId providerId() {
return providerId;
}
@Override
public int hashCode() {
return Objects.hash(providerId, hostId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HostFragmentId)) {
return false;
}
HostFragmentId that = (HostFragmentId) obj;
return Objects.equals(this.hostId, that.hostId) &&
Objects.equals(this.providerId, that.providerId);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("providerId", providerId)
.add("hostId", hostId)
.toString();
}
// for serializer
@SuppressWarnings("unused")
private HostFragmentId() {
this.providerId = null;
this.hostId = null;
}
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import org.onosproject.net.HostId;
import org.onosproject.net.host.HostDescription;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.Timestamp;
/**
* Information published by GossipHostStore to notify peers of a host
* change (create/update) event.
*/
public class InternalHostEvent {
private final ProviderId providerId;
private final HostId hostId;
private final HostDescription hostDescription;
private final Timestamp timestamp;
public InternalHostEvent(ProviderId providerId, HostId hostId,
HostDescription hostDescription, Timestamp timestamp) {
this.providerId = providerId;
this.hostId = hostId;
this.hostDescription = hostDescription;
this.timestamp = timestamp;
}
public ProviderId providerId() {
return providerId;
}
public HostId hostId() {
return hostId;
}
public HostDescription hostDescription() {
return hostDescription;
}
public Timestamp timestamp() {
return timestamp;
}
// Needed for serialization.
@SuppressWarnings("unused")
private InternalHostEvent() {
providerId = null;
hostId = null;
hostDescription = null;
timestamp = null;
}
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.host.impl;
import org.onosproject.net.HostId;
import org.onosproject.store.Timestamp;
/**
* Information published by GossipHostStore to notify peers of a host
* removed event.
*/
public class InternalHostRemovedEvent {
private final HostId hostId;
private final Timestamp timestamp;
public InternalHostRemovedEvent(HostId hostId, Timestamp timestamp) {
this.hostId = hostId;
this.timestamp = timestamp;
}
public HostId hostId() {
return hostId;
}
public Timestamp timestamp() {
return timestamp;
}
// for serialization.
@SuppressWarnings("unused")
private InternalHostRemovedEvent() {
hostId = null;
timestamp = null;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.intent.impl;
import org.onosproject.store.cluster.messaging.MessageSubject;
/**
* Message subjects for internal gossip intent store node-to-node messages.
*/
public final class GossipIntentStoreMessageSubjects {
private GossipIntentStoreMessageSubjects() {}
public static final MessageSubject INTENT_UPDATED_MSG
= new MessageSubject("peer-intent-updated");
public static final MessageSubject INTENT_SET_INSTALLABLES_MSG
= new MessageSubject("peer-intent-set-installables");
public static final MessageSubject INTENT_ANTI_ENTROPY_ADVERTISEMENT
= new MessageSubject("intent-anti-entropy-advertisement");
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.intent.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.net.intent.IntentClockService;
import org.onosproject.net.intent.IntentId;
import org.onosproject.store.Timestamp;
import org.onosproject.store.service.WallClockTimestamp;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
/**
* IntentClockService that issues timestamps based on local wallclock time.
*/
@Component(immediate = true)
@Service
public class IntentClockManager implements IntentClockService {
private final Logger log = getLogger(getClass());
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
log.info("Stopped");
}
@Override
public Timestamp getTimestamp(IntentId intentId) {
return new WallClockTimestamp();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.intent.impl;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.intent.IntentState;
import org.onosproject.store.Timestamp;
/**
* Information published by GossipIntentStore to notify peers of an intent
* creation or state update event.
*/
public class InternalIntentEvent {
private final IntentId intentId;
private final Intent intent;
private final IntentState state;
private final Timestamp timestamp;
public InternalIntentEvent(IntentId intentId, Intent intent, IntentState state,
Timestamp timestamp) {
this.intentId = intentId;
this.intent = intent;
this.state = state;
this.timestamp = timestamp;
}
public IntentId intentId() {
return intentId;
}
public Intent intent() {
return intent;
}
public IntentState state() {
return state;
}
public Timestamp timestamp() {
return timestamp;
}
// Needed for serialization.
@SuppressWarnings("unused")
private InternalIntentEvent() {
intentId = null;
intent = null;
state = null;
timestamp = null;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.store.intent.impl;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentId;
import org.onosproject.store.Timestamp;
import java.util.List;
/**
* Information published by GossipIntentStore to notify peers of an intent
* set installables event.
*/
public class InternalSetInstallablesEvent {
private final IntentId intentId;
private final List<Intent> installables;
private final Timestamp timestamp;
public InternalSetInstallablesEvent(IntentId intentId,
List<Intent> installables,
Timestamp timestamp) {
this.intentId = intentId;
this.installables = installables;
this.timestamp = timestamp;
}
public IntentId intentId() {
return intentId;
}
public List<Intent> installables() {
return installables;
}
public Timestamp timestamp() {
return timestamp;
}
// Needed for serialization.
@SuppressWarnings("unused")
private InternalSetInstallablesEvent() {
intentId = null;
installables = null;
timestamp = null;
}
}
......@@ -51,6 +51,7 @@ import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DefaultDevice;
import org.onosproject.net.DefaultEdgeLink;
import org.onosproject.net.DefaultHost;
import org.onosproject.net.DefaultLink;
import org.onosproject.net.DefaultPath;
import org.onosproject.net.DefaultPort;
......@@ -267,6 +268,7 @@ public final class KryoNamespaces {
DefaultControllerNode.class,
DefaultDevice.class,
DefaultDeviceDescription.class,
DefaultHost.class,
DefaultLinkDescription.class,
Port.class,
DefaultPortDescription.class,
......