Acquiring statistics in ONOS - sdn

I found several ways to get statistics from ONOS, DeviceService, FlowStatisticService, MeterService and StatisticService. But what I want to do is acquiring a statistic of specific one flow traveling many links. Those methods doesn't provide flow-level specific statistics. For example, DeviceService provides port-level statistics. And StatisticService provides list of flow entries which don't contain flow ID. So what I want to do is
I want to get statistic of each flow with flow ID to identify whether it is same flow of other links.
I want to limit bandwidth of those flow
Is there similar provided methods in ONOS? otherwise do I have to develop?

For getting statistic of each flow, you can use the REST API to get statistics for a specific DeviceID and a given FlowID. For example, you can use:
curl -X GET --header 'Accept: application/json'
'http://<controller_ip>:8181/onos/v1/flows/{deviceId}/{flowId}
Replace {deviceId} and {flowId} with your desired Ids.

Related

Can I use a Slack bot to count how many times each user has posted a message in multiple channels without joining those channels?

I want to use the Slack API to aggregate how many times each user in Slack has posted a message in a specific period of time. The conditions are as follows.
Multiple channels are covered
Both public and private channels are covered
So here's what I'd like to ask you;
I've read the official Slack API documentation, and apparently there are no direct API methods suitable for the above kind of aggregation, is that correct?
If the above is correct, I think the only way is to parse the text from the text property, which is the return value of the conversation.history method, and aggregate it, is that correct?
Unfortunately, there is no out-of-the-box method that will enable you to get that exact data. A bot needs to be in a channel if it's going to call conversations.history. You'd need to identify the id of the user[s] and filter through the response payload to get the aggregate number of messages for that user. However, moving forward you can use the Events API with the [messages][2] event type. This way your app will be notified of all messages in a channel in real time.

limiting JSON display values in API GET command

Invoking an API call to my Aspera Shares server to get specific users:
https://myserver/api/v1/data/users/
Displays each user, with 40 lines of values. I'm only interested in 3 lines: "name", "id", and "last_accessed". Is there a way in Postman to display ONLY these values for each user? I tried using a simple Params:
https://myserver/api/v1/data/users?email=*#somecompany.com
https://myserver/api/v1/data/users?id=99
but it does not display select users, just all users. Am I doing something wrong..? or is Aspera super limited with API?
Right,
the IBM Aspera Shares 1.x API is relatively limited:
https://developer.ibm.com/apis/catalog/aspera--aspera-shares-api/User%20Management
You can list all users, or a specific user by id. But all attributes are returned.
This is usually not an issue, as APIs are not meant to be used by humans but rather by software which can subsequently filter on needed attributes.
For example, if you get data by curl you can then filter using jq.
When using POSTMAN you can add a "test script":
https://learning.postman.com/docs/writing-scripts/intro-to-scripts/
If you just want some command line tool, there is:
https://github.com/IBM/aspera-cli

Jira REST API - Why there is specialized API for updating status and assignee fields of issue?

I'm learning Jira REST API.
Table for issue:
I noticed that there are specialized API for updating assignee (PUT /rest/issue/{issueIdOrKey}/assignee) and status (POST /rest/issue/{issueIdOrKey}/transitions) while anoher fields updated by PUT /rest/issue/{issueIdOrKey}.
Could you please explain why this happens the way it described above? May be because for assignee and status fields some validation being performed?
There is no specific 'reason' for it, that's just the way Atlassian have chosen to utilise either PUT versus POST requests to achieve a desired result.
Google "REST API PUT vs POST" for more information about the two methods.

Spotify API get track info based on track name?

Is there a way to query the spotify API in order to get information about a track/artist/album/playlist based on its name.
E.g. query for track=I need a hero&artistName=... and get a URI/ID and some information about the track.
I couldn't find anything like this in the documentation. Am I overlooking something ?
You can use the search API endpoint, by specifying an artist and a track parameters, then extract the track ID from the response if there is only one match:
curl -X GET "https://api.spotify.com/v1/search?q=track:I%20need%20a hero%20artist:the%20artist&type=track"

Lookback API: Is there a way to include more than one artifact type in a single query?

In traditional Rally Webservices REST, if I wanted to get all Defects and Stories modified since a certain date, I would need to issue two separate REST GET requests against each of these endpoints:
https://rally1.rallydev.com/slm/webservice/1.33/hierarchicalrequirement
and
https://rally1.rallydev.com/slm/webservice/1.33/defect/
Is there a way to leverage the Lookback API to combine these into one REST request?
Sure, just add _Type:{$in:["Defect","HierarchicalRequirement"]} to the query. All of the work item types are stored in the same collection. You can also get back descendent Tasks and TestCases.