Esempio n. 1
0
class TestFcnsDatabase(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.fcns_obj = Fcns(switch=self.switch)

    def test_database(self):
        fcnsdb = self.fcns_obj.database()
        if fcnsdb is not None:
            res = self.fcns_obj.database(detail=True)
            log.debug(res)
            self.assertIsNotNone(res)

            if type(fcnsdb) is dict:
                fcnsdb = [fcnsdb]
            vsan = fcnsdb[0]["vsan_id"]
            fcnsentry = fcnsdb[0]["TABLE_fcns_database"]["ROW_fcns_database"]
            if type(fcnsentry) is dict:
                fcnsentry = [fcnsentry]
            fcid = fcnsentry[0]["fcid"]

            res = self.fcns_obj.database(vsan=vsan)
            log.debug(res)
            self.assertIsNotNone(res)

            res = self.fcns_obj.database(vsan=vsan, detail=True)
            log.debug(res)
            self.assertIsNotNone(res)

            res = self.fcns_obj.database(vsan=vsan, fcid=fcid)
            log.debug(res)
            self.assertIsNotNone(res)

            res = self.fcns_obj.database(vsan=vsan, fcid=fcid, detail=True)
            log.debug(res)
            self.assertIsNotNone(res)

    def test_database_nonexistingentry(self):
        fcnsdb = self.fcns_obj.database()
        if fcnsdb is not None:
            if type(fcnsdb) is dict:
                fcnsdb = [fcnsdb]
            vsan_list = [f["vsan_id"] for f in fcnsdb]

            while True:
                vsan = random.randint(2, 400)
                if vsan not in vsan_list:
                    break
            self.assertIsNone(self.fcns_obj.database(vsan=vsan))

    def tearDown(self) -> None:
        pass
Esempio n. 2
0
class TestFcnsRejectDuplicatePwwn(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.fcns_obj = Fcns(switch=self.switch)

    def test_reject_duplicate_pwwn(self):
        self.skipTest("needs to be fixed")
        fcnsdb = self.fcns_obj.database()
        if fcnsdb is not None:
            if type(fcnsdb) is dict:
                fcnsdb = [fcnsdb]
            vsan = fcnsdb[0]["vsan_id"]
            self.fcns_obj.reject_duplicate_pwwn(vsan=vsan)

    def test_reject_duplicate_pwwn_nonexistingentry(self):
        fcnsdb = self.fcns_obj.database()
        if fcnsdb is not None:
            if type(fcnsdb) is dict:
                fcnsdb = [fcnsdb]
            vsan_list = [f["vsan_id"] for f in fcnsdb]
            while True:
                vsan = random.randint(2, 400)
                if vsan not in vsan_list:
                    break
            with self.assertRaises(CLIError) as e:
                self.fcns_obj.reject_duplicate_pwwn(vsan=vsan)
            self.assertEqual(
                'The command " fcns reject-duplicate-pwwn vsan '
                + str(vsan)
                + ' " gave the error " vsan not present ".',
                str(e.exception),
            )

    def tearDown(self) -> None:
        pass
Esempio n. 3
0
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.fcns_obj = Fcns(switch=self.switch)
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.fcns_obj = Fcns(switch=self.switch)
     self.old = self.fcns_obj.no_bulk_notify
 def setUp(self) -> None:
     log.debug(self.switch.version)
     log.debug(self.switch.ipaddr)
     self.fcns_obj = Fcns(switch=self.switch)
     self.old = self.fcns_obj.zone_lookup_cache