当前位置: 首页>>代码示例>>Java>>正文


Java EventSubject类代码示例

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


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

示例1: portAdded

import org.onosproject.ovsdb.controller.EventSubject; //导入依赖的package包/类
@Test
public void portAdded() {
    DefaultEventSubject eventSubject = new DefaultEventSubject(MAC, null,
                                                               new OvsdbPortName("portName"),
                                                               new OvsdbPortNumber(0L),
                                                               new OvsdbDatapathId("10002"),
                                                               new OvsdbPortType("vxlan"),
                                                               new OvsdbIfaceId("102345"));
    controller.ovsdbEventListener
            .handle(new OvsdbEvent<EventSubject>(
                                                 OvsdbEvent.Type.PORT_ADDED,
                                                 eventSubject));
    assertNotNull("never went throught the provider service",
                  providerService.added);

}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:OvsdbHostProviderTest.java

示例2: dispatchInterfaceEvent

import org.onosproject.ovsdb.controller.EventSubject; //导入依赖的package包/类
/**
 * Dispatches event to the north.
 *
 * @param clientService OvsdbClientService instance
 * @param newRow        a new row
 * @param oldRow        an old row
 * @param eventType     type of event
 * @param dbSchema      ovsdb database schema
 */
private void dispatchInterfaceEvent(OvsdbClientService clientService,
                                    Row row,
                                    Type eventType,
                                    DatabaseSchema dbSchema) {

    long dpid = getDataPathid(clientService, dbSchema);
    Interface intf = (Interface) TableGenerator
            .getTable(dbSchema, row, OvsdbTable.INTERFACE);
    if (intf == null) {
        return;
    }

    String portType = (String) intf.getTypeColumn().data();
    long localPort = getOfPort(intf);
    if (localPort < 0) {
        return;
    }
    String[] macAndIfaceId = getMacAndIfaceid(intf);
    if (macAndIfaceId == null) {
        return;
    }

    EventSubject eventSubject = new DefaultEventSubject(MacAddress.valueOf(
            macAndIfaceId[0]),
                                                        new HashSet<IpAddress>(),
                                                        new OvsdbPortName(intf
                                                                                  .getName()),
                                                        new OvsdbPortNumber(localPort),
                                                        new OvsdbDatapathId(Long
                                                                                    .toString(dpid)),
                                                        new OvsdbPortType(portType),
                                                        new OvsdbIfaceId(macAndIfaceId[1]));
    for (OvsdbEventListener listener : ovsdbEventListener) {
        listener.handle(new OvsdbEvent<EventSubject>(eventType,
                                                     eventSubject));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:47,代码来源:OvsdbControllerImpl.java

示例3: portRemoved

import org.onosproject.ovsdb.controller.EventSubject; //导入依赖的package包/类
@Test
public void portRemoved() {
    DefaultEventSubject eventSubject = new DefaultEventSubject(MAC, null,
                                                               new OvsdbPortName("portName"),
                                                               new OvsdbPortNumber(0L),
                                                               new OvsdbDatapathId("10002"),
                                                               new OvsdbPortType("vxlan"),
                                                               new OvsdbIfaceId("102345"));
    controller.ovsdbEventListener
            .handle(new OvsdbEvent<EventSubject>(
                                                 OvsdbEvent.Type.PORT_REMOVED,
                                                 eventSubject));
    assertEquals("port status unhandled", 1, providerService.removeCount);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:OvsdbHostProviderTest.java


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