summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-common-integration
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-common/vpp-common-integration')
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/JVppRegistryProvider.java19
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/VppConfigAttributes.java4
2 files changed, 16 insertions, 7 deletions
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/JVppRegistryProvider.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/JVppRegistryProvider.java
index 300e03806..1432f2c53 100644
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/JVppRegistryProvider.java
+++ b/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/JVppRegistryProvider.java
@@ -16,6 +16,9 @@
package io.fd.hc2vpp.common.integration;
+import static com.google.common.base.Preconditions.checkState;
+import static java.lang.String.format;
+
import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.google.common.primitives.UnsignedInts;
@@ -25,15 +28,11 @@ import io.fd.honeycomb.data.init.ShutdownHandler;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppJNIConnection;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-
-import static com.google.common.base.Preconditions.checkState;
-import static java.lang.String.format;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Provides JVppRegistry. Must be a singleton due to shutdown hook usage. Registers shutdown hook to disconnect from
@@ -54,7 +53,13 @@ public final class JVppRegistryProvider extends ProviderTrait<JVppRegistry> {
protected JVppRegistry create() {
final JVppRegistry registry;
try {
- registry = new JVppRegistryImpl(config.jvppConnectionName);
+ if (config.apiSegmentPrefix.isPresent()) {
+ // TODO(VPP-1342): JVppRegistryImpl requires full SHM region name
+ final String shmName = String.format("/%s-vpe-api", config.apiSegmentPrefix.get());
+ registry = new JVppRegistryImpl(config.jvppConnectionName, shmName);
+ } else {
+ registry = new JVppRegistryImpl(config.jvppConnectionName);
+ }
connectedVppPid = initConnectedVppPid(registry);
shutdownHandler.register("jvpp-registry", () -> {
// Closing JVpp connection with shutdown hook to erase the connection from VPP so HC will be able
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/VppConfigAttributes.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/VppConfigAttributes.java
index 9c351cb7c..ba1a843a4 100644
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/VppConfigAttributes.java
+++ b/vpp-common/vpp-common-integration/src/main/java/io/fd/hc2vpp/common/integration/VppConfigAttributes.java
@@ -16,6 +16,7 @@
package io.fd.hc2vpp.common.integration;
+import java.util.Optional;
import net.jmob.guice.conf.core.BindConfig;
import net.jmob.guice.conf.core.InjectConfig;
import net.jmob.guice.conf.core.Syntax;
@@ -26,6 +27,9 @@ public class VppConfigAttributes {
@InjectConfig("jvpp-connection-name")
public String jvppConnectionName;
+ @InjectConfig("api-segment-prefix")
+ public Optional<String> apiSegmentPrefix;
+
@InjectConfig("jvpp-request-timeout")
public int jvppRequestTimeout;
}