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


Java HostEvent.type方法代码示例

本文整理汇总了Java中org.onosproject.net.host.HostEvent.type方法的典型用法代码示例。如果您正苦于以下问题:Java HostEvent.type方法的具体用法?Java HostEvent.type怎么用?Java HostEvent.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.host.HostEvent的用法示例。


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

示例1: hostMessage

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
protected ObjectNode hostMessage(HostEvent event) {
    Host host = event.subject();
    String hostType = host.annotations().value(AnnotationKeys.TYPE);
    ObjectNode payload = mapper.createObjectNode()
            .put("id", host.id().toString())
            .put("type", isNullOrEmpty(hostType) ? "endstation" : hostType)
            .put("ingress", compactLinkString(edgeLink(host, true)))
            .put("egress", compactLinkString(edgeLink(host, false)));
    payload.set("cp", hostConnect(mapper, host.location()));
    payload.set("labels", labels(mapper, ip(host.ipAddresses()),
                                 host.mac().toString()));
    payload.set("props", props(host.annotations()));
    addGeoLocation(host, payload);
    addMetaUi(host.id().toString(), payload);

    String type = (event.type() == HOST_ADDED) ? "addHost" :
            ((event.type() == HOST_REMOVED) ? "removeHost" : "updateHost");
    return envelope(type, 0, payload);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:20,代码来源:TopologyViewMessages.java

示例2: handle

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
private void handle(HostEvent event) {
    Host host = event.subject();
    if (!mastershipService.isLocalMaster(host.location().deviceId())) {
        // do not allow to proceed without mastership
        return;
    }

    Instance instance = Instance.of(host);
    if (!netTypes.isEmpty() && !netTypes.contains(instance.netType())) {
        // not my service network instance, do nothing
        return;
    }

    switch (event.type()) {
    case HOST_UPDATED:
        instanceUpdated(instance);
        break;
    case HOST_ADDED:
        instanceDetected(instance);
        break;
    case HOST_REMOVED:
        instanceRemoved(instance);
        break;
    default:
        break;
    }
}
 
开发者ID:opencord,项目名称:vtn,代码行数:28,代码来源:AbstractInstanceHandler.java

示例3: event

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
@Override
public void event(HostEvent hostEvent) {
	if (hostEvent.type() == HostEvent.Type.HOST_ADDED) {
		Host host = hostEvent.subject();
		ObjectNode hostMessage = objectNode();
		hostMessage.put("mac", host.mac().toString());
		hostMessage.put("vlan", host.vlan().toShort());
		hostMessage.put("ip", host.ipAddresses().toString());
		connection().sendMessage("hostEvent", 0, hostMessage);
	}
}
 
开发者ID:ShakhMoves,项目名称:ShakhSDVPN,代码行数:12,代码来源:SDVPNWebHandler.java

示例4: event

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
/**
 *
 * @param hostEvent Host event that we use to detect adding new hosts to the network
    */
@Override
public void event(HostEvent hostEvent) {
	if (hostEvent.type() == HostEvent.Type.HOST_ADDED) {
		Host host = hostEvent.subject();
		ObjectNode hostMessage = objectNode();
		hostMessage.put("mac", host.mac().toString());
		hostMessage.put("vlan", host.vlan().toShort());
		hostMessage.put("ip", host.ipAddresses().toString());
		connection().sendMessage("hostEvent", 0, hostMessage);
	}
}
 
开发者ID:eljalalpour,项目名称:SDVPN,代码行数:16,代码来源:SDVPNWebHandler.java

示例5: isRelevant

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
@Override
public boolean isRelevant(HostEvent event) {
    return !appFreezed && event.type() == HOST_ADDED;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:AbstractUpgradableFabricApp.java

示例6: run

import org.onosproject.net.host.HostEvent; //导入方法依赖的package包/类
@Override
public void run() {

    if (event instanceof  DeviceEvent) {
        DeviceEvent deviceEvent = (DeviceEvent) event;

        switch (deviceEvent.type()) {
            case DEVICE_ADDED:
                log.debug("device {} is added", deviceEvent.subject().id());
                break;
            case DEVICE_AVAILABILITY_CHANGED:
                Device device = deviceEvent.subject();
                if (deviceService.isAvailable(device.id())) {
                    log.debug("device {} is added", device.id());
                }
                break;
            case PORT_ADDED:
                processPortUpdated(deviceEvent.subject(), deviceEvent.port());
                break;
            case PORT_UPDATED:
                processPortUpdated(deviceEvent.subject(), deviceEvent.port());
                break;
            case PORT_REMOVED:
                processPortRemoved(deviceEvent.port());
                break;
            default:
                log.debug("Unsupported deviceEvent type {}", deviceEvent.type().toString());
                break;
        }
    } else if (event instanceof HostEvent) {
        HostEvent hostEvent = (HostEvent) event;

        switch (hostEvent.type()) {
            case HOST_REMOVED:
                log.debug("host {} was removed", hostEvent.subject().toString());
                break;
            default:
                log.debug("Unsupported hostEvent type {}", hostEvent.type().toString());
                break;
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:OpenstackSwitchingManager.java


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