summaryrefslogtreecommitdiffstats
path: root/veslibrary
diff options
context:
space:
mode:
Diffstat (limited to 'veslibrary')
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/pom.xml233
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java109
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelBatch.java83
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java6
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java6
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelObject.java41
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java2
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java90
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java6
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java18
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src_test/evel_javalibrary/att/com/maindir/Main.java (renamed from veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java)525
-rwxr-xr-xveslibrary/ves_javalibrary/evel_javalib2/src_test/java_agent_test2
19 files changed, 704 insertions, 469 deletions
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/pom.xml b/veslibrary/ves_javalibrary/evel_javalib2/pom.xml
index fc4f209..40e499e 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/pom.xml
+++ b/veslibrary/ves_javalibrary/evel_javalib2/pom.xml
@@ -1,115 +1,118 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.vnfsdk.compliance</groupId>
- <artifactId>evel_javalib2</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <name>VESJavaLibrary</name>
-
- <properties>
- <!-- If the maven profile "docker" is specified the parameter -Dves.git.url=<MsoGitRepo> must be provided
- i.e: mvn clean install -P docker -Dves.git.url=https://gerrit.onap.org/r-->
- <ves.git.url>${env.GIT_NO_PROJECT}</ves.git.url>
- <ves.project.version>${project.version}</ves.project.version>
- </properties>
-
- <repositories>
- <repository>
- <id>onap-snapshots</id>
- <name>ONAP Snapshot Repository</name>
- <url>http://nexus.onap.org/content/repositories/snapshots</url>
- </repository>
- </repositories>
-
-
- <build>
- <sourceDirectory>src</sourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
- println project.properties['ves.project.version'];
- def versionArray;
- if ( project.properties['ves.project.version'] != null ) {
- versionArray = project.properties['ves.project.version'].split('\\.');
- }
-
- if ( project.properties['ves.project.version'].endsWith("-SNAPSHOT") ) {
- project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
- } else {
- project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
- }
-
- println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>aspectj-maven-plugin</artifactId>
- <versionRange>[1.0,)</versionRange>
- <goals>
- <goal>test-compile</goal>
- <goal>compile</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
-
- </plugins>
-
-
- </build>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
- <dependency>
- <groupId>javax.json</groupId>
- <artifactId>javax.json-api</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.7.5</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.json</artifactId>
- <version>1.0.4</version>
- </dependency>
- </dependencies>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.vnfsdk.compliance</groupId>
+ <artifactId>evel_javalib2</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>VESJavaLibrary</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ <!-- If the maven profile "docker" is specified the parameter -Dves.git.url=<MsoGitRepo> must be provided
+ i.e: mvn clean install -P docker -Dves.git.url=https://gerrit.onap.org/r-->
+ <ves.git.url>${env.GIT_NO_PROJECT}</ves.git.url>
+ <ves.project.version>${project.version}</ves.project.version>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>onap-snapshots</id>
+ <name>ONAP Snapshot Repository</name>
+ <url>http://nexus.onap.org/content/repositories/snapshots</url>
+ </repository>
+ </repositories>
+
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ println project.properties['ves.project.version'];
+ def versionArray;
+ if ( project.properties['ves.project.version'] != null ) {
+ versionArray = project.properties['ves.project.version'].split('\\.');
+ }
+
+ if ( project.properties['ves.project.version'].endsWith("-SNAPSHOT") ) {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ }
+
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>aspectj-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>test-compile</goal>
+ <goal>compile</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.json</groupId>
+ <artifactId>javax.json-api</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.json</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ </dependencies>
+</project>
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
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src_test/evel_javalibrary/att/com/maindir/Main.java
index d3580e8..e49e003 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src_test/evel_javalibrary/att/com/maindir/Main.java
@@ -1,253 +1,272 @@
-package evel_javalibrary.att.com.maindir;
-
-/**************************************************************************//**
- * @file
- * Sample Test Agent for EVEL library
- *
- * This file implements the Sample Agent 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 without worrying about details of the API transport.
- * It also shows how events can be formatted with data for POST
- *
- * 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 org.apache.log4j.Logger;
-
-import evel_javalibrary.att.com.*;
-import evel_javalibrary.att.com.AgentMain.EVEL_ERR_CODES;
-import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
-import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES;
-import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES;
-import evel_javalibrary.att.com.EvelHeader.PRIORITIES;
-import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
-import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE;
-import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_VNIC_PERFORMANCE;
-import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE;
-import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE;
-import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION;
-
-import org.apache.log4j.Level;
-
-import java.io.*;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.util.Date;
-
-public class Main
-{
-
- public static void main(String[] args)
- {
-
- try{
-
- AgentMain.evel_initialize("http://127.0.0.1", 30000,
- "/vendor_event_listener","/example_vnf",
- //null,null
- "pill",
- "will",
- Level.DEBUG);
- } catch( Exception e )
- {
- e.printStackTrace();
- }
-
- for(int i= 0; i < 20; i++)
- {
- EvelHeader header = EvelHeader.evel_new_heartbeat("Hearbeat_vAFX","vmname_ip");
- header.evel_nfnamingcode_set("vVNF");
- header.evel_nfcnamingcode_set("vVNF");
- AgentMain.evel_post_event(header);
- try {
- Thread.sleep(1);
- } catch( Exception e )
- {
- e.printStackTrace();
- }
-
- EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip",
- "NIC error", "Hardware failed",
- EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
- EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
- EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
- EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
- flt.evel_fault_addl_info_add("nichw", "fail");
- flt.evel_fault_addl_info_add("nicsw", "fail");
- AgentMain.evel_post_event(flt);
-
- EvelStateChange stc = new EvelStateChange("StateChange_vVNF", "vmname_ip",
- EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_IN_SERVICE,
- EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp");
- stc.evel_statechange_addl_info_add("bgpa", "fail");
- stc.evel_statechange_addl_info_add("bgpb", "fail");
-
- AgentMain.evel_post_event(stc);
-
- EvelScalingMeasurement sm = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip");
- sm.evel_nfnamingcode_set("vVNF");
- sm.evel_nfcnamingcode_set("vVNF");
- sm.evel_measurement_myerrors_set(10,20,30,40);
- MEASUREMENT_CPU_USE my1 = sm.evel_measurement_new_cpu_use_add("cpu1", 100.0);
- my1.idle.SetValue(20.0);
- my1.sys.SetValue(21.0);
- MEASUREMENT_CPU_USE my2 = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0);
- my2.steal.SetValue(34.0);
- my2.user.SetValue(32.0);
- sm.evel_measurement_custom_measurement_add("group1","name1","val1");
- sm.evel_measurement_custom_measurement_add("group1","name2","val2");
- sm.evel_measurement_custom_measurement_add("group2","name1","val1");
- sm.evel_measurement_custom_measurement_add("group2","name2","val2");
-
- MEASUREMENT_VNIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true");
- vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0);
- vnic_p.recvd_mcast_packets_delta.SetValue(5677888.0);
- vnic_p.recvd_mcast_packets_acc.SetValue(5677888.0);
- vnic_p.tx_ucast_packets_acc.SetValue(547856576.0);
- vnic_p.tx_ucast_packets_delta.SetValue(540000.0);
- sm.evel_meas_vnic_performance_add(vnic_p);
-
- AgentMain.evel_post_event(sm);
-
- EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip",
- EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
- "Router failed","JUNIPER");
- sysl.evel_nfnamingcode_set("vVNF");
- sysl.evel_nfcnamingcode_set("vVNF");
- sysl.evel_syslog_proc_id_set(456);
- sysl.evel_syslog_proc_set("routed");
- AgentMain.evel_post_event(sysl);
-
- EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "vmname_ip");
- hfld.evel_hrtbt_interval_set(23);
- AgentMain.evel_post_event(hfld);
-
-
- EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678");
- sip.evel_nfnamingcode_set("vVNF");
- sip.evel_nfcnamingcode_set("vVNF");
- AgentMain.evel_post_event(sip);
-
- EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip",
- "calleeSideCodc",
- "callerSideCodc", "corlator",
- "midCllRtcp", "juniper");
- vq.evel_nfnamingcode_set("vVNF");
- vq.evel_nfcnamingcode_set("vVNF");
- vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 180, 190);
- AgentMain.evel_post_event(vq);
-
- EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip");
- ev.evel_other_field_add("a1", "b1");
- ev.evel_other_field_add("a1", "b2");
-
- /*ev.evel_other_field_add_namedarray("a1", "b1", "c1");
- ev.evel_other_field_add_namedarray("a1", "b2", "c2");
- ev.evel_other_field_add_namedarray("a2", "b1", "c1");
- ev.evel_other_field_add_namedarray("a2", "b1", "c1");*/
- AgentMain.evel_post_event(ev);
-
-
-
- String dateStart = "01/14/2012 09:29:58";
- String dateStop = "01/15/2012 10:31:48";
-
- //HH converts hour in 24 hours format (0-23), day calculation
- SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
-
- Date d1 = null;
- Date d2 = null;
-
- try {
- d1 = format.parse(dateStart);
- d2 = format.parse(dateStop);
- }catch (Exception e) {
- e.printStackTrace();
- }
-
-
- EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip",
- "CRIT",
- "mcast Limit reached",
- "mcastRxPackets",
- "1250000000",
- EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET,
- "Mcast Rx breached",
- EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY,
- d1,
- EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL,
- d2);
- tca.evel_nfnamingcode_set("vVNF");
- tca.evel_nfcnamingcode_set("vVNF");
- tca.evel_threshold_cross_interfacename_set("ns345");
- tca.evel_thresholdcross_addl_info_add("n1", "v1");
- tca.evel_thresholdcross_addl_info_add("n2", "v2");
- tca.evel_thresholdcross_alertid_add("alert1");
- tca.evel_thresholdcross_alertid_add("alert2");
-
- AgentMain.evel_post_event(tca);
-
-
- EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip",
- "In",
- null,
- "GTP",
- "v2.3",
- "1.2.3.4",
- 345556,
- "5.6.7.8",
- 334344);
- MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS(
- 1.01,
- 2.02,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- d1,
- "ACTIVE",
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25,
- 26,
- 27,
- 28);
- mf.gtp_per_flow_metrics = mygtp;
- mf.evel_nfnamingcode_set("vVNF");
- mf.evel_nfcnamingcode_set("vVNF");
- AgentMain.evel_post_event(mf);
-
-
- }
-
- }
-}
+
+package evel_javalibrary.att.com.maindir;
+
+/**************************************************************************//**
+ * @file
+ * Sample Test Agent for EVEL library
+ *
+ * This file implements the Sample Agent 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 without worrying about details of the API transport.
+ * It also shows how events can be formatted with data for POST
+ *
+ * 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 org.apache.log4j.Logger;
+
+import evel_javalibrary.att.com.*;
+import evel_javalibrary.att.com.AgentMain.EVEL_ERR_CODES;
+import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
+import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES;
+import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES;
+import evel_javalibrary.att.com.EvelHeader.PRIORITIES;
+import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_VNIC_PERFORMANCE;
+import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE;
+import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE;
+import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION;
+
+import org.apache.log4j.Level;
+
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+public class Main
+{
+
+ public static void main(String[] args)
+ {
+
+ try{
+
+ AgentMain.evel_initialize("http://127.0.0.1", 30000,
+ // "http://1.2.3.4", 8080,
+ //"/vendor_event_listener","/example_vnf",
+ null,null,
+ "will",
+ "pill",
+ null, null, null,
+ //"/home/gokul/newwk/demo/vnfs/VES5.0/evel/sslcerts2/my-keystore.jks", "changeit", "changeit",
+ Level.TRACE);
+ } catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ for(int i= 0; i < 2; i++)
+ {
+ EvelHeader header = EvelHeader.evel_new_heartbeat("Hearbeat_vAFX","vmname_ip");
+ header.evel_nfnamingcode_set("vVNF");
+ header.evel_nfcnamingcode_set("vVNF");
+ AgentMain.evel_post_event(header);
+ try {
+ Thread.sleep(1);
+ } catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip",
+ "NIC error", "Hardware failed",
+ EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
+ EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
+ EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
+ EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
+ flt.evel_fault_addl_info_add("nichw", "fail");
+ flt.evel_fault_addl_info_add("nicsw", "fail");
+ AgentMain.evel_post_event(flt);
+
+ EvelBatch be = new EvelBatch();
+ EvelFault flt2 = new EvelFault("Fault_vVNF", "vmname_ip",
+ "NIC error", "Hardware failed",
+ EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
+ EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
+ EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
+ EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
+ flt2.evel_fault_addl_info_add("nichw", "fail");
+ flt2.evel_fault_addl_info_add("nicsw", "fail");
+ be.addEvent(flt2);
+
+ EvelFault flt3 = new EvelFault("Fault_vVNF", "vmname_ip2",
+ "NIC error", "Hardware failed",
+ EvelHeader.PRIORITIES.EVEL_PRIORITY_NORMAL,
+ EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
+ EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
+ EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
+ flt3.evel_fault_type_set("Interface fault");
+ flt3.evel_fault_category_set("Failed category");
+ flt3.evel_fault_interface_set("An Interface Card");
+ flt3.evel_fault_addl_info_add("nichw", "fail");
+ flt3.evel_fault_addl_info_add("nicsw", "fail");
+ be.addEvent(flt3);
+
+
+ EvelStateChange stc = new EvelStateChange("StateChange_vVNF", "vmname_ip",
+ EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_IN_SERVICE,
+ EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp");
+ stc.evel_statechange_addl_info_add("bgpa", "fail");
+ stc.evel_statechange_addl_info_add("bgpb", "fail");
+ //AgentMain.evel_post_event(stc);
+
+ be.addEvent(stc);
+ AgentMain.evel_post_event(be);
+
+ EvelScalingMeasurement sm = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip");
+ sm.evel_measurement_myerrors_set(10,20,30,40);
+ MEASUREMENT_CPU_USE my1 = sm.evel_measurement_new_cpu_use_add("cpu1", 100.0);
+ my1.idle.SetValue(20.0);
+ my1.sys.SetValue(21.0);
+ MEASUREMENT_CPU_USE my2 = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0);
+ my2.steal.SetValue(34.0);
+ my2.user.SetValue(32.0);
+ sm.evel_measurement_custom_measurement_add("group1","name1","val1");
+ sm.evel_measurement_custom_measurement_add("group1","name2","val2");
+ sm.evel_measurement_custom_measurement_add("group2","name1","val1");
+ sm.evel_measurement_custom_measurement_add("group2","name2","val2");
+
+
+ MEASUREMENT_VNIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true");
+ vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0);
+ vnic_p.recvd_mcast_packets_delta.SetValue(5677888.0);
+ vnic_p.recvd_mcast_packets_acc.SetValue(5677888.0);
+ vnic_p.tx_ucast_packets_acc.SetValue(547856576.0);
+ vnic_p.tx_ucast_packets_delta.SetValue(540000.0);
+ sm.evel_meas_vnic_performance_add(vnic_p);
+
+ AgentMain.evel_post_event(sm);
+
+ EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip",
+ EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
+ "Router failed","JUNIPER");
+ sysl.evel_syslog_proc_id_set(456);
+ sysl.evel_syslog_proc_set("routed");
+ AgentMain.evel_post_event(sysl);
+
+ EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "vmname_ip");
+ hfld.evel_hrtbt_interval_set(23);
+ AgentMain.evel_post_event(hfld);
+
+
+ EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678");
+ AgentMain.evel_post_event(sip);
+
+ EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip",
+ "calleeSideCodc",
+ "callerSideCodc", "corlator",
+ "midCllRtcp", "juniper");
+ vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 180, 190);
+ AgentMain.evel_post_event(vq);
+
+ EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip");
+ ev.evel_other_field_add("a1", "b1");
+ ev.evel_other_field_add("a1", "b2");
+
+ ev.evel_other_field_add_namedarray("a1", "b1", "c1");
+ ev.evel_other_field_add_namedarray("a1", "b2", "c2");
+ ev.evel_other_field_add_namedarray("a2", "b1", "c1");
+ ev.evel_other_field_add_namedarray("a2", "b1", "c1");
+ AgentMain.evel_post_event(ev);
+
+ String dateStart = "01/14/2012 09:29:58";
+ String dateStop = "01/15/2012 10:31:48";
+
+ //HH converts hour in 24 hours format (0-23), day calculation
+ SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+
+ Date d1 = null;
+ Date d2 = null;
+
+ try {
+ d1 = format.parse(dateStart);
+ d2 = format.parse(dateStop);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+ EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip",
+ "CRIT",
+ "mcast Limit reached",
+ "mcastRxPackets",
+ "1250000000",
+ EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET,
+ "Mcast Rx breached",
+ EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY,
+ d1,
+ EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL,
+ d2);
+ tca.evel_threshold_cross_interfacename_set("ns345");
+ tca.evel_thresholdcross_addl_info_add("n1", "v1");
+ tca.evel_thresholdcross_addl_info_add("n2", "v2");
+ tca.evel_thresholdcross_alertid_add("alert1");
+ tca.evel_thresholdcross_alertid_add("alert2");
+
+ AgentMain.evel_post_event(tca);
+
+
+ EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip",
+ "In",
+ null,
+ "GTP",
+ "v2.3",
+ "1.2.3.4",
+ 345556,
+ "5.6.7.8",
+ 334344);
+ MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS(
+ 1.01,
+ 2.02,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ d1,
+ "ACTIVE",
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28);
+ mf.gtp_per_flow_metrics = mygtp;
+ AgentMain.evel_post_event(mf);
+
+
+ }
+
+ }
+}
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src_test/java_agent_test b/veslibrary/ves_javalibrary/evel_javalib2/src_test/java_agent_test
new file mode 100755
index 0000000..9f00451
--- /dev/null
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src_test/java_agent_test
@@ -0,0 +1,2 @@
+javac -cp .:../target/evel_javalib2-0.0.1-SNAPSHOT.jar:./log4j.jar:slf4j-api.jar:slf4j-log4j12-1.6.0.jar:./javax.json-1.0.jar ./evel_javalibrary/att/com/maindir/Main.java
+java -cp .:../target/evel_javalib2-0.0.1-SNAPSHOT.jar:./log4j.jar:slf4j-api.jar:slf4j-log4j12-1.6.0.jar:./javax.json-1.0.jar evel_javalibrary.att.com.maindir.Main