added some test cases based on future api interactions, node add/delete/update link add/delete/update

This commit is contained in:
Blake J. Harnden 2018-04-23 15:46:08 -07:00
parent 8f0364c44b
commit 1404ca19c5
3 changed files with 300 additions and 7 deletions

View file

@ -303,8 +303,6 @@ class FutureSession(Session):
:param core.data.LinkData link_data: data to create a link with
:return: nothing
"""
logger.info("link_data: %s", link_data)
# interface data
interface_one_data, interface_two_data = get_interfaces(link_data)
@ -430,6 +428,8 @@ class FutureSession(Session):
interface_two = common_interface_two
break
logger.info("deleting link for interfaces interface_one(%s) interface_two(%s)",
interface_one, interface_two)
if all([interface_one, interface_two]) and any([interface_one.net, interface_two.net]):
if interface_one.net != interface_two.net and all([interface_one.up, interface_two.up]):
raise ValueError("no common network found")
@ -438,8 +438,8 @@ class FutureSession(Session):
interface_two.detachnet()
if net_one.numnetif() == 0:
self.delete_object(net_one.objid)
node_one.delnetif(interface_one_data.id)
node_two.delnetif(interface_two_data.id)
node_one.delnetif(interface_one.netindex)
node_two.delnetif(interface_two.netindex)
finally:
if node_one:
node_one.lock.release()
@ -559,6 +559,7 @@ class FutureSession(Session):
name = "%s%s" % (node_class.__name__, node_id)
# create node
logger.info("creating node(%s) id(%s) name(%s) start(%s)", node_class, node_id, name, start)
node = self.add_object(cls=node_class, objid=node_id, name=name, start=start)
# set node attributes

View file

@ -110,7 +110,7 @@ class SimpleLxcNode(PyCoreNode):
self.check_cmd([constants.IP_BIN, "link", "set", "lo", "up"])
# set hostname for node
logger.info("setting hostname: %s" % self.name)
logger.info("setting hostname: %s", self.name)
self.check_cmd(["hostname", self.name])
# mark node as up
@ -214,7 +214,7 @@ class SimpleLxcNode(PyCoreNode):
:raises CoreCommandError: when a non-zero exit status occurs
"""
source = os.path.abspath(source)
logger.info("mounting %s at %s" % (source, target))
logger.info("mounting %s at %s", source, target)
cmd = 'mkdir -p "%s" && %s -n --bind "%s" "%s"' % (target, constants.MOUNT_BIN, source, target)
status, output = self.client.shcmd_result(cmd)
if status:
@ -567,7 +567,6 @@ class LxcNode(SimpleLxcNode):
finally:
self.rmnodedir()
# TODO: should change how this exception is just swallowed up
def privatedir(self, path):
"""
Create a private directory.