Remove all address bindings code from Host subsystem.
This has been superseded by the InterfaceService.
Change-Id: I8aae4cfe00752a84e545a1030c199aea8b59da38
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/config/Interface.java b/apps/routing-api/src/main/java/org/onosproject/routing/config/Interface.java
index d6f6e57..8d563b87 100644
--- a/apps/routing-api/src/main/java/org/onosproject/routing/config/Interface.java
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/config/Interface.java
@@ -21,7 +21,6 @@
import org.onlab.packet.VlanId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
import java.util.Objects;
import java.util.Set;
@@ -55,18 +54,6 @@
}
/**
- * Creates an Interface based on a PortAddresses object.
- *
- * @param portAddresses the PortAddresses object to turn into an Interface
- */
- public Interface(PortAddresses portAddresses) {
- connectPoint = portAddresses.connectPoint();
- ipAddresses = Sets.newHashSet(portAddresses.ipAddresses());
- macAddress = portAddresses.mac();
- vlan = portAddresses.vlan();
- }
-
- /**
* Retrieves the connection point that this interface maps to.
*
* @return the connection point
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptor.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptor.java
deleted file mode 100644
index 78eecb8..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.routing.config.impl;
-
-import com.google.common.collect.Sets;
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.onosproject.routing.config.Interface;
-
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Adapts PortAddresses data from the HostService into Interface data used by
- * the routing module.
- */
-public class HostToInterfaceAdaptor {
-
- private final HostService hostService;
-
- public HostToInterfaceAdaptor(HostService hostService) {
- this.hostService = checkNotNull(hostService);
- }
-
- public Set<Interface> getInterfaces() {
- Set<PortAddresses> addresses = hostService.getAddressBindings();
- Set<Interface> interfaces = Sets.newHashSetWithExpectedSize(addresses.size());
- for (PortAddresses a : addresses) {
- interfaces.add(new Interface(a));
- }
- return interfaces;
- }
-
- public Interface getInterface(ConnectPoint connectPoint) {
- checkNotNull(connectPoint);
-
- Set<PortAddresses> portAddresses =
- hostService.getAddressBindingsForPort(connectPoint);
-
- for (PortAddresses addresses : portAddresses) {
- if (addresses.connectPoint().equals(connectPoint)) {
- return new Interface(addresses);
- }
- }
-
- return null;
- }
-
- public Interface getInterface(IpAddress ip) {
- Set<PortAddresses> portAddresses = hostService.getAddressBindings();
-
- for (PortAddresses portAddress : portAddresses) {
- for (InterfaceIpAddress portIp : portAddress.ipAddresses()) {
- if (portIp.ipAddress().equals(ip)) {
- return new Interface(portAddress);
- }
- }
- }
-
- return null;
- }
-
- public Interface getMatchingInterface(IpAddress ipAddress) {
- checkNotNull(ipAddress);
-
- for (PortAddresses portAddresses : hostService.getAddressBindings()) {
- for (InterfaceIpAddress ia : portAddresses.ipAddresses()) {
- if (ia.subnetAddress().contains(ipAddress)) {
- return new Interface(portAddresses);
- }
- }
- }
-
- return null;
- }
-
-}
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
index 1078319..0a6f9d4 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
@@ -38,7 +38,6 @@
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.config.basics.SubjectFactories;
-import org.onosproject.net.host.HostService;
import org.onosproject.routing.config.BgpConfig;
import org.onosproject.routing.config.BgpPeer;
import org.onosproject.routing.config.BgpSpeaker;
@@ -76,9 +75,6 @@
private String configFileName = DEFAULT_CONFIG_FILE;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected HostService hostService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected NetworkConfigRegistry registry;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -103,7 +99,6 @@
new DefaultByteArrayNodeFactory());
private MacAddress virtualGatewayMacAddress;
- private HostToInterfaceAdaptor hostAdaptor;
private ConfigFactory configFactory =
new ConfigFactory(SubjectFactories.APP_SUBJECT_FACTORY, BgpConfig.class, "bgp") {
@@ -117,7 +112,6 @@
public void activate() {
registry.registerConfigFactory(configFactory);
readConfiguration();
- hostAdaptor = new HostToInterfaceAdaptor(hostService);
log.info("Routing configuration service started");
}
@@ -189,7 +183,7 @@
@Override
public Set<Interface> getInterfaces() {
- return hostAdaptor.getInterfaces();
+ return Collections.emptySet();
}
@Override
@@ -212,17 +206,17 @@
@Override
public Interface getInterface(ConnectPoint connectPoint) {
- return hostAdaptor.getInterface(connectPoint);
+ return null;
}
@Override
public Interface getInterface(IpAddress ip) {
- return hostAdaptor.getInterface(ip);
+ return null;
}
@Override
public Interface getMatchingInterface(IpAddress ipAddress) {
- return hostAdaptor.getMatchingInterface(ipAddress);
+ return null;
}
@Override
diff --git a/apps/routing/src/test/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptorTest.java b/apps/routing/src/test/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptorTest.java
deleted file mode 100644
index 0347fc5..0000000
--- a/apps/routing/src/test/java/org/onosproject/routing/config/impl/HostToInterfaceAdaptorTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.routing.config.impl;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.onosproject.routing.config.Interface;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Unit tests for the HostToInterfaceAdaptor class.
- */
-public class HostToInterfaceAdaptorTest {
-
- private HostService hostService;
- private HostToInterfaceAdaptor adaptor;
-
- private Set<PortAddresses> portAddresses;
- private Map<ConnectPoint, Interface> interfaces;
-
- private static final ConnectPoint CP1 = new ConnectPoint(
- DeviceId.deviceId("of:1"), PortNumber.portNumber(1));
- private static final ConnectPoint CP2 = new ConnectPoint(
- DeviceId.deviceId("of:1"), PortNumber.portNumber(2));
- private static final ConnectPoint CP3 = new ConnectPoint(
- DeviceId.deviceId("of:2"), PortNumber.portNumber(1));
-
- private static final ConnectPoint NON_EXISTENT_CP = new ConnectPoint(
- DeviceId.deviceId("doesnotexist"), PortNumber.portNumber(1));
-
- @Before
- public void setUp() throws Exception {
- hostService = createMock(HostService.class);
-
- portAddresses = Sets.newHashSet();
- interfaces = Maps.newHashMap();
-
- InterfaceIpAddress ia11 =
- new InterfaceIpAddress(IpAddress.valueOf("192.168.1.1"),
- IpPrefix.valueOf("192.168.1.0/24"));
- createPortAddressesAndInterface(CP1,
- Sets.newHashSet(ia11),
- MacAddress.valueOf("00:00:00:00:00:01"),
- VlanId.NONE);
-
- // Two addresses in the same subnet
- InterfaceIpAddress ia21 =
- new InterfaceIpAddress(IpAddress.valueOf("192.168.2.1"),
- IpPrefix.valueOf("192.168.2.0/24"));
- InterfaceIpAddress ia22 =
- new InterfaceIpAddress(IpAddress.valueOf("192.168.2.2"),
- IpPrefix.valueOf("192.168.2.0/24"));
- createPortAddressesAndInterface(CP2,
- Sets.newHashSet(ia21, ia22),
- MacAddress.valueOf("00:00:00:00:00:02"),
- VlanId.vlanId((short) 4));
-
- // Two addresses in different subnets
- InterfaceIpAddress ia31 =
- new InterfaceIpAddress(IpAddress.valueOf("192.168.3.1"),
- IpPrefix.valueOf("192.168.3.0/24"));
- InterfaceIpAddress ia41 =
- new InterfaceIpAddress(IpAddress.valueOf("192.168.4.1"),
- IpPrefix.valueOf("192.168.4.0/24"));
- createPortAddressesAndInterface(CP3,
- Sets.newHashSet(ia31, ia41),
- MacAddress.valueOf("00:00:00:00:00:03"),
- VlanId.NONE);
-
- expect(hostService.getAddressBindings()).andReturn(portAddresses).anyTimes();
-
- replay(hostService);
-
- adaptor = new HostToInterfaceAdaptor(hostService);
- }
-
- /**
- * Creates both a PortAddresses and an Interface for the given inputs and
- * places them in the correct global data stores.
- *
- * @param cp the connect point
- * @param ipAddresses the set of interface IP addresses
- * @param mac the MAC address
- * @param vlan the VLAN ID
- */
- private void createPortAddressesAndInterface(
- ConnectPoint cp, Set<InterfaceIpAddress> ipAddresses,
- MacAddress mac, VlanId vlan) {
- PortAddresses pa = new PortAddresses(cp, ipAddresses, mac, vlan);
- portAddresses.add(pa);
- expect(hostService.getAddressBindingsForPort(cp)).andReturn(
- Collections.singleton(pa)).anyTimes();
-
- Interface intf = new Interface(cp, ipAddresses, mac, vlan);
- interfaces.put(cp, intf);
- }
-
- /**
- * Tests {@link HostToInterfaceAdaptor#getInterfaces()}.
- * Verifies that the set of interfaces returned matches what is expected
- * based on the input PortAddresses data.
- */
- @Test
- public void testGetInterfaces() {
- Set<Interface> adaptorIntfs = adaptor.getInterfaces();
-
- assertEquals(3, adaptorIntfs.size());
- assertTrue(adaptorIntfs.contains(this.interfaces.get(CP1)));
- assertTrue(adaptorIntfs.contains(this.interfaces.get(CP2)));
- assertTrue(adaptorIntfs.contains(this.interfaces.get(CP3)));
- }
-
- /**
- * Tests {@link HostToInterfaceAdaptor#getInterface(ConnectPoint)}.
- * Verifies that the correct interface is returned for a given connect
- * point.
- */
- @Test
- public void testGetInterface() {
- assertEquals(this.interfaces.get(CP1), adaptor.getInterface(CP1));
- assertEquals(this.interfaces.get(CP2), adaptor.getInterface(CP2));
- assertEquals(this.interfaces.get(CP3), adaptor.getInterface(CP3));
-
- // Try and get an interface for a connect point with no addresses
- reset(hostService);
- expect(hostService.getAddressBindingsForPort(NON_EXISTENT_CP))
- .andReturn(Collections.<PortAddresses>emptySet()).anyTimes();
- replay(hostService);
-
- assertNull(adaptor.getInterface(NON_EXISTENT_CP));
- }
-
- /**
- * Tests {@link HostToInterfaceAdaptor#getInterface(ConnectPoint)} in the
- * case that the input connect point is null.
- * Verifies that a NullPointerException is thrown.
- */
- @Test(expected = NullPointerException.class)
- public void testGetInterfaceNull() {
- ConnectPoint c = null;
- adaptor.getInterface(c);
- }
-
- /**
- * Tests {@link HostToInterfaceAdaptor#getMatchingInterface(IpAddress)}.
- * Verifies that the correct interface is returned based on the given IP
- * address.
- */
- @Test
- public void testGetMatchingInterface() {
- assertEquals(this.interfaces.get(CP1),
- adaptor.getMatchingInterface(IpAddress.valueOf("192.168.1.100")));
- assertEquals(this.interfaces.get(CP2),
- adaptor.getMatchingInterface(IpAddress.valueOf("192.168.2.100")));
- assertEquals(this.interfaces.get(CP3),
- adaptor.getMatchingInterface(IpAddress.valueOf("192.168.3.100")));
- assertEquals(this.interfaces.get(CP3),
- adaptor.getMatchingInterface(IpAddress.valueOf("192.168.4.100")));
-
- // Try and match an address we don't have subnet configured for
- assertNull(adaptor.getMatchingInterface(IpAddress.valueOf("1.1.1.1")));
- }
-
- /**
- * Tests {@link HostToInterfaceAdaptor#getMatchingInterface(IpAddress)} in the
- * case that the input IP address is null.
- * Verifies that a NullPointerException is thrown.
- */
- @Test(expected = NullPointerException.class)
- public void testGetMatchingInterfaceNull() {
- adaptor.getMatchingInterface(null);
- }
-
-}
diff --git a/cli/src/main/java/org/onosproject/cli/Comparators.java b/cli/src/main/java/org/onosproject/cli/Comparators.java
index 0ab6845..b0cbbdd 100644
--- a/cli/src/main/java/org/onosproject/cli/Comparators.java
+++ b/cli/src/main/java/org/onosproject/cli/Comparators.java
@@ -25,7 +25,6 @@
import org.onosproject.net.Port;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.group.Group;
-import org.onosproject.net.host.PortAddresses;
import org.onosproject.net.topology.TopologyCluster;
import java.util.Comparator;
@@ -113,13 +112,6 @@
}
};
- public static final Comparator<PortAddresses> ADDRESSES_COMPARATOR = new Comparator<PortAddresses>() {
- @Override
- public int compare(PortAddresses arg0, PortAddresses arg1) {
- return CONNECT_POINT_COMPARATOR.compare(arg0.connectPoint(), arg1.connectPoint());
- }
- };
-
public static final Comparator<Interface> INTERFACES_COMPARATOR = (intf1, intf2) ->
CONNECT_POINT_COMPARATOR.compare(intf1.connectPoint(), intf2.connectPoint());
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddressBindingsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddressBindingsListCommand.java
deleted file mode 100644
index 3ce45b9..0000000
--- a/cli/src/main/java/org/onosproject/cli/net/AddressBindingsListCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.cli.net;
-
-import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.cli.Comparators;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Lists all configured address port bindings.
- */
-@Command(scope = "onos", name = "address-bindings",
- description = "Lists all configured address port bindings.")
-public class AddressBindingsListCommand extends AbstractShellCommand {
-
- private static final String FORMAT =
- "port=%s/%s, ip(s)=%s, mac=%s, vlan=%s";
-
- @Override
- protected void execute() {
- HostService hostService = get(HostService.class);
-
- List<PortAddresses> addresses =
- Lists.newArrayList(hostService.getAddressBindings());
-
- Collections.sort(addresses, Comparators.ADDRESSES_COMPARATOR);
-
- for (PortAddresses pa : addresses) {
- print(FORMAT, pa.connectPoint().deviceId(), pa.connectPoint().port(),
- printIpAddresses(pa.ipAddresses()), pa.mac(), pa.vlan());
- }
- }
-
- private String printIpAddresses(Set<InterfaceIpAddress> addresses) {
- StringBuilder output = new StringBuilder("[");
- for (InterfaceIpAddress address : addresses) {
- output.append(address.ipAddress().toString());
- output.append("/");
- output.append(address.subnetAddress().prefixLength());
- output.append(", ");
- }
- // Remove the last comma
- output.delete(output.length() - 2 , output.length());
- output.append("]");
- return output.toString();
- }
-
-}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 640868f..9958849 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -331,9 +331,6 @@
</completers>
</command>
<command>
- <action class="org.onosproject.cli.net.AddressBindingsListCommand"/>
- </command>
- <command>
<action class="org.onosproject.cli.net.InterfacesListCommand"/>
</command>
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java b/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java
index d620fed..8676e46 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostAdminService.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.host;
-import org.onosproject.net.ConnectPoint;
import org.onosproject.net.HostId;
/**
@@ -30,37 +29,4 @@
*/
void removeHost(HostId hostId);
- /**
- * Binds IP and MAC addresses to the given connection point.
- * <p>
- * The addresses are added to the set of addresses already bound to the
- * connection point.
- *
- * @param addresses address object containing addresses to add and the port
- * to add them to
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void bindAddressesToPort(PortAddresses addresses);
-
- /**
- * Removes the addresses contained in the given PortAddresses object from
- * the set of addresses bound to the port.
- *
- * @param portAddresses set of addresses to remove and port to remove them
- * from
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void unbindAddressesFromPort(PortAddresses portAddresses);
-
- /**
- * Removes all address information for the given connection point.
- *
- * @param connectPoint the connection point to remove address information
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void clearAddresses(ConnectPoint connectPoint);
-
}
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostService.java b/core/api/src/main/java/org/onosproject/net/host/HostService.java
index be114f0..3901215 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostService.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostService.java
@@ -123,24 +123,4 @@
*/
void requestMac(IpAddress ip);
- /**
- * Returns the addresses information for all connection points.
- *
- * @return the set of address bindings for all connection points
- * @deprecated in Drake release: use InterfaceService instead
- */
- @Deprecated
- Set<PortAddresses> getAddressBindings();
-
- /**
- * Retrieves the addresses that have been bound to the given connection
- * point.
- *
- * @param connectPoint the connection point to retrieve address bindings for
- * @return addresses bound to the port
- * @deprecated in Drake release: use InterfaceService instead
- */
- @Deprecated
- Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint);
-
}
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostStore.java b/core/api/src/main/java/org/onosproject/net/host/HostStore.java
index ca11a94..35a2a8b 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostStore.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostStore.java
@@ -115,53 +115,4 @@
*/
Set<Host> getConnectedHosts(DeviceId deviceId);
- /**
- * Updates the address information for a given port. The given address
- * information is added to any previously held information for the port.
- *
- * @param addresses the port and address information
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void updateAddressBindings(PortAddresses addresses);
-
- /**
- * Removes the given addresses from the set of address information held for
- * a port.
- *
- * @param addresses the port and address information
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void removeAddressBindings(PortAddresses addresses);
-
- /**
- * Removes any previously stored address information for a given connection
- * point.
- *
- * @param connectPoint the connection point
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- void clearAddressBindings(ConnectPoint connectPoint);
-
- /**
- * Returns the address bindings stored for all connection points.
- *
- * @return the set of address bindings
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- Set<PortAddresses> getAddressBindings();
-
- /**
- * Returns the address bindings for a particular connection point.
- *
- * @param connectPoint the connection point to return address information
- * for
- * @return address information for the connection point
- * @deprecated in Drake release: address info now stored in InterfaceService
- */
- @Deprecated
- Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint);
}
diff --git a/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java b/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java
deleted file mode 100644
index 74f22ae..0000000
--- a/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.net.host;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents address information bound to a port.
- */
-public final class PortAddresses {
-
- private final ConnectPoint connectPoint;
- private final Set<InterfaceIpAddress> ipAddresses;
- private final MacAddress macAddress;
- private final VlanId vlan;
-
- /**
- * Constructs a PortAddresses object for the given connection point, with a
- * set of IP addresses and a MAC address. Both address parameters are
- * optional and can be set to null.
- *
- * @param connectPoint the connection point these addresses are for
- * @param ipAddresses a set of interface IP addresses
- * @param mac a MAC address
- * @param vlan a VLAN ID
- */
- public PortAddresses(ConnectPoint connectPoint,
- Set<InterfaceIpAddress> ipAddresses, MacAddress mac, VlanId vlan) {
- this.connectPoint = connectPoint;
- this.ipAddresses = (ipAddresses == null) ?
- Collections.<InterfaceIpAddress>emptySet()
- : new HashSet<>(ipAddresses);
- this.macAddress = mac;
- this.vlan = vlan;
- }
-
- /**
- * Returns the connection point this address information is bound to.
- *
- * @return the connection point
- */
- public ConnectPoint connectPoint() {
- return connectPoint;
- }
-
- /**
- * Returns the set of interface IP addresses.
- *
- * @return the interface IP addresses
- */
- public Set<InterfaceIpAddress> ipAddresses() {
- return ipAddresses;
- }
-
- /**
- * Returns the MAC address.
- *
- * @return the MAC address
- */
- public MacAddress mac() {
- return macAddress;
- }
-
- /**
- * Returns the VLAN ID.
- *
- * @return the VLAN ID
- */
- public VlanId vlan() {
- return vlan;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof PortAddresses)) {
- return false;
- }
-
- PortAddresses otherPa = (PortAddresses) other;
-
- return Objects.equals(this.connectPoint, otherPa.connectPoint)
- && Objects.equals(this.ipAddresses, otherPa.ipAddresses)
- && Objects.equals(this.macAddress, otherPa.macAddress)
- && Objects.equals(this.vlan, otherPa.vlan);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(connectPoint, ipAddresses, macAddress, vlan);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("connect-point", connectPoint)
- .add("ip-addresses", ipAddresses)
- .add("mac-address", macAddress)
- .add("vlan", vlan)
- .toString();
- }
-}
diff --git a/core/api/src/test/java/org/onosproject/net/host/HostServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/host/HostServiceAdapter.java
index 226dad0..0fad54a 100644
--- a/core/api/src/test/java/org/onosproject/net/host/HostServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/host/HostServiceAdapter.java
@@ -15,15 +15,15 @@
*/
package org.onosproject.net.host;
-import java.util.Set;
-
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Host;
import org.onosproject.net.HostId;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
+
+import java.util.Set;
/**
* Test adapter for host service.
@@ -89,14 +89,4 @@
public void removeListener(HostListener listener) {
}
- @Override
- public Set<PortAddresses> getAddressBindings() {
- return null;
- }
-
- @Override
- public Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint) {
- return null;
- }
-
}
diff --git a/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java b/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java
deleted file mode 100644
index 7c10cd1..0000000
--- a/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.net.host;
-
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.NetTestTools;
-
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.testing.EqualsTester;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * Unit tests for port addresses class.
- */
-public class PortAddressesTest {
-
- PortAddresses addresses1;
- PortAddresses sameAsAddresses1;
- PortAddresses addresses2;
- PortAddresses addresses3;
-
- private static final ConnectPoint CONNECT_POINT1 =
- NetTestTools.connectPoint("cp1", 1);
- private static final IpAddress IP_ADDRESS1 = IpAddress.valueOf("1.2.3.4");
- private static final IpPrefix SUBNET_ADDRESS1 =
- IpPrefix.valueOf("1.2.0.0/16");
- private static final InterfaceIpAddress INTERFACE_ADDRESS_1 =
- new InterfaceIpAddress(IP_ADDRESS1, SUBNET_ADDRESS1);
-
- private static final ConnectPoint CONNECT_POINT2 =
- NetTestTools.connectPoint("cp2", 1);
- private static final IpAddress IP_ADDRESS2 = IpAddress.valueOf("1.2.3.5");
- private static final IpPrefix SUBNET_ADDRESS2 =
- IpPrefix.valueOf("1.3.0.0/16");
- private static final InterfaceIpAddress INTERFACE_ADDRESS_2 =
- new InterfaceIpAddress(IP_ADDRESS2, SUBNET_ADDRESS2);
-
- Set<InterfaceIpAddress> ipAddresses;
-
-
- /**
- * Initializes local data used by all test cases.
- */
- @Before
- public void setUpAddresses() {
- ipAddresses = ImmutableSet.of(INTERFACE_ADDRESS_1,
- INTERFACE_ADDRESS_2);
- addresses1 = new PortAddresses(CONNECT_POINT1, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- sameAsAddresses1 = new PortAddresses(CONNECT_POINT1, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- addresses2 = new PortAddresses(CONNECT_POINT2, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- addresses3 = new PortAddresses(CONNECT_POINT2, ipAddresses,
- MacAddress.ZERO, VlanId.NONE);
- }
-
- /**
- * Checks that the PortAddresses class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PortAddresses.class);
- }
-
- /**
- * Checks the operation of the equals(), hash() and toString()
- * methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(addresses1, sameAsAddresses1)
- .addEqualityGroup(addresses2)
- .addEqualityGroup(addresses3)
- .testEquals();
- }
-
- /**
- * Tests that object are created correctly.
- */
- @Test
- public void testConstruction() {
- assertThat(addresses1.mac(), is(MacAddress.BROADCAST));
- assertThat(addresses1.connectPoint(), is(CONNECT_POINT1));
- assertThat(addresses1.ipAddresses(), is(ipAddresses));
- assertThat(addresses1.vlan(), is(VlanId.NONE));
- }
-}
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleHostStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleHostStore.java
index f5604f6..7095d7b 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleHostStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleHostStore.java
@@ -15,23 +15,16 @@
*/
package org.onosproject.store.trivial;
-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_MOVED;
-import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED;
-import static org.onosproject.net.host.HostEvent.Type.HOST_UPDATED;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Multimap;
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.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
import org.onosproject.net.Annotations;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
@@ -44,19 +37,21 @@
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.provider.ProviderId;
import org.onosproject.store.AbstractStore;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
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 java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+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_MOVED;
+import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED;
+import static org.onosproject.net.host.HostEvent.Type.HOST_UPDATED;
+import static org.slf4j.LoggerFactory.getLogger;
// TODO: multi-provider, annotation not supported.
/**
@@ -77,10 +72,6 @@
// Hosts tracked by their location
private final Multimap<ConnectPoint, Host> locations = HashMultimap.create();
- private final SetMultimap<ConnectPoint, PortAddresses> portAddresses =
- Multimaps.synchronizedSetMultimap(
- HashMultimap.<ConnectPoint, PortAddresses>create());
-
@Activate
public void activate() {
log.info("Started");
@@ -224,41 +215,6 @@
return hostset;
}
- @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() {
- synchronized (portAddresses) {
- return ImmutableSet.copyOf(portAddresses.values());
- }
- }
-
- @Override
- public Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint) {
- synchronized (portAddresses) {
- Set<PortAddresses> addresses = portAddresses.get(connectPoint);
-
- if (addresses == null) {
- return Collections.emptySet();
- } else {
- return ImmutableSet.copyOf(addresses);
- }
- }
- }
-
// Auxiliary extension to allow location to mutate.
private static final class StoredHost extends DefaultHost {
private HostLocation location;
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
index 26b96eb..9adba01 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
@@ -46,7 +46,6 @@
import org.onosproject.net.host.HostService;
import org.onosproject.net.host.HostStore;
import org.onosproject.net.host.HostStoreDelegate;
-import org.onosproject.net.host.PortAddresses;
import org.onosproject.net.packet.PacketService;
import org.onosproject.net.provider.AbstractProviderService;
import org.slf4j.Logger;
@@ -199,33 +198,6 @@
}
}
- @Override
- public void bindAddressesToPort(PortAddresses addresses) {
- store.updateAddressBindings(addresses);
- }
-
- @Override
- public void unbindAddressesFromPort(PortAddresses portAddresses) {
- store.removeAddressBindings(portAddresses);
- }
-
- @Override
- public void clearAddresses(ConnectPoint connectPoint) {
- store.clearAddressBindings(connectPoint);
- }
-
- @Override
- public Set<PortAddresses> getAddressBindings() {
- checkPermission(HOST_READ);
- return store.getAddressBindings();
- }
-
- @Override
- public Set<PortAddresses> getAddressBindingsForPort(ConnectPoint connectPoint) {
- checkPermission(HOST_READ);
- return store.getAddressBindingsForPort(connectPoint);
- }
-
// Personalized host provider service issued to the supplied provider.
private class InternalHostProviderService
extends AbstractProviderService<HostProvider>
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
index dbb807f..92c6c93 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
@@ -15,6 +15,36 @@
*/
package org.onosproject.net.host.impl;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.common.event.impl.TestEventDispatcher;
+import org.onosproject.event.Event;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.NetworkConfigServiceAdapter;
+import org.onosproject.net.host.DefaultHostDescription;
+import org.onosproject.net.host.HostDescription;
+import org.onosproject.net.host.HostEvent;
+import org.onosproject.net.host.HostListener;
+import org.onosproject.net.host.HostProvider;
+import org.onosproject.net.host.HostProviderRegistry;
+import org.onosproject.net.host.HostProviderService;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.store.trivial.SimpleHostStore;
+
+import java.util.List;
+import java.util.Set;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -26,41 +56,6 @@
import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED;
import static org.onosproject.net.host.HostEvent.Type.HOST_UPDATED;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.event.Event;
-import org.onosproject.common.event.impl.TestEventDispatcher;
-import org.onosproject.net.config.NetworkConfigServiceAdapter;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.HostId;
-import org.onosproject.net.HostLocation;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.host.DefaultHostDescription;
-import org.onosproject.net.host.HostDescription;
-import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.host.HostListener;
-import org.onosproject.net.host.HostProvider;
-import org.onosproject.net.host.HostProviderRegistry;
-import org.onosproject.net.host.HostProviderService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.onosproject.net.provider.AbstractProvider;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.store.trivial.SimpleHostStore;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
/**
* Test codifying the host service & host provider service contracts.
*/
@@ -90,27 +85,6 @@
private static final PortNumber P2 = PortNumber.portNumber(200);
private static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L);
private static final HostLocation LOC2 = new HostLocation(DID1, P2, 123L);
- private static final ConnectPoint CP1 = new ConnectPoint(DID1, P1);
- private static final ConnectPoint CP2 = new ConnectPoint(DID2, P2);
-
- private static final InterfaceIpAddress IA1 =
- new InterfaceIpAddress(IpAddress.valueOf("10.1.1.1"),
- IpPrefix.valueOf("10.1.1.0/24"));
- private static final InterfaceIpAddress IA2 =
- new InterfaceIpAddress(IpAddress.valueOf("10.2.2.2"),
- IpPrefix.valueOf("10.2.0.0/16"));
- private static final InterfaceIpAddress IA3 =
- new InterfaceIpAddress(IpAddress.valueOf("10.3.3.3"),
- IpPrefix.valueOf("10.3.3.0/24"));
- private static final InterfaceIpAddress IA4 =
- new InterfaceIpAddress(IpAddress.valueOf("2001:100::1"),
- IpPrefix.valueOf("2001:100::/56"));
- private static final InterfaceIpAddress IA5 =
- new InterfaceIpAddress(IpAddress.valueOf("2001:200::1"),
- IpPrefix.valueOf("2001:200::/48"));
- private static final InterfaceIpAddress IA6 =
- new InterfaceIpAddress(IpAddress.valueOf("2001:300::1"),
- IpPrefix.valueOf("2001:300::/56"));
private HostManager mgr;
@@ -290,240 +264,6 @@
}
- @Test
- public void bindAddressesToPort() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1, IA2), MAC1, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- // Add some more addresses and check that they're added correctly
- PortAddresses add2 =
- new PortAddresses(CP1, Sets.newHashSet(IA3), null,
- VlanId.vlanId((short) 2));
-
- mgr.bindAddressesToPort(add2);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(2, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- assertTrue(storedAddresses.contains(add2));
-
- PortAddresses add3 = new PortAddresses(CP1, null, MAC2, VlanId.NONE);
-
- mgr.bindAddressesToPort(add3);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(3, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- assertTrue(storedAddresses.contains(add2));
- assertTrue(storedAddresses.contains(add3));
- }
-
- @Test
- public void bindAddressesToPortIPv6() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4, IA5), MAC3, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- // Add some more addresses and check that they're added correctly
- PortAddresses add2 =
- new PortAddresses(CP1, Sets.newHashSet(IA6), null,
- VlanId.vlanId((short) 2));
-
- mgr.bindAddressesToPort(add2);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(2, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- assertTrue(storedAddresses.contains(add2));
-
- PortAddresses add3 = new PortAddresses(CP1, null, MAC4, VlanId.NONE);
-
- mgr.bindAddressesToPort(add3);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(3, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- assertTrue(storedAddresses.contains(add2));
- assertTrue(storedAddresses.contains(add3));
- }
-
- @Test
- public void unbindAddressesFromPort() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1, IA2), MAC1, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- PortAddresses rem1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1), null, VlanId.NONE);
-
- mgr.unbindAddressesFromPort(rem1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- // It shouldn't have been removed because it didn't match the originally
- // submitted address object
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- mgr.unbindAddressesFromPort(add1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertTrue(storedAddresses.isEmpty());
- }
-
- @Test
- public void unbindAddressesFromPortIPv6() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4, IA5), MAC3, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- PortAddresses rem1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4), null, VlanId.NONE);
-
- mgr.unbindAddressesFromPort(rem1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- // It shouldn't have been removed because it didn't match the originally
- // submitted address object
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- mgr.unbindAddressesFromPort(add1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertTrue(storedAddresses.isEmpty());
- }
-
- @Test
- public void clearAddresses() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1, IA2), MAC1, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- mgr.clearAddresses(CP1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertTrue(storedAddresses.isEmpty());
- }
-
- @Test
- public void clearAddressesIPv6() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4, IA5), MAC3, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
-
- mgr.clearAddresses(CP1);
- storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertTrue(storedAddresses.isEmpty());
- }
-
- @Test
- public void getAddressBindingsForPort() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1, IA2), MAC1, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- }
-
- @Test
- public void getAddressBindingsForPortIPv6() {
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4, IA5), MAC3, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
- Set<PortAddresses> storedAddresses = mgr.getAddressBindingsForPort(CP1);
-
- assertEquals(1, storedAddresses.size());
- assertTrue(storedAddresses.contains(add1));
- }
-
- @Test
- public void getAddressBindings() {
- Set<PortAddresses> storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.isEmpty());
-
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA1, IA2), MAC1, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
-
- storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.size() == 1);
-
- PortAddresses add2 =
- new PortAddresses(CP2, Sets.newHashSet(IA3), MAC2, VlanId.NONE);
-
- mgr.bindAddressesToPort(add2);
-
- storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.size() == 2);
- assertTrue(storedAddresses.equals(Sets.newHashSet(add1, add2)));
- }
-
- @Test
- public void getAddressBindingsIPv6() {
- Set<PortAddresses> storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.isEmpty());
-
- PortAddresses add1 =
- new PortAddresses(CP1, Sets.newHashSet(IA4, IA5), MAC3, VlanId.NONE);
-
- mgr.bindAddressesToPort(add1);
-
- storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.size() == 1);
-
- PortAddresses add2 =
- new PortAddresses(CP2, Sets.newHashSet(IA5), MAC4, VlanId.NONE);
-
- mgr.bindAddressesToPort(add2);
-
- storedAddresses = mgr.getAddressBindings();
-
- assertTrue(storedAddresses.size() == 2);
- assertTrue(storedAddresses.equals(Sets.newHashSet(add1, add2)));
- }
-
private class TestNetworkConfigService extends NetworkConfigServiceAdapter {
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
index 4385ac2..d167197 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
@@ -43,7 +43,6 @@
import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
import org.onosproject.net.host.HostProvider;
import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
import org.onosproject.net.packet.OutboundPacket;
import org.onosproject.net.packet.PacketServiceAdapter;
import org.onosproject.net.provider.ProviderId;
@@ -140,8 +139,6 @@
deviceService.addDevice(device, Collections.singleton(port));
ConnectPoint cp = new ConnectPoint(devId, portNum);
- PortAddresses pa =
- new PortAddresses(cp, Collections.singleton(IA1), sourceMac, VlanId.NONE);
expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
.andReturn(Collections.emptySet()).anyTimes();
@@ -211,9 +208,6 @@
deviceService.addDevice(device, Collections.singleton(port));
ConnectPoint cp = new ConnectPoint(devId, portNum);
- PortAddresses pa =
- new PortAddresses(cp, Collections.singleton(IA1), sourceMac,
- VlanId.vlanId(vlan));
expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
.andReturn(Collections.emptySet()).anyTimes();
diff --git a/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java b/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java
index e833b2d..46c5fa2 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java
@@ -25,7 +25,6 @@
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.function.Predicate;
@@ -52,7 +51,6 @@
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;
@@ -93,10 +91,6 @@
Multimaps.synchronizedSetMultimap(
HashMultimap.<ConnectPoint, Host>create());
- private final SetMultimap<ConnectPoint, PortAddresses> portAddresses =
- Multimaps.synchronizedSetMultimap(
- HashMultimap.<ConnectPoint, PortAddresses>create());
-
private EventuallyConsistentMap<HostId, DefaultHost> hosts;
private EventuallyConsistentMapListener<HostId, DefaultHost> hostLocationTracker =
@@ -123,7 +117,6 @@
hosts.removeListener(hostLocationTracker);
hosts.destroy();
locations.clear();
- portAddresses.clear();
log.info("Stopped");
}
@@ -199,34 +192,6 @@
.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());
}