Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
08643fe6
Commit
08643fe6
authored
10 years ago
by
cody burkard
Browse files
Options
Downloads
Patches
Plain Diff
adding 'ports' command to cli
parent
cde6c3aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mininet/cli.py
+6
-1
6 additions, 1 deletion
mininet/cli.py
mininet/util.py
+9
-0
9 additions, 0 deletions
mininet/util.py
with
15 additions
and
1 deletion
mininet/cli.py
+
6
−
1
View file @
08643fe6
...
@@ -36,7 +36,8 @@
...
@@ -36,7 +36,8 @@
from
mininet.log
import
info
,
output
,
error
from
mininet.log
import
info
,
output
,
error
from
mininet.term
import
makeTerms
,
runX11
from
mininet.term
import
makeTerms
,
runX11
from
mininet.util
import
quietRun
,
isShellBuiltin
,
dumpNodeConnections
from
mininet.util
import
(
quietRun
,
isShellBuiltin
,
dumpNodeConnections
,
dumpPorts
)
class
CLI
(
Cmd
):
class
CLI
(
Cmd
):
"
Simple command-line interface to talk to nodes.
"
"
Simple command-line interface to talk to nodes.
"
...
@@ -127,6 +128,10 @@ def do_nodes( self, _line ):
...
@@ -127,6 +128,10 @@ def do_nodes( self, _line ):
nodes
=
'
'
.
join
(
sorted
(
self
.
mn
)
)
nodes
=
'
'
.
join
(
sorted
(
self
.
mn
)
)
output
(
'
available nodes are:
\n
%s
\n
'
%
nodes
)
output
(
'
available nodes are:
\n
%s
\n
'
%
nodes
)
def
do_ports
(
self
,
line
):
"
display ports and interfaces for each switch
"
dumpPorts
(
self
.
mn
.
switches
)
def
do_net
(
self
,
_line
):
def
do_net
(
self
,
_line
):
"
List network connections.
"
"
List network connections.
"
dumpNodeConnections
(
self
.
mn
.
values
()
)
dumpNodeConnections
(
self
.
mn
.
values
()
)
...
...
This diff is collapsed.
Click to expand it.
mininet/util.py
+
9
−
0
View file @
08643fe6
...
@@ -237,6 +237,15 @@ def dumpNetConnections( net ):
...
@@ -237,6 +237,15 @@ def dumpNetConnections( net ):
nodes
=
net
.
controllers
+
net
.
switches
+
net
.
hosts
nodes
=
net
.
controllers
+
net
.
switches
+
net
.
hosts
dumpNodeConnections
(
nodes
)
dumpNodeConnections
(
nodes
)
def
dumpPorts
(
switches
):
"
dump interface to openflow port mappings for each switch
"
for
switch
in
switches
:
output
(
'
%s
'
%
switch
.
name
)
for
intf
in
switch
.
intfList
():
port
=
switch
.
ports
[
intf
]
output
(
'
%s:%d
'
%
(
intf
,
port
)
)
output
(
'
\n
'
)
# IP and Mac address formatting and parsing
# IP and Mac address formatting and parsing
def
_colonHex
(
val
,
bytecount
):
def
_colonHex
(
val
,
bytecount
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment