summaryrefslogtreecommitdiffstats
path: root/vnfs/vLB
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs/vLB')
-rw-r--r--vnfs/vLB/.DS_Storebin0 -> 10244 bytes
-rw-r--r--vnfs/vLB/DNSClient/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSClient/LICENSE.TXT22
-rw-r--r--vnfs/vLB/DNSClient/README.txt14
-rw-r--r--vnfs/vLB/DNSClient/pom.xml51
-rw-r--r--vnfs/vLB/DNSClient/src/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSClient/src/main/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSClient/src/main/java/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSClient/src/main/java/DNSServer.java85
-rw-r--r--vnfs/vLB/DNSClient/src/main/java/FDClient.java73
-rw-r--r--vnfs/vLB/DNSManager/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSManager/LICENSE.TXT22
-rw-r--r--vnfs/vLB/DNSManager/README.txt17
-rw-r--r--vnfs/vLB/DNSManager/pom.xml51
-rw-r--r--vnfs/vLB/DNSManager/src/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSManager/src/main/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSManager/src/main/java/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/DNSManager/src/main/java/DNSMembershipManager.java95
-rw-r--r--vnfs/vLB/DNSManager/src/main/java/FDServer.java161
-rw-r--r--vnfs/vLB/dns_streams/.DS_Storebin0 -> 6148 bytes
-rw-r--r--vnfs/vLB/dns_streams/dep.xml17
-rw-r--r--vnfs/vLB/dns_streams/pom.xml58
-rw-r--r--vnfs/vLB/dns_streams/stream_dns113
-rw-r--r--vnfs/vLB/dns_streams/stream_dns1013
-rw-r--r--vnfs/vLB/dns_streams/stream_dns213
-rw-r--r--vnfs/vLB/dns_streams/stream_dns313
-rw-r--r--vnfs/vLB/dns_streams/stream_dns413
-rw-r--r--vnfs/vLB/dns_streams/stream_dns513
-rw-r--r--vnfs/vLB/dns_streams/stream_dns613
-rw-r--r--vnfs/vLB/dns_streams/stream_dns713
-rw-r--r--vnfs/vLB/dns_streams/stream_dns813
-rw-r--r--vnfs/vLB/dns_streams/stream_dns913
-rw-r--r--vnfs/vLB/scripts/.DS_Storebin0 -> 8196 bytes
-rw-r--r--vnfs/vLB/scripts/add_dns.sh21
-rw-r--r--vnfs/vLB/scripts/db_dnsdemo_openecomp_org24
-rw-r--r--vnfs/vLB/scripts/dnsclient.sh6
-rw-r--r--vnfs/vLB/scripts/dnsmembership.sh5
-rw-r--r--vnfs/vLB/scripts/named.conf.local12
-rw-r--r--vnfs/vLB/scripts/named.conf.options39
-rw-r--r--vnfs/vLB/scripts/remove_dns.sh24
-rwxr-xr-xvnfs/vLB/scripts/run_streams_dns.sh9
-rw-r--r--vnfs/vLB/scripts/set_gre_tunnel.sh21
-rwxr-xr-xvnfs/vLB/scripts/v_dns_init.sh5
-rwxr-xr-xvnfs/vLB/scripts/v_lb_init.sh52
-rw-r--r--vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh97
-rw-r--r--vnfs/vLB/scripts/vdns.sh98
-rw-r--r--vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh53
-rw-r--r--vnfs/vLB/scripts/vlb.sh98
-rw-r--r--vnfs/vLB/scripts/vpacketgenfordnsdemo.sh99
49 files changed, 1459 insertions, 0 deletions
diff --git a/vnfs/vLB/.DS_Store b/vnfs/vLB/.DS_Store
new file mode 100644
index 00000000..5866ceef
--- /dev/null
+++ b/vnfs/vLB/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSClient/.DS_Store b/vnfs/vLB/DNSClient/.DS_Store
new file mode 100644
index 00000000..210fb02d
--- /dev/null
+++ b/vnfs/vLB/DNSClient/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSClient/LICENSE.TXT b/vnfs/vLB/DNSClient/LICENSE.TXT
new file mode 100644
index 00000000..ae12da20
--- /dev/null
+++ b/vnfs/vLB/DNSClient/LICENSE.TXT
@@ -0,0 +1,22 @@
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
diff --git a/vnfs/vLB/DNSClient/README.txt b/vnfs/vLB/DNSClient/README.txt
new file mode 100644
index 00000000..ce192bbb
--- /dev/null
+++ b/vnfs/vLB/DNSClient/README.txt
@@ -0,0 +1,14 @@
+README
+---
+
+Run the dnsclient.sh script to start the FDClient Java binary. The DNSMembershipManager should be activated first. FDClient will periodically send keep-alive messages to the FDServer.
+- java FDClient [process id] [server IP address] [port] [timeout (sec)] [debug]
+ - [process id]: ID of this process
+ - [server IP address]: IP address of the remote server
+ - [port]: port where the server listens for incoming packets
+ - [timeout (sec)]: how often send a packet to the server
+ - [debug]: verbose mode (TRUE: >=1, FALSE: <=0)
+- Example: java FDClient p1 192.168.9.100 8888 10 1
+
+Please change the default parameters in the dnsclient.sh script as appropriate for your configuration.
+
diff --git a/vnfs/vLB/DNSClient/pom.xml b/vnfs/vLB/DNSClient/pom.xml
new file mode 100644
index 00000000..cfb7db93
--- /dev/null
+++ b/vnfs/vLB/DNSClient/pom.xml
@@ -0,0 +1,51 @@
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.demo.vnf.lb</groupId>
+ <artifactId>dns-client</artifactId>
+ <name>DNS Client</name>
+ <packaging>jar</packaging>
+ <version>1.0.0</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>main.java.DNSServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>nexus</id>
+ <name>OpenECOMP Release Repository</name>
+ <url>https://ecomp-nexus:8443/repository/raw</url>
+ </repository>
+ </distributionManagement>
+
+</project>
diff --git a/vnfs/vLB/DNSClient/src/.DS_Store b/vnfs/vLB/DNSClient/src/.DS_Store
new file mode 100644
index 00000000..dba6f684
--- /dev/null
+++ b/vnfs/vLB/DNSClient/src/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSClient/src/main/.DS_Store b/vnfs/vLB/DNSClient/src/main/.DS_Store
new file mode 100644
index 00000000..9206bc71
--- /dev/null
+++ b/vnfs/vLB/DNSClient/src/main/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSClient/src/main/java/.DS_Store b/vnfs/vLB/DNSClient/src/main/java/.DS_Store
new file mode 100644
index 00000000..05c35472
--- /dev/null
+++ b/vnfs/vLB/DNSClient/src/main/java/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSClient/src/main/java/DNSServer.java b/vnfs/vLB/DNSClient/src/main/java/DNSServer.java
new file mode 100644
index 00000000..483819f3
--- /dev/null
+++ b/vnfs/vLB/DNSClient/src/main/java/DNSServer.java
@@ -0,0 +1,85 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+package main.java;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+
+/*
+ * Client-side Failure Detector (FD) implementation.
+ * @param server_addr: IP address of the remote server
+ * @param port: the port that the FD service listens for incoming UDP packets
+ * @param timeout: how often the FD checks the status of client processes
+ * @param debug: debug mode on/off
+ */
+
+public class DNSServer {
+
+ public static void main(String[] args) throws IOException {
+ if(args.length != 5) {
+ System.out.println("Missing input parameters");
+ System.out.println("Usage:");
+ System.out.print("\t- java FDClient [process ID] [server IP address] [server port] [timeout (sec)] [debug]\n");
+ System.exit(0);
+ }
+ // IP address and port of the remote server
+ String PID = args[0];
+ String SERVER_ADDR = args[1];
+ int PORT = Integer.parseInt(args[2]);
+ long TIMEOUT = Long.parseLong(args[3]) * 1000; // convert the FD timeout to milliseconds
+ int debug = Integer.parseInt(args[4]);
+ boolean DEBUG;
+ if(debug <= 0)
+ DEBUG = false;
+ else
+ DEBUG = true;
+
+ // Run FD client
+ new FDClient(PID, SERVER_ADDR, PORT, TIMEOUT, DEBUG);
+
+ // Listen for reply messages
+ @SuppressWarnings("resource")
+ DatagramSocket sock = new DatagramSocket(PORT);
+ byte[] buffer = new byte[256];
+ boolean gre_tunnel_enabled = false;
+
+ while(true) {
+ DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
+ sock.receive(packet);
+ String[] content = new String(packet.getData()).trim().split(":"); // Remove leading and trailing spaces
+ String msg_type = content[0];
+ String ip = content[1];
+ // Process only PING UDP packets
+ if(msg_type.equals("PONG")) {
+ if(DEBUG) System.out.println("Reply message received from process " + ip);
+ if(!gre_tunnel_enabled) {
+ // Set GRE tunnel towards load balancer
+ String script = new String("bash /opt/FDclient/set_gre_tunnel.sh " + ip);
+ Runtime.getRuntime().exec(script);
+ if(DEBUG) System.out.println("GRE tunnel towards load balancer " + ip + " done");
+ gre_tunnel_enabled = true;
+ }
+ }
+ else {
+ if(DEBUG) System.out.println("The received message is not a PONG. Received content: " + content);
+ }
+ }
+ }
+}
diff --git a/vnfs/vLB/DNSClient/src/main/java/FDClient.java b/vnfs/vLB/DNSClient/src/main/java/FDClient.java
new file mode 100644
index 00000000..8665937a
--- /dev/null
+++ b/vnfs/vLB/DNSClient/src/main/java/FDClient.java
@@ -0,0 +1,73 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+package main.java;
+
+import java.io.*;
+import java.net.*;
+
+/*
+ * Client-side Failure Detector (FD) implementation.
+ * @param server_addr: IP address of the remote server
+ * @param port: the port that the FD service listens for incoming UDP packets
+ * @param timeout: how often the FD checks the status of client processes
+ * @param debug: debug mode on/off
+ */
+
+public class FDClient implements Runnable {
+ private String PID;
+ private String SERVER_ADDR;
+ private int PORT;
+ private long TIMEOUT;
+ private boolean DEBUG;
+
+ public FDClient(String pid, String server_addr, int port, long timeout, boolean debug) throws IOException {
+ PID = pid;
+ SERVER_ADDR = server_addr;
+ PORT = port;
+ TIMEOUT = timeout;
+ DEBUG = debug;
+ (new Thread(this)).start();
+ }
+
+ @SuppressWarnings("resource")
+ @Override
+ public void run() {
+ // Define a DatagramSocket object to send packets to the server
+ try {
+ DatagramSocket sock = new DatagramSocket();
+ InetAddress IPAddress = InetAddress.getByName(SERVER_ADDR);
+
+ // Allocate buffer for the PING message
+ String content = "PING:" + PID;
+ byte[] buffer = content.getBytes();
+
+ // Sent a PING message every TIMEOUT milliseconds
+ while(true) {
+ DatagramPacket packet = new DatagramPacket(buffer, buffer.length, IPAddress, PORT);
+ sock.send(packet);
+
+ if(DEBUG) System.out.println("Sent PING message to server " + SERVER_ADDR + ":" + PORT);
+ try {
+ Thread.sleep(TIMEOUT);
+ }
+ catch(InterruptedException e) {}
+ }
+ } catch(IOException e) {}
+ }
+}
diff --git a/vnfs/vLB/DNSManager/.DS_Store b/vnfs/vLB/DNSManager/.DS_Store
new file mode 100644
index 00000000..cc896b07
--- /dev/null
+++ b/vnfs/vLB/DNSManager/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSManager/LICENSE.TXT b/vnfs/vLB/DNSManager/LICENSE.TXT
new file mode 100644
index 00000000..ae12da20
--- /dev/null
+++ b/vnfs/vLB/DNSManager/LICENSE.TXT
@@ -0,0 +1,22 @@
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
diff --git a/vnfs/vLB/DNSManager/README.txt b/vnfs/vLB/DNSManager/README.txt
new file mode 100644
index 00000000..4c690dc0
--- /dev/null
+++ b/vnfs/vLB/DNSManager/README.txt
@@ -0,0 +1,17 @@
+README
+---
+
+Run the dnsmembership.sh script before activating DNS clients. dnsmembership.sh starts the DNSMembershipManager Java class, which uses the FDServer Java class to keep track of the remote DNS servers that are currently active. Example:
+
+./dnsmembership.sh
+
+The script will call the DNSMembershipManager binary with default parameters:
+- java DNSMembershipManager [port] [timeout (sec)] [threshold] [debug]
+ - [port]: port where the server listens for incoming packets
+ - [timeout (sec)]: how often update the status of remote processes (clients)
+ - [threshold]: how many missed packet are required to suspect a remote process to be dead
+ - [debug]: verbose mode (TRUE: >=1, FALSE: <=0)
+- Example: java DNSMembershipManager 8888 10 3 1
+
+Please change the default parameters in the dnsmembership.sh script as appropriate for your configuration.
+
diff --git a/vnfs/vLB/DNSManager/pom.xml b/vnfs/vLB/DNSManager/pom.xml
new file mode 100644
index 00000000..20287f07
--- /dev/null
+++ b/vnfs/vLB/DNSManager/pom.xml
@@ -0,0 +1,51 @@
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.demo.vnf.lb</groupId>
+ <artifactId>dns-manager</artifactId>
+ <name>DNS Manager</name>
+ <packaging>jar</packaging>
+ <version>1.0.0</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>main.java.DNSMembershipManager</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>nexus</id>
+ <name>OpenECOMP Release Repository</name>
+ <url>https://ecomp-nexus:8443/repository/raw</url>
+ </repository>
+ </distributionManagement>
+
+</project>
diff --git a/vnfs/vLB/DNSManager/src/.DS_Store b/vnfs/vLB/DNSManager/src/.DS_Store
new file mode 100644
index 00000000..201b6cf3
--- /dev/null
+++ b/vnfs/vLB/DNSManager/src/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSManager/src/main/.DS_Store b/vnfs/vLB/DNSManager/src/main/.DS_Store
new file mode 100644
index 00000000..d0f5e852
--- /dev/null
+++ b/vnfs/vLB/DNSManager/src/main/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSManager/src/main/java/.DS_Store b/vnfs/vLB/DNSManager/src/main/java/.DS_Store
new file mode 100644
index 00000000..097132be
--- /dev/null
+++ b/vnfs/vLB/DNSManager/src/main/java/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/DNSManager/src/main/java/DNSMembershipManager.java b/vnfs/vLB/DNSManager/src/main/java/DNSMembershipManager.java
new file mode 100644
index 00000000..a597f3e5
--- /dev/null
+++ b/vnfs/vLB/DNSManager/src/main/java/DNSMembershipManager.java
@@ -0,0 +1,95 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+package main.java;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public class DNSMembershipManager {
+ /*
+ * Uses Failure Detector (FD) to keep track of the DNS servers currently active.
+ * @param port: the port that the FD service listens for incoming UDP packets
+ * @param timeout: how often the FD checks the status of client processes
+ * @param threshold: number of missing ping messages before declaring a client dead
+ * @param debug: debug mode on/off
+ */
+
+ static Set<String> active = new HashSet<String>();
+
+ @SuppressWarnings("static-access")
+ public static void main(String[] args) throws IOException, InterruptedException {
+ if(args.length != 5) {
+ System.out.println("Missing input parameters");
+ System.out.println("Usage:");
+ System.out.print("\t- java FDServer [public IP address] [port] [timeout (sec)] [threshold] [debug]\n");
+ System.exit(0);
+ }
+
+ // Input parameters: PORT, TIMEOUT, THRESHOLD
+ String IPADDR = args[0];
+ int PORT = Integer.parseInt(args[1]);
+ long TIMEOUT = Long.parseLong(args[2]) * 1000; // convert the FD timeout to milliseconds
+ int THRESHOLD = Integer.parseInt(args[3]);
+ int debug = Integer.parseInt(args[4]);
+ boolean DEBUG;
+ if(debug <= 0)
+ DEBUG = false;
+ else
+ DEBUG = true;
+
+ // Start Failure Detector
+ FDServer fd = new FDServer(IPADDR, PORT, TIMEOUT, THRESHOLD, DEBUG);
+
+ // Check the status of client processes periodically. We use the same timeout value as FD
+ Set<String> active = new HashSet<String>();
+ while(true) {
+ Set<String> alive_this_round = fd.getAliveProcesses();
+ Iterator<String> iter = alive_this_round.iterator();
+ String pid;
+
+ // Check if there is some new DNS active
+ while(iter.hasNext()) {
+ pid = iter.next();
+ if(!active.contains(pid)) {
+ active.add(pid);
+ // Add the new vDNS to the set of vDNS servers
+ String script = new String("bash /opt/FDserver/add_dns.sh " + pid);
+ Runtime.getRuntime().exec(script);
+ if(DEBUG) System.out.println("Adding process " + pid + " to the list of DNSs");
+ }
+ }
+
+ // Remove possible dead DNSs
+ iter = active.iterator();
+ while(iter.hasNext()) {
+ pid = iter.next();
+ if(!alive_this_round.contains(pid)) {
+ iter.remove(); // remove element from the iterator to avoid ConcurrentModificationException
+ // Remove the new vDNS from the set of vDNS servers
+ String script = new String("bash /opt/FDserver/remove_dns.sh " + pid);
+ Runtime.getRuntime().exec(script);
+ if(DEBUG) System.out.println("Removing process " + pid + " from the list of DNSs");
+ }
+ }
+ Thread.currentThread().sleep(TIMEOUT);
+ }
+ }
+}
diff --git a/vnfs/vLB/DNSManager/src/main/java/FDServer.java b/vnfs/vLB/DNSManager/src/main/java/FDServer.java
new file mode 100644
index 00000000..4b64c584
--- /dev/null
+++ b/vnfs/vLB/DNSManager/src/main/java/FDServer.java
@@ -0,0 +1,161 @@
+
+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+package main.java;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/*
+ * Server-side Failure Detector (FD) implementation.
+ * @param port: the port that the FD service listens for incoming UDP packets
+ * @param timeout: how often the FD checks the status of client processes
+ * @param threshold: number of missing ping messages before declaring a client dead
+ * @param debug: debug mode on/off
+ */
+
+public class FDServer implements Runnable {
+ // Input parameters
+ private String IP_ADDR;
+ private int PORT;
+ private long TIMEOUT;
+ private int THRESHOLD;
+ private boolean DEBUG;
+
+ // Data structures that store information about alive processes, processes alive/dead this round
+ private Map<String, Integer> alive = new ConcurrentHashMap<String, Integer>(); // Key: process IP address; Value: # consecutive missed pings
+ private Set<String> alive_this_round = ConcurrentHashMap.newKeySet(); // Needs to be synchronized because it is accessed by multiple threads
+ private Set<String> dead = new HashSet<String>();
+
+ public FDServer(String ip_addr, int port, long timeout, int threshold, boolean debug) throws IOException {
+ IP_ADDR = ip_addr;
+ PORT = port;
+ TIMEOUT = timeout;
+ THRESHOLD = threshold;
+ DEBUG = debug;
+ (new Thread(this)).start();
+ }
+
+ @Override
+ public void run() {
+ try {
+ runFD();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void runFD() throws IOException {
+ // Check the status of client processes periodically
+ TimerTask timer = new TimerTask() {
+ public void run() {
+ checkClientStatus();
+ }
+ };
+ new Timer().scheduleAtFixedRate(timer, 0, TIMEOUT);
+
+ // Define a DatagramSocket object for receiving incoming UDP packets
+ @SuppressWarnings("resource")
+ DatagramSocket sock = new DatagramSocket(PORT);
+ byte[] buffer = new byte[256];
+
+ // Wait for incoming PING messages from remote clients
+ while(true) {
+ DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
+ sock.receive(packet);
+ String[] content = new String(packet.getData()).trim().split(":"); // Remove leading and trailing spaces
+ String msg_type = content[0];
+ String pid = content[1];
+ // Process only PING UDP packets
+ if(msg_type.equals("PING")) {
+ String ip = packet.getAddress().getHostAddress();
+ alive_this_round.add(pid);
+ if(DEBUG) System.out.println("Keep-alive message received from process " + pid + " (sender IP Address: " + ip +")");
+ sendReplyMessage(packet.getAddress());
+ }
+ else {
+ if(DEBUG) System.out.println("The received message is not a PING. Received content: " + content);
+ }
+ }
+ }
+
+ private void sendReplyMessage(InetAddress address) throws IOException {
+ DatagramSocket sock = new DatagramSocket();
+ // Allocate buffer for the PING message
+ String content = "PONG:" + IP_ADDR;
+ byte[] buffer = content.getBytes();
+ // Sent a PONG message
+ DatagramPacket packet = new DatagramPacket(buffer, buffer.length, address, PORT);
+ sock.send(packet);
+ sock.close();
+ }
+
+ // Update the list of processes that are alive
+ private void checkClientStatus() {
+ if(DEBUG) System.out.println("/================================/");
+ if(DEBUG) System.out.println("Update status of remote processes");
+ // Check if a process alive the previous round is still alive
+ // Otherwise increment its counter
+ Set<String> alive_processes = alive.keySet();
+ Iterator<String> iter = alive_processes.iterator();
+ while(iter.hasNext()) {
+ String process = iter.next();
+ if(!alive_this_round.contains(process)) {
+ int counter = alive.get(process) + 1;
+ alive.put(process, counter);
+ if(DEBUG) System.out.println("Process " + process + " hasn't sent a message " + counter + " time(s) in a row");
+ // If the number of consecutive missed ping messages reached the threshold,
+ // then assume the process to be dead
+ if(counter == THRESHOLD) {
+ dead.add(process);
+ if(DEBUG) System.out.println("Process " + process + " is dead");
+ }
+ }
+ }
+
+ // Processes alive this round
+ iter = alive_this_round.iterator();
+ while(iter.hasNext()) {
+ String process = iter.next();
+ alive.put(process, 0);
+ if(DEBUG) System.out.println("Process " + process + " is alive this round");
+ }
+
+
+ // Remove dead processes
+ iter = dead.iterator();
+ while(iter.hasNext()) {
+ String process = iter.next();
+ if(alive.containsKey(process))
+ alive.remove(process);
+ if(DEBUG) System.out.println("Process " + process + " is removed from the list of alive processes");
+ }
+
+ // Cleanup
+ alive_this_round.clear();
+ dead.clear();
+ if(DEBUG) System.out.println();
+ }
+
+ // Return the set of alive processes to up-stream applications
+ public Set<String> getAliveProcesses() {
+ return alive.keySet();
+ }
+}
diff --git a/vnfs/vLB/dns_streams/.DS_Store b/vnfs/vLB/dns_streams/.DS_Store
new file mode 100644
index 00000000..5008ddfc
--- /dev/null
+++ b/vnfs/vLB/dns_streams/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/dns_streams/dep.xml b/vnfs/vLB/dns_streams/dep.xml
new file mode 100644
index 00000000..5355773f
--- /dev/null
+++ b/vnfs/vLB/dns_streams/dep.xml
@@ -0,0 +1,17 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>demo</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>stream*</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/vnfs/vLB/dns_streams/pom.xml b/vnfs/vLB/dns_streams/pom.xml
new file mode 100644
index 00000000..a0f33ff0
--- /dev/null
+++ b/vnfs/vLB/dns_streams/pom.xml
@@ -0,0 +1,58 @@
+<!--<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">-->
+<project>
+
+<parent>
+ <groupId>org.openecomp.demo.vnf</groupId>
+ <artifactId>demo-aggregator</artifactId>
+ <version>1.0.0</version>
+<relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openecomp.demo.vnf.vlb</groupId>
+ <artifactId>vlb_dns_streams</artifactId>
+ <!-- <name>vfw_pg_streams</name>-->
+ <version>1.0.0</version>
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>never</phase>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.5.3</version>
+ <configuration>
+ <descriptor>dep.xml</descriptor>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-archive</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+</plugin>
+
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/vnfs/vLB/dns_streams/stream_dns1 b/vnfs/vLB/dns_streams/stream_dns1
new file mode 100644
index 00000000..ff9fdc51
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns1
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns1
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x22c60100000100000000000005686f73743107646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns10 b/vnfs/vLB/dns_streams/stream_dns10
new file mode 100644
index 00000000..9f28e20e
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns10
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns10
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 54
+ hex 0x867b0100000100000000000006686f7374313007646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns2 b/vnfs/vLB/dns_streams/stream_dns2
new file mode 100644
index 00000000..0b3d6c64
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns2
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns2
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x23550100000100000000000005686f73743207646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns3 b/vnfs/vLB/dns_streams/stream_dns3
new file mode 100644
index 00000000..531ba8e1
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns3
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns3
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x7b110100000100000000000005686f73743307646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns4 b/vnfs/vLB/dns_streams/stream_dns4
new file mode 100644
index 00000000..2bfd4cba
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns4
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns4
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x63910100000100000000000005686f73743407646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns5 b/vnfs/vLB/dns_streams/stream_dns5
new file mode 100644
index 00000000..c853c57e
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns5
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns5
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x054e0100000100000000000005686f73743507646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns6 b/vnfs/vLB/dns_streams/stream_dns6
new file mode 100644
index 00000000..dab51566
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns6
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns6
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0xb9d80100000100000000000005686f73743607646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns7 b/vnfs/vLB/dns_streams/stream_dns7
new file mode 100644
index 00000000..1cca61ef
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns7
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns7
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x36f30100000100000000000005686f73743707646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns8 b/vnfs/vLB/dns_streams/stream_dns8
new file mode 100644
index 00000000..ce76bcaf
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns8
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns8
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x09860100000100000000000005686f73743807646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/dns_streams/stream_dns9 b/vnfs/vLB/dns_streams/stream_dns9
new file mode 100644
index 00000000..0cc3132d
--- /dev/null
+++ b/vnfs/vLB/dns_streams/stream_dns9
@@ -0,0 +1,13 @@
+packet-generator new {
+ name dns9
+ rate 10
+ node ip4-input
+ size 100-100
+ no-recycle
+ data {
+ UDP: 104.130.226.226 -> 104.130.169.190
+ UDP: 15320 -> 53
+ length 53
+ hex 0x12610100000100000000000005686f73743907646e7364656d6f096f70656e65636f6d70036f72670000010001
+ }
+}
diff --git a/vnfs/vLB/scripts/.DS_Store b/vnfs/vLB/scripts/.DS_Store
new file mode 100644
index 00000000..b7b2ad39
--- /dev/null
+++ b/vnfs/vLB/scripts/.DS_Store
Binary files differ
diff --git a/vnfs/vLB/scripts/add_dns.sh b/vnfs/vLB/scripts/add_dns.sh
new file mode 100644
index 00000000..04dfc771
--- /dev/null
+++ b/vnfs/vLB/scripts/add_dns.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+ echo "Usage: ./add_dns.sh [remote DNS server]"
+ exit
+fi
+
+DNS_IPADDR=$1
+MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
+MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+
+vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR
+GRE=$(vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR)
+vppctl set int state $GRE up
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS+1
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLB/scripts/db_dnsdemo_openecomp_org b/vnfs/vLB/scripts/db_dnsdemo_openecomp_org
new file mode 100644
index 00000000..631614ac
--- /dev/null
+++ b/vnfs/vLB/scripts/db_dnsdemo_openecomp_org
@@ -0,0 +1,24 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL 604800
+@ IN SOA dnsdemo.openecomp.org. admin.dnsdemo.openecomp.org. (
+ 3 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+; name servers - NS records
+ IN NS dnsdemo.openecomp.org.
+; name servers - A records
+dnsdemo.openecomp.org. IN A 10.0.100.100
+host1.dnsdemo.openecomp.org. IN A 10.0.100.101
+host2.dnsdemo.openecomp.org. IN A 10.0.100.102
+host3.dnsdemo.openecomp.org. IN A 10.0.100.103
+host4.dnsdemo.openecomp.org. IN A 10.0.100.104
+host5.dnsdemo.openecomp.org. IN A 10.0.100.105
+host6.dnsdemo.openecomp.org. IN A 10.0.100.106
+host7.dnsdemo.openecomp.org. IN A 10.0.100.107
+host8.dnsdemo.openecomp.org. IN A 10.0.100.108
+host9.dnsdemo.openecomp.org. IN A 10.0.100.109
+host10.dnsdemo.openecomp.org. IN A 10.0.100.110
diff --git a/vnfs/vLB/scripts/dnsclient.sh b/vnfs/vLB/scripts/dnsclient.sh
new file mode 100644
index 00000000..1de11ed8
--- /dev/null
+++ b/vnfs/vLB/scripts/dnsclient.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+LB_OAM_INT=$(cat /opt/config/lb_oam_int.txt)
+PID=$(cat /opt/config/local_private_ipaddr.txt)
+
+java -jar dns-client-1.0.0.jar $PID $LB_OAM_INT 8888 10 0
diff --git a/vnfs/vLB/scripts/dnsmembership.sh b/vnfs/vLB/scripts/dnsmembership.sh
new file mode 100644
index 00000000..073216b3
--- /dev/null
+++ b/vnfs/vLB/scripts/dnsmembership.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
+
+java -jar dns-manager-1.0.0.jar $MY_PUBLIC_IP 8888 10 3 0
diff --git a/vnfs/vLB/scripts/named.conf.local b/vnfs/vLB/scripts/named.conf.local
new file mode 100644
index 00000000..1b5c9f01
--- /dev/null
+++ b/vnfs/vLB/scripts/named.conf.local
@@ -0,0 +1,12 @@
+//
+// Do any local configuration here
+//
+
+// Consider adding the 1918 zones here, if they are not used in your
+// organization
+//include "/etc/bind/zones.rfc1918";
+
+zone "dnsdemo.openecomp.org" {
+ type master;
+ file "/etc/bind/zones/db.dnsdemo.openecomp.org"; # zone file path
+};
diff --git a/vnfs/vLB/scripts/named.conf.options b/vnfs/vLB/scripts/named.conf.options
new file mode 100644
index 00000000..1daa65c3
--- /dev/null
+++ b/vnfs/vLB/scripts/named.conf.options
@@ -0,0 +1,39 @@
+acl "trusted" {
+ x.x.x.x;
+};
+options {
+ directory "/var/cache/bind";
+
+ recursion no; # enables recursive queries
+ allow-recursion { trusted; }; # allows recursive queries from "trusted” clients i.e. LB only
+ listen-on { x.x.x.x; }; # ns1 IP address - listen on this address only
+ allow-transfer { none; }; # disable zone transfers by default
+
+ forwarders {
+ 8.8.8.8;
+ 8.8.4.4;
+ };
+
+
+ // If there is a firewall between you and nameservers you want
+ // to talk to, you may need to fix the firewall to allow multiple
+ // ports to talk. See http://www.kb.cert.org/vuls/id/800113
+
+ // If your ISP provided one or more IP addresses for stable
+ // nameservers, you probably want to use them as forwarders.
+ // Uncomment the following block, and insert the addresses replacing
+ // the all-0's placeholder.
+
+ // forwarders {
+ // 0.0.0.0;
+ // };
+
+ //========================================================================
+ // If BIND logs error messages about the root key being expired,
+ // you will need to update your keys. See https://www.isc.org/bind-keys
+ //========================================================================
+ dnssec-validation auto;
+
+ auth-nxdomain no; # conform to RFC1035
+ listen-on-v6 { any; };
+};
diff --git a/vnfs/vLB/scripts/remove_dns.sh b/vnfs/vLB/scripts/remove_dns.sh
new file mode 100644
index 00000000..1d505abe
--- /dev/null
+++ b/vnfs/vLB/scripts/remove_dns.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+ echo "Usage: ./add_dns.sh [remote DNS server]"
+ exit
+fi
+
+DNS_IPADDR=$1
+MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
+MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+
+vppctl lb as $MY_PUBLIC_ID"/32" $DNS_IPADDR del
+vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR del
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS-1
+if [[ $CURR_DNS -lt 0 ]]
+then
+ CURR_DNS=0
+fi
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh
new file mode 100755
index 00000000..4d4e5432
--- /dev/null
+++ b/vnfs/vLB/scripts/run_streams_dns.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+vppctl packet-gen disable
+vppctl packet-gen enable-stream dns1
+vppctl packet-gen enable-stream dns2
+sleep 300
+vppctl packet-gen enable-stream dns3
+vppctl packet-gen enable-stream dns4
+vppctl packet-gen enable-stream dns5
diff --git a/vnfs/vLB/scripts/set_gre_tunnel.sh b/vnfs/vLB/scripts/set_gre_tunnel.sh
new file mode 100644
index 00000000..2fa6c64e
--- /dev/null
+++ b/vnfs/vLB/scripts/set_gre_tunnel.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+ echo "Usage: ./set_gre_tunnel.sh [LB public IP address]"
+ exit
+fi
+
+LB_PUBLIC_IP=$1
+LB_PRIVATE_IP=$(cat /opt/config/lb_private_ipaddr.txt)
+MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+
+sed -i "s/x.x.x.x/"$LB_PUBLIC_IP"/g" /etc/bind/named.conf.options
+
+ip tunnel add gre123 mode gre remote $LB_PRIVATE_IP local $MY_PRIVATE_IP ttl 255
+ip link set gre123 up
+ip addr add $LB_PUBLIC_IP"/24" dev gre123
+ifconfig eth0 down
+route add default dev gre123
+
+service bind9 restart
diff --git a/vnfs/vLB/scripts/v_dns_init.sh b/vnfs/vLB/scripts/v_dns_init.sh
new file mode 100755
index 00000000..51ddba75
--- /dev/null
+++ b/vnfs/vLB/scripts/v_dns_init.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd /opt/FDclient
+./dnsclient.sh &>/dev/null &disown
+cd ~
diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh
new file mode 100755
index 00000000..d130c1ec
--- /dev/null
+++ b/vnfs/vLB/scripts/v_lb_init.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# Start VPP
+start vpp
+sleep 1
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+IPADDR2=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+HWADDR2=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
+GW=$(route | grep default | awk '{print $2}')
+
+ifconfig eth0 down
+ifconfig eth0 hw ether $FAKE_HWADDR1
+ip addr flush dev eth0
+ifconfig eth0 up
+vppctl tap connect tappub hwaddr $HWADDR1
+vppctl set int ip address tap-0 $IPADDR1"/24"
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tappub
+brctl addif br0 eth0
+ifconfig br0 up
+
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR2
+ip addr flush dev eth1
+ifconfig eth1 up
+vppctl tap connect tap111 hwaddr $HWADDR2
+vppctl set int ip address tap-1 $IPADDR2"/24"
+vppctl set int state tap-1 up
+brctl addbr br1
+brctl addif br1 tap111
+brctl addif br1 eth1
+ifconfig br1 up
+sleep 1
+
+vppctl lb conf ip4-src-address $IPADDR2
+vppctl lb vip $IPADDR1"/32" encap gre4
+vppctl ip route add 0.0.0.0/0 via $GW
+sleep 1
+
+cd /opt/FDserver
+./dnsmembership.sh &>/dev/null &disown
+
+# Start VES client
+cd /opt/VES/code/evel_training/VESreporting/
+echo 0 > active_dns.txt
+./go-client.sh &>/dev/null &disown
diff --git a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
new file mode 100644
index 00000000..ba7f56ca
--- /dev/null
+++ b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+# Start VPP
+start vpp
+sleep 1
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+GW=$(route | grep default | awk '{print $2}')
+
+ifconfig eth0 down
+ifconfig eth0 hw ether $FAKE_HWADDR1
+ip addr flush dev eth0
+ifconfig eth0 up
+vppctl tap connect tap111 hwaddr $HWADDR1
+vppctl set int ip address tap-0 $IPADDR1"/24"
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tap111
+brctl addif br0 eth0
+ifconfig br0 up
+vppctl ip route add 0.0.0.0/0 via $GW
+sleep 1
+
+
+#Let's set br0 with public IP and valid MAC so that Linux will have public network access
+ifconfig br0 hw ether $HWADDR1
+ifconfig br0 $IPADDR1 netmask 255.255.255.0
+route add default gw $GW
+
+#Adding static arp entry for VPP so that it will be able to send packets to default GW
+ping -c 1 $VLB_IPADDR &>/dev/null &disown
+sleep 3
+
+GW_MAC=$(arp -n | grep -w $GW | tr -s ' ' | cut -d' ' -f3)
+VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3)
+
+#if VLB in our network, we will use its mac
+if [ ! -z "$VLB_MAC" ]; then
+vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
+fi
+
+# in any case let's add arp entry for default gw
+vppctl set ip arp tap-0 $GW $GW_MAC
+
+
+# Install packet streams
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
+
+#sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns*
+
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
+
+vppctl exec /opt/dns_streams/stream_dns1
+vppctl exec /opt/dns_streams/stream_dns2
+vppctl exec /opt/dns_streams/stream_dns3
+vppctl exec /opt/dns_streams/stream_dns4
+vppctl exec /opt/dns_streams/stream_dns5
+vppctl exec /opt/dns_streams/stream_dns6
+vppctl exec /opt/dns_streams/stream_dns7
+vppctl exec /opt/dns_streams/stream_dns8
+vppctl exec /opt/dns_streams/stream_dns9
+vppctl exec /opt/dns_streams/stream_dns10
+sleep 1
+
+# Start HoneyComb
+echo "" > /var/lib/honeycomb/persist/context/data.json
+echo "" > /var/lib/honeycomb/persist/config/data.json
+/opt/honeycomb/sample-distribution-1.0.0/honeycomb &>/dev/null &disown
+sleep 20
+
+# Enable traffic flows
+cd /opt
+chmod +x run_streams_dns.sh
+#./run_streams_dns.sh &>/dev/null &disown
+
diff --git a/vnfs/vLB/scripts/vdns.sh b/vnfs/vLB/scripts/vdns.sh
new file mode 100644
index 00000000..e3f6f111
--- /dev/null
+++ b/vnfs/vLB/scripts/vdns.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_dns_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh
new file mode 100644
index 00000000..9bd77162
--- /dev/null
+++ b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+#Disable all streams via Honeycomb (so that it will in consistent state)
+curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": []}}' "http://localhost:8183/restconf/config/sample-plugin:sample-plugin/pg-streams"
+
+vppctl pac del dns1
+vppctl pac del dns2
+vppctl pac del dns3
+vppctl pac del dns4
+vppctl pac del dns5
+vppctl pac del dns6
+vppctl pac del dns7
+vppctl pac del dns8
+vppctl pac del dns9
+vppctl pac del dns10
+
+
+#Update destination (vLB) IP
+VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+IPADDR1=$(ifconfig br0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
+
+#Update source ports (make them random)
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
+
+vppctl exec /opt/dns_streams/stream_dns1
+vppctl exec /opt/dns_streams/stream_dns2
+vppctl exec /opt/dns_streams/stream_dns3
+vppctl exec /opt/dns_streams/stream_dns4
+vppctl exec /opt/dns_streams/stream_dns5
+vppctl exec /opt/dns_streams/stream_dns6
+vppctl exec /opt/dns_streams/stream_dns7
+vppctl exec /opt/dns_streams/stream_dns8
+vppctl exec /opt/dns_streams/stream_dns9
+vppctl exec /opt/dns_streams/stream_dns10 \ No newline at end of file
diff --git a/vnfs/vLB/scripts/vlb.sh b/vnfs/vLB/scripts/vlb.sh
new file mode 100644
index 00000000..5ab6c40e
--- /dev/null
+++ b/vnfs/vLB/scripts/vlb.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_lb_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vnfs/vLB/scripts/vpacketgenfordnsdemo.sh b/vnfs/vLB/scripts/vpacketgenfordnsdemo.sh
new file mode 100644
index 00000000..427e5337
--- /dev/null
+++ b/vnfs/vLB/scripts/vpacketgenfordnsdemo.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_packetgen_for_dns_demo_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
+