Exemplo n.º 1
0
 def test_fill_trees_invalid_path(self):
     data = RPD_DB()
     # If DB is empty, we will return before detecting invalid path
     self._create_repeated_list(data)
     # Get value from 'test' path
     with self.assertRaises(DBKeyError):
         data.fill_tree({
             'cfg': {
                 'test': None,
                 'RpdCapabilities': {
                     'NumTenGeNsPorts': None
                 }
             }
         })
Exemplo n.º 2
0
 def test_fill_trees_unset_obj_from_filled_db(self):
     data = RPD_DB()
     self._create_repeated_list(data)
     ret = data.fill_tree(
         {'cfg': {
             'RpdCapabilities': {
                 'NumTenGeNsPorts': None
             }
         }})
     self.assertEqual(len(ret.ListFields()), 0)
Exemplo n.º 3
0
 def test_fill_trees_one_repeated(self):
     data = RPD_DB()
     self._create_repeated_list(data)
     ret = data.fill_tree({'cfg': {'DsOfdmProfile': {2: None}}})
     self.assertIsInstance(ret, db)
     # Use get_val to extract profiles from returned object
     value = data.get_val(['cfg', 'DsOfdmProfile'], ret)
     self.assertEqual(len(value), 1)
     value = data.get_val(
         ['cfg', 'DsOfdmProfile', 2, 'DsOfdmSubcarrierModulation'], ret)
     self.assertEqual(len(value), 2)
Exemplo n.º 4
0
 def test_fill_trees_from_empty_db(self):
     data = RPD_DB()
     data.data.Clear()
     ret = data.fill_tree({
         'cfg': {
             'DsOfdmProfile': None,
             'RpdCapabilities': {
                 'NumTenGeNsPorts': None
             }
         }
     })
     self.assertEqual(len(ret.ListFields()), 0)
Exemplo n.º 5
0
    def test_fill_trees_list_and_leaf(self):
        data = RPD_DB()
        self._create_repeated_list(data)
        data.data.cfg.RpdCapabilities.NumBdirPorts = 5
        data.data.cfg.RpdCapabilities.NumTenGeNsPorts = 14
        ret = data.fill_tree({
            'cfg': {
                'DsOfdmProfile': None,
                'RpdCapabilities': {
                    'NumTenGeNsPorts': None
                }
            }
        })
        # Reuse get_val to extract profiles from returned object
        value = data.get_val(['cfg', 'DsOfdmProfile'], ret)
        self.assertEqual(len(value), 2)
        self.assertListEqual([x.ProfileId for x in value], [1, 2])

        value = data.get_val(
            ['cfg', 'DsOfdmProfile', 2, 'DsOfdmSubcarrierModulation'], ret)
        self.assertEqual(len(value), 2)
        value = data.get_val(['cfg', 'RpdCapabilities'], ret)
        self.assertEqual(len(value.ListFields()), 1)
        self.assertEqual(value.NumTenGeNsPorts, 14)