aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/net/src/test
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-10-09 18:32:44 -0700
committerAshlee Young <ashlee@onosfw.com>2015-10-09 18:32:44 -0700
commit6a07d2d622eaa06953f3353e39c080984076e8de (patch)
treebfb50a2090fce186c2cc545a400c969bf2ea702b /framework/src/onos/core/net/src/test
parente6d71622143ff9b2421a1abbe8434b954b5b1099 (diff)
Updated master to commit id 6ee8aa3e67ce89908a8c93aa9445c6f71a18f986
Change-Id: I94b055ee2f298daf71e2ec794fd0f2495bd8081f
Diffstat (limited to 'framework/src/onos/core/net/src/test')
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/cfg/impl/ComponentConfigLoaderTest.java126
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java214
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java2
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompilerTest.java10
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java12
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java6
-rw-r--r--framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java2
-rw-r--r--framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badComponent.json5
-rw-r--r--framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badConfig.json5
-rw-r--r--framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/basic.json5
10 files changed, 343 insertions, 44 deletions
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/cfg/impl/ComponentConfigLoaderTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/cfg/impl/ComponentConfigLoaderTest.java
new file mode 100644
index 00000000..0320cf77
--- /dev/null
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/cfg/impl/ComponentConfigLoaderTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.cfg.impl;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.io.Files;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.cfg.ComponentConfigAdapter;
+import org.slf4j.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import static com.google.common.io.ByteStreams.toByteArray;
+import static com.google.common.io.Files.write;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * UnitTest for ComponentLoader.
+ */
+public class ComponentConfigLoaderTest {
+
+ static final File TEST_DIR = Files.createTempDir();
+
+ private static final String FOO_COMPONENT = "fooComponent";
+
+ private ComponentConfigLoader loader;
+
+ private TestConfigService service;
+
+ private final Logger log = getLogger(getClass());
+
+ /*
+ * Method to SetUp the test environment with test file, a config loader a service,
+ * and assign it to the loader.configService for the test.
+ */
+ @Before
+ public void setUp() {
+ ComponentConfigLoader.cfgFile = new File(TEST_DIR, "test.json");
+ loader = new ComponentConfigLoader();
+ service = new TestConfigService();
+ loader.configService = service;
+ }
+
+ /*
+ * Tests that the component in the json receives the correct configuration.
+ */
+ @Test
+ public void basics() throws IOException {
+ stageTestResource("basic.json");
+ loader.activate();
+ assertEquals("incorrect component", FOO_COMPONENT, service.component);
+ }
+
+ /*
+ * Tests that the component is null if the file has a bad configuration format
+ * for which it yielded an exception. Can't test the exception because it happens
+ * in a different thread.
+ */
+ @Test
+ public void badConfig() throws IOException {
+ stageTestResource("badConfig.json");
+ loader.activate();
+ assertNull("incorrect configuration", service.component);
+
+ }
+
+ /*
+ * Writes the necessary file for the tests in the temporary directory
+ */
+ static void stageTestResource(String name) throws IOException {
+ byte[] bytes = toByteArray(ComponentConfigLoaderTest.class.getResourceAsStream(name));
+ write(bytes, ComponentConfigLoader.cfgFile);
+ }
+
+ /*
+ * Mockup class for the config service.
+ */
+ private class TestConfigService extends ComponentConfigAdapter {
+
+ protected String component;
+ protected String name;
+ protected String value;
+
+ @Override
+ public Set<String> getComponentNames() {
+ return ImmutableSet.of(FOO_COMPONENT);
+ }
+
+ @Override
+ public void preSetProperty(String componentName, String name, String value) {
+ log.info("preSet");
+ this.component = componentName;
+ this.name = name;
+ this.value = value;
+
+ }
+
+ @Override
+ public void setProperty(String componentName, String name, String value) {
+ log.info("Set");
+ this.component = componentName;
+ this.name = name;
+ this.value = value;
+
+ }
+ }
+} \ No newline at end of file
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
index d167197a..3cd2ca2b 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
@@ -23,10 +23,12 @@ import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
+import org.onlab.packet.IPv6;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
+import org.onlab.packet.ndp.NeighborSolicitation;
import org.onosproject.incubator.net.intf.Interface;
import org.onosproject.incubator.net.intf.InterfaceService;
import org.onosproject.net.ConnectPoint;
@@ -64,14 +66,22 @@ import static org.junit.Assert.assertTrue;
public class HostMonitorTest {
- private static final IpAddress TARGET_IP_ADDR =
+ private static final IpAddress TARGET_IPV4_ADDR =
IpAddress.valueOf("10.0.0.1");
- private static final IpAddress SOURCE_ADDR =
+ private static final IpAddress SOURCE_IPV4_ADDR =
IpAddress.valueOf("10.0.0.99");
private static final InterfaceIpAddress IA1 =
- new InterfaceIpAddress(SOURCE_ADDR, IpPrefix.valueOf("10.0.0.0/24"));
+ new InterfaceIpAddress(SOURCE_IPV4_ADDR, IpPrefix.valueOf("10.0.0.0/24"));
private MacAddress sourceMac = MacAddress.valueOf(1L);
+ private static final IpAddress TARGET_IPV6_ADDR =
+ IpAddress.valueOf("1000::1");
+ private static final IpAddress SOURCE_IPV6_ADDR =
+ IpAddress.valueOf("1000::f");
+ private static final InterfaceIpAddress IA2 =
+ new InterfaceIpAddress(SOURCE_IPV6_ADDR, IpPrefix.valueOf("1000::/64"));
+ private MacAddress sourceMac2 = MacAddress.valueOf(2L);
+
private EdgePortService edgePortService;
private HostMonitor hostMonitor;
@@ -90,7 +100,36 @@ public class HostMonitorTest {
}
@Test
- public void testMonitorHostExists() throws Exception {
+ public void testMonitorIpv4HostExists() throws Exception {
+ ProviderId id = new ProviderId("fake://", "id");
+
+ Host host = createMock(Host.class);
+ expect(host.providerId()).andReturn(id);
+ replay(host);
+
+ HostManager hostManager = createMock(HostManager.class);
+ expect(hostManager.getHostsByIp(TARGET_IPV4_ADDR))
+ .andReturn(Collections.singleton(host));
+ replay(hostManager);
+
+ HostProvider hostProvider = createMock(HostProvider.class);
+ expect(hostProvider.id()).andReturn(id).anyTimes();
+ hostProvider.triggerProbe(host);
+ expectLastCall().once();
+ replay(hostProvider);
+
+ hostMonitor = new HostMonitor(null, hostManager, null, edgePortService);
+
+ hostMonitor.registerHostProvider(hostProvider);
+ hostMonitor.addMonitoringFor(TARGET_IPV4_ADDR);
+
+ hostMonitor.run(null);
+
+ verify(hostProvider);
+ }
+
+ @Test
+ public void testMonitorIpv6HostExists() throws Exception {
ProviderId id = new ProviderId("fake://", "id");
Host host = createMock(Host.class);
@@ -98,7 +137,7 @@ public class HostMonitorTest {
replay(host);
HostManager hostManager = createMock(HostManager.class);
- expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
+ expect(hostManager.getHostsByIp(TARGET_IPV6_ADDR))
.andReturn(Collections.singleton(host));
replay(hostManager);
@@ -111,7 +150,7 @@ public class HostMonitorTest {
hostMonitor = new HostMonitor(null, hostManager, null, edgePortService);
hostMonitor.registerHostProvider(hostProvider);
- hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
+ hostMonitor.addMonitoringFor(TARGET_IPV6_ADDR);
hostMonitor.run(null);
@@ -119,7 +158,7 @@ public class HostMonitorTest {
}
@Test
- public void testMonitorHostDoesNotExist() throws Exception {
+ public void testMonitorIpv4HostDoesNotExist() throws Exception {
HostManager hostManager = createMock(HostManager.class);
@@ -140,12 +179,12 @@ public class HostMonitorTest {
ConnectPoint cp = new ConnectPoint(devId, portNum);
- expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
+ expect(hostManager.getHostsByIp(TARGET_IPV4_ADDR))
.andReturn(Collections.emptySet()).anyTimes();
replay(hostManager);
InterfaceService interfaceService = createMock(InterfaceService.class);
- expect(interfaceService.getMatchingInterface(TARGET_IP_ADDR))
+ expect(interfaceService.getMatchingInterface(TARGET_IPV4_ADDR))
.andReturn(new Interface(cp, Collections.singleton(IA1), sourceMac, VlanId.NONE))
.anyTimes();
replay(interfaceService);
@@ -156,7 +195,7 @@ public class HostMonitorTest {
// Run the test
hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
- hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
+ hostMonitor.addMonitoringFor(TARGET_IPV4_ADDR);
hostMonitor.run(null);
@@ -178,16 +217,85 @@ public class HostMonitorTest {
Ethernet eth = Ethernet.deserializer().deserialize(pktData, 0, pktData.length);
assertEquals(Ethernet.VLAN_UNTAGGED, eth.getVlanID());
ARP arp = (ARP) eth.getPayload();
- assertArrayEquals(SOURCE_ADDR.toOctets(),
+ assertArrayEquals(SOURCE_IPV4_ADDR.toOctets(),
arp.getSenderProtocolAddress());
assertArrayEquals(sourceMac.toBytes(),
arp.getSenderHardwareAddress());
- assertArrayEquals(TARGET_IP_ADDR.toOctets(),
+ assertArrayEquals(TARGET_IPV4_ADDR.toOctets(),
arp.getTargetProtocolAddress());
}
@Test
- public void testMonitorHostDoesNotExistWithVlan() throws Exception {
+ public void testMonitorIpv6HostDoesNotExist() throws Exception {
+
+ HostManager hostManager = createMock(HostManager.class);
+
+ DeviceId devId = DeviceId.deviceId("fake");
+
+ Device device = createMock(Device.class);
+ expect(device.id()).andReturn(devId).anyTimes();
+ replay(device);
+
+ PortNumber portNum = PortNumber.portNumber(2L);
+
+ Port port = createMock(Port.class);
+ expect(port.number()).andReturn(portNum).anyTimes();
+ replay(port);
+
+ TestDeviceService deviceService = new TestDeviceService();
+ deviceService.addDevice(device, Collections.singleton(port));
+
+ ConnectPoint cp = new ConnectPoint(devId, portNum);
+
+ expect(hostManager.getHostsByIp(TARGET_IPV6_ADDR))
+ .andReturn(Collections.emptySet()).anyTimes();
+ replay(hostManager);
+
+ InterfaceService interfaceService = createMock(InterfaceService.class);
+ expect(interfaceService.getMatchingInterface(TARGET_IPV6_ADDR))
+ .andReturn(new Interface(cp, Collections.singleton(IA2), sourceMac2, VlanId.NONE))
+ .anyTimes();
+ replay(interfaceService);
+
+ TestPacketService packetService = new TestPacketService();
+
+
+ // Run the test
+ hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+
+ hostMonitor.addMonitoringFor(TARGET_IPV6_ADDR);
+ hostMonitor.run(null);
+
+
+ // Check that a packet was sent to our PacketService and that it has
+ // the properties we expect
+ assertEquals(1, packetService.packets.size());
+ OutboundPacket packet = packetService.packets.get(0);
+
+ // Check the output port is correct
+ assertEquals(1, packet.treatment().immediate().size());
+ Instruction instruction = packet.treatment().immediate().get(0);
+ assertTrue(instruction instanceof OutputInstruction);
+ OutputInstruction oi = (OutputInstruction) instruction;
+ assertEquals(portNum, oi.port());
+
+ // Check the output packet is correct (well the important bits anyway)
+ final byte[] pktData = new byte[packet.data().remaining()];
+ packet.data().get(pktData);
+ Ethernet eth = Ethernet.deserializer().deserialize(pktData, 0, pktData.length);
+ assertEquals(Ethernet.VLAN_UNTAGGED, eth.getVlanID());
+ IPv6 ipv6 = (IPv6) eth.getPayload();
+ assertArrayEquals(SOURCE_IPV6_ADDR.toOctets(), ipv6.getSourceAddress());
+
+ NeighborSolicitation ns =
+ (NeighborSolicitation) ipv6.getPayload().getPayload();
+ assertArrayEquals(sourceMac2.toBytes(), ns.getOptions().get(0).data());
+
+ assertArrayEquals(TARGET_IPV6_ADDR.toOctets(), ns.getTargetAddress());
+ }
+
+ @Test
+ public void testMonitorIpv4HostDoesNotExistWithVlan() throws Exception {
HostManager hostManager = createMock(HostManager.class);
@@ -209,12 +317,12 @@ public class HostMonitorTest {
ConnectPoint cp = new ConnectPoint(devId, portNum);
- expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
+ expect(hostManager.getHostsByIp(TARGET_IPV4_ADDR))
.andReturn(Collections.emptySet()).anyTimes();
replay(hostManager);
InterfaceService interfaceService = createMock(InterfaceService.class);
- expect(interfaceService.getMatchingInterface(TARGET_IP_ADDR))
+ expect(interfaceService.getMatchingInterface(TARGET_IPV4_ADDR))
.andReturn(new Interface(cp, Collections.singleton(IA1), sourceMac, VlanId.vlanId(vlan)))
.anyTimes();
replay(interfaceService);
@@ -225,7 +333,7 @@ public class HostMonitorTest {
// Run the test
hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
- hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
+ hostMonitor.addMonitoringFor(TARGET_IPV4_ADDR);
hostMonitor.run(null);
@@ -247,14 +355,84 @@ public class HostMonitorTest {
Ethernet eth = Ethernet.deserializer().deserialize(pktData, 0, pktData.length);
assertEquals(vlan, eth.getVlanID());
ARP arp = (ARP) eth.getPayload();
- assertArrayEquals(SOURCE_ADDR.toOctets(),
+ assertArrayEquals(SOURCE_IPV4_ADDR.toOctets(),
arp.getSenderProtocolAddress());
assertArrayEquals(sourceMac.toBytes(),
arp.getSenderHardwareAddress());
- assertArrayEquals(TARGET_IP_ADDR.toOctets(),
+ assertArrayEquals(TARGET_IPV4_ADDR.toOctets(),
arp.getTargetProtocolAddress());
}
+ @Test
+ public void testMonitorIpv6HostDoesNotExistWithVlan() throws Exception {
+
+ HostManager hostManager = createMock(HostManager.class);
+
+ DeviceId devId = DeviceId.deviceId("fake");
+ short vlan = 5;
+
+ Device device = createMock(Device.class);
+ expect(device.id()).andReturn(devId).anyTimes();
+ replay(device);
+
+ PortNumber portNum = PortNumber.portNumber(1L);
+
+ Port port = createMock(Port.class);
+ expect(port.number()).andReturn(portNum).anyTimes();
+ replay(port);
+
+ TestDeviceService deviceService = new TestDeviceService();
+ deviceService.addDevice(device, Collections.singleton(port));
+
+ ConnectPoint cp = new ConnectPoint(devId, portNum);
+
+ expect(hostManager.getHostsByIp(TARGET_IPV6_ADDR))
+ .andReturn(Collections.emptySet()).anyTimes();
+ replay(hostManager);
+
+ InterfaceService interfaceService = createMock(InterfaceService.class);
+ expect(interfaceService.getMatchingInterface(TARGET_IPV6_ADDR))
+ .andReturn(new Interface(cp, Collections.singleton(IA2), sourceMac2, VlanId.vlanId(vlan)))
+ .anyTimes();
+ replay(interfaceService);
+
+ TestPacketService packetService = new TestPacketService();
+
+
+ // Run the test
+ hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+
+ hostMonitor.addMonitoringFor(TARGET_IPV6_ADDR);
+ hostMonitor.run(null);
+
+
+ // Check that a packet was sent to our PacketService and that it has
+ // the properties we expect
+ assertEquals(1, packetService.packets.size());
+ OutboundPacket packet = packetService.packets.get(0);
+
+ // Check the output port is correct
+ assertEquals(1, packet.treatment().immediate().size());
+ Instruction instruction = packet.treatment().immediate().get(0);
+ assertTrue(instruction instanceof OutputInstruction);
+ OutputInstruction oi = (OutputInstruction) instruction;
+ assertEquals(portNum, oi.port());
+
+ // Check the output packet is correct (well the important bits anyway)
+ final byte[] pktData = new byte[packet.data().remaining()];
+ packet.data().get(pktData);
+ Ethernet eth = Ethernet.deserializer().deserialize(pktData, 0, pktData.length);
+ assertEquals(vlan, eth.getVlanID());
+ IPv6 ipv6 = (IPv6) eth.getPayload();
+ assertArrayEquals(SOURCE_IPV6_ADDR.toOctets(), ipv6.getSourceAddress());
+
+ NeighborSolicitation ns =
+ (NeighborSolicitation) ipv6.getPayload().getPayload();
+ assertArrayEquals(sourceMac2.toBytes(), ns.getOptions().get(0).data());
+
+ assertArrayEquals(TARGET_IPV6_ADDR.toOctets(), ns.getTargetAddress());
+ }
+
class TestPacketService extends PacketServiceAdapter {
List<OutboundPacket> packets = new ArrayList<>();
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
index 4bf32f43..3f40de09 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
@@ -157,7 +157,7 @@ public class IntentManagerTest {
private static class MockInstallableIntent extends FlowRuleIntent {
public MockInstallableIntent() {
- super(APPID, Collections.singletonList(new MockFlowRule(100)));
+ super(APPID, Collections.singletonList(new MockFlowRule(100)), Collections.emptyList());
}
}
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompilerTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompilerTest.java
index eb7a3936..03d664d3 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompilerTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompilerTest.java
@@ -31,8 +31,7 @@ import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentTestsMocks;
import org.onosproject.net.intent.LinkCollectionIntent;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
-import org.onosproject.net.topology.LinkWeight;
-import org.onosproject.net.topology.PathService;
+import org.onosproject.net.topology.PathServiceAdapter;
import java.util.HashSet;
import java.util.List;
@@ -60,7 +59,7 @@ public class MultiPointToSinglePointIntentCompilerTest extends AbstractIntentTes
/**
* Mock path service for creating paths within the test.
*/
- private static class MockPathService implements PathService {
+ private static class MockPathService extends PathServiceAdapter {
final String[] pathHops;
@@ -86,11 +85,6 @@ public class MultiPointToSinglePointIntentCompilerTest extends AbstractIntentTes
return result;
}
-
- @Override
- public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
- return null;
- }
}
/**
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java
index 2f40b37a..38a116dd 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java
@@ -27,18 +27,12 @@ import org.onosproject.net.DefaultLink;
import org.onosproject.net.DefaultPath;
import org.onosproject.net.Link;
import org.onosproject.net.OchSignalType;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.intent.FlowRuleIntent;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentExtensionService;
-import org.onosproject.net.intent.IntentTestsMocks;
import org.onosproject.net.intent.MockIdGenerator;
import org.onosproject.net.intent.OpticalPathIntent;
-import org.onosproject.net.provider.ProviderId;
import java.util.Arrays;
import java.util.Collection;
@@ -63,16 +57,11 @@ public class OpticalPathIntentCompilerTest {
private final IdGenerator idGenerator = new MockIdGenerator();
private OpticalPathIntentCompiler sut;
- private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
- private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
private final ApplicationId appId = new TestApplicationId("test");
- private final ProviderId pid = new ProviderId("of", "test");
private final ConnectPoint d1p1 = connectPoint("s1", 0);
private final ConnectPoint d2p0 = connectPoint("s2", 0);
private final ConnectPoint d2p1 = connectPoint("s2", 1);
private final ConnectPoint d3p1 = connectPoint("s3", 1);
- private final ConnectPoint d3p0 = connectPoint("s3", 10);
- private final ConnectPoint d1p0 = connectPoint("s1", 10);
private final List<Link> links = Arrays.asList(
new DefaultLink(PID, d1p1, d2p0, DIRECT),
@@ -103,7 +92,6 @@ public class OpticalPathIntentCompilerTest {
intentExtensionService.registerCompiler(OpticalPathIntent.class, sut);
intentExtensionService.unregisterCompiler(OpticalPathIntent.class);
sut.intentManager = intentExtensionService;
- sut.resourceService = new IntentTestsMocks.MockResourceService();
replay(coreService, intentExtensionService);
}
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
index 2a2d0b54..1911da56 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/PathManagerTest.java
@@ -23,13 +23,11 @@ import org.onosproject.net.ElementId;
import org.onosproject.net.Host;
import org.onosproject.net.HostId;
import org.onosproject.net.Path;
-import org.onosproject.net.host.HostService;
import org.onosproject.net.host.HostServiceAdapter;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.net.topology.LinkWeight;
import org.onosproject.net.topology.PathService;
import org.onosproject.net.topology.Topology;
-import org.onosproject.net.topology.TopologyService;
import org.onosproject.net.topology.TopologyServiceAdapter;
import java.util.HashMap;
@@ -137,7 +135,7 @@ public class PathManagerTest {
}
// Fake entity to give out paths.
- private class FakeTopoMgr extends TopologyServiceAdapter implements TopologyService {
+ private class FakeTopoMgr extends TopologyServiceAdapter {
Set<Path> paths = new HashSet<>();
@Override
@@ -152,7 +150,7 @@ public class PathManagerTest {
}
// Fake entity to give out hosts.
- private class FakeHostMgr extends HostServiceAdapter implements HostService {
+ private class FakeHostMgr extends HostServiceAdapter {
private Map<HostId, Host> hosts = new HashMap<>();
@Override
diff --git a/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java b/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
index f3cd28df..56133a0f 100644
--- a/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
+++ b/framework/src/onos/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java
@@ -114,7 +114,7 @@ public class TopologyManagerTest {
link("c", 2, "d", 1), link("d", 1, "c", 2),
link("d", 2, "a", 2), link("a", 2, "d", 2),
link("e", 1, "f", 1), link("f", 1, "e", 1));
- GraphDescription data = new DefaultGraphDescription(4321L, devices, links);
+ GraphDescription data = new DefaultGraphDescription(4321L, System.currentTimeMillis(), devices, links);
providerService.topologyChanged(data, null);
}
diff --git a/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badComponent.json b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badComponent.json
new file mode 100644
index 00000000..5c0ac35d
--- /dev/null
+++ b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badComponent.json
@@ -0,0 +1,5 @@
+{
+ "org.onosproject.proxyarp.ProxyArp2": {
+ "testProperty": true
+ }
+} \ No newline at end of file
diff --git a/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badConfig.json b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badConfig.json
new file mode 100644
index 00000000..a76552e5
--- /dev/null
+++ b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/badConfig.json
@@ -0,0 +1,5 @@
+{
+ "fooComponent": {
+ badconfig
+ }
+} \ No newline at end of file
diff --git a/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/basic.json b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/basic.json
new file mode 100644
index 00000000..dd329243
--- /dev/null
+++ b/framework/src/onos/core/net/src/test/resources/org/onosproject/cfg/impl/basic.json
@@ -0,0 +1,5 @@
+{
+ "fooComponent": {
+ "testProperty": true
+ }
+} \ No newline at end of file