Search in sources :

Example 1 with SwitchDescription

use of net.floodlightcontroller.core.SwitchDescription in project open-kilda by telstra.

the class ReplaceInstallFlowTest method initScheme.

protected void initScheme() {
    scheme = new ReplaceSchemeOutputCommands();
    switchDescription = new SwitchDescription("", "", "", "", "");
}
Also used : SwitchDescription(net.floodlightcontroller.core.SwitchDescription) ReplaceSchemeOutputCommands(org.openkilda.floodlight.message.command.encapsulation.ReplaceSchemeOutputCommands)

Example 2 with SwitchDescription

use of net.floodlightcontroller.core.SwitchDescription in project open-kilda by telstra.

the class PathTest method setUp.

@Before
public void setUp() throws Exception {
    cntx = new FloodlightContext();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(IOFSwitchService.class, getMockSwitchService());
    swDescription = factory.buildDescStatsReply().build();
    swFeatures = factory.buildFeaturesReply().setNBuffers(1000).build();
    sw1Port1 = EasyMock.createMock(OFPortDesc.class);
    sw2Port1 = EasyMock.createMock(OFPortDesc.class);
    expect(sw1Port1.getHwAddr()).andReturn(MacAddress.of(sw1HwAddrTarget)).anyTimes();
    expect(sw1Port1.getPortNo()).andReturn(OFPort.of(1));
    expect(sw2Port1.getHwAddr()).andReturn(MacAddress.of(sw2HwAddrTarget)).anyTimes();
    expect(sw2Port1.getPortNo()).andReturn(OFPort.of(1));
    sw1 = EasyMock.createMock(IOFSwitch.class);
    expect(sw1.getId()).andReturn(sw1Id).anyTimes();
    expect(sw1.getPort(OFPort.of(1))).andReturn(sw1Port1).anyTimes();
    expect(sw1.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw1.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw1.getSwitchDescription()).andReturn(new SwitchDescription(swDescription)).anyTimes();
    expect(sw1.isActive()).andReturn(true).anyTimes();
    expect(sw1.getLatency()).andReturn(U64.of(10L)).anyTimes();
    expect(sw1.getInetAddress()).andReturn(sw1InetAddr).anyTimes();
    sw2 = EasyMock.createMock(IOFSwitch.class);
    expect(sw2.getId()).andReturn(sw2Id).anyTimes();
    expect(sw2.getPort(OFPort.of(1))).andReturn(sw1Port1).anyTimes();
    expect(sw2.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw2.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw2.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw2.getSwitchDescription()).andReturn(new SwitchDescription(swDescription)).anyTimes();
    expect(sw2.isActive()).andReturn(true).anyTimes();
    expect(sw2.getLatency()).andReturn(U64.of(10L)).anyTimes();
    expect(sw2.getInetAddress()).andReturn(sw2InetAddr).anyTimes();
    replay(sw1Port1);
    replay(sw2Port1);
    replay(sw1);
    replay(sw2);
    packetIn = EasyMock.createMock(OFPacketIn.class);
    pvs.initAlgorithm("secret");
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFPortDesc(org.projectfloodlight.openflow.protocol.OFPortDesc) FloodlightModuleContext(net.floodlightcontroller.core.module.FloodlightModuleContext) OFPacketIn(org.projectfloodlight.openflow.protocol.OFPacketIn) SwitchDescription(net.floodlightcontroller.core.SwitchDescription) FloodlightContext(net.floodlightcontroller.core.FloodlightContext) Before(org.junit.Before)

Example 3 with SwitchDescription

use of net.floodlightcontroller.core.SwitchDescription in project open-kilda by telstra.

the class PathVerificationFlowTest method setUp.

@Before
public void setUp() throws Exception {
    logger = LoggerFactory.getLogger(PathVerificationFlowTest.class);
    cntx = new FloodlightContext();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    swDescription = factory.buildDescStatsReply().build();
    swFeatures = factory.buildFeaturesReply().setNBuffers(1000).build();
    sw = EasyMock.createMock(IOFSwitch.class);
    expect(sw.getId()).andReturn(swDpid).anyTimes();
    expect(sw.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(new SwitchDescription(swDescription)).anyTimes();
    expect(sw.isActive()).andReturn(true).anyTimes();
    expect(sw.getLatency()).andReturn(U64.of(10L)).anyTimes();
    replay(sw);
    pvs = new PathVerificationService();
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) FloodlightModuleContext(net.floodlightcontroller.core.module.FloodlightModuleContext) SwitchDescription(net.floodlightcontroller.core.SwitchDescription) FloodlightContext(net.floodlightcontroller.core.FloodlightContext) Before(org.junit.Before)

Example 4 with SwitchDescription

use of net.floodlightcontroller.core.SwitchDescription in project open-kilda by telstra.

the class FloodlightTestCase method buildMockIOFSwitch.

public IOFSwitch buildMockIOFSwitch(Long id, OFPortDesc portDesc, OFFactory factory, OFDescStatsReply swDesc, InetSocketAddress inetAddr) {
    IOFSwitch sw = EasyMock.createMock(IOFSwitch.class);
    expect(sw.getId()).andReturn(DatapathId.of(id)).anyTimes();
    expect(sw.getPort(OFPort.of(1))).andReturn(portDesc).anyTimes();
    expect(sw.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(new SwitchDescription(swDesc)).anyTimes();
    expect(sw.isActive()).andReturn(true).anyTimes();
    expect(sw.getLatency()).andReturn(U64.of(10L)).anyTimes();
    expect(sw.getInetAddress()).andReturn(inetAddr).anyTimes();
    return sw;
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) SwitchDescription(net.floodlightcontroller.core.SwitchDescription)

Aggregations

SwitchDescription (net.floodlightcontroller.core.SwitchDescription)4 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)3 FloodlightContext (net.floodlightcontroller.core.FloodlightContext)2 FloodlightModuleContext (net.floodlightcontroller.core.module.FloodlightModuleContext)2 Before (org.junit.Before)2 ReplaceSchemeOutputCommands (org.openkilda.floodlight.message.command.encapsulation.ReplaceSchemeOutputCommands)1 OFPacketIn (org.projectfloodlight.openflow.protocol.OFPacketIn)1 OFPortDesc (org.projectfloodlight.openflow.protocol.OFPortDesc)1