tom

Merge remote-tracking branch 'origin/master'

package org.onlab.onos.net.host.impl;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.host.PortAddresses;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
public class DefaultPortAddresses implements PortAddresses {
private final ConnectPoint connectPoint;
private final IpAddress ipAddress;
private final MacAddress macAddress;
public DefaultPortAddresses(ConnectPoint connectPoint,
IpAddress ip, MacAddress mac) {
this.connectPoint = connectPoint;
this.ipAddress = ip;
this.macAddress = mac;
}
@Override
public ConnectPoint connectPoint() {
return connectPoint;
}
@Override
public IpAddress ip() {
return ipAddress;
}
@Override
public MacAddress mac() {
return macAddress;
}
}
......@@ -157,26 +157,22 @@ public class HostManager
@Override
public void bindAddressesToPort(IpAddress ip, MacAddress mac,
ConnectPoint connectPoint) {
// TODO Auto-generated method stub
store.updateAddressBindings(new DefaultPortAddresses(connectPoint, ip, mac));
}
@Override
public void unbindAddressesFromPort(ConnectPoint connectPoint) {
// TODO Auto-generated method stub
store.removeAddressBindings(connectPoint);
}
@Override
public Set<PortAddresses> getAddressBindings() {
// TODO Auto-generated method stub
return null;
return store.getAddressBindings();
}
@Override
public PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint) {
// TODO Auto-generated method stub
return null;
return store.getAddressBindingsForPort(connectPoint);
}
// Personalized host provider service issued to the supplied provider.
......
......@@ -51,6 +51,9 @@ public class SimpleHostStore implements HostStore {
// Hosts tracked by their location
private final Multimap<ConnectPoint, Host> locations = HashMultimap.create();
private final Map<ConnectPoint, PortAddresses> portAddresses =
new ConcurrentHashMap<>();
@Activate
public void activate() {
log.info("Started");
......@@ -195,26 +198,22 @@ public class SimpleHostStore implements HostStore {
@Override
public void updateAddressBindings(PortAddresses addresses) {
// TODO Auto-generated method stub
portAddresses.put(addresses.connectPoint(), addresses);
}
@Override
public void removeAddressBindings(ConnectPoint connectPoint) {
// TODO Auto-generated method stub
portAddresses.remove(connectPoint);
}
@Override
public Set<PortAddresses> getAddressBindings() {
// TODO Auto-generated method stub
return null;
return new HashSet<>(portAddresses.values());
}
@Override
public PortAddresses getAddressBindingsForPort(ConnectPoint connectPoint) {
// TODO Auto-generated method stub
return null;
return portAddresses.get(connectPoint);
}
}
......