diff options
author | Gokul Singaraju <goksing@gmail.com> | 2018-01-05 18:53:31 -0500 |
---|---|---|
committer | Gokul Singaraju <goksing@gmail.com> | 2018-01-05 18:55:46 -0500 |
commit | e9fbd4f53b79ff1f98f94e2cef1bdd78d1a8df31 (patch) | |
tree | ea7fc5c072d7cdb15335cc0b7973885151a41e53 /veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary | |
parent | 671a6705ea59791ef96568fb48bd1ab0efbc30e9 (diff) |
Implement Batch API and https
Issue-ID: VNFSDK-145
Change-Id: Id3a124d627630f27baf65c0705655a569121a7cc
Signed-Off-by: Gokul Singaraju <goksing@gmail.com>
Diffstat (limited to 'veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary')
16 files changed, 312 insertions, 101 deletions
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java index 451c5b6..2ba1db5 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java @@ -11,7 +11,7 @@ package evel_javalibrary.att.com; * * License * ------- - * Unless otherwise specified, all software contained herein is + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,11 +28,13 @@ import org.apache.log4j.Logger; import org.apache.log4j.Level; import java.io.BufferedReader; +//import java.io.BufferedReader; import java.io.BufferedWriter; +import java.io.FileInputStream; //import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; -//import java.io.InputStreamReader; +import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; @@ -40,9 +42,14 @@ import java.net.MalformedURLException; //import java.net.ProtocolException; import java.net.URL; //import java.nio.charset.StandardCharsets; - +import java.security.KeyStore; import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManagerFactory; import org.apache.log4j.BasicConfigurator; @@ -77,8 +84,12 @@ public enum EVEL_ERR_CODES { private static String url = null; private static URL vesurl = null; + private static URL vesbatchurl = null; private static HttpURLConnection con = null; private static String userpass = null; + private static String keystore_pth = null; + private static String jks_passw = null; + private static String key_passw = null; private static String version = "5"; /* RingBuffer to forward messages on sending AgentDispatcher thread */ @@ -89,7 +100,7 @@ public enum EVEL_ERR_CODES { /* AgentDispatcher loops on messages in RingBuffer and POSTs them * to external Collector */ - private static class AgentDispatcher implements Runnable { + private static class AgentDispatcher implements Runnable { private String readStream(InputStream stream) throws Exception { StringBuilder builder = new StringBuilder(); @@ -109,25 +120,61 @@ public enum EVEL_ERR_CODES { String datatosend=null; for(;;){ - if( (datatosend = (String) ringb.take()) != null ) + EvelObject tosend = ringb.take(); + if( tosend != null && ((datatosend = (String) tosend.datastr) != null)) { //process data - logger.trace(url + "Got an event size "+datatosend.length()); logger.trace(datatosend); try { //HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); - con = (HttpURLConnection) vesurl.openConnection(); + if( tosend.type == false) + con = (HttpURLConnection) vesurl.openConnection(); + else + con = (HttpURLConnection) vesbatchurl.openConnection(); + if (con instanceof HttpsURLConnection) { HttpsURLConnection httpsConnection = (HttpsURLConnection) con; - //SSLContext sc = SSLContext.getInstance("TLSv1.2"); - // Init the SSLContext with a TrustManager[] and SecureRandom() - //sc.init(null, null, new java.security.SecureRandom()); - //httpsConnection.setHostnameVerifier(getHostnameVerifier()); - //httpsConnection.setSSLSocketFactory(sc.getSocketFactory()); - con = httpsConnection; + + try { + + SSLContext sc = SSLContext.getInstance("TLSv1.2"); + /* Get the JKS contents */ + if( !keystore_pth.isEmpty() && !jks_passw.isEmpty() && !key_passw.isEmpty() ) + { + final KeyStore keyStore = KeyStore.getInstance("JKS"); + try (final InputStream is = new FileInputStream(keystore_pth)) { + keyStore.load(is, jks_passw.toCharArray()); + } + final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory + .getDefaultAlgorithm()); + kmf.init(keyStore, key_passw.toCharArray()); + final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory + .getDefaultAlgorithm()); + tmf.init(keyStore); + sc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new java.security.SecureRandom()); + } + else + { + // Init the SSLContext with a TrustManager[] and SecureRandom() + sc.init(null, null, new java.security.SecureRandom()); + } + httpsConnection.setSSLSocketFactory(sc.getSocketFactory()); + httpsConnection.setHostnameVerifier(new HostnameVerifier() + { + public boolean verify(String hostname, SSLSession session) + { + return true; + } + }); + con = httpsConnection; + + } + catch (final Exception exc) { + exc.printStackTrace(); + } } //add reuqest header @@ -242,6 +289,9 @@ public enum EVEL_ERR_CODES { String topic, String username, String password, + String keystore_path, + String jks_password, + String key_password, Level level) throws IOException { EVEL_ERR_CODES rc = EVEL_ERR_CODES.EVEL_SUCCESS; @@ -273,10 +323,15 @@ public enum EVEL_ERR_CODES { version += "/example_vnf"; } + keystore_pth = keystore_path; + jks_passw = jks_password; + key_passw = key_password; + url = event_api_url+":"+Integer.toString(port)+path+"/eventListener/v"+version; vesurl = null; try { vesurl = new URL(url); + vesbatchurl = new URL(url+"/eventBatch"); } catch (MalformedURLException e) { // TODO Auto-generated catch block logger.info("Error in url input"); @@ -317,14 +372,36 @@ public enum EVEL_ERR_CODES { * @retval boolean True On successful acceptance False on failure *****************************************************************************/ - public static boolean evel_post_event(EvelHeader obj ) + public static boolean evel_post_event(EvelHeader obj) { - String data = obj.evel_json_encode_event(); - boolean ret = ringb.put(data); + String data = obj.evel_json_encode_event().toString(); + EvelObject myobj = new EvelObject(data,false); + boolean ret = ringb.put(myobj); logger.info("Evel Post event ret:"+ret); return ret; } + /**************************************************************************//** + * Handle user formatted post message + * + * @note This function handles VES 5.x formatted messages from all valid + * Domains and stores them in RingBuffer. + * + * @param obj VES 5.x formatted user messages with common header + * and optional specialized body + * + * @retval boolean True On successful acceptance False on failure + *****************************************************************************/ + + public static boolean evel_post_event(EvelBatch obj) + { + String data = obj.evel_json_encode_event().toString(); + EvelObject myobj = new EvelObject(data,true); + boolean ret = ringb.put(myobj); + logger.info("Evel Post batch event ret:"+ret); + return ret; + } + } diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelBatch.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelBatch.java new file mode 100644 index 0000000..6db25b5 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelBatch.java @@ -0,0 +1,83 @@ +package evel_javalibrary.att.com;
+
+/**************************************************************************//**
+ * @file
+ * Evel Batch container class
+ *
+ * This file implements the Evel Mobile Flow Event class which is intended to provide a
+ * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
+ * that VNFs can use it to send Mobile flow events.
+ *
+ * License
+ * -------
+ * Unless otherwise specified, all software contained herein is
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *****************************************************************************/
+
+
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+
+
+public class EvelBatch {
+
+ ArrayList<EvelHeader> batch_events;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelScalingMeasurement.class.getName() );
+
+
+ public EvelBatch(){
+ batch_events = new ArrayList<EvelHeader>();
+ if( batch_events == null ) LOGGER.error("Unable to allocate new batch");
+ }
+
+ public boolean addEvent(EvelHeader element){
+ boolean ret = false;
+ ret = batch_events.add(element);
+ if( ret == false){
+ LOGGER.error("Unable to add batch event");
+ }
+ return ret;
+
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event header only message
+ *****************************************************************************/
+ JsonObject evel_json_encode_event()
+ {
+ JsonObjectBuilder batchobj = Json.createObjectBuilder();
+
+ if( batch_events != null && batch_events.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<batch_events.size();i++) {
+ EvelHeader el = batch_events.get(i);
+ //add Json objects
+ builder.add(el.evel_json_encode_event());
+ }
+
+ batchobj.add("eventList", builder);
+ }
+
+ return batchobj.build();
+
+ }
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java index 64f26aa..19bde72 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java @@ -38,7 +38,7 @@ import org.slf4j.helpers.MessageFormatter; public class EvelFault extends EvelHeader {
//version of EvelFault format revisions
int major_version = 2;
- int minor_version = 1;
+ int minor_version = 0;
/**************************************************************************//**
* Fault / Threshold severities.
@@ -509,7 +509,7 @@ public class EvelFault extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
//encode common event header and body
@@ -521,7 +521,7 @@ public class EvelFault extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java index 4a1a7d1..9f1d3de 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java @@ -77,8 +77,8 @@ public class EvelHeader { EVEL_MAX_PRIORITIES
}
- final int EVEL_HEADER_MAJOR_VERSION = 1;
- final int EVEL_HEADER_MINOR_VERSION = 1;
+ final int EVEL_HEADER_MAJOR_VERSION = 3;
+ final int EVEL_HEADER_MINOR_VERSION = 0;
/***************************************************************************/
/* Version */
/***************************************************************************/
@@ -704,7 +704,7 @@ public class EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event header only message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
JsonObject obj = Json.createObjectBuilder()
@@ -714,7 +714,7 @@ public class EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java index 14566e7..f07557d 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java @@ -37,7 +37,7 @@ public class EvelHeartbeatField extends EvelHeader { //version of Heartbeat field format revisions
int major_version = 1;
- int minor_version = 2;
+ int minor_version = 0;
/**************************************************************************//**
* Alert types.
@@ -192,7 +192,7 @@ public class EvelHeartbeatField extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -206,7 +206,7 @@ public class EvelHeartbeatField extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java index edbf1b5..339cb90 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java @@ -38,8 +38,8 @@ import org.apache.log4j.Logger; public class EvelMobileFlow extends EvelHeader {
- int major_version = 1;
- int minor_version = 2;
+ int major_version = 2;
+ int minor_version = 0;
static int EVEL_TOS_SUPPORTED = 256;
/**************************************************************************//**
@@ -2042,7 +2042,7 @@ public class EvelMobileFlow extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -2056,7 +2056,7 @@ public class EvelMobileFlow extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelObject.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelObject.java new file mode 100644 index 0000000..bd677e3 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelObject.java @@ -0,0 +1,41 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Object class
+ *
+ * This file implements the Evel Mobile Flow Event class which is intended to provide a
+ * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
+ * that VNFs can use it to send Mobile flow events.
+ *
+ * License
+ * -------
+ * Unless otherwise specified, all software contained herein is
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *****************************************************************************/
+
+
+public class EvelObject {
+
+ public Object datastr; // data string
+ public boolean type; //regular or batch type
+
+ public EvelObject(){
+ datastr = null;
+ type = false;
+ }
+
+ public EvelObject(String data, boolean batchtype){
+ datastr = data;
+ type = batchtype;
+ }
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java index d263743..e1bfed9 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java @@ -8,7 +8,7 @@ package evel_javalibrary.att.com; * License
* -------
* Unless otherwise specified, all software contained herein is
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java index 878ad5d..c6fe75c 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java @@ -51,7 +51,7 @@ public class EvelOther extends EvelHeader { /* Optional fields */
/***************************************************************************/
Map<String,String> additional_info;
- HashMap<String,Map<String,String>> evelmap;
+ Map<String,Map<String,String>> evelmap;
private static final Logger LOGGER = Logger.getLogger( EvelOther.class.getName() );
@@ -127,7 +127,7 @@ public class EvelOther extends EvelHeader { * @param name String Name.
* @param value String Value.
*****************************************************************************/
- public void evel_other_field_add_namedarray(String hashname, String name, String value)
+ public void evel_other_field_add_namedarray(String hashname,String name, String value)
{
EVEL_ENTER();
@@ -139,31 +139,39 @@ public class EvelOther extends EvelHeader { assert(name != null);
assert(value != null);
- if( evelmap == null)
- evelmap = new HashMap<String,Map<String,String>>();
-
- LOGGER.debug("Adding hash : "+hashname+" name="+name+"value= "+value);
-
Map<String,String> mymap = null;
- try{
- mymap = evelmap.get(hashname);
- } catch( Exception e)
- {
- e.printStackTrace();
- }
- if(mymap == null)
- mymap = new HashMap<String,String>();
- try{
- if( mymap.put(name, value) == null)
- LOGGER.debug("Unable to add map hash : "+hashname+" name="+name+"value= "+value);;
-
- if( evelmap.put(hashname, mymap) == null)
- LOGGER.debug("Unable to add hash entry : "+hashname+" name="+name+"value= "+value);;
- } catch( Exception e)
- {
- e.printStackTrace();
- }
+ try{
+
+ if( evelmap == null)
+ evelmap = new HashMap<String,Map<String,String>>();
+
+ if( evelmap.containsKey(hashname) )
+ {
+ mymap = evelmap.get(hashname);
+ }
+ else
+ {
+ mymap = new HashMap<String,String>();
+ evelmap.put(hashname, mymap);
+ LOGGER.debug("Inserted map hash : "+hashname+" name="+name);
+ }
+
+ if( mymap.containsKey(name) )
+ {
+ String val = mymap.get(name);
+ LOGGER.error("Error already contains key " + name + "val "+val );
+ }
+ else
+ {
+ mymap.put(name, value);
+ LOGGER.debug("Adding hash : "+hashname+" name="+name+"value= "+value);
+ }
+
+ } catch( Exception e)
+ {
+ e.printStackTrace();
+ }
EVEL_EXIT();
}
@@ -222,8 +230,10 @@ public class EvelOther extends EvelHeader { if(additional_info == null)
additional_info = new HashMap<String,String>();
- if( additional_info.put(name, value) == null)
- LOGGER.debug("Unable to add map : name="+name+"value= "+value);
+ if(additional_info.containsKey(name))
+ LOGGER.error("Already exists Unable to add map : name="+name+"value= "+value);
+ else
+ additional_info.put(name, value);
EVEL_EXIT();
}
@@ -263,11 +273,11 @@ public class EvelOther extends EvelHeader { if( additional_info != null )
{
JsonArrayBuilder builder = Json.createArrayBuilder();
- for(Map.Entry<String, String> entry : additional_info.entrySet()){
+ for(Map.Entry<String, String> entry : additional_info.entrySet()){
LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry.getKey(), entry.getValue()));
JsonObject obj = Json.createObjectBuilder()
.add("name", entry.getKey())
- .add("value", entry.getValue()).build();
+ .add("value",entry.getValue()).build();
builder.add(obj);
}
eveloth.add("nameValuePairs", builder);
@@ -288,21 +298,21 @@ public class EvelOther extends EvelHeader { JsonArrayBuilder builder = Json.createArrayBuilder();
for(Map.Entry<String, Map<String,String>> entry : evelmap.entrySet()){
LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry.getKey(), entry.getValue()));
- Map<String,String> item = entry.getValue();
+ Map<String,String> item = entry.getValue();
+
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "name", entry.getKey());
JsonArrayBuilder builder2 = Json.createArrayBuilder();
for(Map.Entry<String, String> entry2 : item.entrySet()){
LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry2.getKey(), entry2.getValue()));
- JsonObject obj = Json.createObjectBuilder()
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
.add("name", entry2.getKey())
- .add("value", entry2.getValue()).build();
- builder2.add(obj);
+ .add("value",entry2.getValue());
+ builder2.add(obj2.build());
}
-
- JsonObjectBuilder obj = Json.createObjectBuilder()
- .add(entry.getKey(),builder2);
-
- builder.add(obj);
+ obj.add("arrayOfFields", builder2);
+ builder.add(obj.build());
}
eveloth.add("hashOfNameValuePairArrays", builder);
}
@@ -325,7 +335,7 @@ public class EvelOther extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -339,7 +349,7 @@ public class EvelOther extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java index ad13d18..bcbcd20 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java @@ -3619,8 +3619,8 @@ public class EvelScalingMeasurement extends EvelHeader { for(int j=0;j<meas_group.measurements.size();j++) {
custom_meas = meas_group.measurements.get(j);
JsonObjectBuilder obj2 = Json.createObjectBuilder()
- .add("name", custom_meas.name)
- .add("value",custom_meas.value);
+ .add("name",custom_meas.name)
+ .add("value",custom_meas.value);
builder2.add(obj2.build());
}
obj.add("arrayOfFields", builder2);
@@ -3658,7 +3658,7 @@ public class EvelScalingMeasurement extends EvelHeader { *
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -3672,7 +3672,7 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java index f404ded..a4a3b21 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java @@ -37,8 +37,8 @@ import org.slf4j.helpers.MessageFormatter; public class EvelSipSignaling extends EvelHeader {
- int major_version = 2;
- int minor_version = 1;
+ int major_version = 1;
+ int minor_version = 0;
/**************************************************************************//**
* Vendor VNF Name fields.
@@ -536,7 +536,7 @@ public class EvelSipSignaling extends EvelHeader { *
* retval : String of JSON event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -550,7 +550,7 @@ public class EvelSipSignaling extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java index 07937bd..555e700 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java @@ -38,8 +38,8 @@ import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; public class EvelStateChange extends EvelHeader {
- int major_version = 1;
- int minor_version = 2;
+ int major_version = 2;
+ int minor_version = 0;
/**************************************************************************//**
* Alert types.
@@ -236,7 +236,7 @@ public class EvelStateChange extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON state change event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -250,7 +250,7 @@ public class EvelStateChange extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java index 68fa311..4b972c4 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java @@ -38,8 +38,8 @@ import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; public class EvelSyslog extends EvelHeader {
- int major_version = 1;
- int minor_version = 2;
+ int major_version = 3;
+ int minor_version = 0;
/**************************************************************************//**
* Alert types.
@@ -462,7 +462,7 @@ public class EvelSyslog extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON syslog event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -476,7 +476,7 @@ public class EvelSyslog extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java index e97e228..7b7ec51 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java @@ -480,7 +480,7 @@ public class EvelThresholdCross extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON TCA event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -494,7 +494,7 @@ public class EvelThresholdCross extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java index 8fa683d..9a3983c 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java @@ -40,7 +40,7 @@ import org.slf4j.helpers.MessageFormatter; public class EvelVoiceQuality extends EvelHeader {
int major_version = 1;
- int minor_version = 1;
+ int minor_version = 0;
/**************************************************************************//**
* Vendor VNF Name fields.
@@ -649,7 +649,7 @@ public class EvelVoiceQuality extends EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON Voice Quality event message
*****************************************************************************/
- String evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -663,7 +663,7 @@ public class EvelVoiceQuality extends EvelHeader { EVEL_EXIT();
- return obj.toString();
+ return obj;
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java index 9dea6b2..e7e9559 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java @@ -34,7 +34,7 @@ public class RingBuffer { // lock semaphore
public static Semaphore lock;
- public Object[] elements = null;
+ public EvelObject[] elements = null;
public int capacity = 0;
public int writePos = 0;
@@ -45,7 +45,7 @@ public class RingBuffer { */
public RingBuffer(int capacity) {
this.capacity = capacity;
- this.elements = new Object[capacity];
+ this.elements = new EvelObject[capacity];
countsem = new Semaphore(1);
spacesem = new Semaphore(capacity);
lock = new Semaphore(1);
@@ -65,7 +65,7 @@ public class RingBuffer { //Puts Java object into ringbuffer
- public boolean put(Object element){
+ public boolean put(EvelObject element){
boolean ret = false;
//acquire locks
@@ -97,11 +97,11 @@ public class RingBuffer { return ret;
}
- public int put(Object[] newElements){
+ public int put(EvelObject[] newElements){
return put(newElements, newElements.length);
}
- public int put(Object[] newElements, int length){
+ public int put(EvelObject[] newElements, int length){
//Acquire locks
try {
spacesem.acquire();
@@ -170,9 +170,9 @@ public class RingBuffer { * Takes a stored object in Ringbuffer and releases the space
*/
- public Object take() {
+ public EvelObject take() {
- Object nextObj;
+ EvelObject nextObj;
//acquire lock
try {
countsem.acquire();
@@ -201,12 +201,12 @@ public class RingBuffer { }
- public int take(Object[] into){
+ public int take(EvelObject[] into){
return take(into, into.length);
}
- public int take(Object[] into, int length){
+ public int take(EvelObject[] into, int length){
int intoPos = 0;
//acquire lock
|