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


Java Meter.Builder方法代码示例

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


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

示例1: submit

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public Meter submit(MeterRequest request) {

    MeterId id = allocateMeterId(request.deviceId());

    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(request.deviceId())
            .fromApp(request.appId())
            .withBands(request.bands())
            .withId(id)
            .withUnit(request.unit());

    if (request.isBurst()) {
        mBuilder.burst();
    }
    DefaultMeter m = (DefaultMeter) mBuilder.build();
    m.setState(MeterState.PENDING_ADD);
    store.storeMeter(m).whenComplete((result, error) ->
                                             onComplete.accept(request, result, error));
    return m;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:MeterManager.java

示例2: withdraw

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public void withdraw(MeterRequest request, MeterId meterId) {
    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(request.deviceId())
            .fromApp(request.appId())
            .withBands(request.bands())
            .withId(meterId)
            .withUnit(request.unit());

    if (request.isBurst()) {
        mBuilder.burst();
    }

    DefaultMeter m = (DefaultMeter) mBuilder.build();
    m.setState(MeterState.PENDING_REMOVE);
    store.deleteMeter(m).whenComplete((result, error) ->
                                              onComplete.accept(request, result, error));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:MeterManager.java

示例3: testPerformMeterOperationDeviceIdMeterRemove

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Test
public void testPerformMeterOperationDeviceIdMeterRemove() {
    DeviceId mockDeviceId = DeviceId.deviceId("netconf:1.2.3.4:830");

    Band cbsBand = DefaultBand.builder()
            .ofType(Band.Type.REMARK) //Committed - CIR & CBS
            .withRate(37500L)
            .burstSize(2000)
            .dropPrecedence((short) 0)
            .build();

    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(mockDeviceId)
            .withId(MeterId.meterId(1))
            .fromApp(new DefaultApplicationId(101, "unit.test"))
            .burst()
            .withBands(new HashSet<Band>() { { add(cbsBand); } });

    MeterOperation meterOp = new MeterOperation(mBuilder.build(), Type.REMOVE);

    meterProvider.performMeterOperation(mockDeviceId, meterOp);
    //The NETCONF XML generated by this matches the pattern
    // sampleXmlRegexEditConfigBwpGroup1
    // in MockNetconfSession
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:EA1000MeterProviderTest.java

示例4: submit

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public Meter submit(MeterRequest request) {

    MeterId id = allocateMeterId(request.deviceId());

    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(request.deviceId())
            .fromApp(request.appId())
            .withBands(request.bands())
            .withId(id)
            .withUnit(request.unit());

    if (request.isBurst()) {
        mBuilder.burst();
    }
    DefaultMeter m = (DefaultMeter) mBuilder.build();
    m.setState(MeterState.PENDING_ADD);
    store.storeMeter(networkId(), m).whenComplete((result, error) ->
                                             onComplete.accept(request, result, error));
    return m;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:VirtualNetworkMeterManager.java

示例5: withdraw

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public void withdraw(MeterRequest request, MeterId meterId) {
    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(request.deviceId())
            .fromApp(request.appId())
            .withBands(request.bands())
            .withId(meterId)
            .withUnit(request.unit());

    if (request.isBurst()) {
        mBuilder.burst();
    }

    DefaultMeter m = (DefaultMeter) mBuilder.build();
    m.setState(MeterState.PENDING_REMOVE);
    store.deleteMeter(networkId(), m).whenComplete((result, error) ->
                                              onComplete.accept(request, result, error));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:VirtualNetworkMeterManager.java

示例6: testPerformMeterOperationDeviceIdMeterAdd

import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Test
public void testPerformMeterOperationDeviceIdMeterAdd() {
    DeviceId mockDeviceId = DeviceId.deviceId("netconf:1.2.3.4:830");

    Band cbsBand = DefaultBand.builder()
            .ofType(Band.Type.REMARK) //Committed - CIR & CBS
            .withRate(37500L)
            .burstSize(2000)
            .dropPrecedence((short) 0)
            .build();

    Band ebsBand = DefaultBand.builder()
            .ofType(Band.Type.DROP) //Excess - EIR & EBS
            .withRate(50000L) //The rate at which we drop - for EA 1000 subtract CIR to get EIR
            .burstSize(3000) //The burst rate to drop at
            .build();

    Meter.Builder mBuilder = DefaultMeter.builder()
            .forDevice(mockDeviceId)
            .withId(MeterId.meterId(1))
            .fromApp(new DefaultApplicationId(101, "unit.test"))
            .burst()
            .withUnit(Unit.KB_PER_SEC)
            .withBands(new HashSet<Band>() { { add(cbsBand); add(ebsBand); } });

    MeterOperation meterOp = new MeterOperation(mBuilder.build(), Type.ADD);

    meterProvider.performMeterOperation(mockDeviceId, meterOp);
    //The NETCONF XML generated by this matches the pattern
    // sampleXmlRegexEditConfigBwpGroup1
    // in MockNetconfSession
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:33,代码来源:EA1000MeterProviderTest.java


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