Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request qca#7 from qca/master
Browse files Browse the repository at this point in the history
Update to latest
  • Loading branch information
wwahammy authored Aug 31, 2016
2 parents ee59516 + f2423c4 commit 9134e49
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bft
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def main():
else:
n = t.__class__.__name__
for k, v in t.logged.items():
info_for_remote_log[n + '.' + k] = v
info_for_remote_log[n + '-' + k] = v
if hasattr(t, 'result_grade'):
info_for_remote_log[n + ".result"] = t.result_grade
info_for_remote_log[n + "-result"] = t.result_grade

try:
if config.logging_server is not None:
Expand Down
4 changes: 3 additions & 1 deletion devices/openwrt_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ def reset(self, break_into_uboot=False):
self.expect('Hit any key ')
self.sendline('\n\n\n\n\n\n\n') # try really hard
self.expect(self.uprompt, timeout=4)
# Confirm we are in uboot by typing any command.
# If we weren't in uboot, we wouldn't see the command
# that we type.
self.sendline('echo FOO')
self.expect('echo FOO', timeout=4)
self.expect('FOO')
self.expect(self.uprompt, timeout=4)
return
except Exception as e:
Expand Down
89 changes: 89 additions & 0 deletions docs/ELK_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
ELK Setup
=========

ELK is the short term for a software compilation used by BoardFarm to store, process and visualize test results.
ELK consists of three tools:

* Elasticsearch
* Logstash
* Kibana

For this basic setup guide, we won't even need Logstash as the results are already stored in the correct format in the Elasticsearch database.

Installation
------------

This guide was written for Ubuntu 16.04 LTS and the following versions of Elasticsearch and Kibana:

* Elasticsearch 2.3.3
* Kibana 4.5.1

If you follow this guide and you can't get it working with newer versions, you should try again with these versions.

### Prerequisites

Elasticsearch and Logstash require Java. Elasticsearch recommends Oracle Java 8 but I had no issues using OpenJDK 8. Use whatever you prefer, I'll use OpenJDK in this guide.

apt-get install -y openjdk-8-jre openjdk-8-jdk

Now that we've installed Java, we can go on with Elasticsearch.

### Installing Elasticsearch

We'll just download the Elasticsearch Debian package and install it:

wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.3/elasticsearch-2.3.3.deb
dpkg -i ./elasticsearch-2.3.3.deb

You probably want Elasticsearch to automatically start every time you reboot your machine:

systemctl enable elasticsearch

Now let's edit the Elasticsearch configuration to restrict access from anywhere except the host itself:

nano /etc/elasticsearch/elasticsearch.yml

Look for a line containing 'network.host' and uncomment it. Set the value to 'localhost':

network.host: localhost

This will only allow the machine itself to access Elasticsearch on port 9200. Otherwise, anyone with network access to the machine could access your stored data or shut down the Elasticsearch server.

Finally, restart Elasticsearch to apply the changed settings:

systemctl restart elasticsearch

### Installing Kibana

Kibana is available as a 32-bit package and a 64-bit package, I'm using the 64-bit package in this guide:

wget https://download.elastic.co/kibana/kibana/kibana_4.5.1_amd64.deb
dpkg -i ./kibana_4.5.1_amd64.deb

As we did with Elasticsearch, we'll make Kibana automatically start on bootup:

systemctl enable kibana

You should now be able to access the Kibana webinterface on port 5601. Before visiting the webinterface for the first time, we want to store some data in the Elasticsearch database so Kibana has something to work with when we start it for the first time.

### Configuring BoardFarm

We need to tell BoardFarm to store the data in the Elasticsearch database by specifying the server address in BoardFarm's `config.py`. In this guide, I'm running BoardFarm, Elasticsearch and Kibana on the same host, so I'll use 'localhost' as the server address:

elasticsearch_server = 'localhost'

You should then run a few BoardFarm tests to store some data in the Elasticsearch database. After running the tests, you should see something like this at the end of the output:

Elasticsearch: Data stored at localhost boardfarm-2016.07.05/bft_run/AVW6ozxZoiJNDeD5bFyj

Now, we have data to work with.

### Specifying an index pattern in Kibana

When visiting the Kibana webinterface for the first time, you'll have to specify an index pattern so Kibana knows which logfiles to analyze. BoardFarm stores its data in the format boardfarm-\<yyyy.mm.dd>, so we'll tell Kibana to use 'boardfarm-\*' as the index pattern.
Kibana should then automatically recognize your existing database entries and suggest '@timestamp' as the time-field name.
Click 'create' and you're good to go. You should now see a table with a number of fields, e.g. 'board_type' or 'tests_total'.

*Note: If you now run other testcases with new field names, you'll have to click the 'refresh field list' button at the top of the page, otherwise the new fields won't be displayed.*

You can now go to the 'Discover' page to see your log entries or to the 'Visualize' page to create new visualizations.
14 changes: 7 additions & 7 deletions tests/iperf_udp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def server_opts_reverse(self, node=lan):
lan_priv_ip = node.get_interface_ipaddr("eth1")
except:
lan_priv_ip = node.get_interface_ipaddr("wlan0")
board.uci_forward_traffic_redirect("tcp", "5001", lan_priv_ip)
board.uci_forward_traffic_redirect("udp", "5001", lan_priv_ip)
self.rip = board.get_interface_ipaddr(board.wan_iface)
return ""

Expand Down Expand Up @@ -167,10 +167,10 @@ def forward_ip(self):
return "192.168.1.1"

def runTest(self):
super(iPerfNonRoutedTest, self).runTest(client=lan, server=board)
super(iPerfUDPNonRoutedTest, self).runTest(client=lan, server=board)

def recover(self):
super(iPerfNonRoutedTest, self).recover(client=lan, server=board)
super(iPerfUDPNonRoutedTest, self).recover(client=lan, server=board)

class iPerfUDPReverseTest(iPerfUDPTest):
'''iPerf from WAN to LAN'''
Expand Down Expand Up @@ -228,15 +228,15 @@ def reverse_ip(self):
return "4aaa::6"

def server_opts_reverse(self, node):
board.uci_forward_traffic_rule("tcp", "5001", "4aaa::6")
board.uci_forward_traffic_rule("udp", "5001", "4aaa::6")
return "-V -B %s" % self.reverse_ip()

def client_opts(self):
return "-V"

def runTest(self):
ipv6_setup.Set_IPv6_Addresses.runTest(self)
iPerfReverseTest.runTest(self)
iPerfUDPReverseTest.runTest(self)

class iPerfUDPBiDirTest(iPerfUDPTest):
'''iPerf from LAN to/from WAN'''
Expand Down Expand Up @@ -308,12 +308,12 @@ def server_opts_forward(self):
return "-V -B %s" % self.forward_ip()

def server_opts_reverse(self, node):
board.uci_forward_traffic_rule("tcp", "5001", "4aaa::6")
board.uci_forward_traffic_rule("udp", "5001", "4aaa::6")
return "-V -B %s" % self.reverse_ip()

def client_opts(self):
return "-V"

def runTest(self):
ipv6_setup.Set_IPv6_Addresses.runTest(self)
iPerfBiDirTest.runTest(self)
iPerfUDPBiDirTest.runTest(self)

0 comments on commit 9134e49

Please sign in to comment.