本文整理匯總了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());
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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());
}
}
示例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);
}