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


Java DhcpService类代码示例

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


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

示例1: execute

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void execute() {
    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);

    try {
        MacAddress macID = MacAddress.valueOf(macAddr);
        Ip4Address ipAddress = Ip4Address.valueOf(ipAddr);

        IpAssignment ipAssignment = IpAssignment.builder()
                .ipAddress(ipAddress)
                .leasePeriod(dhcpService.getLeaseTime())
                .timestamp(new Date())
                .assignmentStatus(Option_Requested)
                .build();

        if (dhcpService.setStaticMapping(macID, ipAssignment)) {
            print(DHCP_SUCCESS);
        } else {
            print(DHCP_FAILURE);
        }

    } catch (IllegalArgumentException e) {
        print(e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:DhcpSetStaticMapping.java

示例2: execute

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void execute() {
    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);

    try {
        MacAddress macID = MacAddress.valueOf(macAddr);
        if (dhcpService.removeStaticMapping(macID)) {
            print(DHCP_SUCCESS);
        } else {
            print(DHCP_FAILURE);
        }

    } catch (IllegalArgumentException e) {
        print(e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DhcpRemoveStaticMapping.java

示例3: populateTable

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
    Map<HostId, IpAssignment> allocationMap = dhcpService.listMapping();

    for (Map.Entry<HostId, IpAssignment> entry : allocationMap.entrySet()) {
        populateRow(tm.addRow(), entry);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DhcpViewMessageHandler.java

示例4: execute

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void execute() {

    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
    int leaseTime = dhcpService.getLeaseTime();
    int renewTime = dhcpService.getRenewalTime();
    int rebindTime = dhcpService.getRebindingTime();

    print(DHCP_LEASE_FORMAT, leaseTime, renewTime, rebindTime);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:DhcpLeaseDetails.java

示例5: complete

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();
    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
    Iterator<Ip4Address> it = dhcpService.getAvailableIPs().iterator();
    SortedSet<String> strings = delegate.getStrings();

    while (it.hasNext()) {
        strings.add(it.next().toString());
    }

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(buffer, cursor, candidates);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:FreeIpCompleter.java

示例6: execute

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void execute() {

    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
    Map<HostId, IpAssignment> allocationMap = dhcpService.listMapping();

    for (Map.Entry<HostId, IpAssignment> entry : allocationMap.entrySet()) {
        print(DHCP_MAPPING_FORMAT, entry.getKey().toString(), entry.getValue().ipAddress().toString());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:DhcpListAllMappings.java

示例7: execute

import org.onosproject.dhcp.DhcpService; //导入依赖的package包/类
@Override
protected void execute() {
    DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
    int leaseTime = dhcpService.getLeaseTime();
    int renewTime = dhcpService.getRenewalTime();
    int rebindTime = dhcpService.getRebindingTime();

    print(DHCP_LEASE_FORMAT, leaseTime, renewTime, rebindTime);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:10,代码来源:DhcpLeaseDetails.java


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