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


Java VirtualPortId类代码示例

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


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

示例1: onHostVanished

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
public void onHostVanished(Host host) {
    DeviceId deviceId = host.location().deviceId();
    if (!mastershipService.isLocalMaster(deviceId)) {
        return;
    }
    String ifaceId = host.annotations().value(IFACEID);
    if (ifaceId == null) {
        log.error("The ifaceId of Host is null");
        return;
    }
    programSffAndClassifierHost(host, Objective.Operation.REMOVE);
    // apply L2 openflow rules
    applyHostMonitoredL2Rules(host, Objective.Operation.REMOVE);
    // apply L3 openflow rules
    applyHostMonitoredL3Rules(host, Objective.Operation.REMOVE);
    VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
    vPortStore.remove(virtualPortId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:VtnManager.java

示例2: getDeviceIdOfFloatingIP

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

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

示例4: modifyHostDetails

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

示例5: activate

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

示例6: activate

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Activate
public void activate() {
    appId = coreService.registerApplication(VTNRSC_APP);
    KryoNamespace.Builder serializer = KryoNamespace
            .newBuilder()
            .register(KryoNamespaces.API)
            .register(FloatingIp.class, FloatingIpId.class,
                      TenantNetworkId.class, TenantId.class,
                      FloatingIp.Status.class, RouterId.class,
                      VirtualPortId.class, DefaultFloatingIp.class,
                      UUID.class);
    floatingIpStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpBindStore = storageService
            .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
            .withName(FLOATINGIPBINDSTORE).withSerializer(serializer)
            .withTimestampProvider((k, v) -> new WallClockTimestamp())
            .build();
    floatingIpStore.addListener(floatingIpListener);
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:FloatingIpManager.java

示例7: getGatewayMac

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

示例8: isLastSFHostOfTenant

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
/**
 * Checks whether the last Service Function host of a specific tenant in
 * this device.
 *
 * @param host the host on device
 * @param deviceId the device identifier
 * @param tenantId the tenant identifier
 * @return true or false
 */
private boolean isLastSFHostOfTenant(Host host, DeviceId deviceId,
                                     TenantId tenantId) {
    Set<Host> hostSet = hostService.getConnectedHosts(deviceId);
    if (hostSet != null) {
        for (Host h : hostSet) {
            String ifaceId = h.annotations().value(IFACEID);
            if (ifaceId != null) {
                VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
                if (virtualPortService.getPort(hPortId).tenantId().tenantId()
                        .equals(tenantId.tenantId())
                        && isServiceFunction(hPortId)) {
                    if (!h.equals(host)) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:VtnRscManager.java

示例9: isLastClassifierHostOfTenant

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
/**
 * Checks whether the last Classifier host of a specific tenant in this
 * device.
 *
 * @param host the host on device
 * @param deviceId the device identifier
 * @param tenantId the tenant identifier
 * @return true or false
 */
private boolean isLastClassifierHostOfTenant(Host host, DeviceId deviceId,
                                             TenantId tenantId) {
    Set<Host> hostSet = hostService.getConnectedHosts(deviceId);
    if (hostSet != null) {
        for (Host h : hostSet) {
            String ifaceId = h.annotations().value(IFACEID);
            if (ifaceId != null) {
                VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
                if (virtualPortService.getPort(hPortId).tenantId().tenantId()
                        .equals(tenantId.tenantId())
                        && !isServiceFunction(hPortId)) {
                    if (!h.equals(host)) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:VtnRscManager.java

示例10: execute

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
protected void execute() {
    FloatingIpService service = get(FloatingIpService.class);
    try {
        FloatingIp floatingIpObj = new DefaultFloatingIp(
                                                      FloatingIpId.of(id),
                                                      TenantId.tenantId(tenantId),
                                                      TenantNetworkId.networkId(networkId),
                                                      VirtualPortId.portId(portId),
                                                      RouterId.valueOf(routerId),
                                                      floatingIp == null ? null : IpAddress.valueOf(floatingIp),
                                                      fixedIp == null ? null : IpAddress.valueOf(fixedIp),
                                                      status == null ? Status.ACTIVE
                                                                     : Status.valueOf(status));
        Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
        service.createFloatingIps(floatingIpSet);
    } catch (Exception e) {
        print(null, e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:FloatingIpCreateCommand.java

示例11: createExGwPort

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

示例12: execute

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
protected void execute() {
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", name);
    strMap.putIfAbsent("deviceOwner", deviceOwner);
    strMap.putIfAbsent("bindingvnicType", bindingvnicType);
    strMap.putIfAbsent("bindingvifType", bindingvifType);
    strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
    VirtualPortService service = get(VirtualPortService.class);
    VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
                                   TenantNetworkId.networkId(networkId),
                                   false, strMap, VirtualPort.State.ACTIVE,
                                   MacAddress.valueOf(macAddress),
                                   TenantId.tenantId(tenantId),
                                   DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
                                   BindingHostId.bindingHostId(bindingHostId),
                                   allowedAddressPairs, securityGroups);
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.createPorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortCreateCommand.java

示例13: execute

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
protected void execute() {
    VirtualPortService service = get(VirtualPortService.class);
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", name);
    strMap.putIfAbsent("deviceOwner", deviceOwner);
    strMap.putIfAbsent("bindingvnicType", bindingvnicType);
    strMap.putIfAbsent("bindingvifType", bindingvifType);
    strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
    VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
                                                     TenantNetworkId.networkId(networkId),
                                                     false, strMap, VirtualPort.State.ACTIVE,
                                                     MacAddress.valueOf(macAddress),
                                                     TenantId.tenantId(tenantId),
                                                     DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
                                                     BindingHostId.bindingHostId(bindingHostId),
                                                     allowedAddressPairs, securityGroups);
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.updatePorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortUpdateCommand.java

示例14: execute

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
protected void execute() {
    RouterService service = get(RouterService.class);
    try {
        List<String> routes = new ArrayList<String>();
        Router router = new DefaultRouter(
                                          RouterId.valueOf(id),
                                          routerName,
                                          adminStateUp,
                                          status == null ? Status.ACTIVE
                                                        : Status.valueOf(status),
                                          distributed,
                                          null,
                                          VirtualPortId.portId(gatewayPortId),
                                          TenantId.tenantId(tenantId),
                                          routes);
        Set<Router> routerSet = Sets.newHashSet(router);
        service.createRouters(routerSet);
    } catch (Exception e) {
        print(null, e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:RouterCreateCommand.java

示例15: execute

import org.onosproject.vtnrsc.VirtualPortId; //导入依赖的package包/类
@Override
protected void execute() {
    RouterService service = get(RouterService.class);
    RouterId routerId = RouterId.valueOf(id);
    Router router = get(RouterService.class).getRouter(routerId);
    try {
        List<String> routes = new ArrayList<String>();
        Router routerObj = new DefaultRouter(
                                             RouterId.valueOf(id),
                                             routerName == null ? router.name() : routerName,
                                             adminStateUp,
                                             status == null ? Status.ACTIVE
                                                           : Status.valueOf(status),
                                             distributed,
                                             null,
                                             gatewayPortId == null ? router.gatewayPortid()
                                                                  : VirtualPortId.portId(gatewayPortId),
                                             tenantId == null ? router.tenantId()
                                                              : TenantId.tenantId(tenantId),
                                             routes);
        Set<Router> routerSet = Sets.newHashSet(routerObj);
        service.createRouters(routerSet);
    } catch (Exception e) {
        print(null, e.getMessage());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:RouterUpdateCommand.java


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