Search in sources :

Example 6 with ReinstallServer42FlowForSwitchManagerRequest

use of org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest in project open-kilda by telstra.

the class RecordHandlerTest method reinstallServer42FlowRttInputTest.

@Test
public void reinstallServer42FlowRttInputTest() throws SwitchOperationException {
    PortColourCookie cookie = PortColourCookie.builder().portNumber(CUSTOMER_PORT).type(SERVER_42_FLOW_RTT_INPUT).build();
    expect(switchManager.installServer42FlowRttInputFlow(DATAPATH_ID, SERVER42_PORT, CUSTOMER_PORT, SERVER42_MAC_ADDRESS)).andReturn(cookie.getValue()).once();
    expect(switchManager.deleteRulesByCriteria(DATAPATH_ID, false, null, DeleteRulesCriteria.builder().cookie(cookie.getValue()).build())).andReturn(Lists.newArrayList(cookie.getValue())).once();
    replay(switchManager);
    ReinstallServer42FlowForSwitchManagerRequest request = new ReinstallServer42FlowForSwitchManagerRequest(SWITCH_ID, cookie.getValue(), SERVER42_MAC_ADDRESS, SERVER42_VLAN, SERVER42_PORT);
    recordHandler.handleCommand(new CommandMessage(request, 0, null));
    verify(switchManager);
}
Also used : ReinstallServer42FlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest) PortColourCookie(org.openkilda.model.cookie.PortColourCookie) CommandMessage(org.openkilda.messaging.command.CommandMessage) Test(org.junit.Test)

Example 7 with ReinstallServer42FlowForSwitchManagerRequest

use of org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest in project open-kilda by telstra.

the class RecordHandlerTest method reinstallServer42FlowRttOutputVxlanTest.

@Test
public void reinstallServer42FlowRttOutputVxlanTest() throws SwitchOperationException {
    long cookie = SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE;
    expect(switchManager.installServer42FlowRttOutputVxlanFlow(DATAPATH_ID, SERVER42_PORT, SERVER42_VLAN, SERVER42_MAC_ADDRESS)).andReturn(cookie).once();
    expect(switchManager.deleteRulesByCriteria(DATAPATH_ID, false, null, DeleteRulesCriteria.builder().cookie(cookie).build())).andReturn(Lists.newArrayList(cookie)).once();
    replay(switchManager);
    ReinstallServer42FlowForSwitchManagerRequest request = new ReinstallServer42FlowForSwitchManagerRequest(SWITCH_ID, cookie, SERVER42_MAC_ADDRESS, SERVER42_VLAN, SERVER42_PORT);
    recordHandler.handleCommand(new CommandMessage(request, 0, null));
    verify(switchManager);
}
Also used : ReinstallServer42FlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest) CommandMessage(org.openkilda.messaging.command.CommandMessage) Test(org.junit.Test)

Example 8 with ReinstallServer42FlowForSwitchManagerRequest

use of org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest in project open-kilda by telstra.

the class CommandBuilderImpl method buildCommandsToReinstallRules.

@Override
public List<ReinstallDefaultFlowForSwitchManagerRequest> buildCommandsToReinstallRules(SwitchId switchId, List<Long> reinstallRulesCookies) {
    SwitchProperties properties = getSwitchProperties(switchId);
    List<ReinstallDefaultFlowForSwitchManagerRequest> commands = new ArrayList<>();
    for (Long cookie : reinstallRulesCookies) {
        if (isDefaultRuleWithSpecialRequirements(cookie)) {
            commands.add(new ReinstallServer42FlowForSwitchManagerRequest(switchId, cookie, properties.getServer42MacAddress(), properties.getServer42Vlan(), properties.getServer42Port()));
        } else {
            commands.add(new ReinstallDefaultFlowForSwitchManagerRequest(switchId, cookie));
        }
    }
    return commands;
}
Also used : ReinstallDefaultFlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.ReinstallDefaultFlowForSwitchManagerRequest) ArrayList(java.util.ArrayList) SwitchProperties(org.openkilda.model.SwitchProperties) ReinstallServer42FlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest)

Aggregations

ReinstallServer42FlowForSwitchManagerRequest (org.openkilda.messaging.command.flow.ReinstallServer42FlowForSwitchManagerRequest)8 Test (org.junit.Test)6 CommandMessage (org.openkilda.messaging.command.CommandMessage)5 ReinstallDefaultFlowForSwitchManagerRequest (org.openkilda.messaging.command.flow.ReinstallDefaultFlowForSwitchManagerRequest)3 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 SwitchOperationException (org.openkilda.floodlight.error.SwitchOperationException)1 UnsupportedSwitchOperationException (org.openkilda.floodlight.error.UnsupportedSwitchOperationException)1 IKafkaProducerService (org.openkilda.floodlight.service.kafka.IKafkaProducerService)1 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 FlowReinstallResponse (org.openkilda.messaging.info.flow.FlowReinstallResponse)1 SwitchId (org.openkilda.model.SwitchId)1 SwitchProperties (org.openkilda.model.SwitchProperties)1 DatapathId (org.projectfloodlight.openflow.types.DatapathId)1