當前位置: 首頁>>代碼示例>>Java>>正文


Java VirtualPort.macAddress方法代碼示例

本文整理匯總了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;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:22,代碼來源:VtnManager.java

示例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());
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:20,代碼來源:SfcwebUiTopovOverlay.java

示例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;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:23,代碼來源:VtnRscManager.java


注:本文中的org.onosproject.vtnrsc.VirtualPort.macAddress方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。