當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。