本文整理汇总了Java中org.onosproject.net.key.DeviceKeyAdminService类的典型用法代码示例。如果您正苦于以下问题:Java DeviceKeyAdminService类的具体用法?Java DeviceKeyAdminService怎么用?Java DeviceKeyAdminService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeviceKeyAdminService类属于org.onosproject.net.key包,在下文中一共展示了DeviceKeyAdminService类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDeviceKey
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
/**
* Adds a new device key from the JSON input stream.
*
* @param stream device key JSON stream
* @return status of the request - CREATED if the JSON is correct,
* BAD_REQUEST if the JSON is invalid
* @onos.rsModel Devicekey
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addDeviceKey(InputStream stream) {
try {
DeviceKeyAdminService service = get(DeviceKeyAdminService.class);
ObjectNode root = (ObjectNode) mapper().readTree(stream);
DeviceKey deviceKey = codec(DeviceKey.class).decode(root, this);
service.addKey(deviceKey);
UriBuilder locationBuilder = uriInfo.getBaseUriBuilder()
.path("keys")
.path(deviceKey.deviceKeyId().id());
return Response
.created(locationBuilder.build())
.build();
} catch (IOException ioe) {
throw new IllegalArgumentException(ioe);
}
}
示例2: setUpMocks
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpMocks() {
expect(mockDeviceKeyService.getDeviceKeys()).andReturn(deviceKeySet).anyTimes();
// Register the services needed for the test
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory =
new TestServiceDirectory()
.add(DeviceKeyService.class, mockDeviceKeyService)
.add(DeviceKeyAdminService.class, mockDeviceKeyAdminService)
.add(CodecService.class, codecService);
BaseResource.setServiceDirectory(testDirectory);
}
示例3: execute
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
@Override
protected void execute() {
DeviceKeyAdminService service = get(DeviceKeyAdminService.class);
DeviceKey deviceKey = null;
if (type.equalsIgnoreCase(COMMUNITY_NAME)) {
deviceKey = DeviceKey.createDeviceKeyUsingCommunityName(DeviceKeyId.deviceKeyId(id),
label, communityName);
} else if (type.equalsIgnoreCase(USERNAME)) {
deviceKey = DeviceKey.createDeviceKeyUsingUsernamePassword(DeviceKeyId.deviceKeyId(id),
label, username, password);
} else {
print("Invalid Device key type: ", type);
return;
}
service.addKey(deviceKey);
print("Device Key successfully added.");
}
示例4: setUpMocks
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
/**
* Initializes test mocks and environment.
*/
@Before
public void setUpMocks() {
expect(mockDeviceKeyService.getDeviceKeys()).andReturn(deviceKeySet).anyTimes();
// Register the services needed for the test
CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory =
new TestServiceDirectory()
.add(DeviceKeyService.class, mockDeviceKeyService)
.add(DeviceKeyAdminService.class, mockDeviceKeyAdminService)
.add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
示例5: removeDeviceKey
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
/**
* Removes a device key by device key identifier.
*
* @param id device key identifier
* @return 200 OK with a removed device key, 404 not found
*/
@DELETE
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response removeDeviceKey(@PathParam("id") String id) {
DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)),
DEVICE_KEY_NOT_FOUND);
get(DeviceKeyAdminService.class).removeKey(DeviceKeyId.deviceKeyId(id));
return ok(codec(DeviceKey.class).encode(deviceKey, this)).build();
}
示例6: execute
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
@Override
protected void execute() {
DeviceKeyAdminService service = get(DeviceKeyAdminService.class);
service.removeKey(DeviceKeyId.deviceKeyId(id));
}
示例7: getAdminDefaultPerms
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
private static List<Permission> getAdminDefaultPerms() {
List<Permission> permSet = Lists.newArrayList();
permSet.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LeadershipAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterMetadataAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DriverAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(HostAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceKeyAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ResourceAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(RegionAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PartitionAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StorageAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ApplicationService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ComponentConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterMetadataService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LeadershipService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(CodecService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(CoreService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(EventDeliveryService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipTermService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(BasicNetworkConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(NetworkConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DriverService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(EdgePortService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowRuleService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowObjectiveService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(GroupService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(HostService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentPartitionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceKeyService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(MulticastRouteService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(MeterService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ResourceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PacketService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ProxyArpService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(RegionService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowStatisticService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StatisticService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PathService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(TopologyService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PersistenceService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(ApiDocService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterCommunicationService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MessagingService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LogicalClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StorageService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(UiExtensionService.class.getName(), ServicePermission.GET));
return permSet;
}
示例8: getAdminDefaultPerms
import org.onosproject.net.key.DeviceKeyAdminService; //导入依赖的package包/类
private static List<Permission> getAdminDefaultPerms() {
List<Permission> permSet = Lists.newArrayList();
permSet.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LeadershipAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterMetadataAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DriverAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(HostAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceKeyAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ResourceAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(RegionAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PartitionAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StorageAdminService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ApplicationService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ComponentConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterMetadataService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LeadershipService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(CodecService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(CoreService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(EventDeliveryService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MastershipTermService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(BasicNetworkConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(NetworkConfigService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DriverService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(EdgePortService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowRuleService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowObjectiveService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(GroupService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(HostService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(WorkPartitionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(DeviceKeyService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(MulticastRouteService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(MeterService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ResourceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PacketService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(RegionService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(FlowStatisticService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StatisticService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PathService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(TopologyService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PersistenceService.class.getName(), ServicePermission.GET));
// permSet.add(new ServicePermission(ApiDocService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(ClusterCommunicationService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(MessagingService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(LogicalClockService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(StorageService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(UiExtensionService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(UpgradeService.class.getName(), ServicePermission.GET));
permSet.add(new ServicePermission(UpgradeAdminService.class.getName(), ServicePermission.GET));
return permSet;
}