Search in sources :

Example 6 with PropertiesBasedConfigurationProvider

use of org.openkilda.config.provider.PropertiesBasedConfigurationProvider in project open-kilda by telstra.

the class FlowResourcesManagerTest method setUp.

@Before
public void setUp() {
    Properties configProps = new Properties();
    configProps.setProperty("flow.meter-id.max", "40");
    configProps.setProperty("flow.vlan.max", "50");
    PropertiesBasedConfigurationProvider configurationProvider = new PropertiesBasedConfigurationProvider(configProps);
    flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    resourcesManager = new FlowResourcesManager(persistenceManager, flowResourcesConfig);
    flowMeterRepository = repositoryFactory.createFlowMeterRepository();
    flowCookieRepository = repositoryFactory.createFlowCookieRepository();
    switchRepository = repositoryFactory.createSwitchRepository();
    switchRepository.findAll().forEach(switchRepository::remove);
    Stream.of(switch1, switch3, switch4, switch5).forEach(switchRepository::add);
}
Also used : PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) Properties(java.util.Properties) Before(org.junit.Before)

Example 7 with PropertiesBasedConfigurationProvider

use of org.openkilda.config.provider.PropertiesBasedConfigurationProvider in project open-kilda by telstra.

the class PathsServiceTest method setUpOnce.

@BeforeClass
public static void setUpOnce() {
    RepositoryFactory repositoryFactory = persistenceManager.getRepositoryFactory();
    kildaConfigurationRepository = repositoryFactory.createKildaConfigurationRepository();
    switchRepository = repositoryFactory.createSwitchRepository();
    switchPropertiesRepository = repositoryFactory.createSwitchPropertiesRepository();
    islRepository = repositoryFactory.createIslRepository();
    kildaConfigurationRepository = repositoryFactory.createKildaConfigurationRepository();
    PathComputerConfig pathComputerConfig = new PropertiesBasedConfigurationProvider().getConfiguration(PathComputerConfig.class);
    pathsService = new PathsService(repositoryFactory, pathComputerConfig);
}
Also used : PathComputerConfig(org.openkilda.pce.PathComputerConfig) PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) RepositoryFactory(org.openkilda.persistence.repositories.RepositoryFactory) BeforeClass(org.junit.BeforeClass)

Example 8 with PropertiesBasedConfigurationProvider

use of org.openkilda.config.provider.PropertiesBasedConfigurationProvider in project open-kilda by telstra.

the class PersistenceConfig method configurationProvider.

@Bean
public ConfigurationProvider configurationProvider(@Value("${kilda.config.file:kilda.properties}") String fileLocation) throws IOException {
    Resource resource = new FileSystemResource(fileLocation);
    Properties props = PropertiesLoaderUtils.loadProperties(resource);
    return new PropertiesBasedConfigurationProvider(props);
}
Also used : FileSystemResource(org.springframework.core.io.FileSystemResource) Resource(org.springframework.core.io.Resource) PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) FileSystemResource(org.springframework.core.io.FileSystemResource) Properties(java.util.Properties) Bean(org.springframework.context.annotation.Bean)

Example 9 with PropertiesBasedConfigurationProvider

use of org.openkilda.config.provider.PropertiesBasedConfigurationProvider in project open-kilda by telstra.

the class AbstractSpeakerCommandTest method setUp.

@Before
public void setUp() throws Exception {
    injectMocks(this);
    moduleContext.addService(SessionService.class, sessionService);
    moduleContext.addService(IOFSwitchService.class, ofSwitchManager);
    expect(commandProcessor.getModuleContext()).andReturn(moduleContext).anyTimes();
    // sw
    prepareSwitch(sw, dpId);
    prepareSwitch(swNext, dpIdNext);
    Properties configProps = new Properties();
    PropertiesBasedConfigurationProvider provider = new PropertiesBasedConfigurationProvider(configProps);
    KildaCoreConfig config = provider.getConfiguration(KildaCoreConfig.class);
    expect(kildaCore.getConfig()).andReturn(config).anyTimes();
    moduleContext.addService(KildaCore.class, kildaCore);
    moduleContext.addService(FeatureDetectorService.class, featureDetectorService);
    prepareSessionService();
    switchSessionProducePlan.put(dpId, ImmutableList.of(session).iterator());
    switchSessionProducePlan.put(dpIdNext, ImmutableList.of(session).iterator());
}
Also used : PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) KildaCoreConfig(org.openkilda.floodlight.KildaCoreConfig) Properties(java.util.Properties) Before(org.junit.Before)

Example 10 with PropertiesBasedConfigurationProvider

use of org.openkilda.config.provider.PropertiesBasedConfigurationProvider in project open-kilda by telstra.

the class InMemoryGraphPersistenceManager method newInstance.

/**
 * Create new {@link InMemoryGraphPersistenceManager}.
 */
public static InMemoryGraphPersistenceManager newInstance() {
    Properties properties = new Properties();
    properties.put("persistence.implementation.default", PersistenceImplementationType.IN_MEMORY_GRAPH.name());
    PropertiesBasedConfigurationProvider configurationProvider = new PropertiesBasedConfigurationProvider(properties);
    InMemoryGraphPersistenceImplementation implementation = new InMemoryGraphPersistenceImplementation(configurationProvider);
    return new InMemoryGraphPersistenceManager(configurationProvider, PersistenceImplementationType.IN_MEMORY_GRAPH, implementation);
}
Also used : PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) Properties(java.util.Properties)

Aggregations

PropertiesBasedConfigurationProvider (org.openkilda.config.provider.PropertiesBasedConfigurationProvider)11 Properties (java.util.Properties)9 BeforeClass (org.junit.BeforeClass)4 Before (org.junit.Before)3 IOFSwitchService (net.floodlightcontroller.core.internal.IOFSwitchService)2 FloodlightModuleContext (net.floodlightcontroller.core.module.FloodlightModuleContext)2 KildaCore (org.openkilda.floodlight.KildaCore)2 FlowSegmentMetadata (org.openkilda.floodlight.model.FlowSegmentMetadata)2 FeatureDetectorService (org.openkilda.floodlight.service.FeatureDetectorService)2 MessageContext (org.openkilda.messaging.MessageContext)2 PathComputerConfig (org.openkilda.pce.PathComputerConfig)2 RepositoryFactory (org.openkilda.persistence.repositories.RepositoryFactory)2 FlowResourcesConfig (org.openkilda.wfm.share.flow.resources.FlowResourcesConfig)2 KildaCoreConfig (org.openkilda.floodlight.KildaCoreConfig)1 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)1 FlowEntry (org.openkilda.messaging.info.rule.FlowEntry)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1 SwitchProperties (org.openkilda.model.SwitchProperties)1 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)1 AvailableNetworkFactory (org.openkilda.pce.AvailableNetworkFactory)1