Search in sources :

Example 1 with TopologyDefinition

use of org.openkilda.testing.model.topology.TopologyDefinition in project open-kilda by telstra.

the class FlowManagerTest method setUp.

@Before
public void setUp() throws IOException {
    MockitoAnnotations.initMocks(this);
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
    TopologyDefinition topology = mapper.readValue(getClass().getResourceAsStream("/5-switch-test-topology.yaml"), TopologyDefinition.class);
    when(topologyDefinition.getActiveSwitches()).thenReturn(topology.getActiveSwitches());
    when(topologyDefinition.getTraffGens()).thenReturn(topology.getTraffGens());
}
Also used : TopologyDefinition(org.openkilda.testing.model.topology.TopologyDefinition) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 2 with TopologyDefinition

use of org.openkilda.testing.model.topology.TopologyDefinition in project open-kilda by telstra.

the class TopologyConfig method topologyDefinition.

@Bean
public TopologyDefinition topologyDefinition() throws IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
    TopologyDefinition topologyDefinition = mapper.readValue(topologyDefinitionFile.getInputStream(), TopologyDefinition.class);
    topologyDefinition.setBfdOffset(bfdOffset);
    for (TopologyDefinition.Switch sw : topologyDefinition.getSwitches()) {
        sw.setController(managementController + " " + statController);
    }
    return topologyDefinition;
}
Also used : TopologyDefinition(org.openkilda.testing.model.topology.TopologyDefinition) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Bean(org.springframework.context.annotation.Bean)

Example 3 with TopologyDefinition

use of org.openkilda.testing.model.topology.TopologyDefinition in project open-kilda by telstra.

the class TestTopologyConfig method topologyDefinition.

@Bean
public TopologyDefinition topologyDefinition() throws IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
    TopologyDefinition topology = mapper.readValue(getClass().getResourceAsStream("/3-switch-test-topology.yaml"), TopologyDefinition.class);
    return spy(topology);
}
Also used : TopologyDefinition(org.openkilda.testing.model.topology.TopologyDefinition) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Bean(org.springframework.context.annotation.Bean)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)3 TopologyDefinition (org.openkilda.testing.model.topology.TopologyDefinition)3 Bean (org.springframework.context.annotation.Bean)2 Before (org.junit.Before)1