本文整理匯總了Java中org.onosproject.vtnrsc.VirtualPort.macAddress方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualPort.macAddress方法的具體用法?Java VirtualPort.macAddress怎麽用?Java VirtualPort.macAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.onosproject.vtnrsc.VirtualPort
的用法示例。
在下文中一共展示了VirtualPort.macAddress方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGwIpAndMac
import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
private List getGwIpAndMac(VirtualPort port) {
List list = new ArrayList();
MacAddress gwMac = null;
SubnetId subnetId = null;
IpAddress gwIp = null;
Iterator<FixedIp> fixips = port.fixedIps().iterator();
if (fixips.hasNext()) {
FixedIp fixip = fixips.next();
subnetId = fixip.subnetId();
gwIp = subnetService.getSubnet(subnetId).gatewayIp();
FixedIp fixedGwIp = FixedIp.fixedIp(fixip.subnetId(), gwIp);
VirtualPort gwPort = virtualPortService.getPort(fixedGwIp);
if (gwPort == null) {
gwPort = VtnData.getPort(vPortStore, fixedGwIp);
}
gwMac = gwPort.macAddress();
}
list.add(gwIp);
list.add(gwMac);
return list;
}
示例2: modifyHostDetails
import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
@Override
public void modifyHostDetails(PropertyPanel pp, HostId hostId) {
pp.title(MY_HOST_TITLE);
pp.removeAllProps();
PortPairService portPairService = AbstractShellCommand.get(PortPairService.class);
VirtualPortService virtualPortService = AbstractShellCommand.get(VirtualPortService.class);
HostService hostService = AbstractShellCommand.get(HostService.class);
Iterable<PortPair> portPairs = portPairService.getPortPairs();
for (PortPair portPair : portPairs) {
VirtualPort vPort = virtualPortService.getPort(VirtualPortId.portId(portPair.ingress()));
MacAddress dstMacAddress = vPort.macAddress();
Host host = hostService.getHost(HostId.hostId(dstMacAddress));
if (hostId.toString().equals(host.id().toString())) {
pp.addProp("SF Name", portPair.name());
pp.addProp("SF Ip", vPort.fixedIps().iterator().next().ip());
}
}
pp.addProp("SF host Address", hostId.toString());
}
示例3: getGatewayMac
import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
@Override
public MacAddress getGatewayMac(HostId hostId) {
checkNotNull(hostId, "hostId cannot be null");
Host host = hostService.getHost(hostId);
String ifaceId = host.annotations().value(IFACEID);
VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
VirtualPort hPort = virtualPortService.getPort(hPortId);
SubnetId subnetId = hPort.fixedIps().iterator().next().subnetId();
Subnet subnet = subnetService.getSubnet(subnetId);
IpAddress gatewayIp = subnet.gatewayIp();
Iterable<VirtualPort> virtualPorts = virtualPortService.getPorts();
MacAddress macAddress = null;
for (VirtualPort port : virtualPorts) {
Set<FixedIp> fixedIpSet = port.fixedIps();
for (FixedIp fixedIp : fixedIpSet) {
if (fixedIp.ip().equals(gatewayIp)) {
macAddress = port.macAddress();
}
}
}
return macAddress;
}