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


Java DefaultTrafficSelector.emptySelector方法代码示例

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


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

示例1: run

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的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

示例2: forwardingObjective

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Tests adding a forwarding objective.
 */
@Test
public void forwardingObjective() {
    TrafficSelector selector = DefaultTrafficSelector.emptySelector();
    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
    ForwardingObjective forward =
            DefaultForwardingObjective.builder()
                    .fromApp(NetTestTools.APP_ID)
                    .withFlag(ForwardingObjective.Flag.SPECIFIC)
                    .withSelector(selector)
                    .withTreatment(treatment)
                    .makePermanent()
                    .add();

    manager.forward(id1, forward);

    TestTools.assertAfter(RETRY_MS, () ->
        assertThat(forwardingObjectives, hasSize(1)));

    assertThat(forwardingObjectives, hasItem("of:d1"));
    assertThat(filteringObjectives, hasSize(0));
    assertThat(nextObjectives, hasSize(0));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:FlowObjectiveManagerTest.java

示例3: deviceUpEvent

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Tests receipt of a device up event.
 *
 * @throws TestUtilsException if lookup of a field fails
 */
@Test
public void deviceUpEvent() throws TestUtilsException {
    TrafficSelector selector = DefaultTrafficSelector.emptySelector();
    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();

    DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, d2);
    DeviceListener listener = TestUtils.getField(manager, "deviceListener");
    assertThat(listener, notNullValue());

    listener.event(event);

    ForwardingObjective forward =
            DefaultForwardingObjective.builder()
                    .fromApp(NetTestTools.APP_ID)
                    .withFlag(ForwardingObjective.Flag.SPECIFIC)
                    .withSelector(selector)
                    .withTreatment(treatment)
                    .makePermanent()
                    .add();
    manager.forward(id2, forward);

    // new device should have an objective now
    TestTools.assertAfter(RETRY_MS, () ->
            assertThat(forwardingObjectives, hasSize(1)));

    assertThat(forwardingObjectives, hasItem("of:d2"));
    assertThat(filteringObjectives, hasSize(0));
    assertThat(nextObjectives, hasSize(0));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:FlowObjectiveManagerTest.java

示例4: deviceMastershipEvent

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Tests recepit of a device mastership event.
 *
 * @throws TestUtilsException if lookup of a field fails
 */
@Test
public void deviceMastershipEvent() throws TestUtilsException {
    TrafficSelector selector = DefaultTrafficSelector.emptySelector();
    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();

    MastershipEvent event =
            new MastershipEvent(MastershipEvent.Type.MASTER_CHANGED, id2, null);
    MastershipListener listener = TestUtils.getField(manager, "mastershipListener");
    assertThat(listener, notNullValue());

    listener.event(event);

    ForwardingObjective forward =
            DefaultForwardingObjective.builder()
                    .fromApp(NetTestTools.APP_ID)
                    .withFlag(ForwardingObjective.Flag.SPECIFIC)
                    .withSelector(selector)
                    .withTreatment(treatment)
                    .makePermanent()
                    .add();
    manager.forward(id2, forward);

    // new device should have an objective now
    TestTools.assertAfter(RETRY_MS, () ->
            assertThat(forwardingObjectives, hasSize(1)));

    assertThat(forwardingObjectives, hasItem("of:d2"));
    assertThat(filteringObjectives, hasSize(0));
    assertThat(nextObjectives, hasSize(0));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:FlowObjectiveManagerTest.java

示例5: pendingForwardingObjective

import org.onosproject.net.flow.DefaultTrafficSelector; //导入方法依赖的package包/类
/**
 * Tests adding a pending forwarding objective.
 *
 * @throws TestUtilsException if lookup of a field fails
 */
@Test
public void pendingForwardingObjective() throws TestUtilsException {
    TrafficSelector selector = DefaultTrafficSelector.emptySelector();
    TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();

    ForwardingObjective forward4 =
            DefaultForwardingObjective.builder()
                    .fromApp(NetTestTools.APP_ID)
                    .withFlag(ForwardingObjective.Flag.SPECIFIC)
                    .withSelector(selector)
                    .withTreatment(treatment)
                    .makePermanent()
                    .nextStep(4)
                    .add();
    ForwardingObjective forward5 =
            DefaultForwardingObjective.builder()
                    .fromApp(NetTestTools.APP_ID)
                    .withFlag(ForwardingObjective.Flag.SPECIFIC)
                    .withSelector(selector)
                    .withTreatment(treatment)
                    .makePermanent()
                    .nextStep(5)
                    .add();

    //  multiple pending forwards should be combined
    manager.forward(id1, forward4);
    manager.forward(id1, forward4);
    manager.forward(id1, forward5);


    //  1 should be complete, 1 pending
    TestTools.assertAfter(RETRY_MS, () ->
            assertThat(forwardingObjectives, hasSize(1)));

    assertThat(forwardingObjectives, hasItem("of:d1"));
    assertThat(filteringObjectives, hasSize(0));
    assertThat(nextObjectives, hasSize(0));

    // Now send events to trigger the objective still in the queue
    ObjectiveEvent event1 = new ObjectiveEvent(ObjectiveEvent.Type.ADD, 4);
    FlowObjectiveStoreDelegate delegate = TestUtils.getField(manager, "delegate");
    delegate.notify(event1);

    // all should be processed now
    TestTools.assertAfter(RETRY_MS, () ->
            assertThat(forwardingObjectives, hasSize(2)));
    assertThat(forwardingObjectives, hasItem("of:d1"));
    assertThat(filteringObjectives, hasSize(0));
    assertThat(nextObjectives, hasSize(0));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:56,代码来源:FlowObjectiveManagerTest.java


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