Skip to content
Snippets Groups Projects
Commit 9b9d95d6 authored by Edileuton Henrique de Oliveira's avatar Edileuton Henrique de Oliveira
Browse files

webservice: Add setNetUsage function

parent 2db69091
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of datasid
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# set PREFIX
export PREFIX="$(readlink -f "$(dirname $0)/../../")"
# run datasid-common.sh
source "$(readlink -f "$(dirname $0)/../..")/bin/datasid-common.sh" || exit 1
if test -z "${PREFIX}"; then
exit 2
fi
echo "${VERSION}"
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of collect-agent
#
# collect-agent is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
for interface in $(/sbin/ifconfig -s 2>/dev/null | awk '!/Iface/ {print $1}' | sort -u); do
if test "$interface" != "lo"; then
mac=$(/sbin/ifconfig "$interface" 2>/dev/null | awk '/HW/ {print $NF}; /ether/ {print $2}')
newTag="<interface name=\"$interface\" mac-address=\"$mac\"/>"
tags="$tags$newTag"
fi
done
printf "${tags}\n"
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of collect-agent
#
# collect-agent is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# set PREFIX
export PREFIX="$(readlink -f "$(dirname $0)/../../")"
# run datasid-common.sh
bash "$(readlink -f "$(dirname $0)/../../")/bin/datasid-common.sh" || exit 1
if test -z "${PREFIX}"; then
exit 2
fi
# Check if telecentroInfo exists
test -f ${CONFDIR}/telecentroInfo || exit 3
# Collect telecentro id
grep "datasid" ${CONFDIR}/telecentroInfo | awk -F'=' '{print $2}'
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of collect-agent
#
# collect-agent is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#------------------------------------------------------------------------------
# Function: increment_time
# Increment the time counter by 5 minutes
function increment_time()
{
TRAFFIC_MINUTE=$((TRAFFIC_MINUTE + 5))
if test $TRAFFIC_MINUTE -ge 60; then
TRAFFIC_HOUR=$((TRAFFIC_HOUR + 1))
TRAFFIC_MINUTE=2
fi
}
# Function: xml_print
# Function that prints the contents of XML when there are collected
# data. Print the statistics according to the collection.
function xml_print()
{
local TRAFFIC_TIME=$(printf "%02d:%02d:30" $TRAFFIC_HOUR $TRAFFIC_MINUTE)
printf "<netuse id=\"$((COUNT+1))\">"
printf "<date value=\"$TRAFFIC_DATE\" type=\"string\"/>"
printf "<time value=\"$TRAFFIC_TIME\" type=\"string\"/>"
printf "<rx>"
printf "<packets value=\"$(awk '{ print $2 }' <<< $line)\" type=\"int\"/>"
printf "<bytes value=\"$(awk '{ print $3 }' <<< $line)\" type=\"int\"/>"
printf "</rx>"
printf "<tx>"
printf "<packets value=\"$(awk '{ print $4 }' <<< $line)\" type=\"int\"/>"
printf "<bytes value=\"$(awk '{ print $5 }' <<< $line)\" type=\"int\"/>"
printf "</tx>"
printf "</netuse>"
}
# Function: xml_data_generator
# This function compares the file date of the last day of collection
# data with the current date and, if they are equal, generates the
# data to the XML file.
function xml_data_generator()
{
local CURRENT_TIMESTAMP=$(date -d"$(date +%F)" +%s)
local TRAFFIC_TIMESTAMP=$(date -d"$(head -n1 $TRAFFIC)" +%s)
# Check if date in TRAFFIC file aint older than 15 days
if test $TRAFFIC_TIMESTAMP -ge $(($CURRENT_TIMESTAMP - 1296000)); then
# Since we want the mean time between the five minutes intervals,
# the minute counter starts at 2 and gets 5 minutes increments.
# Also the "seconds counter" is fixed at 30. So we always get
# something like HH:2:30 or HH:7:30 (mean times).
#
# Example: if interval = 10:15~10:20 => mean = 10:17:30
TRAFFIC_HOUR=0
TRAFFIC_MINUTE=2
COUNT=-1
while read line; do
# Check if its the first line (containing the date)
if test $COUNT -eq -1; then
TRAFFIC_DATE=$(head -1 $TRAFFIC)
COUNT=$((${COUNT} + 1))
else
INTERVALID=$(cut -d" " -f1 <<< $line)
if test $COUNT -eq $INTERVALID -a $COUNT -lt 288; then
xml_print
COUNT=$((${COUNT} + 1))
increment_time
fi
fi
done < $TRAFFIC
else
# If date in TRAFFIC file is older than 15 days then remove the file.
rm -f $TRAFFIC
fi
printf "\n"
}
# ------------------------------------------------------------------------------
# set PREFIX
export PREFIX="$(readlink -f "$(dirname $0)/../")"
# run datasid-common.sh
source "$(readlink -f "$(dirname $0)")/datasid-common.sh" || exit 1
if test -z "${PREFIX}"; then
date +"%F %T - ERROR: Prefix not set."
exit 2
fi
# If it's the first execution, do not collect network data and exit
if test "${FIRST_EXECUTION}"; then
exit 0
fi
TRAFFICS="${DATADIR}/previous"
test -d ${TRAFFICS} || exit 0
# Call the function xml_data_generator to generate the data to XML
for TRAFFIC in $(ls -r ${TRAFFICS})
do
if test -s $TRAFFIC; then
xml_data_generator
fi
done
...@@ -42,8 +42,10 @@ import javax.xml.validation.SchemaFactory; ...@@ -42,8 +42,10 @@ import javax.xml.validation.SchemaFactory;
public class DataSID { public class DataSID {
private static final String SA_INVENTORY = "sidtb00_sa_inventory"; private static final String SA_INVENTORY = "sidtb00_sa_inventory";
private static final String SA_NET_USAGE = "sidtb00_sa_net_usage";
private static final File XML_SCHEMA = new File("/home/datasid/apache-tomcat/webapps/axis2/WEB-INF/collected-data.xsd"); private static final File XML_INVENTORY_SCHEMA = new File("/home/datasid/apache-tomcat/webapps/axis2/WEB-INF/collected-data.xsd");
private static final File XML_NET_USAGE_SCHEMA = new File("/home/datasid/apache-tomcat/webapps/axis2/WEB-INF/net-collected-data.xsd");
private static final String AGENT_VERSION = "1.0.0"; private static final String AGENT_VERSION = "1.0.0";
private static final String AGENT_UPDATE_LINK = "http://bisid.c3sl.ufpr.br/download/datasid-1.0.0-update.run"; private static final String AGENT_UPDATE_LINK = "http://bisid.c3sl.ufpr.br/download/datasid-1.0.0-update.run";
...@@ -136,7 +138,7 @@ public class DataSID { ...@@ -136,7 +138,7 @@ public class DataSID {
throw new Exception("Failed to get a database connection!"); throw new Exception("Failed to get a database connection!");
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = factory.newSchema(XML_SCHEMA); Schema schema = factory.newSchema(XML_INVENTORY_SCHEMA);
JAXBContext context = JAXBContext.newInstance("br.ufpr.c3sl.datasid"); JAXBContext context = JAXBContext.newInstance("br.ufpr.c3sl.datasid");
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
...@@ -188,14 +190,73 @@ public class DataSID { ...@@ -188,14 +190,73 @@ public class DataSID {
} }
/**
* Receive an XML string which has the inventory data to be parsed and
* inserted into database. Return "Success" string if insertion operation
* is successful. Any other errors will throw exceptions.
*
* @author Eduardo Luis Buratti
* @param xmlData XML string of inventory
* @return String
*/
public static String setNetUsage(String xmlData)
{
try {
InitialContext cxt = new InitialContext();
DataSource ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/datasid");
if (ds == null)
throw new Exception("Data source not found!");
Connection con = ds.getConnection();
if (con == null)
throw new Exception("Failed to get a database connection!");
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = factory.newSchema(XML_NET_USAGE_SCHEMA);
JAXBContext context = JAXBContext.newInstance("br.ufpr.c3sl.datasid");
Unmarshaller unmarshaller = context.createUnmarshaller();
unmarshaller.setSchema(schema);
// Strip spaces in the beginning of the xml
xmlData = xmlData.replaceAll("^\\s+", "");
// transform the xml string into a InputStream
InputStream is = new ByteArrayInputStream(xmlData.getBytes());
// Decode the XML into a Java Object
JAXBElement<NetCollectedData> element = (JAXBElement<NetCollectedData>) unmarshaller.unmarshal(is);
NetCollectedData collected = element.getValue();
PreparedStatement st = createNetUsageStatement(con, collected);
st.executeUpdate();
con.close();
return "Success";
} catch (Exception e) {
log(ERROR, e.getMessage() + " " + xmlData);
e.printStackTrace();
return "ERROR: " + e.getMessage();
}
}
private static PreparedStatement createInventoryStatement(Connection con, CollectedData collectedData) throws SQLException { private static PreparedStatement createInventoryStatement(Connection con, CollectedData collectedData) throws SQLException {
final String query = "INSERT INTO " + SA_INVENTORY + " " + final String query = "INSERT INTO " + SA_INVENTORY + " " +
"(sa_contact_date, sa_gesacid, sa_machine, sa_versao, " + "(sa_contact_date, sa_telecentro_id, sa_versao, sa_machine, sa_machine_type, " +
"sa_admin_name, sa_admin_phone, sa_tl_name, " +
"sa_tl_phone, sa_state, sa_city, " +
"sa_tl_street, sa_tl_number, sa_zipcode, " +
"sa_tl_neighborhood, sa_geolocation, sa_mirrors_timestamp, " +
"sa_hd_model, sa_hd_size, sa_hd_used, " + "sa_hd_model, sa_hd_size, sa_hd_used, " +
"sa_hd2_model, sa_hd2_size, sa_hd2_used, " + "sa_hd2_model, sa_hd2_size, sa_hd2_used, " +
"sa_extra_hds, sa_memory_size, sa_processor, " + "sa_extra_hds, sa_memory_size, sa_processor, " +
"sa_os_type, sa_os_distro, sa_kernel) VALUES " + "sa_os_type, sa_os_distro, sa_kernel) VALUES " +
"(?, ?, ?, ?, " + "(?, ?, ?, ?, ?, " +
"?, ?, ?, " +
"?, ?, ?, " +
"?, ?, ?, " +
"?, ?, ?, " +
"?, ?, ?, " + "?, ?, ?, " +
"?, ?, ?, " + "?, ?, ?, " +
"?, ?, ?, " + "?, ?, ?, " +
...@@ -207,13 +268,14 @@ public class DataSID { ...@@ -207,13 +268,14 @@ public class DataSID {
Inventory inventory = collectedData.getInventory(); Inventory inventory = collectedData.getInventory();
List<Disk> disks = inventory.getDisks().getDisk(); List<Disk> disks = inventory.getDisks().getDisk();
TeleCentroInfo teleCentroInfo = collectedData.getTelecentroInfo();
// sa_contact_date = current date // sa_contact_date = current date
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
st.setDate(1, new java.sql.Date(cal.getTimeInMillis())); st.setDate(1, new java.sql.Date(cal.getTimeInMillis()));
// sa_gesacid // sa_telecentro_id
st.setInt(2, collectedData.getGesacid().intValue()); st.setString(2, teleCentroInfo.getDatasid());
// sa_machine // sa_machine
org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject(); org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject();
...@@ -224,53 +286,125 @@ public class DataSID { ...@@ -224,53 +286,125 @@ public class DataSID {
// sa_versao // sa_versao
st.setString(4, collectedData.getAgentVersion()); st.setString(4, collectedData.getAgentVersion());
// sa_machine_type
if(collectedData.getMachineType().compareTo("client") == 0)
st.setInt(5, 0);
else
st.setInt(5, 1);
// sa_admin_name
st.setString(6, teleCentroInfo.getAdminName());
// sa_admin_phone
st.setString(7, teleCentroInfo.getAdminPhone());
// sa_tl_name
st.setString(8, teleCentroInfo.getTlName());
// sa_tl_phone
st.setString(9, teleCentroInfo.getTlPhone());
// sa_state
st.setString(10, teleCentroInfo.getState());
// sa_city
st.setString(11, teleCentroInfo.getCity());
// sa_tl_street
st.setString(12, teleCentroInfo.getTlStreet());
// sa_tl_number
st.setString(13, teleCentroInfo.getTlNumber());
// sa_tl_zipcode
st.setString(14, teleCentroInfo.getTlZipcode());
// sa_tl_neighborhood
st.setString(15, teleCentroInfo.getTlNeighborhood());
// sa_geolocation
st.setString(16, teleCentroInfo.getGeolocation());
// sa_mirrors_timestamp
st.setString(17, collectedData.getMirrorsTimestamp());
// sa_hd_model // sa_hd_model
st.setString(5, disks.get(0).getModel()); st.setString(18, disks.get(0).getModel());
// sa_hd_size // sa_hd_size
st.setInt(6, disks.get(0).getSize().intValue()); st.setInt(19, disks.get(0).getSize().intValue());
// sa_hd_used // sa_hd_used
st.setInt(7, disks.get(0).getUsed().intValue()); st.setInt(20, disks.get(0).getUsed().intValue());
if (disks.size() > 1) { if (disks.size() > 1) {
// sa_hd2_model // sa_hd2_model
st.setString(8, disks.get(1).getModel()); st.setString(18, disks.get(1).getModel());
// sa_hd2_size // sa_hd2_size
st.setInt(9, disks.get(1).getSize().intValue()); st.setInt(19, disks.get(1).getSize().intValue());
// sa_hd2_used // sa_hd2_used
st.setInt(10, disks.get(1).getUsed().intValue()); st.setInt(20, disks.get(1).getUsed().intValue());
} }
else { else {
// sa_hd2_model // sa_hd2_model
st.setNull(8, Types.VARCHAR); st.setNull(18, Types.VARCHAR);
// sa_hd2_size // sa_hd2_size
st.setNull(9, Types.INTEGER); st.setNull(19, Types.INTEGER);
// sa_hd2_used // sa_hd2_used
st.setNull(10, Types.INTEGER); st.setNull(20, Types.INTEGER);
} }
// sa_extra_hds // sa_extra_hds
st.setInt(11, (disks.size() > 2) ? (disks.size() - 2) : 0); st.setInt(21, (disks.size() > 2) ? (disks.size() - 2) : 0);
// sa_memory_size // sa_memory_size
st.setInt(12, inventory.getMemory().intValue()); st.setInt(22, inventory.getMemory().intValue());
// sa_processor // sa_processor
st.setString(13, inventory.getProcessor()); st.setString(23, inventory.getProcessor());
// sa_os_type // sa_os_type
st.setString(14, inventory.getOs()); st.setString(24, inventory.getOs());
// sa_os_distro // sa_os_distro
st.setString(15, inventory.getDistro()); st.setString(25, inventory.getDistro());
// sa_kernel // sa_kernel
st.setString(16, inventory.getKernel()); st.setString(26, inventory.getKernel());
return st;
}
private static PreparedStatement createNetUsageStatement(Connection con, NetCollectedData netCollectedData) throws SQLException {
final String query = "INSERT INTO " + SA_NET_USAGE + " " +
"(sa_contact_date, sa_telecentro_id, sa_versao, sa_machine) VALUES " +
"(?, ?, ?, ?);";
PreparedStatement st = con.prepareStatement(query);
List<Interface> interfaces = netCollectedData.getInterfaces().getInterface();
// sa_contact_date = current date
Calendar cal = Calendar.getInstance();
st.setDate(1, new java.sql.Date(cal.getTimeInMillis()));
// sa_telecentro_id
st.setString(2, netCollectedData.getTelecentroId());
// sa_machine
org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject();
macaddr.setType("macaddr");
macaddr.setValue(interfaces.get(0).getMacAddress());
st.setObject(3, macaddr);
// sa_versao
st.setString(4, netCollectedData.getAgentVersion());
return st; return st;
} }
......
all: DataSID.aar all: DataSID.aar
DataSID.aar: classes/br/ufpr/c3sl/datasid/DataSID.class collected-data.xsd services.xml DataSID.aar: classes/br/ufpr/c3sl/datasid/DataSID.class collected-data.xsd net-collected-data.xsd services.xml
@mkdir -p pkg/META-INF @mkdir -p pkg/META-INF
cp collected-data.xsd services.xml pkg/META-INF/ cp collected-data.xsd services.xml pkg/META-INF/
cp net-collected-data.xsd services.xml pkg/META-INF/
cp -r classes/* pkg/ cp -r classes/* pkg/
jar cvf $@ -C pkg . jar cvf $@ -C pkg .
classes/br/ufpr/c3sl/datasid/DataSID.class: DataSID.java classes/br/ufpr/c3sl/datasid/CollectedData.class classes/br/ufpr/c3sl/datasid/DataSID.class: DataSID.java classes/br/ufpr/c3sl/datasid/CollectedData.class
javac -source 6 -target 6 -classpath postgresql-9.2-1002.jdbc4.jar:classes -d classes $< javac -source 6 -target 6 -classpath postgresql-9.2-1002.jdbc4.jar:classes -d classes $<
classes/br/ufpr/c3sl/datasid/CollectedData.class: generated/br/ufpr/c3sl/datasid/CollectedData.java classes/br/ufpr/c3sl/datasid/CollectedData.class: generated/br/ufpr/c3sl/datasid/CollectedData.java generated/br/ufpr/c3sl/datasid/NetCollectedData.java
@mkdir -p classes @mkdir -p classes
javac -source 6 -target 6 -sourcepath generated -d classes generated/br/ufpr/c3sl/datasid/*.java javac -source 6 -target 6 -sourcepath generated -d classes generated/br/ufpr/c3sl/datasid/*.java
...@@ -17,6 +18,10 @@ generated/br/ufpr/c3sl/datasid/CollectedData.java: collected-data.xsd ...@@ -17,6 +18,10 @@ generated/br/ufpr/c3sl/datasid/CollectedData.java: collected-data.xsd
@mkdir -p generated @mkdir -p generated
xjc -d generated -p br.ufpr.c3sl.datasid $< xjc -d generated -p br.ufpr.c3sl.datasid $<
generated/br/ufpr/c3sl/datasid/NetCollectedData.java: net-collected-data.xsd
@mkdir -p generated
xjc -d generated -p br.ufpr.c3sl.datasid $<
clean: clean:
rm -rf generated rm -rf generated
rm -rf classes rm -rf classes
......
...@@ -5,17 +5,18 @@ ...@@ -5,17 +5,18 @@
<xsd:complexType name="CollectedData"> <xsd:complexType name="CollectedData">
<xsd:all> <xsd:all>
<xsd:element name="agent-version" type="xsd:string" minOccurs="1" /> <xsd:element name="agent-version" type="xsd:string" minOccurs="1" />
<xsd:element name="gesacid" type="xsd:integer" minOccurs="1" /> <xsd:element name="telecentro-info" type="TeleCentroInfo" minOccurs="1" />
<xsd:element name="interfaces" type="Interfaces" minOccurs="1" /> <xsd:element name="interfaces" type="Interfaces" minOccurs="1" />
<xsd:element name="machine-type" minOccurs="1"> <xsd:element name="machine-type" minOccurs="1">
<xsd:simpleType> <xsd:simpleType>
<xsd:restriction base="xsd:string"> <xsd:restriction base="xsd:string">
<xsd:pattern value="client|server|neither"/> <xsd:pattern value="client|server"/>
</xsd:restriction> </xsd:restriction>
</xsd:simpleType> </xsd:simpleType>
</xsd:element> </xsd:element>
<xsd:element name="inventory" type="Inventory" minOccurs="1" /> <xsd:element name="inventory" type="Inventory" minOccurs="1" />
<xsd:element name="user-history" type="UserHistory" minOccurs="1" /> <xsd:element name="user-history" type="UserHistory" minOccurs="1" />
<xsd:element name="mirrors-timestamp" type="xsd:string" minOccurs="1" />
</xsd:all> </xsd:all>
</xsd:complexType> </xsd:complexType>
...@@ -70,4 +71,21 @@ ...@@ -70,4 +71,21 @@
<xsd:element name="logout" type="xsd:string" /> <xsd:element name="logout" type="xsd:string" />
</xsd:all> </xsd:all>
</xsd:complexType> </xsd:complexType>
<xsd:complexType name="TeleCentroInfo">
<xsd:all>
<xsd:element name="admin_name" type="xsd:string" />
<xsd:element name="admin_phone" type="xsd:string" />
<xsd:element name="tl_name" type="xsd:string" />
<xsd:element name="tl_phone" type="xsd:string" />
<xsd:element name="state" type="xsd:string" />
<xsd:element name="city" type="xsd:string" />
<xsd:element name="tl_street" type="xsd:string" />
<xsd:element name="tl_number" type="xsd:string" />
<xsd:element name="tl_zipcode" type="xsd:string" />
<xsd:element name="tl_neighborhood" type="xsd:string" />
<xsd:element name="geolocation" type="xsd:string" />
<xsd:element name="datasid" type="xsd:string" />
</xsd:all>
</xsd:complexType>
</xsd:schema> </xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="net-collected-data" type="NetCollectedData" />
<xsd:complexType name="NetCollectedData">
<xsd:all>
<xsd:element name="agent-version" type="xsd:string" minOccurs="1" />
<xsd:element name="telecentro-id" type="xsd:string" minOccurs="1" />
<xsd:element name="interfaces" type="Interfaces" minOccurs="1" />
<xsd:element name="bandwidth-usage" type="BandwidthUsage" minOccurs="1" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="Interfaces">
<xsd:sequence>
<xsd:element name="interface" type="Interface" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Interface">
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="mac-address" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:complexType name="BandwidthUsage">
<xsd:sequence>
<xsd:element name="netuse" type="NetUse" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="NetUse">
<xsd:all>
<xsd:element name="rx" type="Rx" />
<xsd:element name="tx" type="Tx" />
</xsd:all>
<xsd:attribute name="date" type="xsd:string" />
<xsd:attribute name="time" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="Rx">
<xsd:attribute name="packets" type="xsd:integer" use="required" />
<xsd:attribute name="bytes" type="xsd:integer" use="required" />
</xsd:complexType>
<xsd:complexType name="Tx">
<xsd:attribute name="packets" type="xsd:integer" use="required" />
<xsd:attribute name="bytes" type="xsd:integer" use="required" />
</xsd:complexType>
</xsd:schema>
...@@ -9,4 +9,7 @@ ...@@ -9,4 +9,7 @@
<operation name="getUpdateLink"> <operation name="getUpdateLink">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation> </operation>
<operation name="setNetUsage">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
</service> </service>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment