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


Java VirtualPort.fixedIps方法代碼示例

本文整理匯總了Java中org.onosproject.vtnrsc.VirtualPort.fixedIps方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualPort.fixedIps方法的具體用法?Java VirtualPort.fixedIps怎麽用?Java VirtualPort.fixedIps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.onosproject.vtnrsc.VirtualPort的用法示例。


在下文中一共展示了VirtualPort.fixedIps方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: updateExGwPort

import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
private void updateExGwPort(VirtualPort exgwPort) {
    VirtualPortService service = get(VirtualPortService.class);
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", exgwPort.name());
    strMap.putIfAbsent("deviceOwner", exgwPort.deviceOwner());
    strMap.putIfAbsent("bindingvnicType", exgwPort.bindingVnicType());
    strMap.putIfAbsent("bindingvifType", exgwPort.bindingVifType());
    strMap.putIfAbsent("bindingvnicDetails", exgwPort.bindingVifDetails());
    VirtualPort virtualPort = new DefaultVirtualPort(exgwPort.portId(),
                                                     exgwPort.networkId(),
                                                     false, strMap,
                                                     VirtualPort.State.DOWN,
                                                     MacAddress.valueOf(macAddress),
                                                     exgwPort.tenantId(),
                                                     exgwPort.deviceId(),
                                                     exgwPort.fixedIps(),
                                                     exgwPort.bindingHostId(),
                                                     Sets.newHashSet(exgwPort
                                                            .allowedAddressPairs()),
                                                     Sets.newHashSet(exgwPort
                                                            .securityGroups()));
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.updatePorts(virtualPorts);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:25,代碼來源:VirtualPortExGwUpdateCommand.java

示例3: onVirtualPortCreated

import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
public void onVirtualPortCreated(VtnRscEventFeedback l3Feedback) {
    VirtualPort vPort = l3Feedback.virtualPort();
    BasicHostConfig basicHostConfig = networkConfigService.addConfig(HostId.hostId(vPort.macAddress()),
                                                                     BasicHostConfig.class);
    Set<IpAddress> ips = new HashSet<>();
    for (FixedIp fixedIp : vPort.fixedIps()) {
        ips.add(fixedIp.ip());
    }
    basicHostConfig.setIps(ips).apply();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:11,代碼來源:VtnManager.java

示例4: onVirtualPortDeleted

import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
public void onVirtualPortDeleted(VtnRscEventFeedback l3Feedback) {
    VirtualPort vPort = l3Feedback.virtualPort();
    HostId hostId = HostId.hostId(vPort.macAddress());
    BasicHostConfig basicHostConfig = networkConfigService.addConfig(hostId,
                                                                     BasicHostConfig.class);
    Set<IpAddress> ips = hostService.getHost(hostId).ipAddresses();
    for (FixedIp fixedIp : vPort.fixedIps()) {
        ips.remove(fixedIp.ip());
    }
    basicHostConfig.setIps(ips).apply();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:12,代碼來源:VtnManager.java

示例5: getSubnetOfFloatingIP

import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
private Subnet getSubnetOfFloatingIP(FloatingIp floatingIp) {
    DeviceId exVmPortId = DeviceId
            .deviceId(floatingIp.id().floatingIpId().toString());
    Collection<VirtualPort> exVmPortList = virtualPortService
            .getPorts(exVmPortId);
    VirtualPort exVmPort = null;
    if (exVmPortList != null) {
        exVmPort = exVmPortList.iterator().next();
    }
    if (exVmPort == null) {
        return null;
    }
    Set<FixedIp> fixedIps = exVmPort.fixedIps();
    SubnetId subnetId = null;
    for (FixedIp f : fixedIps) {
        IpAddress fp = f.ip();
        if (fp.equals(floatingIp.floatingIp())) {
            subnetId = f.subnetId();
            break;
        }
    }
    if (subnetId == null) {
        return null;
    }
    Subnet subnet = subnetService.getSubnet(subnetId);
    return subnet;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:28,代碼來源:VtnManager.java

示例6: onVirtualPortDeleted

import org.onosproject.vtnrsc.VirtualPort; //導入方法依賴的package包/類
public void onVirtualPortDeleted(VtnRscEventFeedback l3Feedback) {
    VirtualPort vPort = l3Feedback.virtualPort();
    HostId hostId = HostId.hostId(vPort.macAddress());
    BasicHostConfig basicHostConfig = networkConfigService.addConfig(hostId,
                                                                     BasicHostConfig.class);
    Set<IpAddress> oldIps = hostService.getHost(hostId).ipAddresses();
    // Copy to a new set as oldIps is unmodifiable set.
    Set<IpAddress> newIps = new HashSet<>();
    newIps.addAll(oldIps);
    for (FixedIp fixedIp : vPort.fixedIps()) {
        newIps.remove(fixedIp.ip());
    }
    basicHostConfig.setIps(newIps).apply();
}
 
開發者ID:opennetworkinglab,項目名稱:onos,代碼行數:15,代碼來源:VtnManager.java


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