Ejemplo n.º 1
0
    def test_ae_id_alloc_cassandra(self):
        #wait for dm
        self.check_dm_state()
        dm_cs = DMCassandraDB.get_instance()
        esi = '10:10:10:10:10:10:10:10:10'
        pr_uuid = 'pr_uuid'
        key = pr_uuid + ':' + esi
        ae_id = 127
        dm_cs.add_ae_id(pr_uuid, esi, ae_id)
        dm_cs.init_pr_ae_map()
        self.assertEqual(dm_cs.get_ae_id(pr_uuid + ':' + esi), ae_id)
        check_db_ae_id = dm_cs.pr_ae_id_map[pr_uuid][esi]
        self.assertEqual(check_db_ae_id, ae_id)

        key_value = dm_cs.get_one_col(dm_cs._PR_AE_ID_CF, key, "index")
        if key_value != ae_id:
            self.assertTrue(False)

        # delete one column
        dm_cs.delete(dm_cs._PR_AE_ID_CF, key, ["index"])
        try:
            key_value = dm_cs.get_one_col(dm_cs._PR_AE_ID_CF, key, "index")
            if key_value is not None:
                self.assertTrue(False)
        except NoIdError:
            pass
        return
Ejemplo n.º 2
0
    def test_dm_cassandra(self):
        #wait for dm
        self.check_dm_state()
        dm_cs = DMCassandraDB.get_instance()
        ip_addr = '10.0.0.1/32'
        lo0_ip_addr = '20.0.0.1/32'
        key = 'pr-uuid' + ':' + 'vn-uuid' + ':' + 'sub-prefix'
        dm_cs.add(dm_cs._PR_VN_IP_CF, key, {DMUtils.get_ip_cs_column_name('irb'): ip_addr})
        dm_cs.add(dm_cs._PR_VN_IP_CF, key, {DMUtils.get_ip_cs_column_name('lo0'): lo0_ip_addr})
        dm_cs.init_pr_map()

        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('irb'))
        if key_value != ip_addr:
            self.assertTrue(False)
        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('lo0'))
        if key_value != lo0_ip_addr:
            self.assertTrue(False)

        # delete one column
        dm_cs.delete(dm_cs._PR_VN_IP_CF, key, [DMUtils.get_ip_cs_column_name('lo0')])

        try:
            key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('lo0'))
            if key_value is not None:
                self.assertTrue(False)
        except NoIdError:
            pass

        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('irb'))
        if key_value != ip_addr:
            self.assertTrue(False)

        return
Ejemplo n.º 3
0
    def test_dm_cassandra(self):
        #wait for dm
        self.check_dm_state()
        dm_cs = DMCassandraDB.get_instance()
        ip_addr = '10.0.0.1/32'
        lo0_ip_addr = '20.0.0.1/32'
        key = 'pr-uuid' + ':' + 'vn-uuid' + ':' + 'sub-prefix'
        dm_cs.add(dm_cs._PR_VN_IP_CF, key, {DMUtils.get_ip_cs_column_name('irb'): ip_addr})
        dm_cs.add(dm_cs._PR_VN_IP_CF, key, {DMUtils.get_ip_cs_column_name('lo0'): lo0_ip_addr})
        dm_cs.init_pr_map()

        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('irb'))
        if key_value != ip_addr:
            self.assertTrue(False)
        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('lo0'))
        if key_value != lo0_ip_addr:
            self.assertTrue(False)

        # delete one column
        dm_cs.delete(dm_cs._PR_VN_IP_CF, key, [DMUtils.get_ip_cs_column_name('lo0')])

        try:
            key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('lo0'))
            if key_value is not None:
                self.assertTrue(False)
        except NoIdError:
            pass

        key_value = dm_cs.get_one_col(dm_cs._PR_VN_IP_CF, key, DMUtils.get_ip_cs_column_name('irb'))
        if key_value != ip_addr:
            self.assertTrue(False)

        return
    def test_ae_id_alloc_cassandra(self):
        #wait for dm
        self.check_dm_state()
        dm_cs = DMCassandraDB.get_instance()
        esi = '10:10:10:10:10:10:10:10:10'
        pr_uuid = 'pr_uuid'
        key = pr_uuid + ':' + esi
        ae_id = 127
        dm_cs.add_ae_id(pr_uuid, esi, ae_id)
        dm_cs.init_pr_ae_map()
        self.assertEqual(dm_cs.get_ae_id(pr_uuid + ':' + esi), ae_id)
        check_db_ae_id = dm_cs.pr_ae_id_map[pr_uuid][esi]
        self.assertEqual(check_db_ae_id, ae_id)

        key_value = dm_cs.get_one_col(dm_cs._PR_AE_ID_CF, key, "index")
        if key_value != ae_id:
            self.assertTrue(False)

        # delete one column
        dm_cs.delete(dm_cs._PR_AE_ID_CF, key, ["index"])
        try:
            key_value = dm_cs.get_one_col(dm_cs._PR_AE_ID_CF, key, "index")
            if key_value is not None:
                self.assertTrue(False)
        except NoIdError:
            pass
        return
Ejemplo n.º 5
0
 def check_dm_state(self):
     self.assertIsNotNone(DMCassandraDB.get_instance())
Ejemplo n.º 6
0
 def check_dm_state(self):
     self.assertIsNotNone(DMCassandraDB.get_instance())