Search in sources :

Example 1 with LinkParametersDto

use of org.openkilda.model.LinkParametersDto in project open-kilda by telstra.

the class SwitchControllerTest method testDeleteIsl.

@Test
public void testDeleteIsl() throws Exception {
    LinkParametersDto linkParametersDto = new LinkParametersDto();
    linkParametersDto.setSrcPort(Integer.valueOf(TestIslMock.SRC_PORT));
    linkParametersDto.setSrcSwitch(TestIslMock.SRC_SWITCH);
    linkParametersDto.setDstPort(Integer.valueOf(TestIslMock.DST_PORT));
    linkParametersDto.setDstSwitch(TestIslMock.DST_SWITCH);
    List<IslLinkInfo> islLinkInfo = new ArrayList<IslLinkInfo>();
    String inputJson = mapToJson(linkParametersDto);
    when(serviceSwitch.deleteLink(linkParametersDto, TestIslMock.USER_ID)).thenReturn(islLinkInfo);
    MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.delete("/api/switch/links").content(inputJson).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andReturn();
    int status = mvcResult.getResponse().getStatus();
    assertEquals(200, status);
}
Also used : LinkParametersDto(org.openkilda.model.LinkParametersDto) ArrayList(java.util.ArrayList) IslLinkInfo(org.openkilda.model.IslLinkInfo) MvcResult(org.springframework.test.web.servlet.MvcResult) Test(org.junit.Test)

Example 2 with LinkParametersDto

use of org.openkilda.model.LinkParametersDto in project open-kilda by telstra.

the class SwitchControllerTest method testUpdateIslBfdFlag.

@Test
public void testUpdateIslBfdFlag() throws Exception {
    LinkParametersDto linkParametersDto = new LinkParametersDto();
    linkParametersDto.setSrcPort(Integer.valueOf(TestIslMock.SRC_PORT));
    linkParametersDto.setSrcSwitch(TestIslMock.SRC_SWITCH);
    linkParametersDto.setDstPort(Integer.valueOf(TestIslMock.DST_PORT));
    linkParametersDto.setDstSwitch(TestIslMock.DST_SWITCH);
    linkParametersDto.setEnableBfd(TestIslMock.ENABLE_BFD_FLAG);
    String inputJson = mapToJson(linkParametersDto);
    MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.patch("/api/switch/link/enable-bfd").content(inputJson).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andReturn();
    int status = mvcResult.getResponse().getStatus();
    assertEquals(200, status);
}
Also used : LinkParametersDto(org.openkilda.model.LinkParametersDto) MvcResult(org.springframework.test.web.servlet.MvcResult) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 LinkParametersDto (org.openkilda.model.LinkParametersDto)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2 ArrayList (java.util.ArrayList)1 IslLinkInfo (org.openkilda.model.IslLinkInfo)1