fixed some refactoring issues with xen and bsd code

This commit is contained in:
Blake J. Harnden 2017-08-03 09:48:26 -07:00
parent d915436c7d
commit bc1a24e880
4 changed files with 8 additions and 7 deletions

View file

@ -196,7 +196,7 @@ class SimpleJailNode(PyCoreNode):
ifindex = self.newifindex()
if ifname is None:
ifname = "eth%d" % ifindex
sessionid = self.session.shortsessionid()
sessionid = self.session.short_session_id()
name = "n%s_%s_%s" % (self.objid, ifindex, sessionid)
localname = name
ifclass = VEth
@ -306,10 +306,10 @@ class SimpleJailNode(PyCoreNode):
dirname = dirname.replace("/", ".")
if file:
pathname = os.path.join(path, file)
sym = os.path.join(self.session.sessiondir, "@.conf", dirname, file)
sym = os.path.join(self.session.session_dir, "@.conf", dirname, file)
else:
pathname = path
sym = os.path.join(self.session.sessiondir, "@.conf", dirname)
sym = os.path.join(self.session.session_dir, "@.conf", dirname)
if os.path.islink(pathname):
if os.readlink(pathname) == sym:

View file

@ -174,7 +174,7 @@ class XenNode(PyCoreNode):
# LxcNode initialization
# self.makenodedir()
if self.nodedir is None:
self.nodedir = os.path.join(session.sessiondir, self.name + ".conf")
self.nodedir = os.path.join(session.session_dir, self.name + ".conf")
self.mountdir = self.nodedir + self.getconfigitem('mount_path')
if not os.path.isdir(self.mountdir):
os.makedirs(self.mountdir)
@ -201,7 +201,7 @@ class XenNode(PyCoreNode):
self.lock.acquire()
try:
if self.up:
raise Exception, "already up"
raise Exception("already up")
self.createlogicalvolume()
self.createpartitions()
persistdev = self.createfilesystems()

View file

@ -14,8 +14,7 @@ from mock import MagicMock
from conftest import EMANE_SERVICES
from core.data import ConfigData
from core.data import EventData
from core.enumerations import MessageFlags, ConfigTlvs, EventTypes
from core.enumerations import MessageFlags
from core.mobility import BasicRangeModel
from core.netns import nodes
from core.netns import vnodeclient
@ -361,6 +360,7 @@ class TestCore:
def node_update(_):
event.set()
core.session.node_handlers.append(node_update)
# instantiate session

View file

@ -1,6 +1,7 @@
"""
Unit tests for testing with a CORE switch.
"""
import threading
from core.api import coreapi, dataconversion