Thomas Vachuska
Committed by Gerrit Code Review

Enhancing STC and cleaning up various test topos.

Change-Id: I7f5b349835ebf3d7da824be0aa2cddd860631f84
/*
* Copyright 2015 Open Networking Laboratory
*
* 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 org.onosproject.cli;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.ui.UiExtension;
import org.onosproject.ui.UiExtensionService;
import java.util.List;
/**
* Lists all UI views.
*/
@Command(scope = "onos", name = "ui-views",
description = "Lists all UI views")
public class UiViewListCommand extends AbstractShellCommand {
private static final String FMT = "id=%s, category=%s, label=%s, icon=%s";
@Override
protected void execute() {
UiExtensionService service = get(UiExtensionService.class);
if (outputJson()) {
print("%s", json(service.getExtensions()));
} else {
service.getExtensions().forEach(ext -> ext.views()
.forEach(v -> print(FMT, v.id(), v.category().label(),
v.label(), v.iconId())));
}
}
private JsonNode json(List<UiExtension> extensions) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode node = mapper.createArrayNode();
extensions.forEach(ext -> ext.views()
.forEach(v -> node.add(mapper.createObjectNode()
.put("id", v.id())
.put("category", v.category().label())
.put("label", v.label())
.put("icon", v.iconId()))));
return node;
}
}
......@@ -59,6 +59,10 @@
</command>
<command>
<action class="org.onosproject.cli.UiViewListCommand"/>
</command>
<command>
<action class="org.onosproject.cli.RolesCommand"/>
</command>
<command>
......
......@@ -3,6 +3,9 @@
# Checks whether all and only the ONOS apps configured in ONOS_APPS are active.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
aux=/tmp/stc-$$.log
trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
......
#!/bin/bash
# -----------------------------------------------------------------------------
# Checks ONOS summary data
# -----------------------------------------------------------------------------
aux=/tmp/stc-$$.log
trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
onos ${1:-$OCI} "onos:summary" > $aux
cat $aux
let status=0
grep -q "nodes=$2" $aux || let status=status+1
grep -q "devices=$3" $aux || let status=status+1
grep -q "links=$4" $aux || let status=status+1
grep -q "hosts=$5" $aux || let status=status+1
exit $status
\ No newline at end of file
#!/bin/bash
# -----------------------------------------------------------------------------
# Checks whether all and only the ONOS apps configured in ONOS_APPS are active.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
aux=/tmp/stc-$$.log
trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
onos ${1} "onos:ui-views" > $aux
cat $aux
shift
grep "$@" $aux
\ No newline at end of file
......@@ -10,10 +10,14 @@ remote=$ONOS_USER@${1:-$OCI}
ssh -t $remote "
# Wait until we reach the run-level 100
running=""
while [ -z \$running ]; do
for i in \$(seq 1 30); do
$ONOS_INSTALL_DIR/bin/onos bundle:list 2>/dev/null | \
grep -q 'START LEVEL 100' && running=1 || sleep 2
grep -q 'START LEVEL 100' && break || sleep 2
done
# Wait until ApplicationManager is available
for i in \$(seq 1 5); do
grep -q \" ApplicationManager .* Started\" \
$ONOS_INSTALL_DIR/log/karaf.log && break || sleep 1
done
"
......
......@@ -41,5 +41,10 @@
exec="mvn clean install"/>
<step name="Reinstall-App-With-UI" requires="^,~Verify-CLI"
exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
<step name="Verify-UI" requires="^"
exec="onos-check-views ${OCI} id=sample"/>
<step name="Uninstall-App" requires="^"
exec="onos-app ${OCI} uninstall org.foo.app"/>
</group>
</scenario>
......
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ 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.
-->
<scenario name="basic-net" description="Basic network functionality test">
<group name="Basic-Net">
<step name="Install-Apps"
exec="onos ${OC1} app activate org.onosproject.proxyarp org.onosproject.fwd"/>
<step name="Check-Apps" requires="Install-Apps"
exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/>
<step name="Config-Topo"
exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/>
<step name="Check-Summary" requires="Config-Topo"
exec="onos-check-summary ${OC1} [0-9]* 25 0 25"/>
<step name="Start-Mininet" requires="Install-Apps,Check-Summary"
exec="echo onos-start-mininet not implemented yet"/>
</group>
</scenario>
\ No newline at end of file
......@@ -20,10 +20,10 @@
<parallel var="${OC#}">
<step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/>
<step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/>
<step name="Kill-${#}" env="~" exec="onos-kill ${OC#}"/>
<step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" requires="Uninstall-${#}"/>
<step name="Install-${#}" exec="onos-install ${OC#}"
requires="Uninstall-${#},Push-Bits-${#},Push-Bits"/>
requires="Kill-${#},Push-Bits-${#},Push-Bits"/>
<step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}"
requires="Install-${#}"/>
......@@ -31,9 +31,9 @@
<step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
requires="~Wait-for-Start-${#}"/>
<step name="Check-Components-${#}" exec="onos-check-components ${OC#}"
requires="~Wait-for-Start-${#},~Check-Logs-${#}"/>
requires="~Wait-for-Start-${#},"/>
<step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}"
requires="~Wait-for-Start-${#},~Check-Logs-${#}"/>
requires="~Wait-for-Start-${#}"/>
</parallel>
</group>
</scenario>
......
......@@ -20,10 +20,10 @@
<parallel var="${OC#}">
<step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/>
<step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/>
<step name="Kill-${#}" env="~" exec="onos-kill ${OC#}"/>
<step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" requires="Uninstall-${#}"/>
<step name="Untar-And-Run-${#}" exec="onos-untar-and-run ${OC#}"
requires="Uninstall-${#},Push-Bits-${#},Push-Bits"/>
requires="Kill-${#},Push-Bits-${#},Push-Bits"/>
<step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}"
requires="Untar-And-Run-${#}"/>
......@@ -31,12 +31,12 @@
<step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
requires="~Wait-for-Start-${#}"/>
<step name="Check-Components-${#}" exec="onos-check-components ${OC#}"
requires="~Wait-for-Start-${#},~Check-Logs-${#}"/>
requires="~Wait-for-Start-${#}"/>
<step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} drivers"
requires="~Wait-for-Start-${#},~Check-Logs-${#}"/>
requires="~Wait-for-Start-${#}"/>
<step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#} ${OC#}"
requires="~Wait-for-Start-${#},~Check-Logs-${#}"/>
requires="~Wait-for-Start-${#}"/>
</parallel>
</group>
......@@ -49,12 +49,12 @@
<step name="Check-Logs-Again-${#}" exec="onos-check-logs ${OC#}"
requires="~Wait-for-Start-Again-${#}"/>
<step name="Check-Components-Again-${#}" exec="onos-check-components ${OC#}"
requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/>
requires="~Wait-for-Start-Again-${#}"/>
<step name="Check-Apps-Again-${#}" exec="onos-check-apps ${OC#} drivers"
requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/>
requires="~Wait-for-Start-Again-${#}"/>
<step name="Check-Nodes-Again-${#}" exec="onos-check-nodes ${OC#}"
requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/>
requires="~Wait-for-Start-Again-${#}"/>
</parallel>
</group>
......
......@@ -26,6 +26,7 @@ def run(controllers=[ '127.0.0.1' ]):
ctrl_count = 0
for controllerIP in controllers:
net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
ctrl_count = ctrl_count + 1
net.build()
net.start()
CLI( net )
......
{
"devices": [
{ "alias": "s11", "uri": "of:0000001000000001", "mac": "001000000001", "annotations": { "name": "MINE", "latitude": 44.977862, "longitude": -93.265427 }, "type": "SWITCH" },
{ "alias": "s12", "uri": "of:0000001000000002", "mac": "001000000002", "annotations": { "name": "BISM", "latitude": 46.817887, "longitude": -100.786109 }, "type": "SWITCH" },
{ "alias": "s13", "uri": "of:0000001000000003", "mac": "001000000003", "annotations": { "name": "BOIS", "latitude": 43.617834, "longitude": -116.216903 }, "type": "SWITCH" },
{ "alias": "s14", "uri": "of:0000001000000004", "mac": "001000000004", "annotations": { "name": "RENO", "latitude": 39.533310, "longitude": -119.796940 }, "type": "SWITCH" },
{ "alias": "s15", "uri": "of:0000001000000005", "mac": "001000000005", "annotations": { "name": "ALBU", "latitude": 35.109657, "longitude": -106.626698 }, "type": "SWITCH" }
],
"hosts": [
{ "alias": "h31", "mac": "00:10:00:00:00:01", "vlan": -1, "location": "of:0000001000000001/1", "ip": "10.0.0.31", "annotations": { "name": "MINE", "latitude": 46.509021, "longitude": -93.820777 } },
{ "alias": "h32", "mac": "00:10:00:00:00:02", "vlan": -1, "location": "of:0000001000000002/1", "ip": "10.0.0.32", "annotations": { "name": "BISM", "latitude": 48.169551, "longitude": -101.866954 } },
{ "alias": "h33", "mac": "00:10:00:00:00:03", "vlan": -1, "location": "of:0000001000000003/1", "ip": "10.0.0.33", "annotations": { "name": "BOIS", "latitude": 44.617834, "longitude": -117.216903 } },
{ "alias": "h34", "mac": "00:10:00:00:00:04", "vlan": -1, "location": "of:0000001000000004/1", "ip": "10.0.0.34", "annotations": { "name": "RENO", "latitude": 40.686744, "longitude": -117.886514 } },
{ "alias": "h35", "mac": "00:10:00:00:00:05", "vlan": -1, "location": "of:0000001000000005/1", "ip": "10.0.0.35", "annotations": { "name": "ALBU", "latitude": 35.486729, "longitude": -104.231201 } }
]
}
#!/usr/bin/env python
"""
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.node import Node
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.util import dumpNodeConnections
class AttMplsTopoExt( Topo ):
"Internet Topology Zoo Specimen."
def __init__( self ):
"Create a topology."
# Initialize Topology
Topo.__init__( self )
# add nodes, switches first...
MINE = self.addSwitch( 's31', dpid='0000001000000001') # 44.977862, -93.265427
BISM = self.addSwitch( 's32', dpid='0000001000000002') # 46.817887, -100.786109
BOIS = self.addSwitch( 's33', dpid='0000001000000003') # 43.617834, -116.216903
RENO = self.addSwitch( 's34', dpid='0000001000000004') # 39.533310, -119.796940
ALBU = self.addSwitch( 's35', dpid='0000001000000005') # 35.109657, -106.626698
# ... and now hosts
MINE_host = self.addHost( 'h31', mac='00:10:00:00:00:01' )
BISM_host = self.addHost( 'h32', mac='00:10:00:00:00:02' )
BOIS_host = self.addHost( 'h33', mac='00:10:00:00:00:03' )
RENO_host = self.addHost( 'h34', mac='00:10:00:00:00:04' )
ALBU_host = self.addHost( 'h35', mac='00:10:00:00:00:05' )
# add edges between switch and corresponding host
self.addLink( MINE , MINE_host )
self.addLink( BISM , BISM_host )
self.addLink( BOIS , BOIS_host )
self.addLink( RENO , RENO_host )
self.addLink( ALBU , ALBU_host )
# add edges between switches
self.addLink( MINE , BISM, bw=10, delay='0.979030824185ms')
self.addLink( BISM , BOIS, bw=10, delay='0.806374975652ms')
self.addLink( BOIS , RENO, bw=10, delay='0.686192970166ms')
self.addLink( BOIS , ALBU, bw=10, delay='0.605826192092ms')
self.addLink( RENO , ALBU, bw=10, delay='1.4018238197ms')
self.addLink( RENO , MINE, bw=10, delay='0.232315346482ms')
self.addLink( BISM , ALBU, bw=10, delay='1.07297714274ms')
topos = { 'att': ( lambda: AttMplsTopoExt() ) }