本文整理汇总了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);
}