Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
tom
2014-09-23 13:20:53 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
caf3bf784a0b62998f6b40c6df1c3e43fd559abc
caf3bf78
1 parent
50d401fe
Added onos-test.
Refactored the CLI classes.
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
38 additions
and
37 deletions
cli/src/main/java/org/onlab/onos/cli/AbstractShellCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DeviceRemoveCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/HostsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/LinksListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/TopologyCommand.java
tools/dev/bash_profile
tools/test/bin/onos-config
tools/test/bin/onos-log
tools/test/bin/onos-test
utils/osgi/src/main/java/org/onlab/osgi/DefaultServiceDirectory.java
cli/src/main/java/org/onlab/onos/cli/AbstractShellCommand.java
View file @
caf3bf7
...
...
@@ -15,6 +15,7 @@ public abstract class AbstractShellCommand extends OsgiCommandSupport {
* @param serviceClass service class
* @param <T> type of service
* @return service implementation
* @throws org.onlab.osgi.ServiceNotFoundException if service is unavailable
*/
public
static
<
T
>
T
get
(
Class
<
T
>
serviceClass
)
{
return
DefaultServiceDirectory
.
getService
(
serviceClass
);
...
...
@@ -26,7 +27,7 @@ public abstract class AbstractShellCommand extends OsgiCommandSupport {
* @param format format string; see {@link String#format}
* @param args arguments
*/
public
static
void
print
(
String
format
,
Object
...
args
)
{
public
void
print
(
String
format
,
Object
...
args
)
{
System
.
out
.
println
(
String
.
format
(
format
,
args
));
}
...
...
@@ -36,7 +37,7 @@ public abstract class AbstractShellCommand extends OsgiCommandSupport {
* @param format format string; see {@link String#format}
* @param args arguments
*/
public
static
void
error
(
String
format
,
Object
...
args
)
{
public
void
error
(
String
format
,
Object
...
args
)
{
System
.
err
.
println
(
String
.
format
(
format
,
args
));
}
...
...
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
View file @
caf3bf7
...
...
@@ -36,7 +36,7 @@ public class DevicePortsListCommand extends DevicesListCommand {
@Override
protected
void
execute
()
{
DeviceService
service
=
get
Service
(
DeviceService
.
class
);
DeviceService
service
=
get
(
DeviceService
.
class
);
if
(
uri
==
null
)
{
for
(
Device
device
:
getSortedDevices
(
service
))
{
printDevice
(
service
,
device
);
...
...
cli/src/main/java/org/onlab/onos/cli/net/DeviceRemoveCommand.java
View file @
caf3bf7
...
...
@@ -19,7 +19,7 @@ public class DeviceRemoveCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
get
Service
(
DeviceAdminService
.
class
).
removeDevice
(
DeviceId
.
deviceId
(
uri
));
get
(
DeviceAdminService
.
class
).
removeDevice
(
DeviceId
.
deviceId
(
uri
));
}
}
...
...
cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
View file @
caf3bf7
...
...
@@ -25,7 +25,7 @@ public class DeviceRoleCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
MastershipRole
mastershipRole
=
MastershipRole
.
valueOf
(
role
.
toUpperCase
());
get
Service
(
DeviceAdminService
.
class
).
setRole
(
DeviceId
.
deviceId
(
uri
),
get
(
DeviceAdminService
.
class
).
setRole
(
DeviceId
.
deviceId
(
uri
),
mastershipRole
);
}
...
...
cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
View file @
caf3bf7
...
...
@@ -30,7 +30,7 @@ public class DevicesListCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
DeviceService
service
=
get
Service
(
DeviceService
.
class
);
DeviceService
service
=
get
(
DeviceService
.
class
);
for
(
Device
device
:
getSortedDevices
(
service
))
{
printDevice
(
service
,
device
);
}
...
...
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
View file @
caf3bf7
...
...
@@ -35,8 +35,8 @@ public class FlowsListCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
DeviceService
deviceService
=
get
Service
(
DeviceService
.
class
);
FlowRuleService
service
=
get
Service
(
FlowRuleService
.
class
);
DeviceService
deviceService
=
get
(
DeviceService
.
class
);
FlowRuleService
service
=
get
(
FlowRuleService
.
class
);
Map
<
Device
,
List
<
FlowRule
>>
flows
=
getSortedFlows
(
deviceService
,
service
);
for
(
Device
d
:
deviceService
.
getDevices
())
{
printFlows
(
d
,
flows
.
get
(
d
));
...
...
cli/src/main/java/org/onlab/onos/cli/net/HostsListCommand.java
View file @
caf3bf7
...
...
@@ -30,7 +30,7 @@ public class HostsListCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
HostService
service
=
get
Service
(
HostService
.
class
);
HostService
service
=
get
(
HostService
.
class
);
for
(
Host
host
:
getSortedHosts
(
service
))
{
printHost
(
host
);
}
...
...
cli/src/main/java/org/onlab/onos/cli/net/LinksListCommand.java
View file @
caf3bf7
...
...
@@ -24,7 +24,7 @@ public class LinksListCommand extends AbstractShellCommand {
@Override
protected
void
execute
()
{
LinkService
service
=
get
Service
(
LinkService
.
class
);
LinkService
service
=
get
(
LinkService
.
class
);
Iterable
<
Link
>
links
=
uri
!=
null
?
service
.
getDeviceLinks
(
deviceId
(
uri
))
:
service
.
getLinks
();
for
(
Link
link
:
links
)
{
...
...
cli/src/main/java/org/onlab/onos/cli/net/TopologyCommand.java
View file @
caf3bf7
...
...
@@ -23,7 +23,7 @@ public class TopologyCommand extends AbstractShellCommand {
* Initializes the context for all cluster commands.
*/
protected
void
init
()
{
service
=
get
Service
(
TopologyService
.
class
);
service
=
get
(
TopologyService
.
class
);
topology
=
service
.
currentTopology
();
}
...
...
tools/dev/bash_profile
View file @
caf3bf7
...
...
@@ -30,6 +30,7 @@ alias mci='mvn clean install'
# Short-hand for ONOS build from the top of the source tree.
alias
ob
=
'o && mvn clean install javadoc:aggregate'
alias
ot
=
'onos-test'
# Short-hand for tailing the ONOS (karaf) log
alias
tl
=
'$ONOS_ROOT/tools/dev/watchLog'
...
...
tools/test/bin/onos-config
View file @
caf3bf7
...
...
@@ -8,25 +8,4 @@
remote
=
$ONOS_USER
@
${
1
:-
$OCI
}
LOG
=
$ONOS_INSTALL_DIR
/config.log
onos
=
$ONOS_INSTALL_DIR
/bin/onos
ssh
$remote
"
# Wait until we reach the run-level 100
echo 'Waiting for cluster bootstrap...'
running=""
while [ -z
\$
running ]; do
$onos
bundle:list 2>>
$LOG
| grep -q 'START LEVEL 100' && running=1 || sleep 2
done
echo 'Installing ONOS bundles...'
$onos
cluster:feature-install default onos-api 1>>
$LOG
2>&1
#
$onos
cluster:feature-install default onos-core 1>>
$LOG
2>&1
$onos
cluster:feature-install default onos-core-trivial 1>>
$LOG
2>&1
$onos
cluster:feature-install default onos-openflow 1>>
$LOG
2>&1
$onos
cluster:feature-install default onos-cli 1>>
$LOG
2>&1
#
$onos
cluster:feature-install default onos-gui 1>>
$LOG
2>&1
#
$onos
cluster:feature-install default onos-rest 1>>
$LOG
2>&1
$onos
cluster:feature-install default onos-app-tvue 1>>
$LOG
2>&1
$onos
cluster:feature-install default onos-app-fwd 1>>
$LOG
2>&1
"
echo
"Deprecated!"
\ No newline at end of file
...
...
tools/test/bin/onos-log
View file @
caf3bf7
...
...
@@ -14,6 +14,7 @@ trap "ssh $remote 'ps -ef | grep \"tail -n 512\" | grep -v grep | cut -c10-15 |
ssh
$remote
"
while true; do
echo ==================================================================
[ ! -f
$LOG
] && sleep 2 && continue
tail -n 512 --follow=name
$LOG
--sleep-interval 2
done
...
...
tools/test/bin/onos-test
0 → 100755
View file @
caf3bf7
#!/bin/bash
#-------------------------------------------------------------------------------
# Launches the ONOS tests on the current cell environment.
#-------------------------------------------------------------------------------
[
! -d
"
$ONOS_ROOT
"
]
&&
echo
"ONOS_ROOT is not defined"
>&2
&&
exit
1
.
$ONOS_ROOT
/tools/build/envDefaults
nodes
=
$(
env | sort | egrep
"OC[0-9]+"
| cut -d
=
-f2
)
onos-package
for
node
in
$nodes
;
do
onos-install -f
$node
;
done
for
node
in
$nodes
;
do
onos-wait-for-start
$node
;
done
utils/osgi/src/main/java/org/onlab/osgi/DefaultServiceDirectory.java
View file @
caf3bf7
...
...
@@ -2,6 +2,7 @@ package org.onlab.osgi;
import
org.osgi.framework.BundleContext
;
import
org.osgi.framework.FrameworkUtil
;
import
org.osgi.framework.ServiceReference
;
/**
* Default implementation of the service directory using OSGi framework utilities.
...
...
@@ -17,12 +18,17 @@ public class DefaultServiceDirectory implements ServiceDirectory {
*/
public
static
<
T
>
T
getService
(
Class
<
T
>
serviceClass
)
{
BundleContext
bc
=
FrameworkUtil
.
getBundle
(
serviceClass
).
getBundleContext
();
T
impl
=
bc
.
getService
(
bc
.
getServiceReference
(
serviceClass
));
if
(
impl
==
null
)
{
throw
new
ServiceNotFoundException
(
"Service "
+
serviceClass
.
getName
()
+
" not found"
);
}
if
(
bc
!=
null
)
{
ServiceReference
<
T
>
reference
=
bc
.
getServiceReference
(
serviceClass
);
if
(
reference
!=
null
)
{
T
impl
=
bc
.
getService
(
reference
);
if
(
impl
!=
null
)
{
return
impl
;
}
}
}
throw
new
ServiceNotFoundException
(
"Service "
+
serviceClass
.
getName
()
+
" not found"
);
}
@Override
public
<
T
>
T
get
(
Class
<
T
>
serviceClass
)
{
...
...
Please
register
or
login
to post a comment