当前位置: 首页>>代码示例>>Java>>正文


Java VtnData.getPort方法代码示例

本文整理汇总了Java中org.onosproject.vtn.util.VtnData.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java VtnData.getPort方法的具体用法?Java VtnData.getPort怎么用?Java VtnData.getPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.vtn.util.VtnData的用法示例。


在下文中一共展示了VtnData.getPort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGwIpAndMac

import org.onosproject.vtn.util.VtnData; //导入方法依赖的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: getDeviceIdOfFloatingIP

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
private DeviceId getDeviceIdOfFloatingIP(FloatingIp floatingIp) {
    VirtualPortId vmPortId = floatingIp.portId();
    VirtualPort vmPort = virtualPortService.getPort(vmPortId);
    if (vmPort == null) {
        vmPort = VtnData.getPort(vPortStore, vmPortId);
    }
    Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
    Host host = null;
    for (Host h : hostSet) {
        String ifaceid = h.annotations().value(IFACEID);
        if (ifaceid != null && ifaceid.equals(vmPortId.portId())) {
            host = h;
            break;
        }
    }
    if (host == null) {
        return null;
    } else {
        return host.location().deviceId();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:VtnManager.java

示例3: programSffAndClassifierHost

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
private void programSffAndClassifierHost(Host host, Objective.Operation type) {
    DeviceId deviceId = host.location().deviceId();
    String ifaceId = host.annotations().value(IFACEID);
    VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
    VirtualPort virtualPort = virtualPortService.getPort(virtualPortId);
    if (virtualPort == null) {
        virtualPort = VtnData.getPort(vPortStore, virtualPortId);
    }
    TenantId tenantId = virtualPort.tenantId();
    if (Objective.Operation.ADD == type) {
        vtnRscService.addDeviceIdOfOvsMap(virtualPortId, tenantId, deviceId);
    } else if (Objective.Operation.REMOVE == type) {
        vtnRscService.removeDeviceIdOfOvsMap(host, tenantId, deviceId);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:VtnManager.java

示例4: onRouterInterfaceVanished

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
@Override
public void onRouterInterfaceVanished(VtnRscEventFeedback l3Feedback) {
    Objective.Operation operation = Objective.Operation.REMOVE;
    RouterInterface routerInf = l3Feedback.routerInterface();
    Iterable<RouterInterface> interfaces = routerInterfaceService
            .getRouterInterfaces();
    Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
            .stream().filter(r -> r.tenantId().equals(routerInf.tenantId()))
            .collect(Collectors.toSet());
    TenantRouter tenantRouter = TenantRouter
            .tenantRouter(routerInf.tenantId(), routerInf.routerId());
    if (routerInfFlagOfTenantRouter.get(tenantRouter) != null) {
        programRouterInterface(routerInf, operation);
        if (interfacesSet.size() == 1) {
            routerInfFlagOfTenantRouter.remove(tenantRouter);
            interfacesSet.stream().forEach(r -> {
                programRouterInterface(r, operation);
            });
        }
    }
    VirtualPort gwPort = virtualPortService.getPort(routerInf.portId());
    if (gwPort == null) {
        gwPort = VtnData.getPort(vPortStore, routerInf.portId());
    }
    vPortStore.remove(gwPort.portId());
    // apply L3 arp flows
    applyL3ArpFlows(null, gwPort, operation);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:VtnManager.java

示例5: onRouterInterfaceVanished

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
@Override
public void onRouterInterfaceVanished(VtnRscEventFeedback l3Feedback) {
    Objective.Operation operation = Objective.Operation.REMOVE;
    RouterInterface routerInf = l3Feedback.routerInterface();
    Iterable<RouterInterface> interfaces = routerInterfaceService
            .getRouterInterfaces();
    Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
            .stream().filter(r -> r.tenantId().equals(routerInf.tenantId()))
            .collect(Collectors.toSet());
    TenantRouter tenantRouter = TenantRouter
            .tenantRouter(routerInf.tenantId(), routerInf.routerId());
    if (routerInfFlagOfTenantRouter.get(tenantRouter) != null) {
        programRouterInterface(routerInf, operation);
        if (interfacesSet.size() == 1) {
            routerInfFlagOfTenantRouter.remove(tenantRouter);
            interfacesSet.forEach(r -> {
                programRouterInterface(r, operation);
            });
        }
    }
    VirtualPort gwPort = virtualPortService.getPort(routerInf.portId());
    if (gwPort == null) {
        gwPort = VtnData.getPort(vPortStore, routerInf.portId());
    }
    vPortStore.remove(gwPort.portId());
    // apply L3 arp flows
    applyL3ArpFlows(null, gwPort, operation);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:29,代码来源:VtnManager.java

示例6: programFloatingIpEvent

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
private void programFloatingIpEvent(VtnRscEventFeedback l3Feedback,
                                   VtnRscEvent.Type type) {
    FloatingIp floaingIp = l3Feedback.floatingIp();
    if (floaingIp != null) {
        VirtualPortId vmPortId = floaingIp.portId();
        VirtualPort vmPort = virtualPortService.getPort(vmPortId);
        VirtualPort fipPort = virtualPortService
                .getPort(floaingIp.networkId(), floaingIp.floatingIp());
        if (vmPort == null) {
            vmPort = VtnData.getPort(vPortStore, vmPortId);
        }
        if (fipPort == null) {
            fipPort = VtnData.getPort(vPortStore, floaingIp.networkId(),
                                      floaingIp.floatingIp());
        }
        Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
        Host host = null;
        for (Host h : hostSet) {
            String ifaceid = h.annotations().value(IFACEID);
            if (ifaceid != null && ifaceid.equals(vmPortId.portId())) {
                host = h;
                break;
            }
        }
        if (host != null && vmPort != null && fipPort != null) {
            DeviceId deviceId = host.location().deviceId();
            Port exPort = exPortOfDevice.get(deviceId);
            TenantRouter tenantRouter = TenantRouter
                    .tenantRouter(floaingIp.tenantId(), floaingIp.routerId());
            SegmentationId l3vni = vtnRscService.getL3vni(tenantRouter);
            // Floating ip BIND
            if (type == VtnRscEvent.Type.FLOATINGIP_BIND) {
                vPortStore.put(fipPort.portId(), fipPort);
                applyNorthSouthL3Flows(deviceId, false, tenantRouter, host,
                                       vmPort, fipPort, floaingIp, l3vni,
                                       exPort, Objective.Operation.ADD);
            } else if (type == VtnRscEvent.Type.FLOATINGIP_UNBIND) {
                // Floating ip UNBIND
                applyNorthSouthL3Flows(deviceId, false, tenantRouter, host,
                                       vmPort, fipPort, floaingIp, l3vni,
                                       exPort,
                                       Objective.Operation.REMOVE);
                vPortStore.remove(fipPort.portId());
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:48,代码来源:VtnManager.java

示例7: downloadSnatRules

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
private boolean downloadSnatRules(DeviceId deviceId, MacAddress srcMac,
                                  IpAddress srcIp, MacAddress dstMac,
                                  IpAddress dstIp, FloatingIp floatingIp) {
    TenantNetwork exNetwork = tenantNetworkService
            .getNetwork(floatingIp.networkId());
    IpAddress fixedIp = floatingIp.fixedIp();
    VirtualPortId vmPortId = floatingIp.portId();
    VirtualPort vmPort = virtualPortService.getPort(vmPortId);
    if (vmPort == null) {
        vmPort = VtnData.getPort(vPortStore, vmPortId);
    }
    Subnet subnet = getSubnetOfFloatingIP(floatingIp);
    IpPrefix ipPrefix = subnet.cidr();
    IpAddress gwIp = subnet.gatewayIp();
    if (ipPrefix == null) {
        return false;
    }
    int mask = ipPrefix.prefixLength();
    if (mask <= 0) {
        return false;
    }
    TenantRouter tenantRouter = TenantRouter
            .tenantRouter(floatingIp.tenantId(), floatingIp.routerId());
    SegmentationId l3vni = vtnRscService.getL3vni(tenantRouter);
    // if the same ip segment
    if (IpUtil.checkSameSegment(srcIp, dstIp, mask)) {
        snatService.programSnatSameSegmentRules(deviceId, l3vni, fixedIp,
                                                dstIp, dstMac, srcMac,
                                                srcIp,
                                                exNetwork.segmentationId(),
                                                Objective.Operation.ADD);
        if (dstIp.equals(gwIp)) {
            snatService
                    .programSnatDiffSegmentRules(deviceId, l3vni, fixedIp,
                                                 dstMac, srcMac, srcIp,
                                                 exNetwork.segmentationId(),
                                                 Objective.Operation.ADD);
        }
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:42,代码来源:VtnManager.java

示例8: programFloatingIpEvent

import org.onosproject.vtn.util.VtnData; //导入方法依赖的package包/类
private void programFloatingIpEvent(VtnRscEventFeedback l3Feedback,
                                   VtnRscEvent.Type type) {
    FloatingIp floaingIp = l3Feedback.floatingIp();
    if (floaingIp != null) {
        VirtualPortId vmPortId = floaingIp.portId();
        VirtualPort vmPort = virtualPortService.getPort(vmPortId);
        VirtualPort fipPort = virtualPortService
                .getPort(floaingIp.networkId(), floaingIp.floatingIp());
        if (vmPort == null) {
            vmPort = VtnData.getPort(vPortStore, vmPortId);
        }
        if (fipPort == null) {
            fipPort = VtnData.getPort(vPortStore, floaingIp.networkId(),
                                      floaingIp.floatingIp());
        }
        Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
        Host host = null;
        for (Host h : hostSet) {
            String ifaceid = h.annotations().value(IFACEID);
            if (ifaceid != null && ifaceid.equals(vmPortId.portId())) {
                host = h;
                break;
            }
        }
        if (host != null && fipPort != null) {
            DeviceId deviceId = host.location().deviceId();
            Port exPort = exPortOfDevice.get(deviceId);
            TenantRouter tenantRouter = TenantRouter
                    .tenantRouter(floaingIp.tenantId(), floaingIp.routerId());
            SegmentationId l3vni = vtnRscService.getL3vni(tenantRouter);
            // Floating ip BIND
            if (type == VtnRscEvent.Type.FLOATINGIP_BIND) {
                vPortStore.put(fipPort.portId(), fipPort);
                applyNorthSouthL3Flows(deviceId, false, tenantRouter, host,
                                       vmPort, fipPort, floaingIp, l3vni,
                                       exPort, Objective.Operation.ADD);
            } else if (type == VtnRscEvent.Type.FLOATINGIP_UNBIND) {
                // Floating ip UNBIND
                applyNorthSouthL3Flows(deviceId, false, tenantRouter, host,
                                       vmPort, fipPort, floaingIp, l3vni,
                                       exPort,
                                       Objective.Operation.REMOVE);
                vPortStore.remove(fipPort.portId());
            }
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:48,代码来源:VtnManager.java


注:本文中的org.onosproject.vtn.util.VtnData.getPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。