當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。