Thomas Vachuska
Committed by Gerrit Code Review

Enhancing STC and cleaning up various test topos.

Change-Id: I7f5b349835ebf3d7da824be0aa2cddd860631f84
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.cli;
17 +
18 +import com.fasterxml.jackson.databind.JsonNode;
19 +import com.fasterxml.jackson.databind.ObjectMapper;
20 +import com.fasterxml.jackson.databind.node.ArrayNode;
21 +import org.apache.karaf.shell.commands.Command;
22 +import org.onosproject.ui.UiExtension;
23 +import org.onosproject.ui.UiExtensionService;
24 +
25 +import java.util.List;
26 +
27 +/**
28 + * Lists all UI views.
29 + */
30 +@Command(scope = "onos", name = "ui-views",
31 + description = "Lists all UI views")
32 +public class UiViewListCommand extends AbstractShellCommand {
33 +
34 + private static final String FMT = "id=%s, category=%s, label=%s, icon=%s";
35 +
36 + @Override
37 + protected void execute() {
38 + UiExtensionService service = get(UiExtensionService.class);
39 + if (outputJson()) {
40 + print("%s", json(service.getExtensions()));
41 + } else {
42 + service.getExtensions().forEach(ext -> ext.views()
43 + .forEach(v -> print(FMT, v.id(), v.category().label(),
44 + v.label(), v.iconId())));
45 + }
46 + }
47 +
48 + private JsonNode json(List<UiExtension> extensions) {
49 + ObjectMapper mapper = new ObjectMapper();
50 + ArrayNode node = mapper.createArrayNode();
51 + extensions.forEach(ext -> ext.views()
52 + .forEach(v -> node.add(mapper.createObjectNode()
53 + .put("id", v.id())
54 + .put("category", v.category().label())
55 + .put("label", v.label())
56 + .put("icon", v.iconId()))));
57 + return node;
58 + }
59 +
60 +}
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
59 </command> 59 </command>
60 60
61 <command> 61 <command>
62 + <action class="org.onosproject.cli.UiViewListCommand"/>
63 + </command>
64 +
65 + <command>
62 <action class="org.onosproject.cli.RolesCommand"/> 66 <action class="org.onosproject.cli.RolesCommand"/>
63 </command> 67 </command>
64 <command> 68 <command>
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
3 # Checks whether all and only the ONOS apps configured in ONOS_APPS are active. 3 # Checks whether all and only the ONOS apps configured in ONOS_APPS are active.
4 # ----------------------------------------------------------------------------- 4 # -----------------------------------------------------------------------------
5 5
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
6 aux=/tmp/stc-$$.log 9 aux=/tmp/stc-$$.log
7 trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT 10 trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
8 11
......
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Checks ONOS summary data
4 +# -----------------------------------------------------------------------------
5 +
6 +aux=/tmp/stc-$$.log
7 +trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
8 +
9 +onos ${1:-$OCI} "onos:summary" > $aux
10 +cat $aux
11 +
12 +let status=0
13 +grep -q "nodes=$2" $aux || let status=status+1
14 +grep -q "devices=$3" $aux || let status=status+1
15 +grep -q "links=$4" $aux || let status=status+1
16 +grep -q "hosts=$5" $aux || let status=status+1
17 +
18 +exit $status
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Checks whether all and only the ONOS apps configured in ONOS_APPS are active.
4 +# -----------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
9 +aux=/tmp/stc-$$.log
10 +trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
11 +
12 +onos ${1} "onos:ui-views" > $aux
13 +cat $aux
14 +
15 +shift
16 +
17 +grep "$@" $aux
...\ No newline at end of file ...\ No newline at end of file
...@@ -10,10 +10,14 @@ remote=$ONOS_USER@${1:-$OCI} ...@@ -10,10 +10,14 @@ remote=$ONOS_USER@${1:-$OCI}
10 10
11 ssh -t $remote " 11 ssh -t $remote "
12 # Wait until we reach the run-level 100 12 # Wait until we reach the run-level 100
13 - running="" 13 + for i in \$(seq 1 30); do
14 - while [ -z \$running ]; do
15 $ONOS_INSTALL_DIR/bin/onos bundle:list 2>/dev/null | \ 14 $ONOS_INSTALL_DIR/bin/onos bundle:list 2>/dev/null | \
16 - grep -q 'START LEVEL 100' && running=1 || sleep 2 15 + grep -q 'START LEVEL 100' && break || sleep 2
17 done 16 done
18 17
18 + # Wait until ApplicationManager is available
19 + for i in \$(seq 1 5); do
20 + grep -q \" ApplicationManager .* Started\" \
21 + $ONOS_INSTALL_DIR/log/karaf.log && break || sleep 1
22 + done
19 " 23 "
......
...@@ -41,5 +41,10 @@ ...@@ -41,5 +41,10 @@
41 exec="mvn clean install"/> 41 exec="mvn clean install"/>
42 <step name="Reinstall-App-With-UI" requires="^,~Verify-CLI" 42 <step name="Reinstall-App-With-UI" requires="^,~Verify-CLI"
43 exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/> 43 exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
44 + <step name="Verify-UI" requires="^"
45 + exec="onos-check-views ${OCI} id=sample"/>
46 +
47 + <step name="Uninstall-App" requires="^"
48 + exec="onos-app ${OCI} uninstall org.foo.app"/>
44 </group> 49 </group>
45 </scenario> 50 </scenario>
......
1 +<!--
2 + ~ Copyright 2015 Open Networking Laboratory
3 + ~
4 + ~ Licensed under the Apache License, Version 2.0 (the "License");
5 + ~ you may not use this file except in compliance with the License.
6 + ~ You may obtain a copy of the License at
7 + ~
8 + ~ http://www.apache.org/licenses/LICENSE-2.0
9 + ~
10 + ~ Unless required by applicable law or agreed to in writing, software
11 + ~ distributed under the License is distributed on an "AS IS" BASIS,
12 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + ~ See the License for the specific language governing permissions and
14 + ~ limitations under the License.
15 + -->
16 +<scenario name="basic-net" description="Basic network functionality test">
17 + <group name="Basic-Net">
18 + <step name="Install-Apps"
19 + exec="onos ${OC1} app activate org.onosproject.proxyarp org.onosproject.fwd"/>
20 + <step name="Check-Apps" requires="Install-Apps"
21 + exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/>
22 +
23 + <step name="Config-Topo"
24 + exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/>
25 + <step name="Check-Summary" requires="Config-Topo"
26 + exec="onos-check-summary ${OC1} [0-9]* 25 0 25"/>
27 +
28 + <step name="Start-Mininet" requires="Install-Apps,Check-Summary"
29 + exec="echo onos-start-mininet not implemented yet"/>
30 + </group>
31 +</scenario>
...\ No newline at end of file ...\ No newline at end of file
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
20 <parallel var="${OC#}"> 20 <parallel var="${OC#}">
21 <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/> 21 <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/>
22 <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/> 22 <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/>
23 - <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}"/> 23 + <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" requires="Uninstall-${#}"/>
24 24
25 <step name="Install-${#}" exec="onos-install ${OC#}" 25 <step name="Install-${#}" exec="onos-install ${OC#}"
26 - requires="Uninstall-${#},Push-Bits-${#},Push-Bits"/> 26 + requires="Kill-${#},Push-Bits-${#},Push-Bits"/>
27 27
28 <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}" 28 <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}"
29 requires="Install-${#}"/> 29 requires="Install-${#}"/>
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
31 <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" 31 <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
32 requires="~Wait-for-Start-${#}"/> 32 requires="~Wait-for-Start-${#}"/>
33 <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" 33 <step name="Check-Components-${#}" exec="onos-check-components ${OC#}"
34 - requires="~Wait-for-Start-${#},~Check-Logs-${#}"/> 34 + requires="~Wait-for-Start-${#},"/>
35 <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}" 35 <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}"
36 - requires="~Wait-for-Start-${#},~Check-Logs-${#}"/> 36 + requires="~Wait-for-Start-${#}"/>
37 </parallel> 37 </parallel>
38 </group> 38 </group>
39 </scenario> 39 </scenario>
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
20 <parallel var="${OC#}"> 20 <parallel var="${OC#}">
21 <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/> 21 <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/>
22 <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/> 22 <step name="Uninstall-${#}" exec="onos-uninstall ${OC#}"/>
23 - <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}"/> 23 + <step name="Kill-${#}" env="~" exec="onos-kill ${OC#}" requires="Uninstall-${#}"/>
24 24
25 <step name="Untar-And-Run-${#}" exec="onos-untar-and-run ${OC#}" 25 <step name="Untar-And-Run-${#}" exec="onos-untar-and-run ${OC#}"
26 - requires="Uninstall-${#},Push-Bits-${#},Push-Bits"/> 26 + requires="Kill-${#},Push-Bits-${#},Push-Bits"/>
27 27
28 <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}" 28 <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}"
29 requires="Untar-And-Run-${#}"/> 29 requires="Untar-And-Run-${#}"/>
...@@ -31,12 +31,12 @@ ...@@ -31,12 +31,12 @@
31 <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}" 31 <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
32 requires="~Wait-for-Start-${#}"/> 32 requires="~Wait-for-Start-${#}"/>
33 <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" 33 <step name="Check-Components-${#}" exec="onos-check-components ${OC#}"
34 - requires="~Wait-for-Start-${#},~Check-Logs-${#}"/> 34 + requires="~Wait-for-Start-${#}"/>
35 <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} drivers" 35 <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} drivers"
36 - requires="~Wait-for-Start-${#},~Check-Logs-${#}"/> 36 + requires="~Wait-for-Start-${#}"/>
37 37
38 <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#} ${OC#}" 38 <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#} ${OC#}"
39 - requires="~Wait-for-Start-${#},~Check-Logs-${#}"/> 39 + requires="~Wait-for-Start-${#}"/>
40 </parallel> 40 </parallel>
41 </group> 41 </group>
42 42
...@@ -49,12 +49,12 @@ ...@@ -49,12 +49,12 @@
49 <step name="Check-Logs-Again-${#}" exec="onos-check-logs ${OC#}" 49 <step name="Check-Logs-Again-${#}" exec="onos-check-logs ${OC#}"
50 requires="~Wait-for-Start-Again-${#}"/> 50 requires="~Wait-for-Start-Again-${#}"/>
51 <step name="Check-Components-Again-${#}" exec="onos-check-components ${OC#}" 51 <step name="Check-Components-Again-${#}" exec="onos-check-components ${OC#}"
52 - requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/> 52 + requires="~Wait-for-Start-Again-${#}"/>
53 <step name="Check-Apps-Again-${#}" exec="onos-check-apps ${OC#} drivers" 53 <step name="Check-Apps-Again-${#}" exec="onos-check-apps ${OC#} drivers"
54 - requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/> 54 + requires="~Wait-for-Start-Again-${#}"/>
55 55
56 <step name="Check-Nodes-Again-${#}" exec="onos-check-nodes ${OC#}" 56 <step name="Check-Nodes-Again-${#}" exec="onos-check-nodes ${OC#}"
57 - requires="~Wait-for-Start-Again-${#},~Check-Logs-Again-${#}"/> 57 + requires="~Wait-for-Start-Again-${#}"/>
58 </parallel> 58 </parallel>
59 </group> 59 </group>
60 60
......
...@@ -26,6 +26,7 @@ def run(controllers=[ '127.0.0.1' ]): ...@@ -26,6 +26,7 @@ def run(controllers=[ '127.0.0.1' ]):
26 ctrl_count = 0 26 ctrl_count = 0
27 for controllerIP in controllers: 27 for controllerIP in controllers:
28 net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP ) 28 net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
29 + ctrl_count = ctrl_count + 1
29 net.build() 30 net.build()
30 net.start() 31 net.start()
31 CLI( net ) 32 CLI( net )
......
1 -{
2 - "devices": [
3 - { "alias": "s11", "uri": "of:0000001000000001", "mac": "001000000001", "annotations": { "name": "MINE", "latitude": 44.977862, "longitude": -93.265427 }, "type": "SWITCH" },
4 - { "alias": "s12", "uri": "of:0000001000000002", "mac": "001000000002", "annotations": { "name": "BISM", "latitude": 46.817887, "longitude": -100.786109 }, "type": "SWITCH" },
5 - { "alias": "s13", "uri": "of:0000001000000003", "mac": "001000000003", "annotations": { "name": "BOIS", "latitude": 43.617834, "longitude": -116.216903 }, "type": "SWITCH" },
6 - { "alias": "s14", "uri": "of:0000001000000004", "mac": "001000000004", "annotations": { "name": "RENO", "latitude": 39.533310, "longitude": -119.796940 }, "type": "SWITCH" },
7 - { "alias": "s15", "uri": "of:0000001000000005", "mac": "001000000005", "annotations": { "name": "ALBU", "latitude": 35.109657, "longitude": -106.626698 }, "type": "SWITCH" }
8 - ],
9 -
10 - "hosts": [
11 - { "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 } },
12 - { "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 } },
13 - { "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 } },
14 - { "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 } },
15 - { "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 } }
16 - ]
17 -
18 -}
1 -#!/usr/bin/env python
2 -
3 -"""
4 -"""
5 -from mininet.topo import Topo
6 -from mininet.net import Mininet
7 -from mininet.node import RemoteController
8 -from mininet.node import Node
9 -from mininet.node import CPULimitedHost
10 -from mininet.link import TCLink
11 -from mininet.cli import CLI
12 -from mininet.log import setLogLevel
13 -from mininet.util import dumpNodeConnections
14 -
15 -class AttMplsTopoExt( Topo ):
16 - "Internet Topology Zoo Specimen."
17 -
18 - def __init__( self ):
19 - "Create a topology."
20 -
21 - # Initialize Topology
22 - Topo.__init__( self )
23 -
24 - # add nodes, switches first...
25 - MINE = self.addSwitch( 's31', dpid='0000001000000001') # 44.977862, -93.265427
26 - BISM = self.addSwitch( 's32', dpid='0000001000000002') # 46.817887, -100.786109
27 - BOIS = self.addSwitch( 's33', dpid='0000001000000003') # 43.617834, -116.216903
28 - RENO = self.addSwitch( 's34', dpid='0000001000000004') # 39.533310, -119.796940
29 - ALBU = self.addSwitch( 's35', dpid='0000001000000005') # 35.109657, -106.626698
30 -
31 - # ... and now hosts
32 - MINE_host = self.addHost( 'h31', mac='00:10:00:00:00:01' )
33 - BISM_host = self.addHost( 'h32', mac='00:10:00:00:00:02' )
34 - BOIS_host = self.addHost( 'h33', mac='00:10:00:00:00:03' )
35 - RENO_host = self.addHost( 'h34', mac='00:10:00:00:00:04' )
36 - ALBU_host = self.addHost( 'h35', mac='00:10:00:00:00:05' )
37 -
38 - # add edges between switch and corresponding host
39 - self.addLink( MINE , MINE_host )
40 - self.addLink( BISM , BISM_host )
41 - self.addLink( BOIS , BOIS_host )
42 - self.addLink( RENO , RENO_host )
43 - self.addLink( ALBU , ALBU_host )
44 -
45 - # add edges between switches
46 - self.addLink( MINE , BISM, bw=10, delay='0.979030824185ms')
47 - self.addLink( BISM , BOIS, bw=10, delay='0.806374975652ms')
48 - self.addLink( BOIS , RENO, bw=10, delay='0.686192970166ms')
49 - self.addLink( BOIS , ALBU, bw=10, delay='0.605826192092ms')
50 - self.addLink( RENO , ALBU, bw=10, delay='1.4018238197ms')
51 - self.addLink( RENO , MINE, bw=10, delay='0.232315346482ms')
52 - self.addLink( BISM , ALBU, bw=10, delay='1.07297714274ms')
53 -
54 -topos = { 'att': ( lambda: AttMplsTopoExt() ) }