Search in sources :

Example 61 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class MappingsWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    // Register the services needed for the test
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(MappingEntry.class, new MappingEntryCodec());
    codecService.registerCodec(MappingAddress.class, new MappingAddressCodec());
    codecService.registerCodec(MappingInstruction.class, new MappingInstructionCodec());
    codecService.registerCodec(MappingAction.class, new MappingActionCodec());
    codecService.registerCodec(MappingTreatment.class, new MappingTreatmentCodec());
    codecService.registerCodec(MappingKey.class, new MappingKeyCodec());
    codecService.registerCodec(MappingValue.class, new MappingValueCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(MappingService.class, mockMappingService).add(DeviceService.class, mockDeviceService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : MappingKeyCodec(org.onosproject.mapping.codec.MappingKeyCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) MappingEntryCodec(org.onosproject.mapping.codec.MappingEntryCodec) MappingTreatmentCodec(org.onosproject.mapping.codec.MappingTreatmentCodec) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) DeviceService(org.onosproject.net.device.DeviceService) CodecManager(org.onosproject.codec.impl.CodecManager) MappingAddressCodec(org.onosproject.mapping.codec.MappingAddressCodec) MappingInstructionCodec(org.onosproject.mapping.codec.MappingInstructionCodec) MappingValueCodec(org.onosproject.mapping.codec.MappingValueCodec) MappingActionCodec(org.onosproject.mapping.codec.MappingActionCodec) Before(org.junit.Before)

Example 62 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class OpenstackManagementWebResourceTest method setUpTest.

/**
 * Sets up the global values for all tests.
 */
@Before
public void setUpTest() {
    ServiceDirectory testDirectory = new TestServiceDirectory().add(OpenstackRouterAdminService.class, mockOpenstackRouterAdminService).add(OpenstackSecurityGroupAdminService.class, mockOpenstackSecurityGroupAdminService).add(OpenstackNetworkAdminService.class, mockOpenstackNetworkAdminService).add(OpenstackNodeAdminService.class, mockOpenstackNodeAdminService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) OpenstackRouterAdminService(org.onosproject.openstacknetworking.api.OpenstackRouterAdminService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) OpenstackNetworkAdminService(org.onosproject.openstacknetworking.api.OpenstackNetworkAdminService) Before(org.junit.Before)

Example 63 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class OpenstackRouterWebResourceTest method setUpTest.

/**
 * Sets up the global values for all tests.
 */
@Before
public void setUpTest() {
    ServiceDirectory testDirectory = new TestServiceDirectory().add(OpenstackRouterAdminService.class, mockOpenstackRouterAdminService).add(OpenstackHaService.class, mockOpenstackHaService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) OpenstackRouterAdminService(org.onosproject.openstacknetworking.api.OpenstackRouterAdminService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 64 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class DmWebResourceTest method setUpTest.

@Before
public void setUpTest() throws CfmConfigException, SoamConfigException {
    CfmCodecContext context = new CfmCodecContext();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMepService.class, mepService).add(SoamService.class, soamService).add(CodecService.class, context.codecManager());
    setServiceDirectory(testDirectory);
    DelayMeasurementStatCurrent.DmStatCurrentBuilder dmCurrBuilder1 = (DelayMeasurementStatCurrent.DmStatCurrentBuilder) DefaultDelayMeasurementStatCurrent.builder(Duration.ofMinutes(1), false).startTime(now).frameDelayBackwardAvg(Duration.ofMillis(10)).frameDelayForwardAvg(Duration.ofMillis(11)).frameDelayRangeBackwardAvg(Duration.ofMillis(12));
    dm1 = DefaultDelayMeasurementEntry.builder(DM1, DelayMeasurementCreate.DmType.DMDMM, DelayMeasurementCreate.Version.Y17312008, MepId.valueOf((short) 2), Mep.Priority.PRIO1).sessionStatus(DelayMeasurementEntry.SessionStatus.ACTIVE).frameDelayTwoWay(Duration.ofMillis(40)).frameDelayBackward(Duration.ofMillis(30)).frameDelayForward(Duration.ofMillis(10)).interFrameDelayVariationTwoWay(Duration.ofMillis(8)).interFrameDelayVariationBackward(Duration.ofMillis(3)).interFrameDelayVariationForward(Duration.ofMillis(5)).currentResult((DelayMeasurementStatCurrent) dmCurrBuilder1.build()).build();
    dm2 = DefaultDelayMeasurementEntry.builder(DM2, DelayMeasurementCreate.DmType.DMDMM, DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 2), Mep.Priority.PRIO2).build();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) SoamService(org.onosproject.incubator.net.l2monitoring.soam.SoamService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) DefaultDelayMeasurementStatCurrent(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementStatCurrent) DelayMeasurementStatCurrent(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 65 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class LmWebResourceTest method setUpTest.

@Before
public void setUpTest() throws CfmConfigException, SoamConfigException {
    CfmCodecContext context = new CfmCodecContext();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMepService.class, mepService).add(SoamService.class, soamService).add(CodecService.class, context.codecManager());
    setServiceDirectory(testDirectory);
    lm1 = DefaultLmEntry.builder(DelayMeasurementCreate.Version.Y17312008, MepId.valueOf((short) 10), Mep.Priority.PRIO1, LossMeasurementCreate.LmType.LMLMM, LMID1).build();
    lm2 = DefaultLmEntry.builder(DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 10), Mep.Priority.PRIO2, LossMeasurementCreate.LmType.LMLMM, LMID2).measuredAvailabilityBackwardStatus(LossMeasurementEntry.AvailabilityType.AVAILABLE).measuredAvailabilityForwardStatus(LossMeasurementEntry.AvailabilityType.UNKNOWN).measuredBackwardFlr(MilliPct.ofPercent(49.9f)).measuredForwardFlr(MilliPct.ofRatio(0.51f)).measuredBackwardLastTransitionTime(now).measuredForwardLastTransitionTime(now).build();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) SoamService(org.onosproject.incubator.net.l2monitoring.soam.SoamService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Aggregations

TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)71 Before (org.junit.Before)66 ServiceDirectory (org.onlab.osgi.ServiceDirectory)53 CodecManager (org.onosproject.codec.impl.CodecManager)37 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)14 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)13 TestStorageService (org.onosproject.store.service.TestStorageService)12 CoreService (org.onosproject.core.CoreService)10 BeforeClass (org.junit.BeforeClass)5 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)5 CodecService (org.onosproject.codec.CodecService)5 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)5 BaseConfig (org.onosproject.net.config.BaseConfig)5 DeviceService (org.onosproject.net.device.DeviceService)5 TestApplicationId (org.onosproject.TestApplicationId)4 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)3 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)3 Semaphore (java.util.concurrent.Semaphore)2