Add sourceName override option to vg-mux 93/23193/1
authorEric Multanen <eric.w.multanen@intel.com>
Sat, 11 Nov 2017 08:31:19 +0000 (00:31 -0800)
committerEric Multanen <eric.w.multanen@intel.com>
Sat, 11 Nov 2017 08:31:19 +0000 (00:31 -0800)
This patch provides the option to override
the value sourceName field in the VES event generated by
the vG-MUX VES agent.  The value can be configured
by vppctl CLI command or via honeycomb REST call.

Change-Id: I1a8b0450b989391b39780476842a576b82564dff
Issue-ID: INT-63
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch
vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch
vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch

index 8c2e31b..0f061fc 100644 (file)
@@ -6,7 +6,7 @@ Subject: [PATCH] Add VES agent configuration for vG-MUX
 Signed-off-by: Johnson Li <johnson.li@intel.com>
 
 diff --git a/pom.xml b/pom.xml
-index 538a5d98..581bedfc 100644
+index 538a5d9..581bedf 100644
 --- a/pom.xml
 +++ b/pom.xml
 @@ -44,13 +44,14 @@
@@ -28,7 +28,7 @@ index 538a5d98..581bedfc 100644
 \ No newline at end of file
 diff --git a/ves/asciidoc/Readme.adoc b/ves/asciidoc/Readme.adoc
 new file mode 100644
-index 00000000..682e7555
+index 0000000..682e755
 --- /dev/null
 +++ b/ves/asciidoc/Readme.adoc
 @@ -0,0 +1,3 @@
@@ -37,7 +37,7 @@ index 00000000..682e7555
 +Overview of ves-agent
 diff --git a/ves/pom.xml b/ves/pom.xml
 new file mode 100644
-index 00000000..1ded0109
+index 0000000..1ded010
 --- /dev/null
 +++ b/ves/pom.xml
 @@ -0,0 +1,56 @@
@@ -99,7 +99,7 @@ index 00000000..1ded0109
 +</project>
 diff --git a/ves/ves-api/asciidoc/Readme.adoc b/ves/ves-api/asciidoc/Readme.adoc
 new file mode 100644
-index 00000000..b561268c
+index 0000000..b561268
 --- /dev/null
 +++ b/ves/ves-api/asciidoc/Readme.adoc
 @@ -0,0 +1,3 @@
@@ -109,7 +109,7 @@ index 00000000..b561268c
 \ No newline at end of file
 diff --git a/ves/ves-api/pom.xml b/ves/ves-api/pom.xml
 new file mode 100644
-index 00000000..78bf47b9
+index 0000000..78bf47b
 --- /dev/null
 +++ b/ves/ves-api/pom.xml
 @@ -0,0 +1,52 @@
@@ -167,10 +167,10 @@ index 00000000..78bf47b9
 +</project>
 diff --git a/ves/ves-api/src/main/yang/vesagent.yang b/ves/ves-api/src/main/yang/vesagent.yang
 new file mode 100644
-index 00000000..a3c79797
+index 0000000..dde09c2
 --- /dev/null
 +++ b/ves/ves-api/src/main/yang/vesagent.yang
-@@ -0,0 +1,71 @@
+@@ -0,0 +1,77 @@
 +module vesagent {
 +
 +    yang-version 1;
@@ -235,6 +235,12 @@ index 00000000..a3c79797
 +                description
 +                    "VES Working Mode, Demo Or Real Only.";
 +            }
++
++            leaf source-name {
++                type string;
++                description
++                    "Override for the sourceName field in the VES event";
++            }
 +        }
 +    }
 +
@@ -244,7 +250,7 @@ index 00000000..a3c79797
 +}
 diff --git a/ves/ves-impl/asciidoc/Readme.adoc b/ves/ves-impl/asciidoc/Readme.adoc
 new file mode 100644
-index 00000000..e07fb05f
+index 0000000..e07fb05
 --- /dev/null
 +++ b/ves/ves-impl/asciidoc/Readme.adoc
 @@ -0,0 +1,3 @@
@@ -254,7 +260,7 @@ index 00000000..e07fb05f
 \ No newline at end of file
 diff --git a/ves/ves-impl/pom.xml b/ves/ves-impl/pom.xml
 new file mode 100644
-index 00000000..5ed2c1b4
+index 0000000..5ed2c1b
 --- /dev/null
 +++ b/ves/ves-impl/pom.xml
 @@ -0,0 +1,157 @@
@@ -417,7 +423,7 @@ index 00000000..5ed2c1b4
 +</project>
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java
 new file mode 100644
-index 00000000..0cd60068
+index 0000000..0cd6006
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java
 @@ -0,0 +1,67 @@
@@ -490,7 +496,7 @@ index 00000000..0cd60068
 +}
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java
 new file mode 100644
-index 00000000..8afed84e
+index 0000000..8afed84
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java
 @@ -0,0 +1,59 @@
@@ -555,7 +561,7 @@ index 00000000..8afed84e
 +
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java
 new file mode 100644
-index 00000000..bef652fd
+index 0000000..bef652f
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java
 @@ -0,0 +1,50 @@
@@ -611,7 +617,7 @@ index 00000000..bef652fd
 +}
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java
 new file mode 100644
-index 00000000..e06afa73
+index 0000000..e06afa7
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java
 @@ -0,0 +1,127 @@
@@ -744,10 +750,10 @@ index 00000000..e06afa73
 +}
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java
 new file mode 100644
-index 00000000..8b6d5a9a
+index 0000000..248d819
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java
-@@ -0,0 +1,97 @@
+@@ -0,0 +1,99 @@
 +/*
 + * Copyright (c) 2017 Intel Corp and/or its affiliates.
 + *
@@ -804,7 +810,7 @@ index 00000000..8b6d5a9a
 +                                       @Nonnull final WriteContext writeContext) throws WriteFailedException {
 +        LOG.debug("Writing VES Agent Working Mode {} dataAfter={}", iid, dataAfter);
 +
-+        checkArgument(dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100,
++        checkArgument(dataAfter.getSourceName() != null && dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100,
 +                      "VES Agent Working Mode need to be correctly configured.");
 +
 +        setVesAgentMode(iid, dataAfter);
@@ -816,7 +822,7 @@ index 00000000..8b6d5a9a
 +        throws WriteFailedException {
 +        LOG.debug("Writing VES Agent Working Mode {} {}-->{}", iid, dataBefore, dataAfter);
 +
-+        checkArgument(dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100,
++        checkArgument(dataAfter.getSourceName() != null && dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100,
 +                      "VES Agent Working Mode need to be correctly configured.");
 +
 +        setVesAgentMode(iid, dataAfter);
@@ -829,7 +835,8 @@ index 00000000..8b6d5a9a
 +        LOG.debug("Restoring VES Mode {} dataBefore={} to default.", iid, dataBefore);
 +
 +        modeBuilder.setWorkingMode("Real")
-+                   .setBasePacketLoss(0L);
++                   .setBasePacketLoss(0L)
++                   .setSourceName("");
 +
 +        setVesAgentMode(iid, modeBuilder.build());
 +    }
@@ -840,6 +847,7 @@ index 00000000..8b6d5a9a
 +
 +        request.pktLossRate = mode.getBasePacketLoss().byteValue();
 +        request.workMode = mode.getWorkingMode().getBytes();
++        request.sourceName = mode.getSourceName().getBytes();
 +
 +        LOG.debug("VES agent working mode change id={} request={}", id, request);
 +        getReplyForWrite(jvppVes.vesAgentMode(request).toCompletableFuture(), id);
@@ -847,7 +855,7 @@ index 00000000..8b6d5a9a
 +}
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java
 new file mode 100644
-index 00000000..581f0460
+index 0000000..581f046
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java
 @@ -0,0 +1,54 @@
@@ -907,7 +915,7 @@ index 00000000..581f0460
 +}
 diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java
 new file mode 100644
-index 00000000..62e46cdb
+index 0000000..62e46cd
 --- /dev/null
 +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java
 @@ -0,0 +1,131 @@
@@ -1043,7 +1051,7 @@ index 00000000..62e46cdb
 +    }
 +}
 diff --git a/vpp-integration/minimal-distribution/pom.xml b/vpp-integration/minimal-distribution/pom.xml
-index e126114a..ca0e5b24 100644
+index e126114..ca0e5b2 100644
 --- a/vpp-integration/minimal-distribution/pom.xml
 +++ b/vpp-integration/minimal-distribution/pom.xml
 @@ -40,6 +40,7 @@
@@ -1074,6 +1082,3 @@ index e126114a..ca0e5b24 100644
        <groupId>io.fd.hc2vpp.management</groupId>
        <artifactId>vpp-management-impl</artifactId>
        <version>${vpp-management-impl.version}</version>
--- 
-2.12.2.windows.2
-
index 7aed63f..9d6233c 100644 (file)
@@ -4,13 +4,14 @@ Date: Fri, 22 Sep 2017 08:58:40 +0800
 Subject: [PATCH] Add VES Agent to report statistics
 
 Change Log:
+v3: Add option to configure source name for VES event
 v2: Use VES 5.x as agent library
 v1: Add VES agent to report statistics
 
 Signed-off-by: Johnson Li <johnson.li@intel.com>
 
 diff --git a/src/configure.ac b/src/configure.ac
-index fb2ead6d..ea641525 100644
+index fb2ead6..ea64152 100644
 --- a/src/configure.ac
 +++ b/src/configure.ac
 @@ -154,6 +154,7 @@ PLUGIN_ENABLED(lb)
@@ -22,7 +23,7 @@ index fb2ead6d..ea641525 100644
  ###############################################################################
  # Dependency checks
 diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
-index 623892e7..84513755 100644
+index 623892e..8451375 100644
 --- a/src/plugins/Makefile.am
 +++ b/src/plugins/Makefile.am
 @@ -69,6 +69,10 @@ if ENABLE_SNAT_PLUGIN
@@ -38,7 +39,7 @@ index 623892e7..84513755 100644
  # Remove *.la files
 diff --git a/src/plugins/ves.am b/src/plugins/ves.am
 new file mode 100644
-index 00000000..10f2194b
+index 0000000..10f2194
 --- /dev/null
 +++ b/src/plugins/ves.am
 @@ -0,0 +1,35 @@
@@ -79,7 +80,7 @@ index 00000000..10f2194b
 +# vi:syntax=automake
 diff --git a/src/plugins/ves/include/double_list.h b/src/plugins/ves/include/double_list.h
 new file mode 100644
-index 00000000..5cf7e1af
+index 0000000..5cf7e1a
 --- /dev/null
 +++ b/src/plugins/ves/include/double_list.h
 @@ -0,0 +1,57 @@
@@ -142,7 +143,7 @@ index 00000000..5cf7e1af
 +#endif
 diff --git a/src/plugins/ves/include/evel.h b/src/plugins/ves/include/evel.h
 new file mode 100644
-index 00000000..6aceec30
+index 0000000..d696085
 --- /dev/null
 +++ b/src/plugins/ves/include/evel.h
 @@ -0,0 +1,4494 @@
@@ -1869,7 +1870,7 @@ index 00000000..6aceec30
 + *          ::evel_free_event.
 + * @retval  NULL  Failed to create the event.
 + *****************************************************************************/
-+EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id);
++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id, const char *ev_source_name);
 +
 +/**************************************************************************//**
 + * Free a Measurement.
@@ -4642,7 +4643,7 @@ index 00000000..6aceec30
 +
 diff --git a/src/plugins/ves/include/evel_internal.h b/src/plugins/ves/include/evel_internal.h
 new file mode 100644
-index 00000000..46f71af1
+index 0000000..46f71af
 --- /dev/null
 +++ b/src/plugins/ves/include/evel_internal.h
 @@ -0,0 +1,858 @@
@@ -5506,7 +5507,7 @@ index 00000000..46f71af1
 +#endif
 diff --git a/src/plugins/ves/include/evel_throttle.h b/src/plugins/ves/include/evel_throttle.h
 new file mode 100644
-index 00000000..c97b3c37
+index 0000000..c97b3c3
 --- /dev/null
 +++ b/src/plugins/ves/include/evel_throttle.h
 @@ -0,0 +1,214 @@
@@ -5726,7 +5727,7 @@ index 00000000..c97b3c37
 +#endif
 diff --git a/src/plugins/ves/include/hashtable.h b/src/plugins/ves/include/hashtable.h
 new file mode 100644
-index 00000000..8be17dc1
+index 0000000..8be17dc
 --- /dev/null
 +++ b/src/plugins/ves/include/hashtable.h
 @@ -0,0 +1,97 @@
@@ -5829,7 +5830,7 @@ index 00000000..8be17dc1
 +#endif
 diff --git a/src/plugins/ves/include/jsmn.h b/src/plugins/ves/include/jsmn.h
 new file mode 100644
-index 00000000..4ae6d9b4
+index 0000000..4ae6d9b
 --- /dev/null
 +++ b/src/plugins/ves/include/jsmn.h
 @@ -0,0 +1,93 @@
@@ -5928,7 +5929,7 @@ index 00000000..4ae6d9b4
 +#endif /* __JSMN_H_ */
 diff --git a/src/plugins/ves/include/metadata.h b/src/plugins/ves/include/metadata.h
 new file mode 100644
-index 00000000..1ee44092
+index 0000000..1ee4409
 --- /dev/null
 +++ b/src/plugins/ves/include/metadata.h
 @@ -0,0 +1,58 @@
@@ -5992,7 +5993,7 @@ index 00000000..1ee44092
 +#endif
 diff --git a/src/plugins/ves/include/ring_buffer.h b/src/plugins/ves/include/ring_buffer.h
 new file mode 100644
-index 00000000..1236b78b
+index 0000000..1236b78
 --- /dev/null
 +++ b/src/plugins/ves/include/ring_buffer.h
 @@ -0,0 +1,96 @@
@@ -6094,10 +6095,10 @@ index 00000000..1236b78b
 +#endif
 diff --git a/src/plugins/ves/ves.api b/src/plugins/ves/ves.api
 new file mode 100644
-index 00000000..a7106f8d
+index 0000000..bae2620
 --- /dev/null
 +++ b/src/plugins/ves/ves.api
-@@ -0,0 +1,72 @@
+@@ -0,0 +1,74 @@
 +/*
 + * Copyright (c) 2017 Intel and/or its affiliates.
 + * Licensed under the Apache License, Version 2.0 (the "License");
@@ -6146,6 +6147,7 @@ index 00000000..a7106f8d
 +    @param context - sender context, to match reply w/ request
 +    @param pkt_loss_rate - Base packet loss rate if Demo Mode
 +    @param work_mode[] - Agent's work mode, real or demo
++    @param source_name[] - Agent's source name
 +*/
 +define ves_agent_mode
 +{
@@ -6153,6 +6155,7 @@ index 00000000..a7106f8d
 +  u32 context;
 +  u32 pkt_loss_rate;
 +  u8  work_mode[8];
++  u8  source_name[129];
 +};
 +
 +/** \brief VES Agent Mode response
@@ -6172,7 +6175,7 @@ index 00000000..a7106f8d
 + */
 diff --git a/src/plugins/ves/ves_all_api_h.h b/src/plugins/ves/ves_all_api_h.h
 new file mode 100644
-index 00000000..72b15697
+index 0000000..72b1569
 --- /dev/null
 +++ b/src/plugins/ves/ves_all_api_h.h
 @@ -0,0 +1,18 @@
@@ -6196,7 +6199,7 @@ index 00000000..72b15697
 +#include <ves/ves.api.h>
 diff --git a/src/plugins/ves/ves_api.c b/src/plugins/ves/ves_api.c
 new file mode 100644
-index 00000000..7a9b8004
+index 0000000..06f0a96
 --- /dev/null
 +++ b/src/plugins/ves/ves_api.c
 @@ -0,0 +1,139 @@
@@ -6283,7 +6286,7 @@ index 00000000..7a9b8004
 +      || !strcmp((char *)mp->work_mode, "DEMO"))
 +    mode = VES_AGENT_MODE_DEMO;
 +
-+  rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate));
++  rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate), (char *) mp->source_name);
 +
 +  REPLY_MACRO (VL_API_VES_AGENT_MODE_REPLY);
 +}
@@ -6341,7 +6344,7 @@ index 00000000..7a9b8004
 + */
 diff --git a/src/plugins/ves/ves_msg_enum.h b/src/plugins/ves/ves_msg_enum.h
 new file mode 100644
-index 00000000..6e8a5dfa
+index 0000000..6e8a5df
 --- /dev/null
 +++ b/src/plugins/ves/ves_msg_enum.h
 @@ -0,0 +1,31 @@
@@ -6378,10 +6381,10 @@ index 00000000..6e8a5dfa
 +#endif /* _VES_MSG_ENUM_H_ */
 diff --git a/src/plugins/ves/ves_node.c b/src/plugins/ves/ves_node.c
 new file mode 100644
-index 00000000..7540dd16
+index 0000000..49d7e87
 --- /dev/null
 +++ b/src/plugins/ves/ves_node.c
-@@ -0,0 +1,646 @@
+@@ -0,0 +1,656 @@
 +/*
 + * Copyright (c) 2017 Intel and/or its affiliates.
 + * Licensed under the Apache License, Version 2.0 (the "License");
@@ -6565,7 +6568,7 @@ index 00000000..7540dd16
 +              packets_out_this_round = 0;
 +      }
 +
-+      vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic");
++      vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic", (char *) vam->config.source_name);
 +      if(vpp_m != NULL) {
 +          char str_pkt_loss[12];
 +          MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
@@ -6912,11 +6915,17 @@ index 00000000..7540dd16
 +
 +int
 +ves_agent_set_mode(ves_agent_mode_t mode,
-+                   u32 pkt_loss_rate)
++                   u32 pkt_loss_rate, char *source_name)
 +{
 +      ves_agent_main_t *vam = &ves_agent_main;
 +      int retval = 0;
 +
++      if (source_name != NULL) {
++              strncpy((char *) vam->config.source_name, source_name, MAX_SRC_NAME_LEN);
++              vam->config.source_name[MAX_SRC_NAME_LEN] = '\0';
++      } else {
++              vam->config.source_name[0] = '\0';
++      }
 +      if (VES_AGENT_MODE_DEMO == mode) {
 +              if (pkt_loss_rate > 100) {
 +                      vam->config.mode = VES_AGENT_MODE_REAL;
@@ -6941,6 +6950,7 @@ index 00000000..7540dd16
 +      u32 pkt_loss_rate = 0;
 +      ves_agent_mode_t mode = VES_AGENT_MODE_REAL;
 +        int set_mode = 0;
++      u8 *source_name = NULL;
 +
 +      while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT) 
 +      {
@@ -6955,13 +6965,15 @@ index 00000000..7540dd16
 +                      set_mode = 1;
 +              else if (unformat (input, "base %u", &pkt_loss_rate))
 +                      ;
++              else if (unformat (input, "source %s", &source_name))
++                      ;
 +              else
 +                      break;
 +      }
 +
 +      if (set_mode)
 +      {
-+              int retval = ves_agent_set_mode(mode, pkt_loss_rate);
++              int retval = ves_agent_set_mode(mode, pkt_loss_rate, (char *)source_name);
 +              if (retval == 0)
 +                      return 0;
 +              else
@@ -6974,7 +6986,7 @@ index 00000000..7540dd16
 +
 +VLIB_CLI_COMMAND (ves_mode_set_command, static) = {
 +      .path = "set ves mode",
-+      .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>]",
++      .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>] [source <name>]",
 +      .function = ves_mode_set_command_fn,
 +};
 +
@@ -6983,11 +6995,12 @@ index 00000000..7540dd16
 +{
 +      ves_agent_main_t *vam = &ves_agent_main;
 +
-+      s = format(s, "%=8s %s\n", "Mode", "Base Packet Loss Rate");
++      s = format(s, "%=8s %s   %s\n", "Mode", "Base Packet Loss Rate", "Source Name");
 +
-+      s = format(s, "%=8s         %.1f %%\n",
++      s = format(s, "%=8s %20.1f%%   %s\n",
 +              vam->config.mode ==  VES_AGENT_MODE_DEMO ? "Demo" : "Real",
-+              (double) vam->config.base_pkt_loss);
++              (double) vam->config.base_pkt_loss,
++              (strlen((char *)vam->config.source_name) > 0) ? (char *)vam->config.source_name : "[default]");
 +
 +      return s;
 +}
@@ -7030,10 +7043,10 @@ index 00000000..7540dd16
 + */
 diff --git a/src/plugins/ves/ves_node.h b/src/plugins/ves/ves_node.h
 new file mode 100644
-index 00000000..7b773843
+index 0000000..9a57f34
 --- /dev/null
 +++ b/src/plugins/ves/ves_node.h
-@@ -0,0 +1,66 @@
+@@ -0,0 +1,68 @@
 +/*
 + * Copyright (c) 2017 Intel and/or its affiliates.
 + * Licensed under the Apache License, Version 2.0 (the "License");
@@ -7060,6 +7073,7 @@ index 00000000..7b773843
 +#define DEFAULT_MEASURE_ETH   "eth0"
 +#define DEFAULT_SERVER_PORT   8080
 +#define DEFAULT_READ_INTERVAL 100
++#define MAX_SRC_NAME_LEN        128
 +
 +typedef enum {
 +      VES_AGENT_MODE_REAL = 0,
@@ -7075,6 +7089,7 @@ index 00000000..7b773843
 +      int                     is_enabled;
 +      u32                     base_pkt_loss; /* For demo only */
 +      ves_agent_mode_t        mode; /* Demo or Real */
++        u8                      source_name[MAX_SRC_NAME_LEN+1];
 +} ves_agent_config_t;
 +
 +typedef struct {
@@ -7097,18 +7112,17 @@ index 00000000..7b773843
 +                 u32 read_interval, int is_del);
 +
 +int ves_agent_set_mode(ves_agent_mode_t mode,
-+                       u32 pkt_loss_rate);
++                       u32 pkt_loss_rate, char *source_name);
 +
 +#endif /* _VES_NODE_H_ */
 diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am
-index f18e0c24..7f4738d8 100644
+index f18e0c2..7f4738d 100644
 --- a/src/vpp-api/java/Makefile.am
 +++ b/src/vpp-api/java/Makefile.am
-@@ -148,6 +148,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js
-       $(call japigen,snat,JVppSnatImpl)
+@@ -149,6 +149,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js
  endif
  
-+#
+ #
 +# VES Plugin
 +#
 +if ENABLE_VES_PLUGIN
@@ -7128,12 +7142,13 @@ index f18e0c24..7f4738d8 100644
 +      $(call japigen,ves,JVppVesImpl)
 +endif
 +
- #
++#
  # iOAM Trace Plugin
  #
+ if ENABLE_IOAM_PLUGIN
 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.c b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
 new file mode 100644
-index 00000000..60e325b5
+index 0000000..60e325b
 --- /dev/null
 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.c
 @@ -0,0 +1,108 @@
@@ -7247,7 +7262,7 @@ index 00000000..60e325b5
 +}
 diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.h b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
 new file mode 100644
-index 00000000..642101ca
+index 0000000..642101c
 --- /dev/null
 +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.h
 @@ -0,0 +1,43 @@
@@ -7294,6 +7309,3 @@ index 00000000..642101ca
 +
 +
 +#endif /* __included_jvpp_ves_h__ */
--- 
-2.14.1.windows.1
-
index 639a7c6..00b1b44 100644 (file)
@@ -1,8 +1,28 @@
+diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
+index 0ae1713..be3ae6c 100644
+--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
++++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
+@@ -1715,13 +1715,14 @@ void evel_fault_type_set(EVENT_FAULT * fault, const char * const type);
+  * @param   measurement_interval
+  * @param event_name    Unique Event Name
+  * @param event_id    A universal identifier of the event for analysis etc
++ * @param event_source_name  Optional override of the source name
+  *
+  * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT.  If the
+  *          event is not used (i.e. posted) it must be released using
+  *          ::evel_free_event.
+  * @retval  NULL  Failed to create the event.
+  *****************************************************************************/
+-EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id);
++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id, const char *ev_source_name);
+ /**************************************************************************//**
+  * Free a Measurement.
 diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c
-index ced29b2..892e4b6 100644
+index 4de49bc..de6b362 100644
 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c
 +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c
-@@ -166,7 +166,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname)
+@@ -167,7 +167,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname)
    header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec;
    header->priority = EVEL_PRIORITY_NORMAL;
    header->reporting_entity_name = strdup(openstack_vm_name());
@@ -12,7 +32,7 @@ index ced29b2..892e4b6 100644
    header->sequence = event_sequence;
    header->start_epoch_microsec = header->last_epoch_microsec;
    header->major_version = EVEL_HEADER_MAJOR_VERSION;
-@@ -180,7 +181,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname)
+@@ -181,7 +182,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname)
    evel_init_option_string(&header->nfcnaming_code);
    evel_init_option_string(&header->nfnaming_code);
    evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid());
@@ -22,7 +42,7 @@ index ced29b2..892e4b6 100644
    evel_init_option_intheader(&header->internal_field);
  
    EVEL_EXIT();
-@@ -215,7 +217,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event
+@@ -216,7 +218,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event
    header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec;
    header->priority = EVEL_PRIORITY_NORMAL;
    header->reporting_entity_name = strdup(openstack_vm_name());
@@ -32,21 +52,105 @@ index ced29b2..892e4b6 100644
    header->sequence = event_sequence;
    header->start_epoch_microsec = header->last_epoch_microsec;
    header->major_version = EVEL_HEADER_MAJOR_VERSION;
-@@ -229,7 +232,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event
+@@ -230,7 +233,63 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event
    evel_init_option_string(&header->nfcnaming_code);
    evel_init_option_string(&header->nfnaming_code);
    evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid());
 -  evel_force_option_string(&header->source_id, openstack_vm_uuid());
 +  /* evel_force_option_string(&header->source_id, openstack_vm_uuid()); */
++  evel_force_option_string(&header->source_id, openstack_vnf_id()); /* vCPE quick hack */
++  evel_init_option_intheader(&header->internal_field);
++
++  EVEL_EXIT();
++}
++
++/**************************************************************************//**
++ * Initialize a newly created event header.
++ *
++ * @param header  Pointer to the header being initialized.
++ *****************************************************************************/
++void evel_init_header_source_name(EVENT_HEADER * const header,const char *const eventname, const char *eventid, const char *eventsrcname)
++{
++  struct timeval tv;
++
++  EVEL_ENTER();
++
++  assert(header != NULL);
++  assert(eventname != NULL);
++  assert(eventid != NULL);
++
++  gettimeofday(&tv, NULL);
++
++  /***************************************************************************/
++  /* Initialize the header.  Get a new event sequence number.  Note that if  */
++  /* any memory allocation fails in here we will fail gracefully because     */
++  /* everything downstream can cope with NULLs.                              */
++  /***************************************************************************/
++  header->event_domain = EVEL_DOMAIN_HEARTBEAT;
++  header->event_id = strdup(eventid);
++  header->event_name = strdup(eventname);
++  header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec;
++  header->priority = EVEL_PRIORITY_NORMAL;
++  header->reporting_entity_name = strdup(openstack_vm_name());
++  /* header->source_name = strdup(openstack_vm_name()); */
++  /* vCPE quck hack */
++  if (strlen(eventsrcname)) {
++    header->source_name = strdup(eventsrcname);
++  } else {
++    header->source_name = strdup(openstack_vnf_id());
++  }
++  header->sequence = event_sequence;
++  header->start_epoch_microsec = header->last_epoch_microsec;
++  header->major_version = EVEL_HEADER_MAJOR_VERSION;
++  header->minor_version = EVEL_HEADER_MINOR_VERSION;
++  event_sequence++;
++
++  /***************************************************************************/
++  /* Optional parameters.                                                    */
++  /***************************************************************************/
++  evel_init_option_string(&header->event_type);
++  evel_init_option_string(&header->nfcnaming_code);
++  evel_init_option_string(&header->nfnaming_code);
++  evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid());
++  /* evel_force_option_string(&header->source_id, openstack_vm_uuid()); */
 +  evel_force_option_string(&header->source_id, openstack_vnf_id()); /* vCPE quick hack */
    evel_init_option_intheader(&header->internal_field);
  
    EVEL_EXIT();
+diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
+index b73eb97..2446e02 100644
+--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
++++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
+@@ -40,13 +40,14 @@
+  * @param   measurement_interval
+  * @param event_name  Unique Event Name confirming Domain AsdcModel Description
+  * @param event_id    A universal identifier of the event for: troubleshooting correlation, analysis, etc
++ * @param event_source_name  Optional override of the source name
+  *
+  * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT.  If the
+  *          event is not used (i.e. posted) it must be released using
+  *          ::evel_free_event.
+  * @retval  NULL  Failed to create the event.
+  *****************************************************************************/
+-EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char* ev_name, const char *ev_id)
++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char* ev_name, const char *ev_id, const char *ev_source_name)
+ {
+   EVENT_MEASUREMENT * measurement = NULL;
+@@ -72,7 +73,7 @@ EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char
+   /***************************************************************************/
+   /* Initialize the header & the measurement fields.                         */
+   /***************************************************************************/
+-  evel_init_header_nameid(&measurement->header,ev_name,ev_id);
++  evel_init_header_source_name(&measurement->header,ev_name,ev_id,ev_source_name);
+   measurement->header.event_domain = EVEL_DOMAIN_MEASUREMENT;
+   measurement->measurement_interval = measurement_interval;
+   dlist_initialize(&measurement->additional_info);
 diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
-index 11fef1b..d82f282 100644
+index 62ea6b5..6c322db 100644
 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
 +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c
-@@ -59,6 +59,11 @@ static char vm_uuid[MAX_METADATA_STRING+1] = {0};
+@@ -60,6 +60,11 @@ static char vm_uuid[MAX_METADATA_STRING+1] = {0};
  static char vm_name[MAX_METADATA_STRING+1] = {0};
  
  /**************************************************************************//**
@@ -58,7 +162,7 @@ index 11fef1b..d82f282 100644
   * How many metadata elements we allow for in the retrieved JSON.
   *****************************************************************************/
  static const int MAX_METADATA_TOKENS = 128;
-@@ -289,6 +294,19 @@ EVEL_ERR_CODES openstack_metadata(int verbosity)
+@@ -290,6 +295,19 @@ EVEL_ERR_CODES openstack_metadata(int verbosity)
      {
        EVEL_DEBUG("VM Name: %s", vm_name);
      }
@@ -78,7 +182,7 @@ index 11fef1b..d82f282 100644
    }
  
  exit_label:
-@@ -318,6 +336,9 @@ void openstack_metadata_initialize()
+@@ -319,6 +337,9 @@ void openstack_metadata_initialize()
    strncpy(vm_name,
            "Dummy VM name - No Metadata available",
            MAX_METADATA_STRING);
@@ -88,7 +192,7 @@ index 11fef1b..d82f282 100644
  }
  
  /**************************************************************************//**
-@@ -590,3 +611,13 @@ const char *openstack_vm_uuid()
+@@ -591,3 +612,13 @@ const char *openstack_vm_uuid()
  {
    return vm_uuid;
  }