• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProviderId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testSingleHostByMacAndVlanFetch

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * Tests fetch of one host by mac and vlan.
 */
@Test
public void testSingleHostByMacAndVlanFetch() {
    final ProviderId pid = new ProviderId("of", "foo");
    final MacAddress mac1 = MacAddress.valueOf("00:00:11:00:00:01");
    final Set<IpAddress> ips1 = ImmutableSet.of(IpAddress.valueOf("1111:1111:1111:1::"));
    final Host host1 =
            new DefaultHost(pid, HostId.hostId(mac1), valueOf(1), vlanId((short) 1),
                    new HostLocation(DeviceId.deviceId("1"), portNumber(11), 1),
                    ips1);

    hosts.add(host1);

    expect(mockHostService.getHost(HostId.hostId("00:00:11:00:00:01/1")))
            .andReturn(host1)
            .anyTimes();
    replay(mockHostService);

    WebTarget wt = target();
    String response = wt.path("hosts/00:00:11:00:00:01/1").request().get(String.class);
    final JsonObject result = Json.parse(response).asObject();
    assertThat(result, matchesHost(host1));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:HostResourceTest.java


示例2: testSingleHostByIdFetch

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * Tests fetch of one host by Id.
 */
@Test
public void testSingleHostByIdFetch() {
    final ProviderId pid = new ProviderId("of", "foo");
    final MacAddress mac1 = MacAddress.valueOf("00:00:11:00:00:01");
    final Set<IpAddress> ips1 = ImmutableSet.of(IpAddress.valueOf("1111:1111:1111:1::"));
    final Host host1 =
            new DefaultHost(pid, HostId.hostId(mac1), valueOf(1), vlanId((short) 1),
                    new HostLocation(DeviceId.deviceId("1"), portNumber(11), 1),
                    ips1);

    hosts.add(host1);

    expect(mockHostService.getHost(HostId.hostId("00:00:11:00:00:01/1")))
            .andReturn(host1)
            .anyTimes();
    replay(mockHostService);

    WebTarget wt = target();
    String response = wt.path("hosts/00:00:11:00:00:01%2F1").request().get(String.class);
    final JsonObject result = Json.parse(response).asObject();
    assertThat(result, matchesHost(host1));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:HostResourceTest.java


示例3: makeLinkPair

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * Synthesizes a pair of unidirectional links between two devices. The
 * string array should be of the form:
 * <pre>
 *     { "device-A-id", "device-A-port", "device-B-id", "device-B-port" }
 * </pre>
 *
 * @param linkPairData device ids and ports
 * @return pair of synthesized links
 */
protected static List<Link> makeLinkPair(String[] linkPairData) {
    DeviceId devA = deviceId(linkPairData[0]);
    PortNumber portA = portNumber(Long.valueOf(linkPairData[1]));
    DeviceId devB = deviceId(linkPairData[2]);
    PortNumber portB = portNumber(Long.valueOf(linkPairData[3]));

    Link linkA = DefaultLink.builder()
            .providerId(ProviderId.NONE)
            .type(Link.Type.DIRECT)
            .src(new ConnectPoint(devA, portA))
            .dst(new ConnectPoint(devB, portB))
            .build();

    Link linkB = DefaultLink.builder()
            .providerId(ProviderId.NONE)
            .type(Link.Type.DIRECT)
            .src(new ConnectPoint(devB, portB))
            .dst(new ConnectPoint(devA, portA))
            .build();

    return ImmutableList.of(linkA, linkB);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:AbstractTopoModelTest.java


示例4: assertInternalDeviceEvent

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
private void assertInternalDeviceEvent(NodeId sender,
        DeviceId deviceId,
        ProviderId providerId,
        DeviceDescription expectedDesc,
        Capture<InternalDeviceEvent> actualEvent,
        Capture<MessageSubject> actualSubject,
        Capture<Function<InternalDeviceEvent, byte[]>> actualEncoder) {
    assertTrue(actualEvent.hasCaptured());
    assertTrue(actualSubject.hasCaptured());
    assertTrue(actualEncoder.hasCaptured());

    assertEquals(GossipDeviceStoreMessageSubjects.DEVICE_UPDATE,
            actualSubject.getValue());
    assertEquals(deviceId, actualEvent.getValue().deviceId());
    assertEquals(providerId, actualEvent.getValue().providerId());
    assertDeviceDescriptionEquals(expectedDesc, actualEvent.getValue().deviceDescription().value());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:GossipDeviceStoreTest.java


示例5: borrowTunnel

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId,
                                          TunnelEndPoint src, TunnelEndPoint dst,
                                          Annotations... annotations) {
    Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src,
                                                       dst, annotations);
    if (tunnels == null || tunnels.size() == 0) {
        Tunnel tunnel = new DefaultTunnel(null, src, dst, null, null, null,
                                          null, null, annotations);
        Set<ProviderId> ids = getProviders();
        for (ProviderId providerId : ids) {
            TunnelProvider provider = getProvider(providerId);
            provider.setupTunnel(tunnel, null);
        }
    }
    return tunnels;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:TunnelManager.java


示例6: handle

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public void handle(ClusterMessage message) {

    log.debug("Received port update event from peer: {}", message.sender());
    InternalPortEvent event = SERIALIZER.decode(message.payload());

    ProviderId providerId = event.providerId();
    DeviceId deviceId = event.deviceId();
    Timestamped<List<PortDescription>> portDescriptions = event.portDescriptions();

    if (getDevice(deviceId) == null) {
        log.debug("{} not found on this node yet, ignoring.", deviceId);
        // Note: dropped information will be recovered by anti-entropy
        return;
    }

    try {
        notifyDelegate(updatePortsInternal(providerId, deviceId, portDescriptions));
    } catch (Exception e) {
        log.warn("Exception thrown handling port update", e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:GossipDeviceStore.java


示例7: updateTopology

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public TopologyEvent updateTopology(ProviderId providerId,
                                    GraphDescription graphDescription,
                                    List<Event> reasons) {
    // First off, make sure that what we're given is indeed newer than
    // what we already have.
    if (current != null && graphDescription.timestamp() < current.time()) {
        return null;
    }

    // Have the default topology construct self from the description data.
    DefaultTopology newTopology =
            new DefaultTopology(providerId, graphDescription);

    // Promote the new topology to current and return a ready-to-send event.
    synchronized (this) {
        current = newTopology;
        return new TopologyEvent(TopologyEvent.Type.TOPOLOGY_CHANGED,
                                 current, reasons);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:SimpleTopologyStore.java


示例8: removeDevice

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public DeviceEvent removeDevice(DeviceId deviceId) {
    Map<ProviderId, DeviceDescriptions> descs = getOrCreateDeviceDescriptions(deviceId);
    synchronized (descs) {
        Device device = devices.remove(deviceId);
        // should DEVICE_REMOVED carry removed ports?
        Map<PortNumber, Port> ports = devicePorts.get(deviceId);
        if (ports != null) {
            ports.clear();
        }
        availableDevices.remove(deviceId);
        descs.clear();
        return device == null ? null :
                new DeviceEvent(DEVICE_REMOVED, device, null);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:SimpleDeviceStore.java


示例9: getOrCreateDeviceDescriptions

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
private Map<ProviderId, DeviceDescriptions> getOrCreateDeviceDescriptions(
        DeviceId deviceId) {
    Map<ProviderId, DeviceDescriptions> r;
    r = deviceDescs.get(deviceId);
    if (r != null) {
        return r;
    }
    r = new HashMap<>();
    final Map<ProviderId, DeviceDescriptions> concurrentlyAdded;
    concurrentlyAdded = deviceDescs.putIfAbsent(deviceId, r);
    if (concurrentlyAdded != null) {
        return concurrentlyAdded;
    } else {
        return r;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:SimpleDeviceStore.java


示例10: read

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public DefaultLink read(Kryo kryo, Input input, Class<DefaultLink> type) {
    ProviderId providerId = (ProviderId) kryo.readClassAndObject(input);
    ConnectPoint src = (ConnectPoint) kryo.readClassAndObject(input);
    ConnectPoint dst = (ConnectPoint) kryo.readClassAndObject(input);
    Type linkType = (Type) kryo.readClassAndObject(input);
    State state = (State) kryo.readClassAndObject(input);
    boolean isDurable = input.readBoolean();
    return DefaultLink.builder()
            .providerId(providerId)
            .src(src)
            .dst(dst)
            .type(linkType)
            .state(state)
            .isExpected(isDurable)
            .build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:DefaultLinkSerializer.java


示例11: getBaseProviderId

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * @return primary ProviderID, or randomly chosen one if none exists
 */
// Guarded by linkDescs value (=locking each Link)
private ProviderId getBaseProviderId(Map<ProviderId, LinkDescription> providerDescs) {

    ProviderId fallBackPrimary = null;
    for (Entry<ProviderId, LinkDescription> e : providerDescs.entrySet()) {
        if (!e.getKey().isAncillary()) {
            return e.getKey();
        } else if (fallBackPrimary == null) {
            // pick randomly as a fallback in case there is no primary
            fallBackPrimary = e.getKey();
        }
    }
    return fallBackPrimary;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:SimpleLinkStore.java


示例12: getPrimaryProviderId

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * Returns the identifier for all providers for a device.
 * @param deviceId device identifier
 * @return set of provider identifiers
 */
private ProviderId getPrimaryProviderId(DeviceId deviceId) {
    Set<ProviderId> allProviderIds = getAllProviders(deviceId);
    return allProviderIds.stream()
                         .filter(p -> !p.isAncillary())
                         .findFirst()
                         .orElse(Iterables.getFirst(allProviderIds, null));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:ECDeviceStore.java


示例13: InternalDeviceEvent

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
protected InternalDeviceEvent(
        ProviderId providerId,
        DeviceId deviceId,
        Timestamped<DeviceDescription> deviceDescription) {
    this.providerId = providerId;
    this.deviceId = deviceId;
    this.deviceDescription = deviceDescription;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:InternalDeviceEvent.java


示例14: composeDevice

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * Returns a Device, merging description given from multiple Providers.
 *
 * @param deviceId      device identifier
 * @param providerDescs Collection of Descriptions from multiple providers
 * @return Device instance
 */
private Device composeDevice(DeviceId deviceId,
                             Map<ProviderId, DeviceDescriptions> providerDescs) {

    checkArgument(!providerDescs.isEmpty(), "No Device descriptions supplied");

    ProviderId primary = pickPrimaryPid(providerDescs);

    DeviceDescriptions desc = providerDescs.get(primary);

    final DeviceDescription base = desc.getDeviceDesc();
    Type type = base.type();
    String manufacturer = base.manufacturer();
    String hwVersion = base.hwVersion();
    String swVersion = base.swVersion();
    String serialNumber = base.serialNumber();
    ChassisId chassisId = base.chassisId();
    DefaultAnnotations annotations = DefaultAnnotations.builder().build();
    annotations = merge(annotations, base.annotations());

    for (Entry<ProviderId, DeviceDescriptions> e : providerDescs.entrySet()) {
        if (e.getKey().equals(primary)) {
            continue;
        }
        // TODO: should keep track of Description timestamp
        // and only merge conflicting keys when timestamp is newer
        // Currently assuming there will never be a key conflict between
        // providers

        // annotation merging. not so efficient, should revisit later
        annotations = merge(annotations, e.getValue().getDeviceDesc().annotations());
    }

    return new DefaultDevice(primary, deviceId, type, manufacturer,
                             hwVersion, swVersion, serialNumber,
                             chassisId, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:SimpleDeviceStore.java


示例15: createHost

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
private Host createHost(MacAddress macAddress, ConnectPoint location) {
    return new DefaultHost(
            new ProviderId("host", "org.onosproject.segmentrouting"),
            HostId.hostId(macAddress),
            macAddress,
            VlanId.NONE,
            new HostLocation(location, System.currentTimeMillis()),
            ImmutableSet.of());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CordConfigHandler.java


示例16: pickPrimaryPid

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
/**
 * @return primary ProviderID, or randomly chosen one if none exists
 */
private ProviderId pickPrimaryPid(Map<ProviderId, DeviceDescriptions> descsMap) {
    ProviderId fallBackPrimary = null;
    for (Entry<ProviderId, DeviceDescriptions> e : descsMap.entrySet()) {
        if (!e.getKey().isAncillary()) {
            return e.getKey();
        } else if (fallBackPrimary == null) {
            // pick randomly as a fallback in case there is no primary
            fallBackPrimary = e.getKey();
        }
    }
    return fallBackPrimary;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:SimpleDeviceStore.java


示例17: createOrUpdateDevice

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public DeviceEvent createOrUpdateDevice(ProviderId providerId,
                                        DeviceId deviceId,
                                        DeviceDescription deviceDescription) {
    Map<ProviderId, DeviceDescriptions> providerDescs
            = getOrCreateDeviceDescriptions(deviceId);

    synchronized (providerDescs) {
        // locking per device
        DeviceDescriptions descs
                = getOrCreateProviderDeviceDescriptions(providerDescs,
                                                        providerId,
                                                        deviceDescription);

        Device oldDevice = devices.get(deviceId);
        // update description
        descs.putDeviceDesc(deviceDescription);
        Device newDevice = composeDevice(deviceId, providerDescs);

        if (oldDevice == null) {
            // ADD
            return createDevice(providerId, newDevice);
        } else {
            // UPDATE or ignore (no change or stale)
            return updateDevice(providerId, oldDevice, newDevice);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:SimpleDeviceStore.java


示例18: updatePortStatus

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public DeviceEvent updatePortStatus(ProviderId providerId,
        DeviceId deviceId,
        PortDescription portDescription) {
    portDescriptions.put(new PortKey(providerId, deviceId, portDescription.portNumber()), portDescription);
    List<DeviceEvent> events =
            refreshDevicePortCache(providerId, deviceId, Optional.of(portDescription.portNumber()));
    return Iterables.getFirst(events, null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:ECDeviceStore.java


示例19: tunnelAdded

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public TunnelId tunnelAdded(TunnelDescription tunnel, State state) {
    TunnelId id = TunnelId.valueOf(String.valueOf(++tunnelIdCounter));
    Tunnel storedTunnel = new DefaultTunnel(ProviderId.NONE,
            tunnel.src(), tunnel.dst(),
            tunnel.type(),
            tunnel.groupId(),
            id,
            tunnel.tunnelName(),
            tunnel.path(),
            tunnel.resource(),
            tunnel.annotations());
    tunnelService.tunnelIdAsKeyStore.put(id, storedTunnel);
    return id;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:PcepTunnelAddedTest.java


示例20: deviceConnected

import org.onosproject.net.provider.ProviderId; //导入依赖的package包/类
@Override
public void deviceConnected(DeviceId deviceId, DeviceDescription deviceDescription) {
    connected.add(deviceId);
    Device device = new DefaultDevice(ProviderId.NONE, deviceId, Device.Type.ROUTER, UNKNOWN, UNKNOWN,
            UNKNOWN, UNKNOWN, new ChassisId(), deviceDescription.annotations());
    deviceMap.put(deviceId, device);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:PcepTopologyProviderTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IsolatedContext类代码示例发布时间:2022-05-22
下一篇:
Java BasicColumnFamilyDefinition类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap