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

Java HostToHostIntent类代码示例

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

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



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

示例1: getIntentById

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
/**
 * Gets intent by application and key.
 * Returns details of the specified intent.
 *
 * @param appId application identifier
 * @param key   intent key
 * @return 200 OK with intent data
 * @onos.rsModel Intents
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{appId}/{key}")
public Response getIntentById(@PathParam("appId") String appId,
                              @PathParam("key") String key) {
    final ApplicationId app = get(CoreService.class).getAppId(appId);

    Intent intent = get(IntentService.class).getIntent(Key.of(key, app));
    if (intent == null) {
        long numericalKey = Long.decode(key);
        intent = get(IntentService.class).getIntent(Key.of(numericalKey, app));
    }
    nullIsNotFound(intent, INTENT_NOT_FOUND);

    final ObjectNode root;
    if (intent instanceof HostToHostIntent) {
        root = codec(HostToHostIntent.class).encode((HostToHostIntent) intent, this);
    } else if (intent instanceof PointToPointIntent) {
        root = codec(PointToPointIntent.class).encode((PointToPointIntent) intent, this);
    } else {
        root = codec(Intent.class).encode(intent, this);
    }
    return ok(root).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:IntentsWebResource.java


示例2: process

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public void process(long sid, ObjectNode payload) {
    // TODO: add protection against device ids and non-existent hosts.
    HostId one = hostId(string(payload, ONE));
    HostId two = hostId(string(payload, TWO));

    HostToHostIntent intent = HostToHostIntent.builder()
            .appId(appId)
            .one(one)
            .two(two)
            .build();

    intentService.submit(intent);
    if (overlayCache.isActive(TrafficOverlay.TRAFFIC_ID)) {
        traffic.monitor(intent);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:TopologyViewMessageHandler.java


示例3: generateIntents

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
private Collection<Intent> generateIntents() {
    List<Host> hosts = Lists.newArrayList(hostService.getHosts());
    List<Intent> fullMesh = Lists.newArrayList();
    for (int i = 0; i < hosts.size(); i++) {
        for (int j = i + 1; j < hosts.size(); j++) {
            fullMesh.add(HostToHostIntent.builder()
                    .appId(appId())
                    .one(hosts.get(i).id())
                    .two(hosts.get(j).id())
                    .build());

        }
    }
    Collections.shuffle(fullMesh);
    return fullMesh.subList(0, Math.min(count, fullMesh.size()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:RandomIntentCommand.java


示例4: execute

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
protected void execute() {
    IntentService service = get(IntentService.class);

    HostId oneId = HostId.hostId(one);
    HostId twoId = HostId.hostId(two);

    TrafficSelector selector = buildTrafficSelector();
    TrafficTreatment treatment = buildTrafficTreatment();
    List<Constraint> constraints = buildConstraints();

    HostToHostIntent intent = HostToHostIntent.builder()
            .appId(appId())
            .key(key())
            .one(oneId)
            .two(twoId)
            .selector(selector)
            .treatment(treatment)
            .constraints(constraints)
            .priority(priority())
            .build();
    service.submit(intent);
    print("Host to Host intent submitted:\n%s", intent.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:AddHostToHostIntentCommand.java


示例5: run

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public void run() {
    TrafficSelector selector = DefaultTrafficSelector.emptySelector();
    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
    List<Constraint> constraint = Lists.newArrayList();
    List<Host> hosts = Lists.newArrayList(hostService.getHosts());
    while (!hosts.isEmpty()) {
        Host src = hosts.remove(0);
        for (Host dst : hosts) {
            HostToHostIntent intent = HostToHostIntent.builder()
                    .appId(appId)
                    .one(src.id())
                    .two(dst.id())
                    .selector(selector)
                    .treatment(treatment)
                    .constraints(constraint)
                    .build();
            existingIntents.add(intent);
            intentService.submit(intent);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DemoInstaller.java


示例6: decode

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public Intent decode(ObjectNode json, CodecContext context) {
    checkNotNull(json, "JSON cannot be null");

    String type = nullIsIllegal(json.get(TYPE),
            TYPE + MISSING_MEMBER_MESSAGE).asText();

    if (type.equals(PointToPointIntent.class.getSimpleName())) {
        return context.codec(PointToPointIntent.class).decode(json, context);
    } else if (type.equals(HostToHostIntent.class.getSimpleName())) {
        return context.codec(HostToHostIntent.class).decode(json, context);
    }

    throw new IllegalArgumentException("Intent type "
            + type + " is not supported");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:IntentCodec.java


示例7: decode

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public HostToHostIntent decode(ObjectNode json, CodecContext context) {
    HostToHostIntent.Builder builder = HostToHostIntent.builder();

    IntentCodec.intentAttributes(json, context, builder);
    ConnectivityIntentCodec.intentAttributes(json, context, builder);

    String one = nullIsIllegal(json.get(ONE),
            ONE + IntentCodec.MISSING_MEMBER_MESSAGE).asText();
    builder.one(HostId.hostId(one));

    String two = nullIsIllegal(json.get(TWO),
            TWO + IntentCodec.MISSING_MEMBER_MESSAGE).asText();
    builder.two(HostId.hostId(two));

    return builder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:HostToHostIntentCodec.java


示例8: matchHostToHostIntent

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
/**
 * Matches the JSON representation of a host to host intent.
 *
 * @param jsonIntent JSON representation of the intent
 * @param description Description object used for recording errors
 * @return true if the JSON matches the intent, false otherwise
 */
private boolean matchHostToHostIntent(JsonNode jsonIntent, Description description) {
    final HostToHostIntent hostToHostIntent = (HostToHostIntent) intent;

    // check host one
    final String host1 = hostToHostIntent.one().toString();
    final String jsonHost1 = jsonIntent.get("one").asText();
    if (!host1.equals(jsonHost1)) {
        description.appendText("host one was " + jsonHost1);
        return false;
    }

    // check host 2
    final String host2 = hostToHostIntent.two().toString();
    final String jsonHost2 = jsonIntent.get("two").asText();
    if (!host2.equals(jsonHost2)) {
        description.appendText("host two was " + jsonHost2);
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:IntentJsonMatcher.java


示例9: hostToHostIntent

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
/**
 * Tests the encoding of a host to host intent.
 */
@Test
public void hostToHostIntent() {
    final HostToHostIntent intent =
            HostToHostIntent.builder()
                    .appId(appId)
                    .one(id1)
                    .two(id2)
                    .build();

    final JsonCodec<HostToHostIntent> intentCodec =
            context.codec(HostToHostIntent.class);
    assertThat(intentCodec, notNullValue());

    final ObjectNode intentJson = intentCodec.encode(intent, context);
    assertThat(intentJson, matchesIntent(intent));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:IntentCodecTest.java


示例10: getIntentById

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
/**
 * Gets a single intent by Id.
 *
 * @param appId the Application ID
 * @param key the Intent key value to look up
 * @return intent data
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{appId}/{key}")
public Response getIntentById(@PathParam("appId") Short appId,
                              @PathParam("key") String key) {
    final ApplicationId app = get(CoreService.class).getAppId(appId);

    Intent intent = get(IntentService.class).getIntent(Key.of(key, app));
    if (intent == null) {
        intent = get(IntentService.class)
                .getIntent(Key.of(Long.parseLong(key), app));
    }
    nullIsNotFound(intent, INTENT_NOT_FOUND);

    final ObjectNode root;
    if (intent instanceof HostToHostIntent) {
        root = codec(HostToHostIntent.class).encode((HostToHostIntent) intent, this);
    } else if (intent instanceof PointToPointIntent) {
        root = codec(PointToPointIntent.class).encode((PointToPointIntent) intent, this);
    } else {
        root = codec(Intent.class).encode(intent, this);
    }
    return ok(root).build();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:32,代码来源:IntentsWebResource.java


示例11: createHostIntent

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
private void createHostIntent(ObjectNode event) {
    ObjectNode payload = payload(event);
    long id = number(event, "sid");
    // TODO: add protection against device ids and non-existent hosts.
    HostId one = hostId(string(payload, "one"));
    HostId two = hostId(string(payload, "two"));

    HostToHostIntent intent =
            HostToHostIntent.builder()
                    .appId(appId)
                    .one(one)
                    .two(two)
                    .build();


    intentService.submit(intent);
    startMonitoringIntent(event, intent);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:TopologyViewWebSocket.java


示例12: createHostIntent

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
private void createHostIntent(ObjectNode event) {
    ObjectNode payload = payload(event);
    long id = number(event, "sid");
    // TODO: add protection against device ids and non-existent hosts.
    HostId one = hostId(string(payload, "one"));
    HostId two = hostId(string(payload, "two"));

    HostToHostIntent intent =
            HostToHostIntent.builder()
                    .appId(appId)
                    .one(one)
                    .two(two)
                    .build();

    intentService.submit(intent);
    startMonitoringIntent(event, intent);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:TopologyViewMessageHandler.java


示例13: execute

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
protected void execute() {
    IntentService service = get(IntentService.class);

    HostId oneId = HostId.hostId(one);
    HostId twoId = HostId.hostId(two);

    List<Constraint> constraints = buildConstraints();

    HostToHostIntent intent = HostToHostIntent.builder()
            .appId(appId())
            .key(key())
            .one(oneId)
            .two(twoId)
            .constraints(constraints)
            .priority(priority())
            .build();
    service.submit(intent);
    print("Host to Host intent submitted:\n%s", intent.toString());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:21,代码来源:AddHostToHostIntentCommand.java


示例14: testMatches

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Test
public void testMatches() {
    Intent intent = HostToHostIntent.builder()
            .key(manager.generateKey(NETWORK, HOST_1, HOST_2))
            .appId(manager.appId)
            .one(HOST_1)
            .two(HOST_2)
            .build();

    assertTrue(manager.matches(NETWORK, Optional.of(HOST_1), intent));
    assertTrue(manager.matches(NETWORK, Optional.of(HOST_2), intent));
    assertTrue(manager.matches(NETWORK, Optional.empty(), intent));

    assertFalse(manager.matches(NETWORK, Optional.of(HOST_3), intent));
    assertFalse(manager.matches(NETWORK_2, Optional.of(HOST_1), intent));
    assertFalse(manager.matches(NETWORK_2, Optional.of(HOST_3), intent));
}
 
开发者ID:bocon13,项目名称:onos-byon,代码行数:18,代码来源:NetworkManagerTest.java


示例15: process

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public void process(ObjectNode payload) {
    // TODO: add protection against device ids and non-existent hosts.
    HostId one = hostId(string(payload, ONE));
    HostId two = hostId(string(payload, TWO));

    HostToHostIntent intent = HostToHostIntent.builder()
            .appId(appId)
            .one(one)
            .two(two)
            .build();

    services.intent().submit(intent);
    if (overlayCache.isActive(TrafficOverlay.TRAFFIC_ID)) {
        traffic.monitor(intent);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:TopologyViewMessageHandler.java


示例16: execute

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
protected void execute() {
    IntentService service = get(IntentService.class);

    HostId oneId = HostId.hostId(one);
    HostId twoId = HostId.hostId(two);

    TrafficSelector selector = buildTrafficSelector();
    TrafficTreatment treatment = buildTrafficTreatment();
    List<Constraint> constraints = buildConstraints();

    HostToHostIntent intent = HostToHostIntent.builder()
            .appId(appId())
            .key(key())
            .one(oneId)
            .two(twoId)
            .selector(selector)
            .treatment(treatment)
            .constraints(constraints)
            .priority(priority())
            .resourceGroup(resourceGroup())
            .build();
    service.submit(intent);
    print("Host to Host intent submitted:\n%s", intent.toString());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:AddHostToHostIntentCommand.java


示例17: decode

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
public Intent decode(ObjectNode json, CodecContext context) {
    checkNotNull(json, "JSON cannot be null");

    String type = nullIsIllegal(json.get(TYPE),
            TYPE + MISSING_MEMBER_MESSAGE).asText();

    if (type.equals(PointToPointIntent.class.getSimpleName())) {
        return context.codec(PointToPointIntent.class).decode(json, context);
    } else if (type.equals(HostToHostIntent.class.getSimpleName())) {
        return context.codec(HostToHostIntent.class).decode(json, context);
    } else if (type.equals(SinglePointToMultiPointIntent.class.getSimpleName())) {
        return context.codec(SinglePointToMultiPointIntent.class).decode(json, context);
    } else if (type.equals(MultiPointToSinglePointIntent.class.getSimpleName())) {
        return context.codec(MultiPointToSinglePointIntent.class).decode(json, context);
    }

    throw new IllegalArgumentException("Intent type "
            + type + " is not supported");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:21,代码来源:IntentCodec.java


示例18: setUp

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
@Override
@Before
public void setUp() {
    intentStore = new GossipIntentStore();
    intentStore.storageService = new TestStorageService();
    intentStore.partitionService = new WorkPartitionServiceAdapter();
    intentStore.clusterService = new ClusterServiceAdapter();
    super.setUp();
    builder1 = HostToHostIntent
                    .builder()
                    .one(hid("12:34:56:78:91:ab/1"))
                    .two(hid("12:34:56:78:91:ac/1"))
                    .appId(APP_ID);
    intentStore.configService = new MockComponentConfigService();
    intentStore.activate(null);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:GossipIntentStoreTest.java


示例19: formatDetails

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
private StringBuilder formatDetails(Intent intent, StringBuilder sb) {
    if (intent instanceof ConnectivityIntent) {
        buildConnectivityDetails((ConnectivityIntent) intent, sb);
    }

    if (intent instanceof HostToHostIntent) {
        buildHostToHostDetails((HostToHostIntent) intent, sb);

    } else if (intent instanceof PointToPointIntent) {
        buildPointToPointDetails((PointToPointIntent) intent, sb);

    } else if (intent instanceof MultiPointToSinglePointIntent) {
        buildMPToSPDetails((MultiPointToSinglePointIntent) intent, sb);

    } else if (intent instanceof SinglePointToMultiPointIntent) {
        buildSPToMPDetails((SinglePointToMultiPointIntent) intent, sb);

    } else if (intent instanceof PathIntent) {
        buildPathDetails((PathIntent) intent, sb);

    } else if (intent instanceof LinkCollectionIntent) {
        buildLinkConnectionDetails((LinkCollectionIntent) intent, sb);
    }

    if (sb.length() == 0) {
        sb.append("(No details for this intent)");
    } else {
        sb.insert(0, "Details: ");
    }
    return sb;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:IntentViewMessageHandler.java


示例20: buildHostToHostDetails

import org.onosproject.net.intent.HostToHostIntent; //导入依赖的package包/类
private void buildHostToHostDetails(HostToHostIntent intent,
                                    StringBuilder sb) {
    sb.append(" Host 1: ")
            .append(intent.one())
            .append(", Host 2: ")
            .append(intent.two());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:IntentViewMessageHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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