Ejemplo n.º 1
0
class TestDeviceAliasAttrLocked(unittest.TestCase):
    def __init__(self, testName, sw):
        super().__init__(testName)
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        self.old = self.d.distribute
        currdb = self.d.database
        if currdb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
        else:
            while True:
                self.name = get_random_string()
                self.pwwn = get_random_pwwn()
                if self.name not in currdb.keys(
                ) and self.pwwn not in currdb.values():
                    break
        log.debug({self.name: self.pwwn})

    def test_locked_values(self):
        self.assertIn(self.d.locked, [True, False])

    def test_locked_write_error(self):
        with self.assertRaises(AttributeError) as e:
            self.d.locked = True
        self.assertEqual("can't set attribute", str(e.exception))

    def test_acquire_lock(self):
        # Verify that lock is not acquired first
        self.assertFalse(self.d.locked)
        # Verify that distribute is set
        if not self.old:
            self.d.distribute = True
            self.assertTrue(self.d.distribute)
        self.switch.config("device-alias database ; device-alias name " +
                           self.name + " pwwn " + self.pwwn)
        self.assertTrue(self.d.locked)
        self.d.clear_lock()
        self.assertFalse(self.d.locked)
        self.d.distribute = self.old
        self.assertFalse(self.d.locked)

    def tearDown(self) -> None:
        self.d.distribute = self.old
        self.assertEqual(self.d.distribute, self.old)
        try:
            self.d.delete(self.name)
            newdb = self.d.database
            if newdb is not None:
                self.assertNotIn(self.name, newdb.keys())
                self.assertNotIn(self.pwwn, newdb.values())
        except CLIError as c:
            if "Device Alias not present" not in c.message:
                raise CLIError(c.args)
        finally:
            self.assertFalse(self.d.locked)
Ejemplo n.º 2
0
class TestDeviceAliasClearDatabase(unittest.TestCase):
    def __init__(self, testName, sw):
        super().__init__(testName)
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        self.olddb = self.d.database
        if self.olddb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
            self.d.create({self.name: self.pwwn})
            newdb = self.d.database
            self.assertIn(self.name, newdb.keys())
            self.assertEqual(self.pwwn, newdb[self.name])

    # def test_clear_database(self):
    #     self.d.clear_database()
    #     self.assertIsNone(self.d.database)

    def tearDown(self) -> None:
        if self.olddb is not None:
            currdb = self.d.database
            if currdb == self.olddb:
                pass
            else:
                self.d.create(self.olddb)
 def test_mode_write_invalid(self):
     d = DeviceAlias(self.switch)
     mode = 'asdf'
     with self.assertRaises(InvalidMode) as e:
         d.mode = mode
     self.assertEqual(
         "InvalidMode: Invalid device alias mode: " + str(mode) +
         ". Valid values are " + ENHANCED + "," + BASIC, str(e.exception))
 def test_distribute_write(self):
     d = DeviceAlias(self.switch)
     old = d.distribute
     d.distribute = True
     self.assertTrue(d.distribute)
     d.distribute = False
     self.assertFalse(d.distribute)
     d.distribute = old
 def test_mode_write(self):
     d = DeviceAlias(self.switch)
     old = d.mode
     d.mode = ENHANCED
     self.assertEqual(ENHANCED, d.mode.lower())
     d.mode = BASIC
     self.assertEqual(BASIC, d.mode.lower())
     d.mode = old
Ejemplo n.º 6
0
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.d = DeviceAlias(self.switch)
     self.olddb = self.d.database
     if self.olddb is None:
         self.name = get_random_string()
         self.pwwn = get_random_pwwn()
         self.d.create({self.name: self.pwwn})
         newdb = self.d.database
         self.assertIn(self.name, newdb.keys())
         self.assertEqual(self.pwwn, newdb[self.name])
 def test_create_name_beyondmax(self):
     d = DeviceAlias(self.switch)
     name = list(self.new_beyondmax.keys())[0]
     pwwn = list(self.new_beyondmax.values())[0]
     with self.assertRaises(CLIError) as e:
         d.create(self.new_beyondmax)
     self.maxDiff = 1000
     self.assertEqual(
         "The command \" device-alias database ;  device-alias name " +
         str(name) + " pwwn " + str(pwwn) +
         " ; \" gave the error \" % String exceeded max length of (64) \".",
         str(e.exception))
Ejemplo n.º 8
0
 def test_delete_nonexisting(self):
     d = DeviceAlias(self.switch)
     d.create(self.new1)
     keys = list(self.new1.keys())
     d.delete(keys[0])
     with self.assertRaises(CLIError) as e:
         d.delete(keys[0])
     self.assertEqual(
         'The command " device-alias database ; no device-alias name ' +
         str(keys[0]) +
         ' " gave the error " Device Alias not present\nPlease use \'show device-alias session rejected\' to display the rejected set of commands and for the device-alias best-practices recommendation. ".',
         str(e.exception))
     keys.remove(keys[0])
     for k in keys:
         d.delete(k)
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.d = DeviceAlias(self.switch)
     currdb = self.d.database
     if currdb is None:
         self.name = get_random_string()
         self.pwwn = get_random_pwwn()
     else:
         while True:
             self.name = get_random_string()
             self.pwwn = get_random_pwwn()
             if self.name not in currdb.keys() and self.pwwn not in currdb.values():
                 break
     log.debug({self.name: self.pwwn})
Ejemplo n.º 10
0
 def test_delete(self):
     d = DeviceAlias(self.switch)
     d.create(self.new)
     keys = list(self.new.keys())
     d.delete(keys[0])
     self.assertIsNone(d.database.get(keys[0]))
     keys.remove(keys[0])
     for k in keys:
         d.delete(k)
Ejemplo n.º 11
0
class TestDeviceAliasDelete(unittest.TestCase):
    def __init__(self, testName, sw):
        super().__init__(testName)
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        self.olddb = self.d.database
        if self.olddb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
        else:
            while True:
                self.name = get_random_string()
                self.pwwn = get_random_pwwn()
                if (
                        self.name not in self.olddb.keys()
                        and self.pwwn not in self.olddb.values()
                ):
                    break
        log.debug({self.name: self.pwwn})

    def test_delete(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])
        self.d.delete(self.name)
        newdb = self.d.database
        if newdb is not None:
            self.assertNotIn(self.name, newdb.keys())
            self.assertNotIn(self.pwwn, newdb.values())

    def test_delete_nonexisting(self):
        db = self.d.database
        while True:
            somename = get_random_string()
            if db is None or somename not in db.keys():
                break
        with self.assertRaises(CLIError) as e:
            self.d.delete(somename)
        self.assertIn("Device Alias not present", str(e.exception))

    def tearDown(self) -> None:
        try:
            self.d.delete(self.name)
        except CLIError as c:
            if "Device Alias not present" not in c.message:
                self.fail("Tear down failed: " + c.message)
        enddb = self.d.database
        if enddb is not None:
            self.assertEqual(enddb, self.olddb)
 def test_create(self):
     d = DeviceAlias(self.switch)
     d.create(self.new)
     self.assertEqual(self.new, d.database)
     keys = list(self.new.keys())
     for k in keys:
         d.delete(k)
 def test_create_name_existing(self):
     d = DeviceAlias(self.switch)
     d.create(self.new_existingname)
     name = list(self.existingname.keys())[0]
     pwwn = list(self.existingname.values())[0]
     with self.assertLogs(level='INFO') as l:
         d.create(self.existingname)
     self.assertEqual(
         'INFO:mdssdk.devicealias:The command : device-alias database ;  device-alias name '
         + str(name) + ' pwwn ' + str(pwwn) +
         ' ;  was not executed because Device Alias already present',
         l.output[0])
     keys = list(self.new_existingname.keys())
     for k in keys:
         d.delete(k)
Ejemplo n.º 14
0
 def test_delete_emptydb(self):
     d = DeviceAlias(self.switch)
     d.clear_database()
     with self.assertRaises(CLIError) as e:
         d.delete(self.nonexisting)
     self.assertEqual(
         'The command " device-alias database ; no device-alias name ' +
         str(self.nonexisting) +
         ' " gave the error " Device Alias not present\nPlease use \'show device-alias session rejected\' to display the rejected set of commands and for the device-alias best-practices recommendation. ".',
         str(e.exception))
 def test_create_name_invalidfirstchar(self):
     d = DeviceAlias(self.switch)
     name = list(self.new_invalidfirstchar.keys())[0]
     pwwn = list(self.new_invalidfirstchar.values())[0]
     with self.assertRaises(CLIError) as e:
         d.create(self.new_invalidfirstchar)
     self.assertEqual(
         "The command \" device-alias database ;  device-alias name " +
         str(name) + " pwwn " + str(pwwn) +
         " ; \" gave the error \" Illegal first character. Name must start with a letter \".",
         str(e.exception))
     d.clear_lock()
 def test_create_name_invalid(self):
     d = DeviceAlias(self.switch)
     name = list(self.new_invalidname.keys())[0]
     pwwn = list(self.new_invalidname.values())[0]
     with self.assertRaises(CLIError) as e:
         d.create(self.new_invalidname)
     self.assertEqual(
         "The command \" device-alias database ;  device-alias name " +
         str(name) + " pwwn " + str(pwwn) +
         " ; \" gave the error \" Illegal character present in the name \".",
         str(e.exception))
     d.clear_lock()
class TestDeviceAliasAttrDatabase(unittest.TestCase):
    def __init__(self, testName, sw):
        super().__init__(testName)
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        currdb = self.d.database
        if currdb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
        else:
            while True:
                self.name = get_random_string()
                self.pwwn = get_random_pwwn()
                if self.name not in currdb.keys() and self.pwwn not in currdb.values():
                    break
        log.debug({self.name: self.pwwn})

    def test_database_read(self):
        log.debug("Starting test test_database_read")
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])
        self.d.delete(self.name)
        newdb = self.d.database
        if newdb is not None:
            self.assertNotIn(self.name, newdb.keys())
            self.assertNotIn(self.pwwn, newdb.values())

    def test_database_write_error(self):
        log.debug("Starting test test_database_write_error")
        with self.assertRaises(AttributeError) as e:
            self.d.database = {self.name: self.pwwn}
        self.assertEqual("can't set attribute", str(e.exception))

    def tearDown(self) -> None:
        try:
            self.d.delete(self.name)
            newdb = self.d.database
            if newdb is not None:
                self.assertNotIn(self.name, newdb.keys())
                self.assertNotIn(self.pwwn, newdb.values())
        except CLIError as c:
            if "Device Alias not present" not in c.message:
                # raise CLIError(c.args)
                raise CLIError(c.command, c.message)
Ejemplo n.º 18
0
 def test_remove_members_dict(self):
     fc_name = ""
     for k, v in list(self.switch.interfaces.items()):
         if type(v) is Fc:
             fc_name = k
             break
     while True:
         pc_id = get_random_id(1, 256)
         if "port-channel" + str(pc_id) not in self.switch.interfaces.keys():
             break
     pc = PortChannel(self.switch, pc_id)
     d = DeviceAlias(self.switch)
     olddb = d.database
     if olddb is None:
         da_name = get_random_string()
         da_pwwn = get_random_pwwn()
     else:
         while True:
             da_name = get_random_string()
             da_pwwn = get_random_pwwn()
             if da_name not in olddb.keys() and da_pwwn not in olddb.values():
                 break
     d.create({da_name: da_pwwn})
     members = [
         {"pwwn": "50:08:01:60:08:9f:4d:00"},
         {"interface": fc_name},
         {"device-alias": da_name},
         {"ip-address": "1.1.1.1"},
         {"symbolic-nodename": "symbnodename"},
         {"fwwn": "11:12:13:14:15:16:17:18"},
         {"fcid": "0x123456"},
         {"interface": pc.name},
         {"fcalias": "somefcalias"},
     ]
     self.switch.config("fcalias name somefcalias vsan " + str(self.id))
     self.z.add_members(members)
     mem = self.z.members
     self.assertIsNotNone(self.z.members)
     self.z.remove_members(members)
     self.assertEqual([], self.z.members)
     d.delete(da_name)
 def test_database_write_error(self):
     d = DeviceAlias(self.switch)
     with self.assertRaises(AttributeError) as e:
         d.database = self.new
     self.assertEqual('can\'t set attribute', str(e.exception))
Ejemplo n.º 20
0
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.d = DeviceAlias(self.switch)
     self.old = self.d.distribute
 def test_distribute_read(self):
     d = DeviceAlias(self.switch)
     self.assertIn(d.distribute, [True, False])
Ejemplo n.º 22
0
v.create()

# Creating Fc object for interface fc1/3
int13 = Fc(sw, "fc1/3")

# Instantiating PortChannel object 1
pc1 = PortChannel(sw, 1)

# Creating port channel
pc1.create()

# Adding interfaces to vsan 2
v.add_interfaces([int13, pc1])

# Instantiating DeviceAlias object
d = DeviceAlias(sw)
new = {"da1": "60:66:61:01:0e:00:01:ff"}

# Adding new device alias
d.create(new)

# Instantiate zone object
z = Zone(sw, "zone1", v.id)

# Create new zone
z.create()

# Configuring fcalias
sw.config("fcalias name somefcalias vsan " + str(v.id))

memlist = [
Ejemplo n.º 23
0
p = 8443

# Set connection_type='https' for NXAPI
# Set connection_type='ssh' for SSH
sw = Switch(
    ip_address=ip_address,
    username=user,
    password=pw,
    connection_type="https",
    port=p,
    timeout=30,
    verify_ssl=False,
)

# Instantiating DeviceAlias object
d = DeviceAlias(sw)

# Display the database, mode, distribute, locked
print("Device Alias Database")
print(d.database)
print("Mode : " + d.mode)
print("Distribute : " + str(d.distribute))
print("Locked : " + str(d.locked))

old = d.database
d.clear_database()

# Adding new device alias
new = {
    "device1": "21:00:00:0e:1e:30:34:a5",
    "device2": "21:00:00:0e:1e:30:3c:c5"
 def test_clear_database(self):
     d = DeviceAlias(self.switch)
     d.clear_database()
     self.assertIsNone(d.database)
Ejemplo n.º 25
0
class TestDeviceAliasCreate(unittest.TestCase):
    def __init__(self, testName, sw):
        super().__init__(testName) 
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        self.olddb = self.d.database
        if self.olddb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
        else:
            while True:
                self.name = get_random_string()
                self.pwwn = get_random_pwwn()
                if (
                    self.name not in self.olddb.keys()
                    and self.pwwn not in self.olddb.values()
                ):
                    break
        log.debug({self.name: self.pwwn})

    def test_create(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])
        self.d.delete(self.name)
        newdb = self.d.database
        if newdb is not None:
            self.assertNotIn(self.name, newdb.keys())
            self.assertNotIn(self.pwwn, newdb.values())

    def test_create_name_invalid(self):
        invalid_name = {
            "da1&": get_random_pwwn()
        }  # da name a-zA-Z1-9 - _ $ ^    64chars max
        name = list(invalid_name.keys())[0]
        pwwn = list(invalid_name.values())[0]
        with self.assertRaises(CLIError) as e:
            self.d.create(invalid_name)
        self.assertEqual(
            'The command " device-alias database ;  device-alias name '
            + str(name)
            + " pwwn "
            + str(pwwn)
            + ' ; " gave the error " Illegal character present in the name ".',
            str(e.exception),
        )
        self.d.clear_lock()

    def test_create_name_invalidfirstchar(self):
        invalidfirstchar = {"1da": "53:66:61:01:0e:00:01:ff"}
        name = list(invalidfirstchar.keys())[0]
        pwwn = list(invalidfirstchar.values())[0]
        with self.assertRaises(CLIError) as e:
            self.d.create(invalidfirstchar)
        self.assertEqual(
            'The command " device-alias database ;  device-alias name '
            + str(name)
            + " pwwn "
            + str(pwwn)
            + ' ; " gave the error " Illegal first character. Name must start with a letter ".',
            str(e.exception),
        )
        self.d.clear_lock()

    def test_create_name_beyondmax(self):
        beyondmax = {
            "da123456789123456789123456789123456789123456789123456789123456789": get_random_pwwn()
        }
        name = list(beyondmax.keys())[0]
        pwwn = list(beyondmax.values())[0]
        with self.assertRaises(CLIError) as e:
            self.d.create(beyondmax)
        self.assertEqual(
            'The command " device-alias database ;  device-alias name '
            + str(name)
            + " pwwn "
            + str(pwwn)
            + ' ; " gave the error " % String exceeded max length of (64) ".',
            str(e.exception),
        )

    def test_create_pwwn_existing(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        newname = get_random_string()
        with self.assertRaises(CLIError) as e:
            self.d.create({newname: self.pwwn})
        self.assertIn(
            "Another device-alias already present with the same pwwn", str(e.exception)
        )

        # DB should not be updated with the new name
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        self.d.delete(self.name)

    def test_create_name_existing(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        newpwwn = get_random_pwwn()
        with self.assertRaises(CLIError) as e:
            self.d.create({self.name: newpwwn})
        self.assertIn("Device Alias already present", str(e.exception))

        # DB should not be updated with the new pwwn
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        self.d.delete(self.name)

    def tearDown(self) -> None:
        try:
            self.d.delete(self.name)
        except CLIError as c:
            if "Device Alias not present" not in c.message:
                self.fail("Tear down failed: " + c.message)
        enddb = self.d.database
        if enddb is not None:
            self.assertEqual(enddb, self.olddb)
Ejemplo n.º 26
0
class TestDeviceAliasRename(unittest.TestCase):

    def __init__(self, testName, sw):
        super().__init__(testName) 
        self.switch = sw

    def setUp(self) -> None:
        log.debug(self.switch.version)
        log.debug(self.switch.ipaddr)
        self.d = DeviceAlias(self.switch)
        self.olddb = self.d.database
        if self.olddb is None:
            self.name = get_random_string()
            self.pwwn = get_random_pwwn()
        else:
            while True:
                self.name = get_random_string()
                self.pwwn = get_random_pwwn()
                if (
                    self.name not in self.olddb.keys()
                    and self.pwwn not in self.olddb.values()
                ):
                    break
        log.debug({self.name: self.pwwn})

    def test_rename(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])
        while True:
            self.newname_to_replace = get_random_string()
            if self.newname_to_replace not in newdb.keys():
                break
        self.d.rename(oldname=self.name, newname=self.newname_to_replace)
        chkdb = self.d.database
        self.assertIn(self.newname_to_replace, chkdb.keys())
        self.assertEqual(self.pwwn, chkdb[self.newname_to_replace])
        self.assertNotIn(self.name, chkdb.keys())
        self.d.delete(self.newname_to_replace)
        chkdb = self.d.database
        if chkdb is not None:
            self.assertNotIn(self.newname_to_replace, chkdb.keys())
            self.assertNotIn(self.pwwn, chkdb.values())
            self.assertNotIn(self.name, chkdb.keys())

    def test_rename_not_present(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])
        while True:
            self.newname_to_replace = get_random_string()
            if self.newname_to_replace not in newdb.keys():
                break
        with self.assertRaises(CLIError) as e:
            self.d.rename(oldname=self.newname_to_replace, newname=self.name)
        self.assertIn("Device Alias not present", str(e.exception))

        self.d.delete(self.name)
        chkdb = self.d.database
        if chkdb is not None:
            self.assertNotIn(self.newname_to_replace, chkdb.keys())
            self.assertNotIn(self.pwwn, chkdb.values())
            self.assertNotIn(self.name, chkdb.keys())

    def test_rename_already_present(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        with self.assertRaises(CLIError) as e:
            self.d.rename(oldname=self.name, newname=self.name)
        self.assertIn(
            "Target device-alias name already in use. Please specify a new name.",
            str(e.exception),
        )

        self.d.delete(self.name)
        chkdb = self.d.database
        if chkdb is not None:
            self.assertNotIn(self.pwwn, chkdb.values())
            self.assertNotIn(self.name, chkdb.keys())

    def test_rename_invalid(self):
        self.d.create({self.name: self.pwwn})
        newdb = self.d.database
        self.assertIn(self.name, newdb.keys())
        self.assertEqual(self.pwwn, newdb[self.name])

        invalid_name = "da1&"  # da name a-zA-Z1-9 - _ $ ^    64chars max
        with self.assertRaises(CLIError) as e:
            self.d.rename(oldname=self.name, newname=invalid_name)
        self.assertIn("Illegal character present in the name", str(e.exception))
        self.d.clear_lock()

        self.d.delete(self.name)
        chkdb = self.d.database
        if chkdb is not None:
            self.assertNotIn(self.pwwn, chkdb.values())
            self.assertNotIn(self.name, chkdb.keys())

    def tearDown(self) -> None:
        try:
            self.d.delete(self.name)
        except CLIError as c:
            if "Device Alias not present" not in c.message:
                self.fail("Tear down failed: " + c.message)
        enddb = self.d.database
        if enddb is not None:
            self.assertEqual(enddb, self.olddb)
Ejemplo n.º 27
0
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.d = DeviceAlias(self.switch)
     self.oldmode = self.d.mode
 def test_clear_lock(self):
     d = DeviceAlias(self.switch)
     d.clear_lock()
     self.assertEqual(False, d.locked)
            verify_ssl=False)

import sys

sys.stdout = open('test_zone_output.txt', 'wt')

vsan_id = [2, 3, 4, 5, 6, 7, 8, 9]
zone_name = ["zone" + str(i) for i in range(1, 9)]

from mdssdk.fc import Fc
from mdssdk.devicealias import DeviceAlias
from mdssdk.portchannel import PortChannel

fc = Fc(sw, "fc1/48")
pc = PortChannel(sw, 1)
d = DeviceAlias(sw)
da_name = 'hello'
da_pwwn = '40:66:61:01:0e:00:01:ff'
d.create({da_name: da_pwwn})

members_dict = [{
    'pwwn': '50:08:01:60:08:9f:4d:00'
}, {
    'pwwn': '50:08:01:60:08:9f:4d:01'
}, {
    'interface': fc.name
}, {
    'device-alias': da_name
}, {
    'ip-address': '1.1.1.1'
}, {
 def test_database_read(self):
     d = DeviceAlias(self.switch)
     d.create(self.new)
     self.assertEquals(self.new, d.database)
     for da in self.new.keys():
         d.delete(da)