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


Java Device.id方法代码示例

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


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

示例1: populateRow

import org.onosproject.net.Device; //导入方法依赖的package包/类
private void populateRow(TableModel.Row row, Device dev,
                         DeviceService ds, MastershipService ms) {
    DeviceId id = dev.id();
    boolean available = ds.isAvailable(id);
    String iconId = available ? ICON_ID_ONLINE : ICON_ID_OFFLINE;

    row.cell(ID, id)
        .cell(NAME, deviceName(dev))
        .cell(AVAILABLE, available)
        .cell(AVAILABLE_IID, iconId)
        .cell(TYPE_IID, getTypeIconId(dev))
        .cell(MFR, dev.manufacturer())
        .cell(HW, dev.hwVersion())
        .cell(SW, dev.swVersion())
        .cell(PROTOCOL, deviceProtocol(dev))
        .cell(NUM_PORTS, ds.getPorts(id).size())
        .cell(MASTER_ID, ms.getMasterFor(id));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:DeviceViewMessageHandler.java

示例2: createHost

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Creates a default host connected at the given edge device and port. Note
 * that an identifying hex character ("a" - "f") should be supplied. This
 * will be included in the MAC address of the host (and equivalent value
 * as last byte in IP address).
 *
 * @param device  edge device
 * @param port    port number
 * @param hexChar identifying hex character
 * @return host connected at that location
 */
protected static Host createHost(Device device, int port, String hexChar) {
    DeviceId deviceId = device.id();
    String devNum = deviceId.toString().substring(1);

    MacAddress mac = MacAddress.valueOf(HOST_MAC_PREFIX + devNum + hexChar);
    HostId hostId = hostId(String.format("%s/-1", mac));

    int ipByte = Integer.valueOf(hexChar, 16);
    if (ipByte < 10 || ipByte > 15) {
        throw new IllegalArgumentException("hexChar must be a-f");
    }
    HostLocation loc = new HostLocation(deviceId, portNumber(port), 0);

    IpAddress ip = ip("10." + devNum + ".0." + ipByte);

    return new DefaultHost(ProviderId.NONE, hostId, mac, VlanId.NONE,
            loc, ImmutableSet.of(ip));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:AbstractTopoModelTest.java

示例3: nextBatch

import org.onosproject.net.Device; //导入方法依赖的package包/类
private List<FlowRule> nextBatch(int size) {
    List<FlowRule> rules = Lists.newArrayList();
    for (int i = 0; i < size; ++i) {
        Device device = devices.next();
        long srcMac = macIndex.incrementAndGet();
        long dstMac = srcMac + 1;
        TrafficSelector selector = DefaultTrafficSelector.builder()
                .matchEthSrc(MacAddress.valueOf(srcMac))
                .matchEthDst(MacAddress.valueOf(dstMac))
                .matchInPort(PortNumber.portNumber(2))
                .build();
        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                .add(Instructions.createOutput(PortNumber.portNumber(3))).build();
        FlowRule rule = new DefaultFlowRule(device.id(),
                selector,
                treatment,
                100,
                appId,
                50000,
                true,
                null);
        rules.add(rule);
    }
    return rules;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:FlowPerfApp.java

示例4: loadAllByType

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
                                                              TypedStoredFlowEntry.FlowLiveType liveType,
                                                              Instruction.Type instType) {
    checkPermission(STATISTIC_READ);

    Map<ConnectPoint, List<TypedFlowEntryWithLoad>> allLoad = new TreeMap<>(CONNECT_POINT_COMPARATOR);

    if (device == null) {
        return allLoad;
    }

    List<Port> ports = new ArrayList<>(deviceService.getPorts(device.id()));

    for (Port port : ports) {
        ConnectPoint cp = new ConnectPoint(device.id(), port.number());
        List<TypedFlowEntryWithLoad> tfel = loadAllPortInternal(cp, liveType, instType);
        allLoad.put(cp, tfel);
    }

    return allLoad;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:FlowStatisticManager.java

示例5: addOrUpdateDevice

import org.onosproject.net.Device; //导入方法依赖的package包/类
void addOrUpdateDevice(Device device) {
    DeviceId id = device.id();
    UiDevice uiDevice = uiTopology.findDevice(id);
    if (uiDevice == null) {
        uiDevice = addNewDevice(device);
    }
    updateDevice(uiDevice);

    postEvent(DEVICE_ADDED_OR_UPDATED, uiDevice);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:ModelCache.java

示例6: cleanConflictedFlowRules

import org.onosproject.net.Device; //导入方法依赖的package包/类
private void cleanConflictedFlowRules() {
    Iterable<Device> deviceList = deviceService.getAvailableDevices();

    for (Device d : deviceList) {
        DeviceId id = d.id();
        log.trace("Searching for flow rules to remove from: " + id);
        for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
            boolean match = false;
            for (Instruction i : r.treatment().allInstructions()) {
                if (i.type() == Instruction.Type.OUTPUT) {
                    OutputInstruction oi = (OutputInstruction) i;
                    // if the flow has matching src and dst
                    for (Criterion cr : r.selector().criteria()) {
                        if (cr.type() == Criterion.Type.TCP_DST || cr.type() == Criterion.Type.TCP_SRC) {
                            int portNumber = ((TcpPortCriterion) cr).tcpPort().toInt();
                            if (portNumber == 20) {
                                match = true;
                            }
                        }
                    }
                }
            }
            if (match) {
                log.trace("Removed flow rule from device: " + id);
                flowRuleService.removeFlowRules((FlowRule) r);
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:SimpleSecurityRouting.java

示例7: sendEvent

import org.onosproject.net.Device; //导入方法依赖的package包/类
private void sendEvent(Device device) {
    // Make it look like things came from ports attached to hosts
    eth.setSourceMACAddress("00:00:00:10:00:0" + SRC_HOST)
            .setDestinationMACAddress("00:00:00:10:00:0" + DST_HOST);
    InboundPacket inPkt = new DefaultInboundPacket(
            new ConnectPoint(device.id(), PortNumber.portNumber(SRC_HOST)),
            eth, ByteBuffer.wrap(eth.serialize()));
    providerService.processPacket(new NullPacketContext(inPkt, null));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:NullPacketProvider.java

示例8: getDevice

import org.onosproject.net.Device; //导入方法依赖的package包/类
private DeviceId getDevice(PccId pccId) {
    // Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID.
    IpAddress lsrId = pccId.ipAddress();
    String lsrIdentifier = String.valueOf(lsrId);

    // Find PCC deviceID from lsrId stored as annotations
    Iterable<Device> devices = deviceService.getAvailableDevices();
    for (Device dev : devices) {
        if (dev.annotations().value(AnnotationKeys.TYPE).equals("L3")
                && dev.annotations().value(LSRID).equals(lsrIdentifier)) {
            return dev.id();
        }
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:PcepTunnelProvider.java

示例9: populateAllRoutingRules

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Populates all routing rules to all connected routers, including default
 * routing rules, adjacency rules, and policy rules if any.
 *
 * @return true if it succeeds in populating all rules, otherwise false
 */
public boolean populateAllRoutingRules() {

    statusLock.lock();
    try {
        populationStatus = Status.STARTED;
        rulePopulator.resetCounter();
        log.info("Starting to populate segment-routing rules");
        log.debug("populateAllRoutingRules: populationStatus is STARTED");

        for (Device sw : srManager.deviceService.getDevices()) {
            if (!srManager.mastershipService.isLocalMaster(sw.id())) {
                log.debug("populateAllRoutingRules: skipping device {}...we are not master",
                          sw.id());
                continue;
            }

            EcmpShortestPathGraph ecmpSpg = new EcmpShortestPathGraph(sw.id(), srManager);
            if (!populateEcmpRoutingRules(sw.id(), ecmpSpg, ImmutableSet.of())) {
                log.debug("populateAllRoutingRules: populationStatus is ABORTED");
                populationStatus = Status.ABORTED;
                log.debug("Abort routing rule population");
                return false;
            }
            currentEcmpSpgMap.put(sw.id(), ecmpSpg);

            // TODO: Set adjacency routing rule for all switches
        }

        log.debug("populateAllRoutingRules: populationStatus is SUCCEEDED");
        populationStatus = Status.SUCCEEDED;
        log.info("Completed routing rule population. Total # of rules pushed : {}",
                rulePopulator.getCounter());
        return true;
    } finally {
        statusLock.unlock();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:DefaultRoutingHandler.java

示例10: execute

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
protected void execute() {
    DeviceService deviceService = get(DeviceService.class);
    MastershipService roleService = get(MastershipService.class);

    if (outputJson()) {
        print("%s", json(roleService, getSortedDevices(deviceService)));
    } else {
        for (Device d : getSortedDevices(deviceService)) {
            DeviceId did = d.id();
            printRoles(roleService, did);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:RolesCommand.java

示例11: processPortLinks

import org.onosproject.net.Device; //导入方法依赖的package包/类
private void processPortLinks(Device device, Port port) {
    ConnectPoint connectPoint = new ConnectPoint(device.id(), port.number());
    for (Link link : linkService.getLinks(connectPoint)) {
        if (link.isDurable() && link.type() == OPTICAL) {
            processLink(link);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:OpticalLinkProvider.java

示例12: loadSummary

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber) {
    checkPermission(STATISTIC_READ);

    ConnectPoint cp = new ConnectPoint(device.id(), pNumber);
    return loadSummaryPortInternal(cp);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:FlowStatisticManager.java

示例13: onControllerDetected

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public void onControllerDetected(Device controllerDevice) {
    if (controllerDevice == null) {
        log.error("The controller device is null");
        return;
    }
    String localIpAddress = controllerDevice.annotations()
            .value(CONTROLLER_IP_KEY);
    IpAddress localIp = IpAddress.valueOf(localIpAddress);
    DeviceId controllerDeviceId = controllerDevice.id();
    DriverHandler handler = driverService.createHandler(controllerDeviceId);
    if (mastershipService.isLocalMaster(controllerDeviceId)) {
        // Get DataPathIdGenerator
        String ipaddress = controllerDevice.annotations().value("ipaddress");
        DataPathIdGenerator dpidGenerator = DataPathIdGenerator.builder()
                                        .addIpAddress(ipaddress).build();
        DeviceId deviceId = dpidGenerator.getDeviceId();
        String dpid = dpidGenerator.getDpId();
        // Inject pipeline driver name
        BasicDeviceConfig config = configService.addConfig(deviceId,
                                                           BasicDeviceConfig.class);
        config.driver(DRIVER_NAME);
        configService.applyConfig(deviceId, BasicDeviceConfig.class, config.node());
        // Add Bridge
        Versioned<String> exPortVersioned = exPortMap.get(EX_PORT_KEY);
        if (exPortVersioned != null) {
            VtnConfig.applyBridgeConfig(handler, dpid, exPortVersioned.value());
            log.info("A new ovs is created in node {}", localIp.toString());
        }
        switchesOfController.put(localIp, true);
    }
    // Create tunnel in br-int on all controllers
    programTunnelConfig(controllerDeviceId, localIp, handler);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:VtnManager.java

示例14: onControllerVanished

import org.onosproject.net.Device; //导入方法依赖的package包/类
@Override
public void onControllerVanished(Device controllerDevice) {
    if (controllerDevice == null) {
        log.error("The device is null");
        return;
    }
    String dstIp = controllerDevice.annotations().value(CONTROLLER_IP_KEY);
    IpAddress dstIpAddress = IpAddress.valueOf(dstIp);
    DeviceId controllerDeviceId = controllerDevice.id();
    if (mastershipService.isLocalMaster(controllerDeviceId)) {
        switchesOfController.remove(dstIpAddress);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:VtnManager.java

示例15: getControllerId

import org.onosproject.net.Device; //导入方法依赖的package包/类
/**
 * Get the ControllerId from the device .
 *
 * @param device Device
 * @param devices Devices
 * @return Controller Id
 */
public static DeviceId getControllerId(Device device,
                                       Iterable<Device> devices) {
    for (Device d : devices) {
        if (d.type() == Device.Type.CONTROLLER && d.id().toString()
                .contains(getControllerIpOfSwitch(device))) {
            return d.id();
        }
    }
    log.info("Can not find controller for device : {}", device.id());
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:VtnData.java


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