Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
d56f5400
Commit
d56f5400
authored
Aug 17, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming ForeignInterface -> ImportedInterface
parent
e8386b9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
sample-api.py
sample-api.py
+1
-1
src/netns/interface.py
src/netns/interface.py
+9
-7
No files found.
sample-api.py
View file @
d56f5400
...
@@ -53,7 +53,7 @@ link0.connect(if1)
...
@@ -53,7 +53,7 @@ link0.connect(if1)
# Add and connect a tap device (as if a external router were plugged into a
# Add and connect a tap device (as if a external router were plugged into a
# switch)
# switch)
if2
=
netns
.
Foreign
Interface
(
'tap0'
)
if2
=
netns
.
Imported
Interface
(
'tap0'
)
link0
.
connect
(
if2
)
link0
.
connect
(
if2
)
link0
.
up
=
True
link0
.
up
=
True
...
...
src/netns/interface.py
View file @
d56f5400
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
os
,
weakref
import
os
,
weakref
import
netns.iproute
import
netns.iproute
__all__
=
[
'NodeInterface'
,
'P2PInterface'
,
'
Foreign
Interface'
,
__all__
=
[
'NodeInterface'
,
'P2PInterface'
,
'
Imported
Interface'
,
'ForeignNodeInterface'
,
'ImportedNodeInterface'
,
'Link'
]
'ForeignNodeInterface'
,
'ImportedNodeInterface'
,
'Link'
]
class
Interface
(
object
):
class
Interface
(
object
):
...
@@ -268,15 +268,17 @@ class SlaveInterface(ExternalInterface):
...
@@ -268,15 +268,17 @@ class SlaveInterface(ExternalInterface):
def
destroy
(
self
):
def
destroy
(
self
):
pass
pass
class
ForeignInterface
(
ExternalInterface
):
class
ImportedInterface
(
ExternalInterface
):
"""Class to handle already existing interfaces. This kind of interfaces can
"""Class to handle already existing interfaces. Analogous to
only be connected to Link objects and not assigned to a name space.
ImportedNodeInterface, this class only differs in that the interface is not
On destruction, the code will try to restore the interface to the state it
migrated inside the name space. This kind of interfaces can only be
was in before being imported into netns."""
connected to Link objects and not assigned to a name space. On
destruction, the code will try to restore the interface to the state it was
in before being imported into netns."""
def
__init__
(
self
,
iface
):
def
__init__
(
self
,
iface
):
iface
=
netns
.
iproute
.
get_if
(
iface
)
iface
=
netns
.
iproute
.
get_if
(
iface
)
self
.
_original_state
=
iface
.
copy
()
self
.
_original_state
=
iface
.
copy
()
super
(
Foreign
Interface
,
self
).
__init__
(
iface
.
index
)
super
(
Imported
Interface
,
self
).
__init__
(
iface
.
index
)
# FIXME: register somewhere for destruction!
# FIXME: register somewhere for destruction!
def
destroy
(
self
):
# override: restore as much as possible
def
destroy
(
self
):
# override: restore as much as possible
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment