No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

eSight V300R010C00SPC200, 300, and 500 Self-Service Integration Guide 10

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Network Traffic APIs

Network Traffic APIs

Query Device Information

Function

This interface is used to query device information about network traffic monitoring.

URI

/rest/openapi/network/nta/devicemgr/deviceinfo

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request header parameter list

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

nedn

Optional

Request entity parameter list

String

Indicates the device DN.

The value can be the DNs of multiple devices separated by semicolons (;). A maximum of ten DNs are supported.

neid

Optional

Request entity parameter list

String

Indicates the device ID, which is the identifier of an NTA subsystem.

The value can be the IDs of multiple devices separated by semicolons (;). A maximum of ten IDs are supported.

aliasname

Optional

Request entity parameter list

String

Indicates the device alias on eSight.

The value can be the aliases of multiple devices separated by semicolons (;). A maximum of ten aliases are supported.

nename

Optional

Request entity parameter list

String

Indicates the device name on the device.

The value can be the host names of multiple devices separated by semicolons (;). A maximum of ten host names are supported.

neip

Optional

Request entity parameter list

String

Indicates the device's IP address.

The value can be the IP addresses of multiple devices separated by semicolons (;). A maximum of ten IP addresses are supported.

nestate

Optional

Request entity parameter list

int

Indicates the device's administrative state. The options are as follows:

0: all (default)

1: managed

2: not managed

3: others

page_size

Optional

Request entity parameter list

int

Indicates the number of records on each page.

By default, each page contains 20 records. The maximum value of this parameter is 100.

page_num

Optional

Request entity parameter list

int

Indicates the current page number.

The default value is 1. The maximum value of this parameter is 21474836.

The value 1 indicates the first page; the value 2 indicates the second page; and so on.

Request Example

curl -X get -k -H 'openid: 6c719e7633c0194237f5ae4aa5f45f4def2bf323c5d21fb4' -i 'https://10.120.66.130:32102/rest/openapi/network/nta/devicemgr/deviceinfo'

Result

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: successful
  • Non-0: failed

data

String

Indicates the queried device information, in the JSON format.

description

String

Indicates the description of the interface invoking result.

The following table lists the fields contained in the data object.

Field

Value Type

Description

page_size

int

Indicates the number of records on the current page.

total_page

int

Indicates the total pages of records that meet search criteria.

current_page

int

Indicate the current page, which starts from 1.

device_infos

List<DeviceInfo>

Indicates the list of managed devices.

The following table lists the fields contained in the DeviceInfo object.

Field

Value Type

Description

nedn

int

Indicates the device DN.

deviceid

int

Indicates the device ID.

aliasname

String

Indicates the device name.

nename

String

Indicates the host name.

neip

String

Indicates the device's IP address.

nestate

int

Indicates the device's administrative state. The options are as follows:

  • 0: all (default)
  • 1: managed
  • 2: not managed
  • 3: Others

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 306

{"code":0,"data":{"device_infos":[{"nedn":"NE=34603109","neip":"10.134.23.105","nestate":1,"deviceid":1,"aliasname":"nkgy4l004032591.china.huawei.com","nenameInOpenApi":"nkgy4l004032591.china.huawei.com"}],"total_page":1,"current_page":1,"page_size":1},"description":"Operation success."}

Precautions

Concurrency is not supported.

Example

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

public class Query
{
    private static final String EAM_TYPE = "/rest/openapi/network/nta/devicemgr/deviceinfo";
    public static void main(String[] args) throws Exception
    { 
        Login.login();
        queryTest();
    }

    public static void queryTest()
        throws Exception
    {
        //set the URL and method 
        String openidURL = EAM_TYPE;
        String method = "GET";

        //set headers
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //set parameters BasicNameValuePair[] parameters =
            { 
                new BasicNameValuePair("neid", 1)
            };
        //send the request
        HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        String body = NewHttpsAccess.getResult(response); System.out.println(body);
    }
}

The returned result is as follows:
{
  "code": 0,
  "data": {
    "page_size": 1,
    "total_page": 1,
    "current_page": 1,
    "device_infos": [
      {
        "aliasname": "nkgy5dwx3800661.china.huawei.com",
        "nedn": "NE=34603009",
        "nename": "nkgy5dwx3800661.china.huawei.com",
        "nestate": 1,
        "deviceid": 1,
        "neip": "10.134.122.185"
      }
    ]
  },
  "description": "Operation success."
}

Query Interface Information

Function

This interface is used to query interface information about the NTA system.

URI

/rest/openapi/network/nta/ifmgr/interfaceinfo

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request header parameter list

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

neid

Mandatory

Request entity parameter list

String

Indicates the device ID, which is the identifier of an NTA subsystem.

This parameter indicates the device ID returned when the device information is queried.

ifid

Optional

Request entity parameter list

String

Indicates the interface ID, which is the identifier of an NTA subsystem.

The value can be the IDs of multiple device interfaces separated by semicolons (;). A maximum of ten interface IDs are supported.

ifindex

Optional

Request entity parameter list

String

Indicates the interface index of a device card.

The value can be the indexes of multiple device interfaces separated by semicolons (;). A maximum of ten interface indexes are supported.

ifstate

Optional

Request entity parameter list

int

Indicates the interface's monitoring state. The options are as follows:

  • 0: all (default)
  • 1: monitored
  • 2: unmonitored

page_size

Optional

Request entity parameter list

int

Indicates the number of records on each page.

By default, each page contains 20 records. The maximum value of this parameter is 100.

page_num

Optional

Request entity parameter list

int

Indicates the current page number.

The default value is 1. The maximum value of this parameter is 21474836.

The value 1 indicates the first page; the value 2 indicates the second page; and so on.

Request Example

curl -X get -k -H 'openid: 15cf17442da21b3cce78315b60854a35ea4992204eaa1cde' -i 'https://10.120.66.130:32102/rest/openapi/network/nta/ifmgr/interfaceinfo?neid=1'

Result

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: successful
  • Non-0: failed

data

String

Indicates the queried interface information, in the JSON format.

description

String

Indicates the description of the interface invoking result.

The following table lists the fields contained in the data object.

Field

Value Type

Description

page_size

int

Indicates the number of records on the current page.

total_page

int

Indicates the total pages of records that meet search criteria.

current_page

int

Indicate the current page, which starts from 1.

interface_infos

List<InterfaceInfo>

Indicates the list of monitored interfaces.

The following table lists the fields contained in the InterfaceInfo object.

Field

Value Type

Description

ifid

int

Indicates the interface ID.

ifindex

int

Indicates the interface index.

ifname

String

Indicates the interface name.

ifalias

String

Indicates the interface alias.

sample_rate_in

int

Indicates the sampling ratio of incoming traffic.

sample_rate_out

int

Indicates the sampling ratio of outgoing traffic.

ifstate

int

Indicates the interface's monitoring state. The options are as follows:

  • 0: all (default)
  • 1: monitored
  • 2: unmonitored

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 990

{"code":0,"data":{"interface_infos":[{"ifid":1},{"ifindex":20},{"ifalias":"IfIndex_20"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_20"},{"ifid":2},{"ifindex":21},{"ifalias":"IfIndex_21"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_21"},{"ifid":3},{"ifindex":1},{"ifalias":"IfIndex_1"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_1"},{"ifid":4},{"ifindex":2},{"ifalias":"IfIndex_2"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_2"},{"ifid":5},{"ifindex":4},{"ifalias":"IfIndex_4"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_4"},{"ifid":6},{"ifindex":3},{"ifalias":"IfIndex_3"},{"sample_rate_in":1000},{"sample_rate_out":1000},{"ifstate":1},{"ifnameInOpenApi":"IfIndex_3"}],"total_page":1,"current_page":1,"page_size":6},"description":"Operation success."}

Precautions

Concurrency is not supported.

Example

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
public class Query
{
    private static final String EAM_TYPE = "/rest/openapi/network/nta/ifmgr/interfaceinfo";
    public static void main(String[] args) throws Exception
    { 
        Login.login();
        queryTest();
    }

    public static void queryTest()
        throws Exception
    {
        //set the URL and method 
        String openidURL = EAM_TYPE;
        String method = "GET";

        //set headers
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //set parameters BasicNameValuePair[] parameters =
            { 
                new BasicNameValuePair("neid", 1)
            };
        //send the request
        HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        String body = NewHttpsAccess.getResult(response); System.out.println(body);
    }
}

The returned result is as follows:

{
  "code": 0,
  "data": {
    "page_size": 3,
    "total_page": 1,
    "current_page": 1,
    "interface_infos": [
      {
        "ifindex": 1,
        "ifstate": 1,
        "ifalias": "",
        "ifname": "Software Loopback Interface 1",
        "sample_rate_in": 1000,
        "ifid": 1,
        "sample_rate_out": 1000
      },
      {
        "ifindex": 2,
        "ifstate": 2,
        "ifalias": "",
        "ifname": "WAN Miniport (SSTP)",
        "sample_rate_in": 1000,
        "ifid": 2,
        "sample_rate_out": 1000
      },
      {
        "ifindex": 3,
        "ifstate": 1,
        "ifalias": "",
        "ifname": "WAN Miniport (L2TP)",
        "sample_rate_in": 1000,
        "ifid": 3,
        "sample_rate_out": 1000
      }
    ]
  },
  "description": "Operation success."
}

Query Application Information

Function

This interface is used to query application information.

URI

/rest/openapi/network/nta/appmgr/appinfo

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request header parameter list

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

appid

Optional

Request entity parameter list

String

Indicates the application index of an NTA subsystem.

The value can be the indexes of multiple applications separated by semicolons (;). A maximum of ten application indexes are supported.

appname

Optional

Request entity parameter list

String

Indicates the application name.

The value can be the names of multiple applications separated by semicolons (;). A maximum of ten application names are supported.

page_size

Optional

Request entity parameter list

int

Indicates the number of records on each page.

By default, each page contains 20 records. The maximum value of this parameter is 100.

page_num

Optional

Request entity parameter list

int

Indicates the current page number.

The default value is 1. The maximum value of this parameter is 21474836.

The value 1 indicates the first page; the value 2 indicates the second page; and so on.

Request Example

curl -X get -k -H 'openid: 15cf17442da21b3cce78315b60854a35ea4992204eaa1cde' -i 'https://10.120.66.130:32102/rest/openapi/network/nta/appmgr/appinfo'

Result

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

data

String

Indicates the queried application information, in the JSON format.

description

String

Indicates the description of the interface invoking result.

The following table lists the fields contained in the data object.

Field

Value Type

Description

page_size

int

Indicates the number of records on the current page.

total_page

int

Indicates the total pages of records that meet search criteria.

current_page

int

Indicate the current page, which starts from 1.

app_infos

List<AppInfo>

Indicates the application list.

The following table lists the fields contained in the AppInfo object.

Field

Value Type

Description

appid

int

Indicates the application index.

appname

String

Indicates the application name.

appdesc

String

Indicates the application description.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 1659

{"code":0,"data":{"app_infos":[{"appsid":2137,"appsname":"mpls","appsdesc":"MPLS in IP"},{"appsid":2253,"appsname":"test1","appsdesc":"Used for experimentation and testing"},{"appsid":2254,"appsname":"test2","appsdesc":"Used for experimentation and testing"},{"appsid":2255,"appsname":"reserved","appsdesc":"Reserved by IANA"},{"appsid":10000007,"appsname":"echo","appsdesc":"Echo Protocol"},{"appsid":10000009,"appsname":"discard","appsdesc":"Discard Protocol"},{"appsid":10000011,"appsname":"systat","appsdesc":"Active Users Protocol"},{"appsid":10000013,"appsname":"daytime","appsdesc":"Daytime Protocol"},{"appsid":10000017,"appsname":"qotd","appsdesc":"Quote of the Day Protocol"},{"appsid":10000019,"appsname":"chargen","appsdesc":"Character Generator Protocol"},{"appsid":10000020,"appsname":"ftp-data","appsdesc":"File Transfer Protocol (FTP) Data traffic"},{"appsid":10000021,"appsname":"ftp","appsdesc":"File Transfer Protocol (FTP) Control traffic"},{"appsid":10000022,"appsname":"ssh","appsdesc":"Secure Shell (SSH) Remote Login Protocol"},{"appsid":10000023,"appsname":"telnet","appsdesc":"Telnet Protocol"},{"appsid":10000025,"appsname":"smtp","appsdesc":"Simple Mail Transfer Protocol (SMTP)"},{"appsid":10000037,"appsname":"time","appsdesc":"Time Protocol"},{"appsid":10000038,"appsname":"rap","appsdesc":"Route Access Protocol"},{"appsid":10000040,"appsname":"rlp","appsdesc":"Resource Location Protocol"},{"appsid":10000042,"appsname":"nameserver","appsdesc":"Host Name Server"},{"appsid":10000043,"appsname":"nicname","appsdesc":"NICNAME/WHOIS Protocol"}],"total_page":28,"current_page":1,"page_size":20},"description":"Operation success."}

Precautions

Concurrency is not supported.

Example

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

public class Query
{
    private static final String EAM_TYPE = "/rest/openapi/network/nta/appmgr/appinfo";
    public static void main(String[] args) throws Exception
    { 
        Login.login();
        queryTest();
    }

    public static void queryTest()
        throws Exception
    {
        //set the URL and method 
        String openidURL = EAM_TYPE;
        String method = "GET";

        //set headers
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //set parameters BasicNameValuePair[] parameters =
            { 
                new BasicNameValuePair("appid", 2000)
            };
        //send the request
        HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        String body = NewHttpsAccess.getResult(response); System.out.println(body);
    }
}

The returned result is as follows:
{
  "code": 0,
  "data": {
    "page_size": 1,
    "total_page": 1,
    "current_page": 1,
    "app_infos": [
      {
        "appname": "hopopt",
        "appdesc": "IP Hop-by-Hop Option",
        "appid": 2000
      }
    ]
  },
  "description": "Operation success."
}

Query Basic Carrier Information

Function

This interface is used to query basic information about all carriers.

URI

/rest/openapi/nta/carrier/basicInfo

Access Method

GET

Parameter Description

Parameter Name

Mandatory/Optional

Location

Parameter Type

Description

openid

Mandatory

Request message header

string

Indicates the session identifier. It is used for open API authentication.

NOTE:

This parameter is obtained by a third party to invoke the login interface.

Request Example

curl -X get -k -H 'openid: 15cf17442da21b3cce78315b60854a35ea4992204eaa1cde' -i 'https://10.120.66.130:32102/rest/openapi/nta/carrier/basicInfo'

Result

Field

Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • Others: failed

data

List<CarrierData>

Indicates the list of basic carrier information.

description

string

Indicates the description of the returned result.

CarrierData contains the following fields:

Field

Type

Description

carrierID

string

Indicates the unique identifier of a carrier.

name

string

Indicates the carrier name.

description

string

Indicates the carrier description.

ipRangeDataList

IpRangeData[]

Indicates the list of IP addresses.

inBandwidth

long

Indicates the incoming bandwidth. Unit: Bps (byte/s)

outBandwidth

long

Indicates the outgoing bandwidth. Unit: Bps (byte/s)

IpRangeData contains the following fields:

Field

Value Type

Description

ipRangeID

string

Indicates the unique identifier of a carrier.

type

int

Indicates the type.

  • 1: single IP address
  • 2: IP address range
  • 3: network segment

startIpAddr

string

Indicates the start IP address or IP address range.

This parameter is effective only when the IP address range is used. Leave it empty in other scenarios.

endIpAddr

string

Indicates the end IP address.

This parameter is effective only when the IP address range is used. Leave it empty in other scenarios.

maskLen

int

Indicates the mask length.

This parameter is effective only when the IP address or range is used.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 538

{"code":0,"data":[{"carrierID":"1","name":"CHINA TELECOM","description":"CHINA TELECOM","ipRangeDataList":null,"inBandwidth":0,"outBandwidth":0},{"carrierID":"2","name":"CHINA UNICOM","description":"CHINA UNICOM","ipRangeDataList":null,"inBandwidth":0,"outBandwidth":0},{"carrierID":"3","name":"CHINA MOBILE","description":"CHINA MOBILE","ipRangeDataList":null,"inBandwidth":0,"outBandwidth":0},{"carrierID":"4","name":"BGP","description":"BGP","ipRangeDataList":null,"inBandwidth":0,"outBandwidth":0}],"description":"Operation success."}

Precautions

As for un-defined carrier information, an exception is not reported, and only empty data is returned. Concurrency is not supported.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;
public class QueryCarrierInfoDemo
{
public static String queryCarrierBasicInfo(String ip, int port, Map<String,String> header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://").append(ip).append(":").append(port).append("/rest/openapi/nta/carrier/basicInfo");

String url = sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request); 
Map<String, String> result =ParseResponse.parseResponse(response);

System.out.println("In QueryCarrierBasicInfo:" + result);
return result.get("data");
}

public static void main(String[] args)
throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP,Constants.SERVER_PORT, Constants.LOGIN_INFO); 
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryCarrierBasicInfo(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}

The returned result is as follows:

{
"code": 0, 
"data": [
{
"carrierID": "1", 
"name": "CHINA TELECOM", 
"description": "CHINA TELECOM", 
"ipRangeDataList": [
{
"ipRangeID": "7", 
"type": 2, 
"startIpAddr": "10.137.62.1", 
"endIpAddr": "10.137.63.1", 
"maskLen": 23
}, 
{
"ipRangeID": "8", 
"type": 3, 
"startIpAddr": "10.137.61.2", 
"endIpAddr": null, 
"maskLen": 24
}, 
{
"ipRangeID": "9", 
"type": 1, 
"startIpAddr": "10.137.66.2", 
"endIpAddr": null, 
"maskLen": 0
}
], 
"inBandwidth": 1000, 
"outBandwidth": 1000
}, 
{
"carrierID": "2", 
"name": "CHINA UNICOM", 
"description": "CHINA UNICOM", 
"ipRangeDataList": [
{
"ipRangeID":"10", 
"type": 3, 
"startIpAddr": "10.137.61.11", 
"endIpAddr": null, 
"maskLen": 23
}
], 
"inBandwidth": 1000000, 
"outBandwidth": 1000000
}, 
{
"carrierID": "3", 
"name": "CHINA MOBILE", 
"description": "CHINA MOBILE", 
"ipRangeDataList": [
{
"ipRangeID": "11", 
"type": 1, 
"startIpAddr": "10.137.61.21", 
"endIpAddr": null, 
"maskLen": 0
}
], 
"inBandwidth": 2000000, 
"outBandwidth": 2000000
}, 
{
"carrierID": "4", 
"name": "BGP", 
"description": "BGP", 
"ipRangeDataList": null, 
"inBandwidth": 0, 
"outBandwidth": 0
}
], 
"description": "Operation success."
}

Query Current Carrier Traffic

Function

This interface is used to query the last minute data about incoming and outgoing carrier traffic.

URI

/rest/openapi/nta/carrier/last1MinTrafficStat

Access Method

GET

Parameter Description

Parameter Name

Mandatory/Optional

Location

Parameter Type

Description

openid

Mandatory

Request message header

string

Indicates the session identifier. It is used for open API authentication.

NOTE:

This parameter is obtained by a third party to invoke the login interface.

Request Example

curl -X get -k -H 'openid: 15cf17442da21b3cce78315b60854a35ea4992204eaa1cde' -i 'https://10.120.66.130:32102/rest/openapi/nta/carrier/last1MinTrafficStat'

Result

Field

Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • Others: failed

data

CarrierTrafficStatModel

Indicates the current carrier traffic data.

description

string

Indicates the description of the returned result.

CarrierTrafficStatModel contains the following fields:

Field

Type

Description

carrierTraffic

List<CarrierTrafficModel>

Indicates the last minute carrier traffic data.

summary

SummaryTrafficData

Indicates traffic statistics.

CarrierTrafficModel contains the following fields:

Field

Type

Description

lastCollectTime

long

Indicates the time point for the last minute traffic. Unit: millisecond (UTC)

totalBytes

long

Indicates the total number of bytes within one minute. Unit: byte

totalPackets

long

Indicates the total number of packets within one minute.

totalBandwidthUsage

float

Indicates the byte bandwidth usage within one minute. Accurate to two digits after the decimal point. Unit: %

totalBandwidth

long

Indicates the total carrier bandwidth. Unit: Bps (byte/s)

trafficOrder

int

Indicates the order of carrier traffic in all carriers (by totalBandwidthUsage).

trafficOrderPercent

float

Indicates the percentage of the carrier traffic among all carriers (by totalBytes/Sum(all). Accurate to two digits after the decimal point. Unit: %

SummaryTrafficData contains the following fields:

Field

Type

Description

totalBytes

long

Indicates the total number of bytes within one minute. Unit: byte

totalPackets

long

Indicates the total number of packets within one minute.

totalBandwidthUsage

float

Indicates the byte bandwidth usage within one minute. Accurate to two digits after the decimal point. Unit: %

totalBandwidth

long

Indicates the total bandwidth of all carriers. Unit: Bps (byte/s)

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 732

{"code":0,"data":{"carrierTraffic":[{"carrierID":"4","name":"BGP","inTrafficData":{"lastCollectTime":1534921200000,"totalBytes":97815000000,"totalPackets":87000300000,"totalBandwidthUsage":0.0,"totalBandwidth":0,"trafficOrder":2,"trafficOrderPercent":100.0},"outTrafficData":{"lastCollectTime":1534921200000,"totalBytes":96915000000,"totalPackets":78000300000,"totalBandwidthUsage":0.0,"totalBandwidth":0,"trafficOrder":1,"trafficOrderPercent":100.0}}],"summary":{"inTrafficData":{"totalBytes":97815000000,"totalPackets":87000300000,"totalBandwidthUsage":0.0,"totalBandwidth":0},"outTrafficData":{"totalBytes":96915000000,"totalPackets":78000300000,"totalBandwidthUsage":0.0,"totalBandwidth":0}}},"description":"Operation success."}

Precautions

  • As for un-defined carrier information, an exception is not reported, and only empty data is returned. Summary traffic does not require the returned data.
  • Bandwidth that is un-defined or 0 is not calculated in bandwidth usage (processed as 0).
  • If a carrier does not exist, empty data is returned.
  • Concurrency is not supported.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;

public class QueryCarrierTrafficDemo
{
public static String queryCarrierTraffic(String ip, int port, Map<String, String>header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://")
.append(ip)
.append(":")
.append(port)
.append("/rest/openapi/nta/carrier/last1MinTrafficStat");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);

System.out.println("In queryCarrierTraffic:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryCarrierTraffic(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}

The returned result is as follows:

{
"code": 0, 
"data": {
"carrierTraffic": [
{
"carrierID": "3", 
"name": "CHINA MOBILE", 
"inTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes": 58315000, 
"totalPackets": 3673000, 
"totalBandwidthUsage": 48.6, 
"totalBandwidth": 2000000, 
"trafficOrder": 4, 
"trafficOrderPercent": 39.39
}, 
"outTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes": 105507000, 
"totalPackets": 6391000, 
"totalBandwidthUsage": 87.92, 
"totalBandwidth": 2000000, 
"trafficOrder": 2, 
"trafficOrderPercent": 38.02
}
}, 
{
"carrierID": "2", 
"name": "CHINA UNICOM", 
"inTrafficData": null, 
"outTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes": 47026000, 
"totalPackets": 2336000, 
"totalBandwidthUsage": 78.38, 
"totalBandwidth": 1000000, 
"trafficOrder": 3, 
"trafficOrderPercent": 16.95
}
}, 
{
"carrierID": "1", 
"name": "CHINA TELECOM", 
"inTrafficData": null, 
"outTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes": 50380000, 
"totalPackets": 2974000, 
"totalBandwidthUsage": 83966.67, 
"totalBandwidth": 1000, 
"trafficOrder": 1, 
"trafficOrderPercent": 18.16
}
}, 
{
"carrierID": "4", 
"name": "BGP", 
"inTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes":89729000, 
"totalPackets": 6599000, 
"totalBandwidthUsage": 0, 
"totalBandwidth": 0, 
"trafficOrder": 6, 
"trafficOrderPercent": 60.61
}, 
"outTrafficData": {
"lastCollectTime": 1445339760000, 
"totalBytes": 74561000, 
"totalPackets": 5658000, 
"totalBandwidthUsage": 0, 
"totalBandwidth": 0, 
"trafficOrder": 5, 
"trafficOrderPercent": 26.87
}
}
], 
"summary": {
"inTrafficData": {
"totalBytes": 148044000, 
"totalPackets": 10272000, 
"totalBandwidthUsage": 82.22, 
"totalBandwidth": 3001000
}, 
"outTrafficData": {
"totalBytes": 277474000, 
"totalPackets": 17359000, 
"totalBandwidthUsage": 154.1, 
"totalBandwidth": 3001000
}
}
}, 
"description": "Operation success."
}

Query EIP Top N Traffic

Function

This interface is used to set query parameters, including N value, statistical range, carrier ID, and traffic direction. Only the last minute data for all EIPs is collected.

URI

/rest/openapi/nta/eip/last1MinTrafficStat

Access Method

GET

Parameter Description

Parameter Name

Mandatory/Optional

Location

Parameter Type

Description

openid

Mandatory

Request message header

string

Indicates the session identifier. It is used for open API authentication.

NOTE:

This parameter is obtained by a third party to invoke the login interface.

topnValue

Mandatory

Request entity parameter list

int

Indicates the N value. Value range: 1 to 100

rangeType

Optional

Request entity parameter list

int

Indicates the statistical range.

  • 1: traffic about all carriers
  • 2: traffic about a specific carrier

carrierID

Optional

Request entity parameter list

string

Indicates the carrier ID.

NOTE:

This parameter is effective only when rangeType is 2, and must work with rangeType.

deviceIP

Optional

Request entity parameter list

string

Indicates the device IP.

NOTE:

deviceIP and rangeType cannot be provided at the same time.

interfaceName

Optional

Request entity parameter list

string

Indicates the interface name for eSight network traffic analysis management.

NOTE:

This parameter must be provided with deviceIP.

trafficDirection

Mandatory

Request entity parameter list

int

Indicates the traffic direction.

  • 1: incoming traffic
  • 2: outgoing traffic
  • 3: incoming and outgoing traffic

Request Example

curl -X get -k -H 'openid: a12e0f067fcb8c1f6a7cacb5dd41592eadee4a804be34e7e' -i 'https://10.120.66.130:32102/rest/openapi/nta/eip/last1MinTrafficStat?topnValue=5&trafficDirection=1'

Result

Field

Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • Others: failed Value 100001 indicates that the parameter is invalid.

data

List<HostEIPTrafficModel>

Indicates EIP traffic information.

description

string

Indicates the description of the returned result.

HostEIPTrafficModel contains the following fields:

Field

Type

Description

eipAddr

string

Indicates the IP address of the EIP.

carrierID

string

Indicates the carrier ID of the EIP.

carrierName

string

Indicates the carrier name of the EIP.

customerID

string

Indicates the customer ID of the EIP.

customerName

string

Indicates the customer name of the EIP.

carGroupID

string

Indicates the car group ID of the EIP.

carGroupName

string

Indicates the car group name of the EIP.

lastCollectTime

long

Indicates the time point for the last minute traffic. Unit: millisecond (UTC)

totalBytes

long

Indicates the total number of bytes within one minute. Unit: byte

totalPackets

long

Indicates the total number of packets within one minute.

trafficOrder

int

Indicates the order of the EIP traffic among all Top N and others (by totalBytes).

trafficOrderPercent

float

Indicates the percentage of the EIP traffic among all Top N and others (by totalBytes). Accurate to two digits after the decimal point. Unit: %

interfaceTraffic

InterfaceTrafficModel

Indicates the traffic under the returned interface. If deviceIP is not provided, this parameter is left empty.

InterfaceTrafficModel contains the following fields:

Field

Value Type

Description

inPackets

long

Indicates the number of all incoming packets under a specific interface within lastCollectTime.

outPackets

long

Indicates the number of all outgoing packets under a specific interface within lastCollectTime.

inTotalBytes

long

Indicates the number of all incoming bytes under a specific interface within lastCollectTime.

outTotalBytes

long

Indicates the number of all outgoing bytes under a specific interface within lastCollectTime.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 1804

{"code":0,"data":{"eipTraffic":[{"eipAddr":"192.168.1.4","carrierID":"4","carrierName":"BGP","customerID":"575","customerName":"testDomain4","carGroupID":"4","carGroupName":"testBandwidth4","lastCollectTime":1534937760000,"totalBytes":36000000000,"totalPackets":3600000000,"trafficOrder":1,"trafficOrderPercent":90.9},{"eipAddr":"Other","carrierID":null,"carrierName":null,"customerID":null,"customerName":null,"carGroupID":null,"carGroupName":null,"lastCollectTime":1534937760000,"totalBytes":2406000000,"totalPackets":24000120000,"trafficOrder":2,"trafficOrderPercent":6.07},{"eipAddr":"192.168.1.87","carrierID":"4","carrierName":"BGP","customerID":"763","customerName":"testDomain487","carGroupID":"487","carGroupName":"testBandwidth487","lastCollectTime":1534937760000,"totalBytes":300000000,"totalPackets":3000000000,"trafficOrder":3,"trafficOrderPercent":0.76},{"eipAddr":"192.168.1.190","carrierID":"4","carrierName":"BGP","customerID":"562","customerName":"testDomain190","carGroupID":"190","carGroupName":"testBandwidth190","lastCollectTime":1534937760000,"totalBytes":300000000,"totalPackets":3000000000,"trafficOrder":4,"trafficOrderPercent":0.76},{"eipAddr":"192.168.1.86","carrierID":"4","carrierName":"BGP","customerID":"761","customerName":"testDomain486","carGroupID":"486","carGroupName":"testBandwidth486","lastCollectTime":1534937760000,"totalBytes":300000000,"totalPackets":3000000000,"trafficOrder":5,"trafficOrderPercent":0.76},{"eipAddr":"192.168.1.181","carrierID":"4","carrierName":"BGP","customerID":"553","customerName":"testDomain181","carGroupID":"181","carGroupName":"testBandwidth181","lastCollectTime":1534937760000,"totalBytes":300000000,"totalPackets":3000000000,"trafficOrder":6,"trafficOrderPercent":0.76}],"interfaceTraffic":null},"description":"Operation success."}

Precautions

If the carrier ID does not exist or there is no specific directional traffic within one minute, empty data is returned. Concurrency is not supported.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;

public class QueryEIPTopNTrafficDemo
{
public static String queryEIPTopNTraffic(String ip, int port, Map<String, String>header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://").append(ip).append(":").append(port).append("/rest/openapi/nta/eip/last1MinTrafficStat");
sb.append("?");
sb.append("topnValue=5");
sb.append("&deviceIP=10.137.63.103");
sb.append("&interfaceName=IfIndex_1");
sb.append("&trafficDirection=1");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);
System.out.println("In QueryEIPTopNTrafficTest:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryEIPTopNTraffic(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}

The returned result is as follows:

{
"code": 0,
"data": {
"interfaceTraffic": {
"inPackets": 946000,
"inTotalBytes": 10098000,
"outPackets": 582000,
"outTotalBytes": 7422000
},
"eipTraffic": [{
"eipAddr": "others",
"carrierID": null,
"carrierName": null,
"customerID": null,
"customerName": null,
"carGroupID": null,
"carGroupName": null,
"lastCollectTime": 1449725700000,
"totalBytes": 4065000,
"totalPackets": 563000,
"trafficOrder": 1,
"trafficOrderPercent": 40.26
}, {
"eipAddr": "137.63.185.166",
"carrierID": "2",
"carrierName": "CHINA UNICOM",
"customerID": "335",
"customerName": "Customer_666",
"carGroupID": "5335",
"carGroupName": "CarGroup_1666",
"lastCollectTime": 1449725700000,
"totalBytes": 1477000,
"totalPackets": 48000,
"trafficOrder": 2,
"trafficOrderPercent": 14.63
}, {
"eipAddr": "137.63.185.168",
"carrierID": "4",
"carrierName": "BGP",
"customerID": "333",
"customerName": "Customer_668",
"carGroupID": "5333",
"carGroupName": "CarGroup_1668",
"lastCollectTime": 1449725700000,
"totalBytes": 1302000,
"totalPackets": 82000,
"trafficOrder": 3,
"trafficOrderPercent": 12.89
}, {
"eipAddr": "137.62.182.241",
"carrierID": "3",
"carrierName": "CHINA MOBILE",
"customerID": "10",
"customerName": "Customer_991",
"carGroupID":"6010",
"carGroupName": "CarGroup_991",
"lastCollectTime": 1449725700000,
"totalBytes": 1235000,
"totalPackets": 10000,
"trafficOrder": 4,
"trafficOrderPercent": 12.23
}, {
"eipAddr": "137.64.184.221",
"carrierID": "3",
"carrierName": "CHINA MOBILE",
"customerID": "530",
"customerName": "Customer_471",
"carGroupID": "5530",
"carGroupName": "CarGroup_1471",
"lastCollectTime": 1449725700000,
"totalBytes": 1051000,
"totalPackets": 131000,
"trafficOrder": 5,
"trafficOrderPercent": 10.41
}, {
"eipAddr": "137.63.185.163",
"carrierID": "3",
"carrierName": "CHINA MOBILE",
"customerID": "338",
"customerName": "Customer_663",
"carGroupID": "5338",
"carGroupName": "CarGroup_1663",
"lastCollectTime": 1449725700000,
"totalBytes": 968000,
"totalPackets": 112000,
"trafficOrder": 6,
"trafficOrderPercent": 9.59
}]
},
"description": "Operation success."
}

Query EIP Top N Session Traffic

Function

This interface is used to set query parameters, including N value, EIP, and traffic direction. Only the last minute session data for all EIPs is collected.

URI

/rest/openapi/nta/eipSession/last1MinTrafficStat

Access Method

GET

Parameter Description

Parameter Name

Mandatory/Optional

Location

Parameter Type

Description

openid

Mandatory

Request message header

string

Indicates the session identifier. It is used for open API authentication.

NOTE:

This parameter is obtained by a third party to invoke the login interface.

topnValue

Mandatory

Request entity parameter list

int

Indicates the N value. Value range: 1 to 100

eipAddr

Mandatory

Request entity parameter list

string

Indicates an EIP address. Only one EIP address is specified.

trafficDirection

Mandatory

Request entity parameter list

int

Indicates the traffic direction.

  • 1: incoming traffic
  • 2: outgoing traffic
  • 3: incoming and outgoing traffic

Request Example

curl -X get -k -H 'openid: 61cc470305e7f473b4fcc2ed9e5a4b673dee59a88226049c' -i 'https://10.120.66.130:32102/rest/openapi/nta/eipSession/last1MinTrafficStat?topnValue=5&trafficDirection=1&eipAddr=192.168.1.4'

Result

Field

Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • Others: failed Value 100001 indicates that the parameter is invalid.

data

List<EIPSessionModel>

Indicates EIP session traffic information.

description

string

Indicates the description of the returned result.

EIPSessionModel contains the following fields:

Field

Type

Description

lastCollectTime

long

Indicates the time point for the last minute traffic. Unit: millisecond (UTC)

eipDirectionType

int

Indicates the type of the EIP in the session.

  • 1: source address
  • 2: destination address

sessionName

string

Indicates the session name or others.

srcIpAddr

string

Indicates the source address.

dstIpAddr

string

Indicates the destination address.

srcPort

int

Indicates the source port.

dstPort

int

Indicates the destination port.

tosValue

int

Indicates the TOS/DSCP value.

protocolName

string

Indicates the protocol name.

protocolDesc

string

Indicates the protocol description.

appName

string

Indicates the application name.

appDesc

string

Indicates the application description.

carrierID

string

Indicates the carrier ID of the EIP.

carrierName

string

Indicates the carrier name of the EIP.

customerID

string

Indicates the customer ID of the EIP.

customerName

string

Indicates the customer name of the EIP.

carGroupID

string

Indicates the car group ID of the EIP.

carGroupName

string

Indicates the car group name of the EIP.

totalBytes

long

Indicates the total number of bytes within one minute. Unit: byte

totalPackets

long

Indicates the total number of packets within one minute.

trafficOrder

int

Indicates the order of the EIP traffic among all Top N and others (by totalBytes).

trafficOrderPercent

float

Indicates the percentage of the EIP traffic among all Top N and others (by totalBytes). Accurate to two digits after the decimal point. Unit: %

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 976

{"code":0,"data":[{"lastCollectTime":1534922700000,"eipDirectionType":2,"appName":"BT","appDesc":"BT_desc","carrierID":"4","carrierName":"BGP","customerID":"575","customerName":"testDomain4","carGroupID":"74","carGroupName":"testBandwidth74","totalBytes":90000000000,"totalPackets":9000000000,"trafficOrder":1,"trafficOrderPercent":100.0,"sessionName":"192.168.1.2 to 192.168.1.4","srcIpAddr":"192.168.1.2","dstIpAddr":"192.168.1.4","srcPort":80,"dstPort":33584,"tosValue":8,"protocolName":"tcp","protocolDesc":"Transmission Control"},{"lastCollectTime":1534922700000,"eipDirectionType":0,"appName":null,"appDesc":null,"carrierID":null,"carrierName":null,"customerID":null,"customerName":null,"carGroupID":null,"carGroupName":null,"totalBytes":0,"totalPackets":0,"trafficOrder":2,"trafficOrderPercent":0.0,"sessionName":"Other","srcIpAddr":null,"dstIpAddr":null,"srcPort":0,"dstPort":0,"tosValue":0,"protocolName":null,"protocolDesc":null}],"description":"Operation success."}

Precautions

If the EID does not exist or there is no specific directional traffic within one minute, empty data is returned. Concurrency is not supported.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;
public class QueryEIPTopNConvDemo
{
public static String queryEIPTopNConv(String ip, int port, Map<String, String> header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://")
.append(ip)
.append(":")
.append(port)
.append("/rest/openapi/nta/eipSession/last1MinTrafficStat");
sb.append("?");
sb.append("topnValue=3");
sb.append("&eipAddr=137.64.180.76");
sb.append("&trafficDirection=1");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);

System.out.println("In QueryEIPTopNConvTest:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);

// Add OpenID to the header.
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryEIPTopNConv(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}

The returned result is as follows:

{
"code": 0, 
"data": [
{
"lastCollectTime": 1445345220000, 
"eipDirectionType": 0, 
"sessionName": "Other", 
"srcIpAddr": null, 
"dstIpAddr": null, 
"srcPort": 0, 
"dstPort": 0, 
"tosValue": 0, 
"protocolName": null, 
"protocolDesc": null, 
"appName": null, 
"appDesc": null, 
"carrierID": null, 
"carrierName": null, 
"customerID": null, 
"customerName": null, 
"carGroupID": null, 
"carGroupName": null, 
"totalBytes": 52941000, 
"totalPackets": 3558000, 
"trafficOrder": 1, 
"trafficOrderPercent": 86.1
}, 
{
"lastCollectTime": 1445345220000, 
"eipDirectionType": 2, 
"sessionName": "10.26.54.110 to 137.64.180.76", 
"srcIpAddr": "10.26.54.110", 
"dstIpAddr": "137.64.180.76", 
"srcPort": 37, 
"dstPort": 0, 
"tosValue": 8, 
"protocolName": "tcp", 
"protocolDesc": "transmission control",
"appName": "time", 
"appDesc": "time protocol service",
"carrierID": "3", 
"carrierName": "CHINA MOBILE", 
"customerID": "675", 
"customerName":"Customer_326", 
"carGroupID": "1675", 
"carGroupName": "CarGroup_326", 
"totalBytes": 3115000, 
"totalPackets": 116000, 
"trafficOrder": 2, 
"trafficOrderPercent": 5.07
}
// Other data is skipped here.
], 
"description": "Operation success."
}

Query EIP Top N Application Traffic

Function

This interface is used to set query parameters, including N value, EIP, and traffic direction. Only the last minute application data for all EIPs is collected.

URI

/rest/openapi/nta/eipApp/last1MinTrafficStat

Access Method

GET

Parameter Description

Parameter Name

Mandatory/Optional

Location

Parameter Type

Description

openid

Mandatory

Request message header

string

Indicates the session identifier. It is used for open API authentication.

NOTE:

This parameter is obtained by a third party to invoke the login interface.

topnValue

Mandatory

Request entity parameter list

int

Indicates the N value. Value range: 1 to 100

eipAddr

Mandatory

Request entity parameter list

string

Indicates an EIP address. Only one EIP address is specified.

trafficDirection

Mandatory

Request entity parameter list

int

Indicates the traffic direction.

  • 1: incoming traffic
  • 2: outgoing traffic
  • 3: incoming and outgoing traffic

Request Example

curl -X get -k -H 'openid: f88a25205a54a114e9e56559c24c74022ac2a1e802b7d4cf' -i 'https://10.120.66.130:32102/rest/openapi/nta/eipApp/last1MinTrafficStat?topnValue=5&trafficDirection=1&eipAddr=192.168.1.4'

Result

Field

Type

Description

code

int

Indicates the code of the returned result. The options are as follows:

  • 0: successful
  • Others: failed Value 100001 indicates that the parameter is invalid.

data

List<EIPAppTrafficModel>

Indicates EIP session application information.

description

string

Indicates the description of the returned result.

EIPAppTrafficModel contains the following fields:

Field

Type

Description

lastCollectTime

long

Indicates the time point for the last minute traffic. Unit: millisecond (UTC)

eipDirectionType

int

Indicates the type of the EIP in the session.

  • 1: source address
  • 2: destination address
  • 3: source or destination address

appName

string

Indicates the application name.

appDesc

string

Indicates the application description.

carrierID

string

Indicates the carrier ID of the EIP.

carrierName

string

Indicates the carrier name of the EIP.

customerID

string

Indicates the customer ID of the EIP.

customerName

string

Indicates the customer name of the EIP.

carGroupID

string

Indicates the car group ID of the EIP.

carGroupName

string

Indicates the car group name of the EIP.

totalBytes

long

Indicates the total number of bytes within one minute. Unit: byte

totalPackets

long

Indicates the total number of packets within one minute.

trafficOrder

int

Indicates the order of the EIP traffic among all Top N and others (by totalBytes).

trafficOrderPercent

float

Indicates the percentage of the EIP traffic among all Top N and others (by totalBytes). Accurate to two digits after the decimal point. Unit: %

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 976

{"code":0,"data":[{"lastCollectTime":1534922880000,"eipDirectionType":1,"appName":"BT","appDesc":"BT_desc","carrierID":"4","carrierName":"BGP","customerID":"575","customerName":"testDomain4","carGroupID":"74","carGroupName":"testBandwidth74","totalBytes":90000000000,"totalPackets":9000000000,"trafficOrder":1,"trafficOrderPercent":99.67},{"lastCollectTime":1534922880000,"eipDirectionType":1,"appName":"eSight","appDesc":"eSight_desc","carrierID":"4","carrierName":"BGP","customerID":"575","customerName":"testDomain4","carGroupID":"74","carGroupName":"testBandwidth74","totalBytes":300000000,"totalPackets":3000000000,"trafficOrder":2,"trafficOrderPercent":0.33},{"lastCollectTime":1534922880000,"eipDirectionType":0,"appName":"Other","appDesc":null,"carrierID":null,"carrierName":null,"customerID":null,"customerName":null,"carGroupID":null,"carGroupName":null,"totalBytes":0,"totalPackets":0,"trafficOrder":3,"trafficOrderPercent":0.0}],"description":"Operation success."}

Precautions

If the EID does not exist or there is no specific directional traffic within one minute, empty data is returned. Concurrency is not supported.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;
public class QueryEIPTopNConvDemo
{
public static String queryEIPTopNConv(String ip, int port, Map<String, String> header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://")
.append(ip)
.append(":")
.append(port)
.append("/rest/openapi/nta/eipSession/last1MinTrafficStat");
sb.append("?");
sb.append("topnValue=3");
sb.append("&eipAddr=137.64.180.76");
sb.append("&trafficDirection=1");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client =HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);

System.out.println("In QueryEIPTopNConvTest:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);

// Add OpenID to the header.
Map<String,String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryEIPTopNConv(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}

The returned result is as follows:

{
"code": 0, 
"data": [
{
"lastCollectTime": 1445345640000, 
"eipDirectionType": 0, 
"appName": "Other", 
"appDesc": null, 
"carrierID": null, 
"carrierName": null, 
"customerID": null, 
"customerName": null, 
"carGroupID": null, 
"carGroupName": null, 
"totalBytes": 47701000, 
"totalPackets": 3162000, 
"trafficOrder": 1, 
"trafficOrderPercent": 84.99
}, 
{
"lastCollectTime": 1445345640000, 
"eipDirectionType": 2, 
"appName": "time", 
"appDesc": "time protocol service",
"carrierID": "3", 
"carrierName": "CHINA MOBILE", 
"customerID": "675", 
"customerName": "Customer_326", 
"carGroupID": "1675", 
"carGroupName": "CarGroup_326", 
"totalBytes": 3079000, 
"totalPackets": 173000, 
"trafficOrder": 2, 
"trafficOrderPercent": 5.49
}
// Other data is skipped here.
], 
"description": "Operation success."
}

EIP Information Notification Interface

Function

This interface is used by the VPC to notify eSight of the EIP information in a cloud DC scenario.

URI

/rest/openapi/network/nta/eip

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the login interface to obtain the value of this parameter.

changeType

Mandatory

Request entity parameter list

String

Indicates the notification message type. The options are as follows:

ADD: add

DELETE: delete

id

Mandatory

Request entity parameter list

String

Indicates the EIP ID.

publicIpAddress

Mandatory

Request entity parameter list

String

Indicates the public IP address, which is a valid IPv4 address.

createBandwidth

Optional

Request entity parameter list

boolean

Indicates whether to create bandwidth.

billing

Optional

Request entity parameter list

boolean

Indicates whether there is an order.

type

Mandatory

Request entity parameter list

String

Indicates the type. The options include BGP, MOBILE, TELCOM, UNION, and dual-line.

privateIpAddress

Mandatory

Request entity parameter list

String

Indicates the private IP address.

portId

Optional

Request entity parameter list

String

Indicates the port ID.

status

Optional

Request entity parameter list

String

Indicates the status. The options are as follows: ACTIVE, DOWN, ERROR.

profile

Optional

Request entity parameter list

Dictionary

Indicates the extended public IP address field.

tenantId

Mandatory

Request entity parameter list

String

Indicates the tenant ID corresponding to the EIP.

createTime

Optional

Request entity parameter list

String

Indicates the time when the EIP is created.

bandwidthId

Mandatory

Request entity parameter list

String

Indicates the bandwidth ID corresponding to the EIP.

bandwidthType

Optional

Request entity parameter list

String

Indicates the bandwidth type.

bandwidthNum

Optional

Request entity parameter list

Int

Indicates the bandwidth size.

name

Optional

Request entity parameter list

String

Indicates the bandwidth name.

size

Optional

Request entity parameter list

String

Indicates the bandwidth represent by a character string.

shareType

Optional

Request entity parameter list

String

Indicates the bandwidth sharing type.

userId

Optional

Request entity parameter list

String

Indicates the user ID.

orderId

Optional

Request entity parameter list

String

Indicates the order ID.

productId

Optional

Request entity parameter list

String

Indicates the product ID.

regionId

Optional

Request entity parameter list

String

Indicates the region ID.

Request Example

curl -i -k -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' -H 'openid: fc18c7cd4cc0d5a262ce8049d78daedb6570990c1a472e53' -X post -d'{"vpcrestdata": {"changeType":"ADD","id":"tt123","publicIpAddress":"10.10.10.10","type":"BGP","privateIpAddress":"17.17.17.17","tenantId":"testTent","bandwidthId":"bandwidthId002"}}' https://10.120.66.130:32102/rest/openapi/network/nta/eip

Result

Field

Value Type

Description

code

Int

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed

data

List

The field is displayed as null.

description

String

Indicates the description of the interface invoking result.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 57

{"code":0,"data":null,"description":"Operation success."}

Precautions

This interface is used by the VPC only in a cloud DC scenario where EIP information is changed. Concurrency is not supported.

Example

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.Login;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

public class NotifyEIPInfo
{
    private static final String NTA_EIP = "/rest/openapi/network/nta/eip";
    public static void main(final String[] args)
        throws Exception
    {
        Login.login();
        NotifyEIPfromVPC();
    }
    public static void NotifyEIPfromVPC()
        throws Exception
    {
        //set the URL and method
        final String openidURL = NTA_EIP;
        final String method = "POST";
        //set headers
        final BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        // eip json data
        final String jsonStr =
            "{\"changeType\":\"ADD\",\"id\":\"123\",\"publicIpAddress\":\"10.135.18.22\",\"type\":\"bgp\",\"privateIpAddress\":\"192.168.18.223\",\"tenantId\":\"testTent\",\"bandwidthId\":\"testBandwidth\"}";
        //set parameters        
        final BasicNameValuePair[] parameters = {new BasicNameValuePair("vpcrestdata", jsonStr)};
        //send the request
        final HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        final String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

The returned result is as follows:

{
    https://10.137.59.61:32102/rest/openapi/network/nta/eip
    {"code":0,"data":null,"description":"Operation success."}
}

Rate Limit Group Information Notification Interface

Function

This interface is used by the VPC to notify eSight of the rate limit group information in a cloud DC scenario.

URI

/rest/openapi/network/nta/cargroup

Access Method

POST

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session ID, which is used for Open API authentication.

NOTE:

A third-party system invokes the login interface to obtain the value of this parameter.

changeType

Mandatory

Request entity parameter list

String

Indicates the notification message type. The options are as follows:

ADD: add

UPDATE: update

DELETE: delete

id

Mandatory

Request entity parameter list

String

Indicates the bandwidth ID.

name

Mandatory

Request entity parameter list

String

Indicates the bandwidth name (rate limit group name).

size

Mandatory

Request entity parameter list

int

Indicates the bandwidth size. The unit is MB.

bandwidthType

Mandatory

Request entity parameter list

String

Indicates the bandwidth type. The options are as follows: telecom, unicom, double, bgp.

shareType

Optional

Request entity parameter list

String

Indicates the bandwidth sharing type. The options are as follows: PER (not sharing) and WHOLE (sharing).

publicIpIds

Optional

Request entity parameter list

List[Dictionary]

Indicates the bandwidth-associated public IP attribute.

billingInfo

Optional

Request entity parameter list

String

Indicates the order billing attribute (EP field).

tenantId

Mandatory

Request entity parameter list

String

Indicates the tenant ID corresponding to the bandwidth.

Request Example

curl -i -k -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' -H 'openid: e296f52a3fda3e18d9dcde5a17898671e2958c8fbeb3675e' -X post -d'{"vpcrestdata": {"changeType":"ADD","id":"456","name":"cargroup1","size":"12","bandwidthType":"bgp","tenantId":"Testuser"}}' https://10.120.66.130:32102/rest/openapi/network/nta/cargroup

Result

Field

Value Type

Description

code

Int

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed

data

List

The field is displayed as null.

description

String

Indicates the description of the interface invoking result.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 57
{"code":0,"data":null,"description":"Operation success."}

Precautions

This interface is used by the VPC only in a cloud DC scenario where the rate limit group information is changed. Concurrency is not supported.

Example

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.Login;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

public class NotifyCarGroupInfo
{
    private static final String NTA_CARGP = "/rest/openapi/network/nta/cargroup";
    public static void main(final String[] args)
        throws Exception
    {
        Login.login();
        NotifyCarGroupfromVPC();
    }
    public static void NotifyCarGroupfromVPC()
        throws Exception
    {
        //set the URL and method
        final String openidURL = NTA_CARGP;
        final String method = "POST";
        //set headers
        final BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        // eip json data
        final String jsonStr =
            "{\"changeType\":\"ADD\",\"id\":\"456\",\"name\":\"cargroup1\",\"size\":\"12\",\"bandwidthType\":\"bgp\",\"tenantId\":\"Testuser\"}";
        //set parameters        
        final BasicNameValuePair[] parameters = {new BasicNameValuePair("vpcrestdata", jsonStr)};
        //send the request
        final HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        final String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

The returned result is as follows:

{
    https://10.137.59.61:32102/rest/openapi/network/nta/cargroup
    {"code":0,"data":null,"description":"Operation success."}
}

Querying the Number of Clients of WLAN Top N Applications

Function

This interface is used to query the number of clients of WLAN top N applications.

URI

/rest/openapi/nta/wlan/top10AppByClientCount

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request header parameter list

String

Indicates the session ID, which is used for open API authentication.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

deviceid

Optional

Request entity parameter list

String

Indicates the device ID, which is the identifier of an NTA subsystem. This parameter indicates the device ID returned when the device information is queried.

topnValue

Mandatory

Request entity parameter list

String

1 to 10

beginTime

Mandatory

Request entity parameter list

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

Mandatory

Request entity parameter list

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

trafficDirection

Mandatory

Request entity parameter list

String

Indicates the traffic direction. The options include 0 (upstream), 1 (downstream), and 2 (upstream or downstream).

Request Example

curl -X get -k -H 'openid: e296f52a3fda3e18d9dcde5a17898671e2958c8fbeb3675e' -i 'https://10.120.66.130:32102/rest/openapi/nta/wlan/top10AppByClientCount?topnValue=5&trafficDirection=0&beginTime=1531816200001&endTime=1531816250000'

Result

Field

Value Type

Description

code

int

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed

data

String

Indicates the queried application information, which is in the JSON format.

description

String

Indicates the description of the interface invoking result.

The following table lists the fields contained in the data object.

Field

Value Type

Description

page_size

int

Indicates the number of records on the current page.

total_page

int

Indicates the total pages of records that meet search criteria.

current_page

int

Indicate the current page, which starts from 1.

app_infos

List<AppInfo>

Indicates the application list.

The following table lists the fields contained in the AppInfo object.

Field

Value Type

Description

clientnum

int

Indicates the number of clients.

appid

int

Indicates the application index.

appname

String

Indicates the application name.

appdesc

String

Indicates the application description.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 526

{"code":0,"data":{"app_infos":[{"clientnum":603,"appsid":10001812,"appsname":"radius","appsdesc":"Remote Authentication Dial In User Service (RADIUS)"},{"clientnum":526,"appsid":10001813,"appsname":"radius","appsdesc":"RADIUS Accounting"},{"clientnum":456,"appsid":10001814,"appsname":null,"appsdesc":null},{"clientnum":399,"appsid":10001815,"appsname":null,"appsdesc":null},{"clientnum":333,"appsid":10001816,"appsname":null,"appsdesc":null}],"total_page":1,"current_page":1,"page_size":5},"description":"Operation success."}

Precautions

Concurrency is not supported. Only data of one year can be queried.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;

public class QueryEIPTopNTrafficDemo
{
public static String queryEIPTopNTraffic(String ip, int port, Map<String, String>header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://").append(ip).append(":").append(port).append("/rest/openapi/nta/wlan/top10AppByClientCount");
sb.append("?");
sb.append("topnValue=10");
sb.append("&deviceid=1");
sb.append("&beginTime=1531816200000");
sb.append("&endTime=1531847700000");
sb.append("&trafficDirection=0");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);
System.out.println("In QueryEIPTopNTrafficTest:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryEIPTopNTraffic(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}
The returned result is as follows:
{
  "code": 0,
  "data": {
    "app_infos": [
      {
        "clientnum": 2,
        "appid": 70000069,
        "appname": "BT",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000042,
        "appname": "qqdownload",
        "appdesc": "A download manager and BitTorrent client"
      },
      {
        "clientnum": 1,
        "appid": 70000062,
        "appname": "uusee",
        "appdesc": "A piece of IPTV software"
      },
      {
        "clientnum": 1,
        "appid": 70000070,
        "appname": "BaiBao",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000072,
        "appname": "POCO",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000073,
        "appname": "Fring_VoIP",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000074,
        "appname": "KuGoo",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000075,
        "appname": "PPGou",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000076,
        "appname": "TVAnts",
        "appdesc": ""
      },
      {
        "clientnum": 1,
        "appid": 70000077,
        "appname": "Soulseek",
        "appdesc": ""
      }
    ],
    "total_page": 1,
    "current_page": 1,
    "page_size": 10
  },
  "description": "Operation success."
}

Querying WLAN Top N Application Traffic

Function

This interface is used to query WLAN top N application traffic.

URI

/rest/openapi/nta/wlan/top10AppByTraffic

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request header parameter list

String

Indicates the session ID, which is used for open API authentication.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

topnValue

Mandatory

Request entity parameter list

String

1 to 10

beginTime

Mandatory

Request entity parameter list

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

Mandatory

Request entity parameter list

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

trafficDirection

Mandatory

Request entity parameter list

String

Indicates the traffic direction. The options include 0 (upstream), 1 (downstream), and 2 (upstream or downstream).

Request Example

curl -X get -k -H 'openid: e296f52a3fda3e18d9dcde5a17898671e2958c8fbeb3675e' -i 'https://10.120.66.130:32102/rest/openapi/nta/wlan/top10AppByTraffic?topnValue=5&trafficDirection=0&beginTime=1534937940000&endTime=1534938180000'

Result

Field

Value Type

Description

code

int

Indicates the operation return code. The options are as follows:

  • 0: successful
  • Others: failed

data

List<AppTrafficData>

Indicates the queried application information, which is in the JSON format.

description

String

Indicates the description of the interface invoking result.

The following table lists the fields contained in the AppTrafficData object.

Field

Value Type

Description

appName

String

Indicates the application name.

appDesc

String

Indicates the application description.

totalBytes

long

Indicates the total number of bytes in a specified range.

totalPackets

long

Indicates the total number of packets in a specified range.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 516

{"code":0,"data":[{"appName":"Fring_VoIP","appDesc":null,"totalBytes":14002000,"totalPackets":2800400},{"appName":"PPGou","appDesc":null,"totalBytes":13000000,"totalPackets":2600000},{"appName":"BaiBao","appDesc":null,"totalBytes":12001000,"totalPackets":2400200},{"appName":"DirectConnect","appDesc":null,"totalBytes":11001000,"totalPackets":2200200},{"appName":"ppstream","appDesc":"A piece of P2P streaming video network software","totalBytes":11001000,"totalPackets":2200200}],"description":"Operation success."}

Precautions

Concurrency is not supported. You cannot query data in a time span exceeding one year.

Example

package com.huawei.esight.openapi.demo.rest;

import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import com.huawei.esight.openapi.demo.client.HttpClientUtil;
import com.huawei.esight.openapi.demo.client.HttpMethod;
import com.huawei.esight.openapi.demo.client.ParseResponse;

public class QueryTopNAppTrafficDemo
{
public static String queryTopNAppTraffic(String ip, int port, Map<String, String>header) throws Exception
{ 
StringBuffer sb = new StringBuffer();
sb.append("https://").append(ip).append(":").append(port).append("/rest/openapi/nta/wlan/top10AppByTraffic");
sb.append("?");
sb.append("topnValue=10");
sb.append("&beginTime=1531816200000");
sb.append("&endTime=1531847700000");
sb.append("&trafficDirection=0");

String url= sb.toString();
HttpRequestBase request = HttpClientUtil.createHttpRequest(url,HttpMethod.GET, null, header);

HttpClient client = HttpClientUtil.getHttpClient(port);
HttpResponse response = client.execute(request);
Map<String, String> result =ParseResponse.parseResponse(response);
System.out.println("In queryTopNAppTraffic:" + result);
return result.get("data");
}
public static void main(String[] args) throws Exception
{
String openId = GetOpenIdDemo.getOpenId(Constants.SERVER_IP, Constants.SERVER_PORT,Constants.LOGIN_INFO);
Map<String, String> header = new HashMap<String, String>();
header.put("openid", openId);

System.out.println(queryTopNAppTraffic(Constants.SERVER_IP,Constants.SERVER_PORT, header));
}
}
The returned result is as follows:
{
"code": 0,
  "data": [
    {
      "appName": "POCO",
      "appDesc": "",
      "totalBytes": 18000000,
      "totalPackets": 3600000
    },
    {
      "appName": "ppstream",
      "appDesc": "Free-of-charge P2P video software",
      "totalBytes": 18000000,
      "totalPackets": 3600000
    },
    {
      "appName": "PPGou",
      "appDesc": "",
      "totalBytes": 16000000,
      "totalPackets": 3200000
    },
    {
      "appName": "Fring_VoIP",
      "appDesc": "",
      "totalBytes": 14000000,
      "totalPackets": 2800000
    },
    {
      "appName": "KuGoo",
      "appDesc": "",
      "totalBytes": 14000000,
      "totalPackets": 2800000
    },
    {
      "appName": "BaiBao",
      "appDesc": "",
      "totalBytes": 12000000,
      "totalPackets": 2400000
    },
    {
      "appName": "DirectConnect",
      "appDesc": "",
      "totalBytes": 6000000,
      "totalPackets": 1200000
    }
  ],
  "description": "Operation success."
}
Translation
Download
Updated: 2019-10-30

Document ID: EDOC1100044386

Views: 15311

Downloads: 83

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next