mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
parent
5fdd33fe3b
commit
7065988087
@ -19,6 +19,8 @@ import socket
|
|||||||
from .cloud import Cloud
|
from .cloud import Cloud
|
||||||
from ...error import NodeError
|
from ...error import NodeError
|
||||||
|
|
||||||
|
import gns3server.utils.interfaces
|
||||||
|
|
||||||
|
|
||||||
class Nat(Cloud):
|
class Nat(Cloud):
|
||||||
"""
|
"""
|
||||||
@ -32,6 +34,9 @@ class Nat(Cloud):
|
|||||||
if socket.gethostname() != "gns3vm":
|
if socket.gethostname() != "gns3vm":
|
||||||
raise NodeError("NAT node is supported only on GNS3 VM")
|
raise NodeError("NAT node is supported only on GNS3 VM")
|
||||||
|
|
||||||
|
if "eth1" not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]:
|
||||||
|
raise NodeError("eth1 is missing on the GNS3 VM. You need to provide a nat interface as eth1")
|
||||||
|
|
||||||
self.ports = [
|
self.ports = [
|
||||||
{
|
{
|
||||||
"name": "nat0",
|
"name": "nat0",
|
||||||
|
@ -322,5 +322,6 @@ def on_gns3vm():
|
|||||||
"""
|
"""
|
||||||
Mock the hostname to emulate the GNS3 VM
|
Mock the hostname to emulate the GNS3 VM
|
||||||
"""
|
"""
|
||||||
with patch("socket.gethostname", return_value="gns3vm"):
|
with patch("gns3server.utils.interfaces.interfaces", return_value=[{"name": "eth0"}, {"name": "eth1"}]):
|
||||||
yield
|
with patch("socket.gethostname", return_value="gns3vm"):
|
||||||
|
yield
|
||||||
|
Loading…
Reference in New Issue
Block a user