Commit d56f5400 authored by Martín Ferrari's avatar Martín Ferrari

Renaming ForeignInterface -> ImportedInterface

parent e8386b9b
...@@ -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.ForeignInterface('tap0') if2 = netns.ImportedInterface('tap0')
link0.connect(if2) link0.connect(if2)
link0.up = True link0.up = True
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import os, weakref import os, weakref
import netns.iproute import netns.iproute
__all__ = ['NodeInterface', 'P2PInterface', 'ForeignInterface', __all__ = ['NodeInterface', 'P2PInterface', 'ImportedInterface',
'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(ForeignInterface, self).__init__(iface.index) super(ImportedInterface, 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment