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


Java FixedIp类代码示例

本文整理汇总了Java中org.onosproject.vtnrsc.FixedIp的典型用法代码示例。如果您正苦于以下问题:Java FixedIp类的具体用法?Java FixedIp怎么用?Java FixedIp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getGwIpAndMac

import org.onosproject.vtnrsc.FixedIp; //导入依赖的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: getPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
/**
 * Get VirtualPort.
 *
 * @param vPortStore EventuallyConsistentMap of VirtualPort
 * @param fixedIP FixedIp of the VirtualPort
 * @return VirtualPort
 */
public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
                                  FixedIp fixedIP) {
    if (vPortStore != null) {
        List<VirtualPort> vPorts = new ArrayList<>();
        vPortStore.values().stream().forEach(p -> {
            Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
            while (fixedIps.hasNext()) {
                if (fixedIps.next().equals(fixedIP)) {
                    vPorts.add(p);
                    break;
                }
            }
        });
        if (vPorts.size() == 0) {
            return null;
        }
        return vPorts.get(0);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:VtnData.java

示例3: getGatewayMac

import org.onosproject.vtnrsc.FixedIp; //导入依赖的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

示例4: getPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Override
public VirtualPort getPort(FixedIp fixedIP) {
    checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
    List<VirtualPort> vPorts = new ArrayList<>();
    vPortStore.values().stream().forEach(p -> {
        Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
        while (fixedIps.hasNext()) {
            if (fixedIps.next().equals(fixedIP)) {
                vPorts.add(p);
                break;
            }
        }
    });
    if (vPorts.size() == 0) {
        return null;
    }
    return vPorts.get(0);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:VirtualPortManager.java

示例5: createExGwPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
private void createExGwPort(TenantNetwork network, Subnet subnet, FixedIp fixedGwIp) {
    VirtualPortService service = get(VirtualPortService.class);
    Map<String, String> strMap = Maps.newHashMap();
    VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId("externalgateway-update-id"),
                                                     network.id(),
                                                     false, strMap,
                                                     VirtualPort.State.DOWN,
                                                     MacAddress.valueOf(macAddress),
                                                     subnet.tenantId(),
                                                     DeviceId.deviceId(""),
                                                     Sets.newHashSet(fixedGwIp),
                                                     BindingHostId.bindingHostId(""),
                                                     Sets.newHashSet(),
                                                     Sets.newHashSet());
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.createPorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:VirtualPortExGwUpdateCommand.java

示例6: activate

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(Router.class, RouterId.class, DefaultRouter.class,
                      TenantNetworkId.class, TenantId.class,
                      VirtualPortId.class, DefaultRouter.class,
                      RouterGateway.class, Router.Status.class,
                      SubnetId.class, FixedIp.class);
    routerStore = storageService
            .<RouterId, Router>eventuallyConsistentMapBuilder()
            .withName(ROUTER).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    routerStore.addListener(routerListener);
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:RouterManager.java

示例7: getPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Override
public BasePort getPort(FixedIp fixedIP) {
    checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
    List<BasePort> vPorts = new ArrayList<>();
    vPortStore.values().forEach(p -> {
        for (FixedIp fixedIp : p.fixedIps()) {
            if (fixedIp.equals(fixedIP)) {
                vPorts.add(p);
                break;
            }
        }
    });
    if (vPorts.size() == 0) {
        return null;
    }
    return vPorts.get(0);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:BasePortManager.java

示例8: getPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
/**
 * Get VirtualPort.
 *
 * @param vPortStore EventuallyConsistentMap of VirtualPort
 * @param fixedIP FixedIp of the VirtualPort
 * @return VirtualPort
 */
public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
                                  FixedIp fixedIP) {
    if (vPortStore != null) {
        List<VirtualPort> vPorts = new ArrayList<>();
        vPortStore.values().forEach(p -> {
            Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
            while (fixedIps.hasNext()) {
                if (fixedIps.next().equals(fixedIP)) {
                    vPorts.add(p);
                    break;
                }
            }
        });
        if (vPorts.isEmpty()) {
            return null;
        }
        return vPorts.get(0);
    }
    return null;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:28,代码来源:VtnData.java

示例9: getPort

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Override
public VirtualPort getPort(FixedIp fixedIP) {
    checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
    List<VirtualPort> vPorts = new ArrayList<>();
    vPortStore.values().forEach(p -> {
        Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
        while (fixedIps.hasNext()) {
            if (fixedIps.next().equals(fixedIP)) {
                vPorts.add(p);
                break;
            }
        }
    });
    if (vPorts.isEmpty()) {
        return null;
    }
    return vPorts.get(0);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:VirtualPortManager.java

示例10: onVirtualPortCreated

import org.onosproject.vtnrsc.FixedIp; //导入依赖的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

示例11: onVirtualPortDeleted

import org.onosproject.vtnrsc.FixedIp; //导入依赖的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

示例12: getSubnetOfFloatingIP

import org.onosproject.vtnrsc.FixedIp; //导入依赖的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

示例13: activate

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Activate
public void activate() {

    appId = coreService.registerApplication(VTNRSC_APP);

    eventDispatcher.addSink(VirtualPortEvent.class, listenerRegistry);

    vPortStore = storageService.<VirtualPortId, VirtualPort>eventuallyConsistentMapBuilder()
            .withName(VIRTUALPORT)
            .withSerializer(KryoNamespace.newBuilder().register(KryoNamespaces.API)
                            .register(MultiValuedTimestamp.class)
                    .register(VirtualPortId.class,
                              TenantNetworkId.class,
                              VirtualPort.State.class,
                              TenantId.class,
                              AllowedAddressPair.class,
                              FixedIp.class,
                              BindingHostId.class,
                              SecurityGroup.class,
                              SubnetId.class,
                              IpAddress.class,
                              DefaultVirtualPort.class))
            .withTimestampProvider((k, v) ->new WallClockTimestamp())
                                      .build();

    vPortStore.addListener(virtualPortListener);
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:VirtualPortManager.java

示例14: execute

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
@Override
protected void execute() {
    VirtualPortService service = get(VirtualPortService.class);
    SubnetService subnetService = get(SubnetService.class);
    TenantNetworkService tenantNetworkService = get(TenantNetworkService.class);
    Iterable<TenantNetwork> networks = tenantNetworkService.getNetworks();
    if (networks != null) {
        for (TenantNetwork network : networks) {
            if (network.routerExternal()) {
                Iterable<Subnet> subnets = subnetService.getSubnets();
                if (subnets != null) {
                    for (Subnet subnet : subnets) {
                        if (network.id().networkId().equals(subnet.networkId().networkId())) {
                            IpAddress exgwip = subnet.gatewayIp();
                            FixedIp fixedGwIp = FixedIp.fixedIp(subnet.id(), exgwip);
                            VirtualPort exgwPort = service.getPort(fixedGwIp);
                            if (exgwPort == null) {
                                createExGwPort(network, subnet, fixedGwIp);
                            } else {
                                updateExGwPort(exgwPort);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:VirtualPortExGwUpdateCommand.java

示例15: verifyRouterData

import org.onosproject.vtnrsc.FixedIp; //导入依赖的package包/类
/**
 * Verifies validity of Router data.
 *
 * @param routers router instance
 */
private void verifyRouterData(Router routers) {
    checkNotNull(routers, ROUTER_NOT_NULL);
    if (routers.gatewayPortid() != null
            && !virtualPortService.exists(routers.gatewayPortid())) {
        log.debug("The gateway port ID is not exist whose identifier is {}",
                  routers.gatewayPortid().toString());
        throw new IllegalArgumentException("gateway port ID doesn't exist");
    }

    if (routers.externalGatewayInfo() != null) {
        RouterGateway routerGateway = routers.externalGatewayInfo();
        if (!tenantNetworkService.exists(routerGateway.networkId())) {
            log.debug("The network ID of gateway info is not exist whose identifier is {}",
                      routers.id().toString());
            throw new IllegalArgumentException(
                                               "network ID of gateway info doesn't exist");
        }
        Iterable<FixedIp> fixedIps = routerGateway.externalFixedIps();
        for (FixedIp fixedIp : fixedIps) {
            if (!subnetService.exists(fixedIp.subnetId())) {
                log.debug("The subnet ID of gateway info is not exist whose identifier is {}",
                          routers.id().toString());
                throw new IllegalArgumentException(
                                                   "subnet ID of gateway info doesn't exist");
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:RouterManager.java


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