• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PortChangeType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitch.PortChangeType的典型用法代码示例。如果您正苦于以下问题:Java PortChangeType类的具体用法?Java PortChangeType怎么用?Java PortChangeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PortChangeType类属于net.floodlightcontroller.core.IOFSwitch包,在下文中一共展示了PortChangeType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: switchPortsChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Called when ports on the given switch have changed. Writes the
 * updated switch to the sync store and queues a switch notification
 * to listeners
 * @param sw
 */
public synchronized void switchPortsChanged(IOFSwitch sw,
                                            ImmutablePort port,
                                            PortChangeType type) {
    if (role != Role.MASTER) {
        counters.invalidPortsChanged.updateCounterWithFlush();
        return;
    }
    if (!this.activeSwitches.containsKey(sw.getId())) {
        counters.invalidPortsChanged.updateCounterWithFlush();
        return;
    }
    // update switch in store
    addSwitchToStore(sw);
    // no need to count here. SwitchUpdate.dispatch will count
    // the portchanged
    SwitchUpdate update = new SwitchUpdate(sw.getId(),
                                           SwitchUpdateType.PORTCHANGED,
                                           port, type);
    addUpdateToQueue(update);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:27,代码来源:Controller.java


示例2: SwitchUpdate

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
public SwitchUpdate(long swId,
                    SwitchUpdateType switchUpdateType,
                    ImmutablePort port,
                    PortChangeType changeType) {
    if (switchUpdateType == SwitchUpdateType.PORTCHANGED) {
        if (port == null) {
            throw new NullPointerException("Port must not be null " +
                    "for PORTCHANGED updates");
        }
        if (changeType == null) {
            throw new NullPointerException("ChangeType must not be " +
                    "null for PORTCHANGED updates");
        }
    } else {
        if (port != null || changeType != null) {
            throw new IllegalArgumentException("port and changeType " +
                    "must be null for " + switchUpdateType +
                    " updates");
        }
    }
    this.swId = swId;
    this.switchUpdateType = switchUpdateType;
    this.port = port;
    this.changeType = changeType;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:26,代码来源:Controller.java


示例3: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long swId, OFPortDesc port,
        PortChangeType changeType) {
    switch (changeType) {
    case ADD:
        switchPortAdded(swId, port);
        break;
    case DELETE:
        switchPortRemoved(swId, port);
        break;
    case UP:
        // NOTE: Currently, we treat Port UP/DOWN same as Port ADD/DELETE
        switchPortAdded(swId, port);
        break;
    case DOWN:
        // NOTE: Currently, we treat Port UP/DOWN same as Port ADD/DELETE
        switchPortRemoved(swId, port);
        break;
    case OTHER_UPDATE:
    default:
        // XXX S what is the right set of port change handlers?
        log.debug("Topology publisher does not handle these port updates: {}",
                    changeType);
    }
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:26,代码来源:TopologyPublisher.java


示例4: SwitchUpdate

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
public SwitchUpdate(long swId,
        SwitchUpdateType switchUpdateType,
        OFPortDesc port,
        PortChangeType changeType) {
    if (switchUpdateType == SwitchUpdateType.PORTCHANGED) {
        if (port == null) {
            throw new NullPointerException("Port must not be null " +
                    "for PORTCHANGED updates");
        }
        if (changeType == null) {
            throw new NullPointerException("ChangeType must not be " +
                    "null for PORTCHANGED updates");
        }
    } else {
        if (port != null || changeType != null) {
            throw new IllegalArgumentException("port and changeType " +
                    "must be null for " + switchUpdateType +
                    " updates");
        }
    }
    this.swId = swId;
    this.switchUpdateType = switchUpdateType;
    this.port = port;
    this.changeType = changeType;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:26,代码来源:Controller.java


示例5: notifyPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Indicates that ports on the given switch have changed. Enqueue a switch
 * update.
 *
 * @param sw
 */
protected void notifyPortChanged(long dpid, OFPortDesc port,
        PortChangeType changeType) {
    if (port == null || changeType == null) {
        String msg = String.format("Switch port or changeType must not "
                + "be null in port change notification");
        throw new NullPointerException(msg);
    }
    if (connectedSwitches.get(dpid) == null || getSwitch(dpid) == null) {
        log.warn("Port change update on switch {} not connected or activated "
                + "... Aborting.", HexString.toHexString(dpid));
        return;
    }

    SwitchUpdate update = new SwitchUpdate(dpid, SwitchUpdateType.PORTCHANGED,
            port, changeType);
    addUpdateToQueue(update);
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:24,代码来源:Controller.java


示例6: testNotifyPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Test the method to notify the controller of a port change.
 * The controller should send out an update to the switch listeners.
 *
 * @throws InterruptedException
 */
@Test
public void testNotifyPortChanged() throws InterruptedException {
    long dpid = 1L;

    // No difference between OpenFlow versions here
    OFVersion version = OFVersion.OF_10;
    IOFSwitch sw = createMockSwitch(dpid, version);
    OFPortDesc port = OFFactories.getFactory(version).buildPortDesc()
            .setName("myPortName1")
            .setPortNo(OFPort.of(42))
            .build();

    replay(sw);

    controller.connectedSwitches.put(1L, new OFChannelHandler(controller));
    controller.activeMasterSwitches.put(1L, sw);

    doTestNotifyPortChanged(dpid, port, PortChangeType.ADD);
    doTestNotifyPortChanged(dpid, port, PortChangeType.OTHER_UPDATE);
    doTestNotifyPortChanged(dpid, port, PortChangeType.DELETE);
    doTestNotifyPortChanged(dpid, port, PortChangeType.UP);
    doTestNotifyPortChanged(dpid, port, PortChangeType.DOWN);

}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:31,代码来源:ControllerTest.java


示例7: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long switchId, ImmutablePort port,
                              PortChangeType type) {
    String msg = String.format("Switch %s port %s changed: %s",
                               HexString.toHexString(switchId),
                               port.getName(),
                               type.toString());
    notifier.postNotification(msg);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:10,代码来源:Controller.java


示例8: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long switchId, ImmutablePort port,
		PortChangeType type) {
	switch (type) {
	case DELETE:
	case DOWN:
		this.handlePortDown(switchId, port);
		break;
	default:
		break;
	}

}
 
开发者ID:xuraylei,项目名称:floodlight_with_topoguard,代码行数:14,代码来源:TopoloyUpdateChecker.java


示例9: doTestUpdateQueueWithPortUpdate

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
private void doTestUpdateQueueWithPortUpdate(long dpid, OFPortDesc port,
        PortChangeType type,
        DummySwitchListener listener) throws InterruptedException {
    controller.updates.put(controller.new SwitchUpdate(dpid,
            SwitchUpdateType.PORTCHANGED, port, type));
    synchronized (listener) {
        listener.wait(500);
    }
    // Test that the update was seen by the listener 1 time
    assertEquals(1, listener.getPortUpdateCount(type));
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:12,代码来源:ControllerTest.java


示例10: doTestNotifyPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
private void doTestNotifyPortChanged(long dpid, OFPortDesc port,
        PortChangeType changeType) throws InterruptedException {
    controller.notifyPortChanged(dpid, port, changeType);

    assertEquals(1, controller.updates.size());
    IUpdate update = controller.updates.take();
    assertEquals(true, update instanceof SwitchUpdate);
    SwitchUpdate swUpdate = (SwitchUpdate) update;
    assertEquals(dpid, swUpdate.getSwId());
    assertEquals(SwitchUpdateType.PORTCHANGED, swUpdate.getSwitchUpdateType());
    assertEquals(changeType, swUpdate.getPortChangeType());
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:13,代码来源:ControllerTest.java


示例11: testNotifySwitchPoArtChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Test that notifyPortChanged() results in an IOFSwitchListener
 * update and that its arguments are passed through to
 * the listener call
 */
@Test
public void testNotifySwitchPoArtChanged() throws Exception {
    long dpid = 42L;

    OFFeaturesReply fr1 = createOFFeaturesReply();
    fr1.setDatapathId(dpid);
    OFPhysicalPort p1 = createOFPhysicalPort("Port1", 1);
    fr1.setPorts(Collections.singletonList(p1));

    OFFeaturesReply fr2 = createOFFeaturesReply();
    fr1.setDatapathId(dpid);
    OFPhysicalPort p2 = createOFPhysicalPort("Port1", 1);
    p2.setAdvertisedFeatures(0x2); // just some bogus values
    fr2.setPorts(Collections.singletonList(p2));

    OFDescriptionStatistics desc = createOFDescriptionStatistics();

    // activate switch
    IOFSwitch sw = doActivateNewSwitch(dpid, desc, fr1);

    // check the store
    SwitchSyncRepresentation ssr = storeClient.getValue(dpid);
    assertNotNull(ssr);
    assertEquals(dpid, ssr.getDpid());
    assertEquals(1, ssr.getPorts().size());
    assertEquals(p1, ssr.getPorts().get(0).toOFPhysicalPort());

    IOFSwitchListener listener = createMock(IOFSwitchListener.class);
    controller.addOFSwitchListener(listener);
    // setup switch with the new, second features reply (and thus ports)
    setupSwitchForAddSwitch(sw, dpid, desc, fr2);
    listener.switchPortChanged(dpid, ImmutablePort.fromOFPhysicalPort(p2),
                               PortChangeType.OTHER_UPDATE);
    expectLastCall().once();
    replay(listener);
    replay(sw);
    controller.notifyPortChanged(sw, ImmutablePort.fromOFPhysicalPort(p2),
                                 PortChangeType.OTHER_UPDATE);
    controller.processUpdateQueueForTesting();
    verify(listener);
    verify(sw);

    // check the store
    ssr = storeClient.getValue(dpid);
    assertNotNull(ssr);
    assertEquals(dpid, ssr.getDpid());
    assertEquals(1, ssr.getPorts().size());
    assertEquals(p2, ssr.getPorts().get(0).toOFPhysicalPort());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:55,代码来源:ControllerTest.java


示例12: testPortStatusMessageMaster

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Test port status message handling while MASTER
 *
 */
@Test
public void testPortStatusMessageMaster() throws Exception {
    long dpid = featuresReply.getDatapathId();
    testInitialMoveToMasterWithRole();

    OFPhysicalPort p = new OFPhysicalPort();
    p.setName("Port1");
    p.setPortNumber((short)1);
    OFPortStatus ps = (OFPortStatus)
            BasicFactory.getInstance().getMessage(OFType.PORT_STATUS);
    ps.setDesc(p);

    // The events we expect sw.handlePortStatus to return
    // We'll just use the same list for all valid OFPortReasons and add
    // arbitrary events for arbitrary ports that are not necessarily
    // related to the port status message. Our goal
    // here is not to return the correct set of events but the make sure
    // that a) sw.handlePortStatus is called
    //      b) the list of events sw.handlePortStatus returns is sent
    //         as IOFSwitchListener notifications.
    OrderedCollection<PortChangeEvent> events =
            new LinkedHashSetWrapper<PortChangeEvent>();
    ImmutablePort p1 = ImmutablePort.create("eth1", (short)1);
    ImmutablePort p2 = ImmutablePort.create("eth2", (short)2);
    ImmutablePort p3 = ImmutablePort.create("eth3", (short)3);
    ImmutablePort p4 = ImmutablePort.create("eth4", (short)4);
    ImmutablePort p5 = ImmutablePort.create("eth5", (short)5);
    events.add(new PortChangeEvent(p1, PortChangeType.ADD));
    events.add(new PortChangeEvent(p2, PortChangeType.DELETE));
    events.add(new PortChangeEvent(p3, PortChangeType.UP));
    events.add(new PortChangeEvent(p4, PortChangeType.DOWN));
    events.add(new PortChangeEvent(p5, PortChangeType.OTHER_UPDATE));


    for (OFPortReason reason: OFPortReason.values()) {
        ps.setReason(reason.getReasonCode());

        reset(sw);
        expect(sw.inputThrottled(anyObject(OFMessage.class)))
                .andReturn(false).anyTimes();
        expect(sw.getId()).andReturn(dpid).anyTimes();

        expect(sw.processOFPortStatus(ps)).andReturn(events).once();
        replay(sw);

        reset(controller);
        controller.notifyPortChanged(sw, p1, PortChangeType.ADD);
        controller.notifyPortChanged(sw, p2, PortChangeType.DELETE);
        controller.notifyPortChanged(sw, p3, PortChangeType.UP);
        controller.notifyPortChanged(sw, p4, PortChangeType.DOWN);
        controller.notifyPortChanged(sw, p5, PortChangeType.OTHER_UPDATE);
        sendMessageToHandlerNoControllerReset(
               Collections.<OFMessage>singletonList(ps));
        verify(sw);
        verify(controller);
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:62,代码来源:OFChannelHandlerTest.java


示例13: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long switchId, ImmutablePort port,
		PortChangeType type) {
	// TODO Auto-generated method stub
	flag=true;color = decideSWColor();setDefaultRules();
}
 
开发者ID:shao-you,项目名称:SDN-Traceroute,代码行数:7,代码来源:Traceroute.java


示例14: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long swId, OFPortDesc port, PortChangeType changeType) {
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:4,代码来源:DefaultRules.java


示例15: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long swId, OFPortDesc port,
        PortChangeType changeType) {
    // TODO Auto-generated method stub

}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:7,代码来源:LinkDiscoveryManager.java


示例16: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long swId, OFPortDesc port, PortChangeType pct) {
    // TODO Auto-generated method stub
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:5,代码来源:FlowProgrammer.java


示例17: getPortChangeType

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
public PortChangeType getPortChangeType() {
    return changeType;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:4,代码来源:Controller.java


示例18: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public synchronized void switchPortChanged(long swId, OFPortDesc port,
        PortChangeType changeType) {
    portUpdateCount.add(changeType);
    notifyAll();
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:7,代码来源:ControllerTest.java


示例19: testUpdateQueue

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
/**
 * Tests that updates sent into the Controller updates queue are dispatched
 * to the listeners correctly.
 *
 * @throws InterruptedException
 */
@Test
public void testUpdateQueue() throws InterruptedException {
    // No difference between OpenFlow versions here
    OFVersion version = OFVersion.OF_10;
    OFPortDesc port = OFFactories.getFactory(version)
            .buildPortDesc().build();
    long dpid = 1L;

    DummySwitchListener switchListener = new DummySwitchListener();
    IOFSwitch sw = createMockSwitch(dpid, version);
    replay(sw);
    ControllerRunThread t = new ControllerRunThread();
    t.start();

    controller.addOFSwitchListener(switchListener);

    // Switch updates
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.ACTIVATED_MASTER,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.ACTIVATED_EQUAL,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.EQUAL_TO_MASTER,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.MASTER_TO_EQUAL,
            switchListener);
    doTestUpdateQueueWithUpdate(dpid, SwitchUpdateType.DISCONNECTED,
            switchListener);

    // Port updates
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.ADD,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.OTHER_UPDATE,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.DELETE,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.UP,
            switchListener);
    doTestUpdateQueueWithPortUpdate(dpid, port, PortChangeType.DOWN,
            switchListener);
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:47,代码来源:ControllerTest.java


示例20: switchPortChanged

import net.floodlightcontroller.core.IOFSwitch.PortChangeType; //导入依赖的package包/类
@Override
public void switchPortChanged(long switchId, ImmutablePort port,
		PortChangeType type) {
	//nothing to do here
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:6,代码来源:FlowSpaceFirewall.java



注:本文中的net.floodlightcontroller.core.IOFSwitch.PortChangeType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NoopRequest类代码示例发布时间:2022-05-22
下一篇:
Java JsonXMLOutputFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap