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
e3d07bc1
Commit
e3d07bc1
authored
11 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Add 'x' command to open an X11 tunnel (and run a client)
fixes #142
parent
f53866d0
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
+12
-1
12 additions, 1 deletion
mininet/cli.py
mininet/term.py
+6
-0
6 additions, 0 deletions
mininet/term.py
with
18 additions
and
1 deletion
mininet/cli.py
+
12
−
1
View file @
e3d07bc1
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
import
time
import
time
from
mininet.log
import
info
,
output
,
error
from
mininet.log
import
info
,
output
,
error
from
mininet.term
import
makeTerms
from
mininet.term
import
makeTerms
,
runX11
from
mininet.util
import
quietRun
,
isShellBuiltin
,
dumpNodeConnections
from
mininet.util
import
quietRun
,
isShellBuiltin
,
dumpNodeConnections
class
CLI
(
Cmd
):
class
CLI
(
Cmd
):
...
@@ -241,6 +241,17 @@ def do_xterm( self, line, term='xterm' ):
...
@@ -241,6 +241,17 @@ def do_xterm( self, line, term='xterm' ):
node
=
self
.
nodemap
[
arg
]
node
=
self
.
nodemap
[
arg
]
self
.
mn
.
terms
+=
makeTerms
(
[
node
],
term
=
term
)
self
.
mn
.
terms
+=
makeTerms
(
[
node
],
term
=
term
)
def
do_x
(
self
,
line
):
"""
Create an X11 tunnel to the given node,
optionally starting a client.
"""
args
=
line
.
split
()
if
not
args
:
error
(
'
usage: x node [cmd args]...
\n
'
)
else
:
node
=
self
.
mn
[
args
[
0
]
]
cmd
=
args
[
1
:
]
self
.
mn
.
terms
+=
runX11
(
node
,
cmd
)
def
do_gterm
(
self
,
line
):
def
do_gterm
(
self
,
line
):
"
Spawn gnome-terminal(s) for the given node(s).
"
"
Spawn gnome-terminal(s) for the given node(s).
"
self
.
do_xterm
(
line
,
term
=
'
gterm
'
)
self
.
do_xterm
(
line
,
term
=
'
gterm
'
)
...
...
This diff is collapsed.
Click to expand it.
mininet/term.py
+
6
−
0
View file @
e3d07bc1
...
@@ -52,6 +52,12 @@ def makeTerm( node, title='Node', term='xterm', display=None ):
...
@@ -52,6 +52,12 @@ def makeTerm( node, title='Node', term='xterm', display=None ):
term
=
node
.
popen
(
cmds
[
term
]
+
[
display
,
'
-e
'
,
'
env TERM=ansi bash
'
]
)
term
=
node
.
popen
(
cmds
[
term
]
+
[
display
,
'
-e
'
,
'
env TERM=ansi bash
'
]
)
return
[
tunnel
,
term
]
if
tunnel
else
[
term
]
return
[
tunnel
,
term
]
if
tunnel
else
[
term
]
def
runX11
(
node
,
cmd
):
"
Run an X11 client on a node
"
display
,
tunnel
=
tunnelX11
(
node
)
popen
=
node
.
popen
(
cmd
)
return
[
tunnel
,
popen
]
def
cleanUpScreens
():
def
cleanUpScreens
():
"
Remove moldy socat X11 tunnels.
"
"
Remove moldy socat X11 tunnels.
"
errRun
(
"
pkill -9 -f mnexec.*socat
"
)
errRun
(
"
pkill -9 -f mnexec.*socat
"
)
...
...
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