本文整理汇总了Java中org.onosproject.core.CoreService类的典型用法代码示例。如果您正苦于以下问题:Java CoreService类的具体用法?Java CoreService怎么用?Java CoreService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CoreService类属于org.onosproject.core包,在下文中一共展示了CoreService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getIntentById
import org.onosproject.core.CoreService; //导入依赖的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: setUpTest
import org.onosproject.core.CoreService; //导入依赖的package包/类
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpTest() {
expect(mockIntentService.getIntents()).andReturn(intents).anyTimes();
expect(mockIntentService.getIntentState(anyObject()))
.andReturn(IntentState.INSTALLED)
.anyTimes();
// Register the services needed for the test
final CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory =
new TestServiceDirectory()
.add(IntentService.class, mockIntentService)
.add(CodecService.class, codecService)
.add(CoreService.class, mockCoreService);
BaseResource.setServiceDirectory(testDirectory);
bindNewGenerator();
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:IntentsResourceTest.java
示例3: setUpTest
import org.onosproject.core.CoreService; //导入依赖的package包/类
/**
* Sets up the global values for all the tests.
*/
@Before
public void setUpTest() {
// Mock Core Service
expect(mockCoreService.getAppId(anyShort()))
.andReturn(NetTestTools.APP_ID).anyTimes();
expect(mockCoreService.registerApplication(REST_APP_ID))
.andReturn(APP_ID).anyTimes();
replay(mockCoreService);
// Register the services needed for the test
final CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory =
new TestServiceDirectory()
.add(FlowObjectiveService.class, mockFlowObjectiveService)
.add(CodecService.class, codecService)
.add(CoreService.class, mockCoreService);
BaseResource.setServiceDirectory(testDirectory);
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:FlowObjectiveResourceTest.java
示例4: init
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
super.init(connection, directory);
this.directory = checkNotNull(directory, "Directory cannot be null");
clusterService = directory.get(ClusterService.class);
deviceService = directory.get(DeviceService.class);
linkService = directory.get(LinkService.class);
hostService = directory.get(HostService.class);
mastershipService = directory.get(MastershipService.class);
intentService = directory.get(IntentService.class);
flowService = directory.get(FlowRuleService.class);
flowStatsService = directory.get(StatisticService.class);
portStatsService = directory.get(PortStatisticsService.class);
topologyService = directory.get(TopologyService.class);
tunnelService = directory.get(TunnelService.class);
servicesBundle = new ServicesBundle(intentService, deviceService,
hostService, linkService,
flowService,
flowStatsService, portStatsService);
String ver = directory.get(CoreService.class).version().toString();
version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", "");
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:TopologyViewMessageHandlerBase.java
示例5: init
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
public void init(DeviceId deviceId, PipelinerContext context) {
this.deviceId = deviceId;
// Initialize OFDPA group handler
groupHandler = new CpqdOfdpa2GroupHandler();
groupHandler.init(deviceId, context);
serviceDirectory = context.directory();
coreService = serviceDirectory.get(CoreService.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
groupService = serviceDirectory.get(GroupService.class);
flowObjectiveStore = context.store();
deviceService = serviceDirectory.get(DeviceService.class);
driverId = coreService.registerApplication(
"org.onosproject.driver.CpqdOfdpa2Pipeline");
initializePipeline();
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:CpqdOfdpa2Pipeline.java
示例6: init
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
public void init(DeviceId deviceId, PipelinerContext context) {
this.deviceId = deviceId;
// Initialize OFDPA group handler
groupHandler = new Ofdpa2GroupHandler();
groupHandler.init(deviceId, context);
serviceDirectory = context.directory();
coreService = serviceDirectory.get(CoreService.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
groupService = serviceDirectory.get(GroupService.class);
flowObjectiveStore = context.store();
deviceService = serviceDirectory.get(DeviceService.class);
driverId = coreService.registerApplication(
"org.onosproject.driver.Ofdpa2Pipeline");
initializePipeline();
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:Ofdpa2Pipeline.java
示例7: init
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
public void init(DeviceId deviceId, PipelinerContext context) {
this.serviceDirectory = context.directory();
this.deviceId = deviceId;
coreService = serviceDirectory.get(CoreService.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
flowObjectiveStore = context.store();
filters = Collections.newSetFromMap(new ConcurrentHashMap<Filter, Boolean>());
pendingVersatiles = Collections.newSetFromMap(
new ConcurrentHashMap<ForwardingObjective, Boolean>());
appId = coreService.registerApplication(
"org.onosproject.driver.OVSPicaPipeline");
initializePipeline();
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:PicaPipeline.java
示例8: init
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
public void init(DeviceId deviceId, PipelinerContext context) {
this.deviceId = deviceId;
// Initialize OFDPA group handler
groupHandler = new CpqdOfdpa2GroupHandler();
groupHandler.init(deviceId, context);
serviceDirectory = context.directory();
coreService = serviceDirectory.get(CoreService.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
groupService = serviceDirectory.get(GroupService.class);
flowObjectiveStore = context.store();
deviceService = serviceDirectory.get(DeviceService.class);
driverId = coreService.registerApplication(
"org.onosproject.driver.CpqdOfdpa2VlanPipeline");
initializePipeline();
}
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:CpqdOfdpa2VlanPipeline.java
示例9: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Before
public void setUp() {
coreService = createMock(CoreService.class);
expect(coreService.registerApplication(appId.name()))
.andReturn(appId).anyTimes();
replay(coreService);
provider.cfgService = new ComponentConfigAdapter();
provider.coreService = coreService;
provider.providerRegistry = hostRegistry;
provider.topologyService = topoService;
provider.packetService = packetService;
provider.deviceService = deviceService;
provider.hostService = hostService;
provider.activate(CTX_FOR_NO_REMOVE);
provider.eventHandler = MoreExecutors.newDirectExecutorService();
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:HostLocationProviderTest.java
示例10: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
/**
* Initialize test related variables.
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
InputStream jsonStream = McastConfigTest.class
.getResourceAsStream("/mcast-config.json");
InputStream invalidJsonStream = McastConfigTest.class
.getResourceAsStream("/mcast-config-invalid.json");
ApplicationId subject = APP_ID;
String key = CoreService.CORE_APP_NAME;
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config = new McastConfig();
config.init(subject, key, jsonNode, mapper, delegate);
invalidConfig = new McastConfig();
invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:McastConfigTest.java
示例11: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Before
public void setUp() {
provider = new PtToPtIntentVirtualNetworkProvider();
provider.providerRegistry = virtualNetworkRegistry;
final CoreService mockCoreService = createMock(CoreService.class);
provider.coreService = mockCoreService;
expect(mockCoreService.registerApplication(PtToPtIntentVirtualNetworkProvider.PTPT_INTENT_APPID))
.andReturn(APP_ID).anyTimes();
replay(mockCoreService);
Intent.unbindIdGenerator(idGenerator);
Intent.bindIdGenerator(idGenerator);
intentService.addListener(listener);
provider.intentService = intentService;
// Register a compiler and an installer both setup for success.
intentExtensionService = intentService;
intentExtensionService.registerCompiler(PointToPointIntent.class, compiler);
provider.activate();
created = new Semaphore(0, true);
removed = new Semaphore(0, true);
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PtToPtIntentVirtualNetworkProviderTest.java
示例12: execute
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
protected void execute() {
DeviceService deviceService = get(DeviceService.class);
CoreService coreService = get(CoreService.class);
FlowRuleService flowRuleService = get(FlowRuleService.class);
ApplicationId appId = coreService.registerApplication("eval.add.dummy");
Iterable<Device> devices = deviceService.getDevices();
for (Device d : devices) {
for (FlowEntry r : flowRuleService.getFlowEntries(d.id())) {
if (r.appId() == appId.id()) {
flowRuleService.removeFlowRules((FlowRule) r);
}
}
}
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:RemoveDummyFlowsCommand.java
示例13: execute
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
protected void execute() {
CoreService coreService = get(CoreService.class);
DeviceService deviceService = get(DeviceService.class);
FlowRuleService service = get(FlowRuleService.class);
compilePredicate();
SortedMap<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service, coreService);
if (outputJson()) {
print("%s", json(flows.keySet(), flows));
} else {
flows.forEach((device, flow) -> printFlows(device, flow, coreService));
}
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:FlowsListCommand.java
示例14: printFlows
import org.onosproject.core.CoreService; //导入依赖的package包/类
/**
* Prints flows.
*
* @param d the device
* @param flows the set of flows for that device
* @param coreService core system service
*/
protected void printFlows(Device d, List<FlowEntry> flows,
CoreService coreService) {
boolean empty = flows == null || flows.isEmpty();
print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size());
if (empty || countOnly) {
return;
}
for (FlowEntry f : flows) {
if (shortOutput) {
print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(),
f.tableId(), f.priority(), f.selector().criteria(),
printTreatment(f.treatment()));
} else {
ApplicationId appId = coreService.getAppId(f.appId());
print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(),
f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(),
appId != null ? appId.name() : "<none>",
f.payLoad() == null ? null : f.payLoad().payLoad().toString(),
f.selector().criteria(), f.treatment());
}
}
}
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:FlowsListCommand.java
示例15: execute
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Override
protected void execute() {
MeterService service = get(MeterService.class);
CoreService coreService = get(CoreService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
Band band = DefaultBand.builder()
.ofType(Band.Type.DROP)
.withRate(500)
.build();
MeterRequest request = DefaultMeterRequest.builder()
.forDevice(deviceId)
.fromApp(coreService.registerApplication(appId))
.withUnit(Meter.Unit.KB_PER_SEC)
.withBands(Collections.singleton(band))
.add();
service.submit(request);
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:AddMeter.java
示例16: activate
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Activate
protected void activate(ComponentContext context) {
componentConfigService.registerProperties(getClass());
modified(context);
coreAppId = coreService.registerApplication(CoreService.CORE_APP_NAME);
routerAppId = coreService.registerApplication(RoutingService.ROUTER_APP_ID);
networkConfigRegistry.registerConfigFactory(mcastConfigFactory);
networkConfigService.addListener(configListener);
deviceService.addListener(deviceListener);
interfaceService.addListener(internalInterfaceList);
updateConfig();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:SingleSwitchFibInstaller.java
示例17: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
hostService = createMock(HostService.class);
routingConfigurationService =
createMock(RoutingConfigurationService.class);
RouteSourceService routeSourceService = createMock(RouteSourceService.class);
routeSourceService.start(anyObject(RouteListener.class));
routeSourceService.stop();
replay(routeSourceService);
fibListener = createMock(FibListener.class);
router = new DefaultRouter();
router.coreService = createNiceMock(CoreService.class);
router.hostService = hostService;
router.routingConfigurationService = routingConfigurationService;
router.routeSourceService = routeSourceService;
router.activate();
router.addFibListener(fibListener);
router.start();
internalHostListener = router.new InternalHostListener();
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:RouterAsyncArpTest.java
示例18: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
setUpHostService();
routingConfigurationService =
createMock(RoutingConfigurationService.class);
RouteSourceService routeSourceService = createMock(RouteSourceService.class);
routeSourceService.start(anyObject(RouteListener.class));
routeSourceService.stop();
replay(routeSourceService);
fibListener = createMock(FibListener.class);
router = new DefaultRouter();
router.coreService = createNiceMock(CoreService.class);
router.hostService = hostService;
router.routingConfigurationService = routingConfigurationService;
router.routeSourceService = routeSourceService;
router.activate();
router.addFibListener(fibListener);
router.start();
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:RouterTest.java
示例19: McastHandler
import org.onosproject.core.CoreService; //导入依赖的package包/类
/**
* Constructs the McastEventHandler.
*
* @param srManager Segment Routing manager
*/
public McastHandler(SegmentRoutingManager srManager) {
coreAppId = srManager.coreService.getAppId(CoreService.CORE_APP_NAME);
this.srManager = srManager;
this.storageService = srManager.storageService;
this.topologyService = srManager.topologyService;
mcastKryo = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(McastStoreKey.class)
.register(McastRole.class);
mcastNextObjStore = storageService
.<McastStoreKey, NextObjective>consistentMapBuilder()
.withName("onos-mcast-nextobj-store")
.withSerializer(Serializer.using(mcastKryo.build("McastHandler-NextObj")))
.build();
mcastRoleStore = storageService
.<McastStoreKey, McastRole>consistentMapBuilder()
.withName("onos-mcast-role-store")
.withSerializer(Serializer.using(mcastKryo.build("McastHandler-Role")))
.build();
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:McastHandler.java
示例20: setUp
import org.onosproject.core.CoreService; //导入依赖的package包/类
@Before
public void setUp() {
sut = new OpticalPathIntentCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent"))
.andReturn(appId);
sut.coreService = coreService;
Intent.bindIdGenerator(idGenerator);
intent = OpticalPathIntent.builder()
.appId(appId)
.src(d1p1)
.dst(d3p1)
.path(new DefaultPath(PID, links, hops))
.lambda(createLambda())
.signalType(OchSignalType.FIXED_GRID)
.build();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(OpticalPathIntent.class, sut);
intentExtensionService.unregisterCompiler(OpticalPathIntent.class);
sut.intentManager = intentExtensionService;
replay(coreService, intentExtensionService);
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:OpticalPathIntentCompilerTest.java
注:本文中的org.onosproject.core.CoreService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论