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

View file

@ -174,7 +174,7 @@ class XenNode(PyCoreNode):
# LxcNode initialization # LxcNode initialization
# self.makenodedir() # self.makenodedir()
if self.nodedir is None: 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') self.mountdir = self.nodedir + self.getconfigitem('mount_path')
if not os.path.isdir(self.mountdir): if not os.path.isdir(self.mountdir):
os.makedirs(self.mountdir) os.makedirs(self.mountdir)
@ -201,7 +201,7 @@ class XenNode(PyCoreNode):
self.lock.acquire() self.lock.acquire()
try: try:
if self.up: if self.up:
raise Exception, "already up" raise Exception("already up")
self.createlogicalvolume() self.createlogicalvolume()
self.createpartitions() self.createpartitions()
persistdev = self.createfilesystems() persistdev = self.createfilesystems()

View file

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

View file

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