Search in sources :

Example 1 with TransitVlanRepository

use of org.openkilda.persistence.repositories.TransitVlanRepository in project open-kilda by telstra.

the class SwitchSyncServiceImplTest method setUp.

@Before
public void setUp() {
    RepositoryFactory repositoryFactory = Mockito.mock(RepositoryFactory.class);
    FlowRepository flowRepository = Mockito.mock(FlowRepository.class);
    FlowPathRepository flowPathRepository = Mockito.mock(FlowPathRepository.class);
    TransitVlanRepository transitVlanRepository = Mockito.mock(TransitVlanRepository.class);
    when(repositoryFactory.createFlowPathRepository()).thenReturn(flowPathRepository);
    when(repositoryFactory.createFlowRepository()).thenReturn(flowRepository);
    when(repositoryFactory.createTransitVlanRepository()).thenReturn(transitVlanRepository);
    when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
    Properties configProps = new Properties();
    configProps.setProperty("flow.meter-id.max", "40");
    configProps.setProperty("flow.vlan.max", "50");
    PropertiesBasedConfigurationProvider configurationProvider = new PropertiesBasedConfigurationProvider(configProps);
    FlowResourcesConfig flowResourcesConfig = configurationProvider.getConfiguration(FlowResourcesConfig.class);
    service = new SwitchSyncServiceImpl(carrier, persistenceManager, flowResourcesConfig);
    service.commandBuilder = commandBuilder;
    request = SwitchValidateRequest.builder().switchId(SWITCH_ID).performSync(true).build();
    flowEntry = new FlowEntry(new FlowSegmentCookie(FlowPathDirection.FORWARD, 7).getValue(), 0, 0, 0, 0, "", 0, 0, 0, 0, null, null, null);
    InstallIngressFlow installingRule = new InstallIngressFlow(UUID.randomUUID(), FLOW_ID, flowEntry.getCookie(), SWITCH_ID, 1, 2, 50, 0, 60, FlowEncapsulationType.TRANSIT_VLAN, OutputVlanType.POP, 10L, 100L, EGRESS_SWITCH_ID, false, false, false, null);
    when(commandBuilder.buildCommandsToSyncMissingRules(eq(SWITCH_ID), any())).thenReturn(singletonList(installingRule));
    missingRules = singletonList(flowEntry.getCookie());
    excessRules = emptyList();
    misconfiguredRules = emptyList();
    excessMeters = emptyList();
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) FlowRepository(org.openkilda.persistence.repositories.FlowRepository) FlowPathRepository(org.openkilda.persistence.repositories.FlowPathRepository) FlowResourcesConfig(org.openkilda.wfm.share.flow.resources.FlowResourcesConfig) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) TransitVlanRepository(org.openkilda.persistence.repositories.TransitVlanRepository) PropertiesBasedConfigurationProvider(org.openkilda.config.provider.PropertiesBasedConfigurationProvider) RepositoryFactory(org.openkilda.persistence.repositories.RepositoryFactory) Properties(java.util.Properties) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry) Before(org.junit.Before)

Aggregations

Properties (java.util.Properties)1 Before (org.junit.Before)1 PropertiesBasedConfigurationProvider (org.openkilda.config.provider.PropertiesBasedConfigurationProvider)1 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)1 FlowEntry (org.openkilda.messaging.info.rule.FlowEntry)1 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)1 FlowPathRepository (org.openkilda.persistence.repositories.FlowPathRepository)1 FlowRepository (org.openkilda.persistence.repositories.FlowRepository)1 RepositoryFactory (org.openkilda.persistence.repositories.RepositoryFactory)1 TransitVlanRepository (org.openkilda.persistence.repositories.TransitVlanRepository)1 FlowResourcesConfig (org.openkilda.wfm.share.flow.resources.FlowResourcesConfig)1